diff --git a/edi_867_to_table.py b/edi_867_to_table.py index 2786b8e..f05ab6c 100644 --- a/edi_867_to_table.py +++ b/edi_867_to_table.py @@ -398,6 +398,7 @@ def process_file(edi_filename: pathlib.Path, x3_customer_mapping): warehouse_shipment.header.ylicplate = f'{po_number}' if picking_number != previous_picking_number and previous_picking_number != '': if warehouse_shipment.header.bpdnam != 'Shandex Group': + warehouse_shipment.header.pick_ticket = previous_picking_number warehouse_shipment.header.shidat = datetime.datetime.strptime( shipping_date, "%Y%m%d") time_stamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") @@ -472,6 +473,7 @@ def process_file(edi_filename: pathlib.Path, x3_customer_mapping): time_stamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") if warehouse_shipment.header.bpcord == '': missing_customer_alert(customer_key) + warehouse_shipment.header.pick_ticket = picking_number import_shipment(warehouse_shipment) @@ -566,7 +568,7 @@ def import_shipment(warehouse_shipment): sdhtyp=warehouse_shipment.header.sdhtyp, growei=warehouse_shipment.header.growei, pacnbr=warehouse_shipment.header.pacnbr, - star71=warehouse_shipment.header.star71, + star71=warehouse_shipment.header.pick_ticket, star72=warehouse_shipment.header.star72, star81=warehouse_shipment.header.star81, star82=warehouse_shipment.header.star82 @@ -769,6 +771,7 @@ class WarehouseShipmentHeader: bptnum: str = "" ylicplate: str = "SHANDEX" yclippership: str = "" + pick_ticket: str = "" invdtaamt_2: decimal.Decimal = decimal.Decimal() invdtaamt_3: decimal.Decimal = decimal.Decimal() invdtaamt_4: decimal.Decimal = decimal.Decimal() diff --git a/edi_944_to_table.py b/edi_944_to_table.py index 4a80c10..26e7080 100644 --- a/edi_944_to_table.py +++ b/edi_944_to_table.py @@ -75,59 +75,35 @@ def main(): """ for edi_filename in X12_DIRECTORY.iterdir(): if SHANDEX_944_FILENAME_RE.match(edi_filename.name): - process_file(edi_filename) + determine_edi_action(edi_filename) # file moved to 997 processing folder to be sent later - shutil.move(edi_filename, EDI_997_DIRECTORY / edi_filename.name) + # shutil.move(edi_filename, EDI_997_DIRECTORY / edi_filename.name)#TODO uncomment -def new_944_alert(sdhnum, pohnum, rcpdat): - msg = MIMEMultipart() - msg['Subject'] = 'New Receipt from Shandex' - msg['Precedence'] = 'bulk' - msg['From'] = 'x3report@stashtea.com' - msg['To'] = 'icortes@yamamotoyama.com,mdelacruz@yamamotoyama.com,dalmanza@yamamotoyama.com,jpena@yamamotoyama.com' - msg['CC'] = 'bleeson@stashtea.com' - emailtext = f'Delivery: {sdhnum}\nPO: {pohnum}\nDate: {rcpdat}' - msg.attach(MIMEText(emailtext, 'plain')) - with smtplib.SMTP_SSL("smtp.gmail.com", 465) as smtp: - smtp.login(user='x3reportmk2@yamamotoyama.com', password=r'n