Mapping update to include shipment site, taxes, and discounts.

master
bleeson 2024-03-11 13:11:02 -07:00
parent 7ca7b0edb8
commit 85a0b11a86
2 changed files with 31 additions and 29 deletions

View File

@ -109,7 +109,7 @@ def process_files(file):
if num == 0: if num == 0:
continue #skip header lines continue #skip header lines
if num >= 1: #gather header information if num >= 1: #gather header information
current_order = row[5] current_order = row[6]
if current_order != previous_order: if current_order != previous_order:
time_stamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") time_stamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
if sales_order.header.cusordref != '': if sales_order.header.cusordref != '':
@ -119,33 +119,33 @@ def process_files(file):
sales_order.output(import_file) sales_order.output(import_file)
sales_order = SalesOrder() sales_order = SalesOrder()
previous_order = current_order previous_order = current_order
order_id = row[5] ship_site = row[0]
order_date = row[8] order_id = row[6]
customer_name = row[9] order_date = row[9]
customer_name = row[10]
# shipadd1 = row[9] # address information is not stored in X3 # shipadd1 = row[9] # address information is not stored in X3
# shipadd2 = row[10] # shipadd2 = row[10]
# shipcity = row[11] # shipcity = row[11]
# shipstate = row[12] # shipstate = row[12]
# shipzip = row[13] # shipzip = row[13]
tracking = row[14] tracking = row[16]
weight = row[16] weight = row[18]
ship_charge = row[20] taxes = row[22]
taxes = "?" #TODO fixme ship_charge = row[21]
ship_site = "?" #TODO fixme discount = row[24]
discount = "?" #TODO fixme
sales_order.header.cusordref = order_id sales_order.header.cusordref = order_id
sales_order.header.orddat = datetime.datetime.strptime(order_date,'%m/%d/%y %I:%M %p').strftime('%Y%m%d') #TODO strftim this sales_order.header.orddat = datetime.datetime.strptime(order_date,'%m/%d/%y %I:%M %p').strftime('%Y%m%d') #TODO strftim this
sales_order.header.stofcy = ship_site sales_order.header.stofcy = ship_site
sales_order.header.bpdnam = customer_name sales_order.header.bpdnam = customer_name
sales_order.header.invdtaamt_5 = ship_charge sales_order.header.invdtaamt_5 = ship_charge
sales_order.header.invdtaamt_7 = '0.33' #TODO discount sales_order.header.invdtaamt_7 = discount
sales_order.header.invdtaamt_8 = '0.51'#TODO taxes sales_order.header.invdtaamt_8 = taxes
#gather line data #gather line data
line_product = row[0] line_product = row[1]
line_qty = row[2] line_qty = row[3]
line_lot = row[3] line_lot = row[4]
line_price = row[19] line_price = row[20]
sales_order.append( sales_order.append(
SalesOrderDetail( SalesOrderDetail(
itmref=line_product, itmref=line_product,

View File

@ -76,7 +76,7 @@ def process_files(file):
if num == 0: if num == 0:
continue #skip header lines continue #skip header lines
if num >= 1: #gather header information if num >= 1: #gather header information
sohnum = find_so_from_po(row[5]) sohnum = find_so_from_po(row[6])
if num == 1: if num == 1:
previous_order = sohnum previous_order = sohnum
if previous_order != sohnum: if previous_order != sohnum:
@ -88,19 +88,19 @@ def process_files(file):
warehouse_shipment.output(import_file) warehouse_shipment.output(import_file)
warehouse_shipment = WarehouseShipment() warehouse_shipment = WarehouseShipment()
previous_order = sohnum previous_order = sohnum
order_date = row[8] order_date = row[9]
customer_name = row[9] customer_name = row[10]
# shipadd1 = row[9] # address information is not stored in X3 # shipadd1 = row[9] # address information is not stored in X3
# shipadd2 = row[10] # shipadd2 = row[10]
# shipcity = row[11] # shipcity = row[11]
# shipstate = row[12] # shipstate = row[12]
# shipzip = row[13] # shipzip = row[13]
tracking = row[14] tracking = row[16]
weight = row[16] weight = row[18]
ship_charge = row[20] ship_charge = row[21]
taxes = "?" #TODO fixme taxes = row[22]
ship_site = "?" #TODO fixme ship_site = row[0]
discount = "?" #TODO fixme discount = row[4]
warehouse_shipment.sohnum = sohnum warehouse_shipment.sohnum = sohnum
#warehouse_shipment.header.sohnum = sohnum #warehouse_shipment.header.sohnum = sohnum
warehouse_shipment.header.shidat = datetime.datetime.strptime(order_date,'%m/%d/%y %I:%M %p') warehouse_shipment.header.shidat = datetime.datetime.strptime(order_date,'%m/%d/%y %I:%M %p')
@ -108,10 +108,10 @@ def process_files(file):
warehouse_shipment.header.growei = weight warehouse_shipment.header.growei = weight
#gather line data #gather line data
#TODO how are multiple lots processed? #TODO how are multiple lots processed?
line_product = row[0] line_product = row[1]
line_qty = row[2] line_qty = row[3]
line_lot = row[3] line_lot = row[4]
line_price = row[19] line_price = row[20]
subdetail = WarehouseShipmentSubDetail( subdetail = WarehouseShipmentSubDetail(
qtypcu=-1 * int(line_qty), qtypcu=-1 * int(line_qty),
lot=line_lot, lot=line_lot,
@ -276,6 +276,8 @@ class WarehouseShipmentDetail:
itmref=self.itmref, itmref=self.itmref,
).first() ).first()
else: else:
pprint.pprint(self.sohnum)
pprint.pprint(self.itmref)
raise NotImplementedError # TODO raise NotImplementedError # TODO
result = get() result = get()
self.soplin = result.SOPLIN_0 self.soplin = result.SOPLIN_0