From 85a0b11a86b630c8502d881a30e32e1cc73e3ded Mon Sep 17 00:00:00 2001 From: bleeson Date: Mon, 11 Mar 2024 13:11:02 -0700 Subject: [PATCH] Mapping update to include shipment site, taxes, and discounts. --- source_ecommerce_make_order.py | 32 +++++++++++++++---------------- source_ecommerce_make_shipment.py | 28 ++++++++++++++------------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/source_ecommerce_make_order.py b/source_ecommerce_make_order.py index 5920d76..64bc2d7 100644 --- a/source_ecommerce_make_order.py +++ b/source_ecommerce_make_order.py @@ -109,7 +109,7 @@ def process_files(file): if num == 0: continue #skip header lines if num >= 1: #gather header information - current_order = row[5] + current_order = row[6] if current_order != previous_order: time_stamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") if sales_order.header.cusordref != '': @@ -119,33 +119,33 @@ def process_files(file): sales_order.output(import_file) sales_order = SalesOrder() previous_order = current_order - order_id = row[5] - order_date = row[8] - customer_name = row[9] + ship_site = row[0] + order_id = row[6] + order_date = row[9] + customer_name = row[10] # shipadd1 = row[9] # address information is not stored in X3 # shipadd2 = row[10] # shipcity = row[11] # shipstate = row[12] # shipzip = row[13] - tracking = row[14] - weight = row[16] - ship_charge = row[20] - taxes = "?" #TODO fixme - ship_site = "?" #TODO fixme - discount = "?" #TODO fixme + tracking = row[16] + weight = row[18] + taxes = row[22] + ship_charge = row[21] + discount = row[24] 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.stofcy = ship_site sales_order.header.bpdnam = customer_name sales_order.header.invdtaamt_5 = ship_charge - sales_order.header.invdtaamt_7 = '0.33' #TODO discount - sales_order.header.invdtaamt_8 = '0.51'#TODO taxes + sales_order.header.invdtaamt_7 = discount + sales_order.header.invdtaamt_8 = taxes #gather line data - line_product = row[0] - line_qty = row[2] - line_lot = row[3] - line_price = row[19] + line_product = row[1] + line_qty = row[3] + line_lot = row[4] + line_price = row[20] sales_order.append( SalesOrderDetail( itmref=line_product, diff --git a/source_ecommerce_make_shipment.py b/source_ecommerce_make_shipment.py index d9934fc..636ae3b 100644 --- a/source_ecommerce_make_shipment.py +++ b/source_ecommerce_make_shipment.py @@ -76,7 +76,7 @@ def process_files(file): if num == 0: continue #skip header lines if num >= 1: #gather header information - sohnum = find_so_from_po(row[5]) + sohnum = find_so_from_po(row[6]) if num == 1: previous_order = sohnum if previous_order != sohnum: @@ -88,19 +88,19 @@ def process_files(file): warehouse_shipment.output(import_file) warehouse_shipment = WarehouseShipment() previous_order = sohnum - order_date = row[8] - customer_name = row[9] + order_date = row[9] + customer_name = row[10] # shipadd1 = row[9] # address information is not stored in X3 # shipadd2 = row[10] # shipcity = row[11] # shipstate = row[12] # shipzip = row[13] - tracking = row[14] - weight = row[16] - ship_charge = row[20] - taxes = "?" #TODO fixme - ship_site = "?" #TODO fixme - discount = "?" #TODO fixme + tracking = row[16] + weight = row[18] + ship_charge = row[21] + taxes = row[22] + ship_site = row[0] + discount = row[4] warehouse_shipment.sohnum = sohnum #warehouse_shipment.header.sohnum = sohnum 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 #gather line data #TODO how are multiple lots processed? - line_product = row[0] - line_qty = row[2] - line_lot = row[3] - line_price = row[19] + line_product = row[1] + line_qty = row[3] + line_lot = row[4] + line_price = row[20] subdetail = WarehouseShipmentSubDetail( qtypcu=-1 * int(line_qty), lot=line_lot, @@ -276,6 +276,8 @@ class WarehouseShipmentDetail: itmref=self.itmref, ).first() else: + pprint.pprint(self.sohnum) + pprint.pprint(self.itmref) raise NotImplementedError # TODO result = get() self.soplin = result.SOPLIN_0