Fixed regex.
parent
8461cf2919
commit
268cf9e298
|
@ -34,7 +34,7 @@ SHANDEX_944_FILENAME_RE = re.compile(
|
|||
)
|
||||
|
||||
SHANDEX_RETURN_944_FILENAME_RE = re.compile(
|
||||
r"\A 944_RET_YAMAMOTOYAMA \S+ [.]edi \Z", re.X | re.M | re.S
|
||||
r"\A 944_RET_YAMAMOTOYAMA.*[.]edi\Z", re.X | re.M | re.S
|
||||
)
|
||||
|
||||
INSERT_RECEIPT = """
|
||||
|
@ -78,11 +78,12 @@ def main():
|
|||
Do it!
|
||||
"""
|
||||
for edi_filename in X12_DIRECTORY.iterdir():
|
||||
pprint.pprint(edi_filename.name)
|
||||
if SHANDEX_944_FILENAME_RE.match(edi_filename.name):
|
||||
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)
|
||||
elif SHANDEX_RETURN_944_FILENAME_RE(edi_filename.name):
|
||||
elif SHANDEX_RETURN_944_FILENAME_RE.match(edi_filename.name):
|
||||
process_return(edi_filename)
|
||||
shutil.move(edi_filename, EDI_997_DIRECTORY / edi_filename.name)
|
||||
|
||||
|
@ -195,7 +196,7 @@ def process_return(edi_filename: pathlib.Path):
|
|||
if fields[0] == "W07":
|
||||
# W07*33*CA**PN*10077652772170*LT*06022027A***UK*10077652772170
|
||||
_, qty_str, uom, _, _, gtin, _, lot = fields[:8]
|
||||
x3_sku = gtin_to_sku(gtin)['ITMREF_0']
|
||||
x3_sku = gtin_to_sku(gtin)
|
||||
uom = fix_uom(uom)
|
||||
line_data.append(f'{x3_sku} {qty_str} {uom} {lot}')
|
||||
simple_email_notification.email_noticication(['bleeson@stashtea.com','scrinvoices@stashtea.com','business@stashtea.com'],
|
||||
|
|
Loading…
Reference in New Issue