diff --git a/shiftflow/services/assembly_closing.py b/shiftflow/services/assembly_closing.py index cf6e9e8..28bd6c5 100644 --- a/shiftflow/services/assembly_closing.py +++ b/shiftflow/services/assembly_closing.py @@ -185,9 +185,10 @@ def apply_assembly_closing(workitem_id: int, fact_qty: int, user_id: int) -> boo # Двигаем техпроцесс workitem.quantity_done = (workitem.quantity_done or 0) + fact_qty + workitem.quantity_reported = max(int(workitem.quantity_reported or 0), int(workitem.quantity_done or 0)) if workitem.quantity_done >= workitem.quantity_plan: workitem.status = 'done' - workitem.save(update_fields=['quantity_done', 'status']) + workitem.save(update_fields=['quantity_done', 'quantity_reported', 'status']) logger.info( 'assembly_closing:done workitem_id=%s qty=%s deal_id=%s location_id=%s user_id=%s report_id=%s', diff --git a/shiftflow/services/closing.py b/shiftflow/services/closing.py index 629d24a..c27fa6d 100644 --- a/shiftflow/services/closing.py +++ b/shiftflow/services/closing.py @@ -198,13 +198,14 @@ def apply_closing_workitems( created_shift += 1 wi.quantity_done = done_total + fact + wi.quantity_reported = max(int(wi.quantity_reported or 0), int(wi.quantity_done or 0)) if wi.quantity_done >= plan_total: wi.status = 'done' elif wi.quantity_done > 0: wi.status = 'leftover' else: wi.status = 'planned' - wi.save(update_fields=['quantity_done', 'status']) + wi.save(update_fields=['quantity_done', 'quantity_reported', 'status']) for stock_item_id, qty in consumptions.items(): if qty and float(qty) > 0: