Minor changes to format at production introduction.
parent
467e489ea8
commit
46556990a0
|
@ -34,7 +34,7 @@ SHANDEX_944_FILENAME_RE = re.compile(
|
||||||
)
|
)
|
||||||
|
|
||||||
SHANDEX_RETURN_944_FILENAME_RE = re.compile(
|
SHANDEX_RETURN_944_FILENAME_RE = re.compile(
|
||||||
r"\A 944_RET_YAMAMOTOYAMA.*[.]edi\Z", re.X | re.M | re.S
|
r"\A 944_RET_STASH-YAMAMOTOYAMA.*[.]edi\Z", re.X | re.M | re.S
|
||||||
)
|
)
|
||||||
|
|
||||||
INSERT_RECEIPT = """
|
INSERT_RECEIPT = """
|
||||||
|
@ -156,6 +156,23 @@ def find_shipment_line(sdhnum, itmref):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def find_coman_po_line(sdhnum, itmref):
|
||||||
|
with yamamotoyama.get_connection() as database:
|
||||||
|
result = database.query(
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
POPLIN_0
|
||||||
|
from PROD.PORDERQ
|
||||||
|
where
|
||||||
|
POHNUM_0 = :sdhnum
|
||||||
|
and ITMREF_0 = :itmref
|
||||||
|
""",
|
||||||
|
sdhnum=sdhnum,
|
||||||
|
itmref=itmref
|
||||||
|
).first()['POPLIN_0']
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
def check_shipment_status(delivery):
|
def check_shipment_status(delivery):
|
||||||
with yamamotoyama.get_connection() as database:
|
with yamamotoyama.get_connection() as database:
|
||||||
result = database.query(
|
result = database.query(
|
||||||
|
@ -196,12 +213,14 @@ def process_return(edi_filename: pathlib.Path):
|
||||||
if fields[0] == "W17":
|
if fields[0] == "W17":
|
||||||
#_, _, rcpdat, _, sohnum, sdhnum = fields[:6]
|
#_, _, rcpdat, _, sohnum, sdhnum = fields[:6]
|
||||||
#W17*F*20250327*143365*RA9000022
|
#W17*F*20250327*143365*RA9000022
|
||||||
_, _, rcpdat, _, return_num, sohnum_0 = fields[:6]
|
#W17*F*20250826*147651*RA1729253
|
||||||
|
_, _, rcpdat, _, return_num = fields[:5]
|
||||||
rcpdat = datetime.datetime.strptime(rcpdat, "%Y%m%d").date() # 20230922
|
rcpdat = datetime.datetime.strptime(rcpdat, "%Y%m%d").date() # 20230922
|
||||||
if fields[0] == 'N9' and fields[1] == 'PO':
|
if fields[0] == 'N9' and fields[1] == 'PO':
|
||||||
po = fields[2]
|
po = fields[2]
|
||||||
if fields[0] == 'N9' and fields[1] == 'ZZ':
|
if fields[0] == 'N9' and fields[1] == 'ZZ':
|
||||||
reason = fields[3]
|
#N9*ZZ*INFO
|
||||||
|
reason = fields[2]
|
||||||
if fields[0] == 'N9' and fields[1] == 'CR':
|
if fields[0] == 'N9' and fields[1] == 'CR':
|
||||||
shandex_customer = fields[2]
|
shandex_customer = fields[2]
|
||||||
shandex_customer = customer_map_lookup(shandex_customer + '%') + '\n'
|
shandex_customer = customer_map_lookup(shandex_customer + '%') + '\n'
|
||||||
|
@ -352,8 +371,8 @@ def process_coman_receipt(edi_filename: pathlib.Path):
|
||||||
for fields in tokens_from_edi_file(edi_filename):
|
for fields in tokens_from_edi_file(edi_filename):
|
||||||
if fields[0] == "W17":
|
if fields[0] == "W17":
|
||||||
_, _, rcpdat, _, pohnum = fields[:5]
|
_, _, rcpdat, _, pohnum = fields[:5]
|
||||||
warehouse_receipt.sdhnum = get_coman_shipment(pohnum)
|
warehouse_receipt.sdhnum = pohnum
|
||||||
validated = check_shipment_status(warehouse_receipt.sdhnum)
|
#validated = check_shipment_status(warehouse_receipt.sdhnum)
|
||||||
warehouse_receipt.header.rcpdat = datetime.datetime.strptime(
|
warehouse_receipt.header.rcpdat = datetime.datetime.strptime(
|
||||||
rcpdat, "%Y%m%d"
|
rcpdat, "%Y%m%d"
|
||||||
).date() # 20230922
|
).date() # 20230922
|
||||||
|
@ -372,7 +391,7 @@ def process_coman_receipt(edi_filename: pathlib.Path):
|
||||||
if fields[0] == 'N9' and fields[1] == 'LI':
|
if fields[0] == 'N9' and fields[1] == 'LI':
|
||||||
# N9*LI*1000
|
# N9*LI*1000
|
||||||
#line = fields[2] #This line isn't the line number from X3, it needs to be looked up
|
#line = fields[2] #This line isn't the line number from X3, it needs to be looked up
|
||||||
line = find_shipment_line(warehouse_receipt.sdhnum, itmref)
|
line = find_coman_po_line_line(warehouse_receipt.sdhnum, itmref)
|
||||||
warehouse_receipt.append(
|
warehouse_receipt.append(
|
||||||
ReceiptDetail(
|
ReceiptDetail(
|
||||||
sdhnum=warehouse_receipt.sdhnum,
|
sdhnum=warehouse_receipt.sdhnum,
|
||||||
|
|
Loading…
Reference in New Issue