diff --git a/modules/automation/automation.py b/modules/automation/automation.py index 38cdb2f..802fc2f 100644 --- a/modules/automation/automation.py +++ b/modules/automation/automation.py @@ -182,6 +182,39 @@ class AutomationDocument(ModelSQL, ModelView, Workflow): logger.error("Metadata processing error: %s", e) doc.save() + + def create_weight_report(self): + wr_payload = { + "chunk_key": 4660139, + "gross_weight": 50000, + "net_weight": 49500, + "tare_total": 500, + "bags": 100, + "surveyor_code": 1424, + "place_key": 100086, + "report_date": 20260126 + } + + response = requests.post( + "http://automation-service:8006/weight-report", + json=wr_payload, # đŸ‘ˆ ICI la correction + timeout=10 + ) + + response.raise_for_status() + data = response.json() + + # Exemple de data retournĂ©e : + # { + # "success": true, + # "weight_report_key": 123456789 + # } + + self.notes = ( + f"WR creation success: {data.get('success')}\n" + f"WEIGHT_REPORT_KEY: {data.get('weight_report_key')}" + ) + # ------------------------------------------------------- # FULL PIPELINE # ------------------------------------------------------- @@ -366,7 +399,7 @@ class AutomationDocument(ModelSQL, ModelView, Workflow): logger.info("ADD_LOT:%s",l) LotQt.add_physical_lots(lqt,[l]) - + doc.create_weight_report() # if cls.rule_set.ocr_required:[] # cls.run_ocr([doc])