11.02.26
This commit is contained in:
@@ -236,20 +236,22 @@ class AutomationDocument(ModelSQL, ModelView, Workflow):
|
||||
doc.notes = (doc.notes or "") + f"Shipment found: {sh[0].number}\n"
|
||||
logger.info("BL_NUMBER:%s",sh[0].bl_number)
|
||||
if sh[0].incoming_moves:
|
||||
weight_total = sum([m.lot.lot_quantity for m in sh[0].incoming_moves if m.lot.lot_type == 'physic'])
|
||||
factor = weight_total / wr.net_landed_kg if wr.net_landed_kg else 1
|
||||
factor_net = wr.net_landed_kg / wr.bales if wr.bales else 1
|
||||
factor_gross = wr.gross_landed_kg / wr.bales if wr.bales else 1
|
||||
for move in sh[0].incoming_moves:
|
||||
lot = move.lot
|
||||
if lot.lot_type == 'physic':
|
||||
wr_payload = {
|
||||
"chunk_key": lot.lot_chunk_key,
|
||||
"gross_weight": float(round(lot.lot_gross_quantity / factor,5)),
|
||||
"net_weight": float(round(lot.lot_quantity / factor,5)),
|
||||
"tare_total": float(round(wr.tare_kg * (lot.lot_quantity / weight_total),5)) ,
|
||||
"gross_weight": float(round(lot.lot_qt * factor_gross,5)),
|
||||
"net_weight": float(round(lot.lot_qt * factor_net,5)),
|
||||
"tare_total": float(round(wr.tare_kg * (lot.lot_qt / wr.bales),5)) ,
|
||||
"bags": int(lot.lot_qt),
|
||||
"surveyor_code": 231,
|
||||
"place_key": 0,
|
||||
"report_date": 20260127
|
||||
"surveyor_code": sh[0].controller.get_alf(),
|
||||
"place_key": sh[0].to_location.get_places(),
|
||||
"report_date": wr.report_date,
|
||||
"weight_date": wr.weight_date,
|
||||
"agent": sh[0].agent.get_alf()
|
||||
}
|
||||
logger.info("PAYLOAD:%s",wr_payload)
|
||||
data = doc.create_weight_report(wr_payload)
|
||||
|
||||
@@ -300,6 +300,7 @@ class AutomationCron(ModelSQL, ModelView):
|
||||
shipment.to_location = loc_to
|
||||
shipment.carrier = None #carrier
|
||||
shipment.supplier = agent
|
||||
shipment.agent = agent
|
||||
shipment.vessel = vessel
|
||||
shipment.cargo_mode = 'bulk'
|
||||
shipment.bl_number = bl_number
|
||||
|
||||
Reference in New Issue
Block a user