Check for shipments already made against orders.
parent
bc6f82ada2
commit
a239a09799
|
@ -27,6 +27,8 @@ import records # type: ignore
|
|||
import yamamotoyama # type: ignore
|
||||
import yamamotoyama.x3_imports # type: ignore
|
||||
|
||||
import simple_email_notification
|
||||
|
||||
THIS_DIRECTORY = pathlib.Path(__file__).parent
|
||||
X12_DIRECTORY = THIS_DIRECTORY / "incoming"
|
||||
IMPORTS_DIRECTORY = THIS_DIRECTORY / "x3_imports"
|
||||
|
@ -202,7 +204,9 @@ X3_CUSTOMER_MAPPING = {
|
|||
'LOND1000_0000' : 'LOND0001',
|
||||
'VEND1000_VENDAB' : 'VEND0002',
|
||||
'ISLA1000_190132' : 'ISLA0005',
|
||||
'ISLA1000_0000' : 'ISLA0005',
|
||||
'PURI1000_0000' : 'PURI0002',
|
||||
'AVRI1000_AVRIGR' : 'AVRI0001',
|
||||
}
|
||||
|
||||
def main():
|
||||
|
@ -410,6 +414,16 @@ def process_file(edi_filename: pathlib.Path):
|
|||
def import_shipment(warehouse_shipment):
|
||||
"""send the shipment information to the shandex staging database"""
|
||||
with yamamotoyama.get_connection() as data_base:
|
||||
result = data_base.query(
|
||||
"""
|
||||
SELECT
|
||||
ylicplate
|
||||
FROM [staging].[dbo].[shandex_shipments]
|
||||
where ylicplate = :order
|
||||
""",
|
||||
order=warehouse_shipment.header.ylicplate,
|
||||
).all()
|
||||
if not result:
|
||||
with data_base.transaction():
|
||||
data_base.query(
|
||||
INSERT_SHIPMENT,
|
||||
|
@ -517,6 +531,8 @@ def import_shipment(warehouse_shipment):
|
|||
lot=subdetail.lot,
|
||||
sernum=subdetail.sernum
|
||||
)
|
||||
else:
|
||||
simple_email_notification.email_noticication(['bleeson@stashtea.com'],'Shandex Order Error',[f'{warehouse_shipment.header.ylicplate} already exists, is this a reship?'])
|
||||
|
||||
@dataclasses.dataclass
|
||||
class WarehouseShipmentSubDetail:
|
||||
|
|
Loading…
Reference in New Issue