From 777776b5f0bf26ea1f1993ada06225323c9978f4 Mon Sep 17 00:00:00 2001 From: bleeson Date: Thu, 9 Oct 2025 07:17:26 -0700 Subject: [PATCH] Changes to email only 947 based on newly arrived file from Shandex --- edi_947.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/edi_947.py b/edi_947.py index 3d49446..c1752f4 100644 --- a/edi_947.py +++ b/edi_947.py @@ -104,11 +104,11 @@ def main(): """ for edi_filename in X12_DIRECTORY.iterdir(): if SHANDEX_947_FILENAME_RE.match(edi_filename.name): - pprint.pprint(edi_filename.name) + #pprint.pprint(edi_filename.name) process_file(edi_filename) # file moved to 997 processing folder to be sent later shutil.move(edi_filename, EDI_997_DIRECTORY / edi_filename.name) - combine_zscs() + #combine_zscs() def gmail_authenticate(): @@ -177,9 +177,9 @@ def tokens_from_edi_file( fields = record.split("*") if fields[0] in { "ISA", - "GS" + "GS", + "ST", "N1", - "N9", "SE", "GE", "IEA" @@ -232,16 +232,17 @@ def process_file(edi_filename: pathlib.Path): """ warehouse_stockchange = StockChange() vcrlin = 0 + status = '' + qty = '' + uom = '' + gtin = '' + lot = '' + license_plate = '' + control_number = '' + reason = '' + bucket = '' + product = '' for fields in tokens_from_edi_file(edi_filename): - status = '' - qty = '' - uom = '' - gtin = '' - lot = '' - license_plate = '' - control_number = '' - reason = '' - bucket = '' if fields[0] == "G62": iptdat = fields[2] warehouse_stockchange.header.iptdat = datetime.datetime.strptime( @@ -263,7 +264,8 @@ def process_file(edi_filename: pathlib.Path): reason = fields[2] elif fields[1] == 'ZZ': bucket = fields[2] - stock_movement_alert(product, qty, lot, status, license_plate, control_number, reason, bucket) + elif fields[1] == 'LT': + stock_movement_alert(product, qty, lot, status, license_plate, control_number, reason, bucket) #Per John Pena 9/2025, don't perform imports, only notify # if status in EMAIL_ONLY_CODES: # continue