From fe5d2968f45f91811562b5eebf67c60cba0baef5 Mon Sep 17 00:00:00 2001 From: bleeson Date: Fri, 18 Jul 2025 08:28:43 -0700 Subject: [PATCH] Handle 944s for unsent 943s with email notification. --- edi_944_to_table.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/edi_944_to_table.py b/edi_944_to_table.py index ef81c45..0df96c6 100644 --- a/edi_944_to_table.py +++ b/edi_944_to_table.py @@ -90,16 +90,22 @@ def determine_edi_action(edi_filename: pathlib.Path): transaction = '' for fields in tokens_from_edi_file(edi_filename): if fields[0] == "W17": - transaction = fields[5] - break - pprint.pprint(transaction) + if len(fields) == 6: + transaction = fields[5] + break + elif len(fields) == 5: + transaction = fields[4] + break + if transaction: if transaction.startswith('SHP'): process_intersite_receipt(edi_filename) elif transaction.startswith('RA'): process_return(edi_filename) - # elif transaction.startswith('RA*'):#TODO how are coman pos received - # pprint.pprint('return') + # PO is used when Shandex does not receive a 943, will they receive 943s for comans? + elif transaction.startswith('PO'):#TODO how are coman pos received + simple_email_notification.email_noticication(['bleeson@stashtea.com'], + 'Unknown Shandex 944',[transaction]) else: raise Exception('Unknown transaction type') else: