Production updates & pulling Shopify information from closed orders instead of new.
parent
73a4f79bd6
commit
cc66d44bd1
|
@ -27,3 +27,12 @@ To catch issues we need to look at:
|
||||||
-possible sales order duplicates that have the same Shopify PO number
|
-possible sales order duplicates that have the same Shopify PO number
|
||||||
-missing sales orders, that came into the shipping table, but failed to import in
|
-missing sales orders, that came into the shipping table, but failed to import in
|
||||||
-missing deliveries, that failed during import, e.g. not enough stock
|
-missing deliveries, that failed during import, e.g. not enough stock
|
||||||
|
|
||||||
|
To find these use the sql files in "daily sql reports"
|
||||||
|
|
||||||
|
----------------------------------------------------------------------------------------
|
||||||
|
Reimporting:
|
||||||
|
The open orders report finds eCommerce orders that should have shipped. This is typically
|
||||||
|
a problem because of stock shortages that we need to disassemble cases for. The
|
||||||
|
'source_ecommerce_reimport_from_archive.py' script can help mass reimport the
|
||||||
|
missing shipments
|
||||||
|
|
|
@ -34,7 +34,7 @@ ARCHIVE_DIRECTORY = THIS_DIRECTORY / "incoming_shipments" / "archive"
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
#retrieve_x12_edi_files()#TODO uncomment
|
retrieve_x12_edi_files()#TODO uncomment
|
||||||
for file in INCOMING_DIRECTORY.iterdir():
|
for file in INCOMING_DIRECTORY.iterdir():
|
||||||
if file.name[-4:] != '.csv':
|
if file.name[-4:] != '.csv':
|
||||||
continue
|
continue
|
||||||
|
@ -91,15 +91,16 @@ def process_files(file):
|
||||||
qty = row[3]
|
qty = row[3]
|
||||||
lot = row[4]
|
lot = row[4]
|
||||||
order_id = row[6]
|
order_id = row[6]
|
||||||
|
tracking = row[16]
|
||||||
ship_date = datetime.datetime.strptime(row[17],'%m/%d/%Y %I:%M:%S %p').strftime('%m/%d/%Y')# what comes from SL
|
ship_date = datetime.datetime.strptime(row[17],'%m/%d/%Y %I:%M:%S %p').strftime('%m/%d/%Y')# what comes from SL
|
||||||
#ship_date = datetime.datetime.strptime(row[17],'%m/%d/%Y %H:%M').strftime('%m/%d/%Y')#default when we sort in Excel
|
#ship_date = datetime.datetime.strptime(row[17],'%m/%d/%Y %H:%M').strftime('%m/%d/%Y')#default when we sort in Excel
|
||||||
|
|
||||||
db_connection.query(
|
db_connection.query(
|
||||||
"""
|
"""
|
||||||
INSERT INTO [analytics].[dbo].[SL_ECOMM]
|
INSERT INTO [analytics].[dbo].[SL_ECOMM]
|
||||||
([site],[item],[des],[qty],[lot],[order_id],[ship_date])
|
([site],[item],[des],[qty],[lot],[order_id],[ship_date],[tracking])
|
||||||
VALUES
|
VALUES
|
||||||
(:site,:item,:des,:qty,:lot,:order_id,:ship_date)
|
(:site,:item,:des,:qty,:lot,:order_id,:ship_date,:tracking)
|
||||||
""",
|
""",
|
||||||
site=site,
|
site=site,
|
||||||
item=item,
|
item=item,
|
||||||
|
@ -107,7 +108,8 @@ def process_files(file):
|
||||||
qty=qty,
|
qty=qty,
|
||||||
lot=lot,
|
lot=lot,
|
||||||
order_id=order_id,
|
order_id=order_id,
|
||||||
ship_date=ship_date
|
ship_date=ship_date,
|
||||||
|
tracking=tracking
|
||||||
)
|
)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -131,9 +131,9 @@ def process_files(file): #I am assuming I am getting a sorted csv file by order
|
||||||
# shipzip = row[13]
|
# shipzip = row[13]
|
||||||
tracking = row[16]
|
tracking = row[16]
|
||||||
weight = row[18]
|
weight = row[18]
|
||||||
taxes = shopify_order_info[0]['total_tax']#row[22]
|
taxes = shopify_order_info[0]['current_total_tax']#row[22]
|
||||||
ship_charge = shopify_order_info[0]['shipping_lines__price']#row[21]
|
ship_charge = shopify_order_info[0]['shipping_lines__price']#row[21]
|
||||||
discount = shopify_order_info[0]['total_discounts']#row[24]
|
discount = shopify_order_info[0]['current_total_discounts']#row[24]
|
||||||
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:%S %p').strftime('%Y%m%d') # what comes from SL
|
sales_order.header.orddat = datetime.datetime.strptime(order_date,'%m/%d/%Y %I:%M:%S %p').strftime('%Y%m%d') # what comes from SL
|
||||||
#sales_order.header.orddat = datetime.datetime.strptime(order_date,'%m/%d/%Y %H:%M').strftime('%Y%m%d') #default when we sort in Excel
|
#sales_order.header.orddat = datetime.datetime.strptime(order_date,'%m/%d/%Y %H:%M').strftime('%Y%m%d') #default when we sort in Excel
|
||||||
|
@ -175,16 +175,16 @@ def get_details_from_shopify(order):
|
||||||
return db_connection.query(
|
return db_connection.query(
|
||||||
"""
|
"""
|
||||||
select
|
select
|
||||||
[ecommerce_orders].[order_number]
|
[ecommerce_shipped_orders].[order_number]
|
||||||
,[ecommerce_orders].[total_tax]
|
,[ecommerce_shipped_orders].[current_total_tax]
|
||||||
,[ecommerce_orders].[total_discounts]
|
,[ecommerce_shipped_orders].[current_total_discounts]
|
||||||
,[ecommerce_orders].[shipping_lines__price]
|
,[ecommerce_shipped_orders].[shipping_lines__price]
|
||||||
,[ecommerce_order_lines].[sku]
|
,[ecommerce_shipped_order_lines].[sku]
|
||||||
,[ecommerce_order_lines].[quantity]
|
,[ecommerce_shipped_order_lines].[quantity]
|
||||||
,[ecommerce_order_lines].[price]
|
,[ecommerce_shipped_order_lines].[price]
|
||||||
from [staging].[dbo].[ecommerce_orders]
|
from [staging].[dbo].[ecommerce_shipped_orders]
|
||||||
left join [staging].[dbo].[ecommerce_order_lines]
|
left join [staging].[dbo].[ecommerce_shipped_order_lines]
|
||||||
on [ecommerce_orders].[id] = [ecommerce_order_lines].[id]
|
on [ecommerce_shipped_orders].[id] = [ecommerce_shipped_order_lines].[id]
|
||||||
where order_number = :shopifyorder
|
where order_number = :shopifyorder
|
||||||
""",
|
""",
|
||||||
shopifyorder=order,
|
shopifyorder=order,
|
||||||
|
|
|
@ -87,7 +87,7 @@ def process_files(file):
|
||||||
warehouse_shipment = WarehouseShipment()
|
warehouse_shipment = WarehouseShipment()
|
||||||
previous_order = current_order
|
previous_order = current_order
|
||||||
sohnum = find_so_from_po(current_order)
|
sohnum = find_so_from_po(current_order)
|
||||||
order_date = row[9]
|
ship_date = row[17]
|
||||||
customer_name = row[10]
|
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]
|
||||||
|
@ -102,8 +102,8 @@ def process_files(file):
|
||||||
# discount = "?" #unused
|
# discount = "?" #unused
|
||||||
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:%S %p')# what comes from SL
|
warehouse_shipment.header.shidat = datetime.datetime.strptime(ship_date,'%m/%d/%Y %I:%M:%S %p')# what comes from SL
|
||||||
#warehouse_shipment.header.shidat = datetime.datetime.strptime(order_date,'%m/%d/%Y %H:%M')#default when we sort in Excel
|
#warehouse_shipment.header.shidat = datetime.datetime.strptime(ship_date,'%m/%d/%Y %H:%M')#default when we sort in Excel
|
||||||
warehouse_shipment.header.ylicplate = tracking
|
warehouse_shipment.header.ylicplate = tracking
|
||||||
warehouse_shipment.header.growei = weight
|
warehouse_shipment.header.growei = weight
|
||||||
#gather line data
|
#gather line data
|
||||||
|
@ -289,6 +289,7 @@ class WarehouseShipmentHeader:
|
||||||
cfmflg: int = 1
|
cfmflg: int = 1
|
||||||
pjt: str = ""
|
pjt: str = ""
|
||||||
bptnum: str = ""
|
bptnum: str = ""
|
||||||
|
mdl: str = ""
|
||||||
ylicplate: str = ""
|
ylicplate: str = ""
|
||||||
invdtaamt_2: decimal.Decimal = decimal.Decimal()
|
invdtaamt_2: decimal.Decimal = decimal.Decimal()
|
||||||
invdtaamt_3: decimal.Decimal = decimal.Decimal()
|
invdtaamt_3: decimal.Decimal = decimal.Decimal()
|
||||||
|
@ -372,6 +373,7 @@ class WarehouseShipmentHeader:
|
||||||
self.cfmflg,
|
self.cfmflg,
|
||||||
self.pjt,
|
self.pjt,
|
||||||
self.bptnum,
|
self.bptnum,
|
||||||
|
self.mdl,
|
||||||
self.ylicplate,
|
self.ylicplate,
|
||||||
self.invdtaamt_2,
|
self.invdtaamt_2,
|
||||||
self.invdtaamt_3,
|
self.invdtaamt_3,
|
||||||
|
|
Loading…
Reference in New Issue