Fix for bilingual SKUs with multiple GTINs
parent
317292b98f
commit
ee576aa67f
|
@ -84,7 +84,7 @@ def determine_edi_action(edi_filename: pathlib.Path):
|
||||||
"""
|
"""
|
||||||
944s from Shandex are either:
|
944s from Shandex are either:
|
||||||
-Intersite transfer receipt
|
-Intersite transfer receipt
|
||||||
-Comanufacturer PO receipt
|
-Comanufacturer receipt
|
||||||
-Customer return
|
-Customer return
|
||||||
"""
|
"""
|
||||||
transaction = ''
|
transaction = ''
|
||||||
|
@ -205,8 +205,15 @@ def gtin_to_sku(gtin):
|
||||||
where replace(ZCASEUPC_0, ' ', '') = :gtin
|
where replace(ZCASEUPC_0, ' ', '') = :gtin
|
||||||
""",
|
""",
|
||||||
gtin=gtin,
|
gtin=gtin,
|
||||||
).first()
|
).all()
|
||||||
return result
|
#bilingual products have multiple gtin records, guess at the correct one
|
||||||
|
best_itmref = ''
|
||||||
|
for record in result:
|
||||||
|
if best_itmref == '':
|
||||||
|
best_itmref = record['ITMREF_0']
|
||||||
|
elif record['ITMREF_0'].startswith('C'):
|
||||||
|
best_itmref = record['ITMREF_0']
|
||||||
|
return best_itmref
|
||||||
|
|
||||||
|
|
||||||
def process_intersite_receipt(edi_filename: pathlib.Path):
|
def process_intersite_receipt(edi_filename: pathlib.Path):
|
||||||
|
@ -288,7 +295,7 @@ def process_coman_receipt(edi_filename: pathlib.Path):
|
||||||
# W07*2025*CA**PN*10077652321019*LT*18JUN2027SE***UK*10077652321019
|
# W07*2025*CA**PN*10077652321019*LT*18JUN2027SE***UK*10077652321019
|
||||||
# N9*LI*1
|
# N9*LI*1
|
||||||
_, qty_str, uom, _, _, gtin, _, lot = fields[:8]
|
_, qty_str, uom, _, _, gtin, _, lot = fields[:8]
|
||||||
itmref = gtin_to_sku(gtin)['ITMREF_0']
|
itmref = gtin_to_sku(gtin)
|
||||||
subdetail = ReceiptSubDetail(
|
subdetail = ReceiptSubDetail(
|
||||||
pcu=fix_uom(uom),
|
pcu=fix_uom(uom),
|
||||||
qtypcu=int(qty_str),
|
qtypcu=int(qty_str),
|
||||||
|
|
Loading…
Reference in New Issue