diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index e200b2d..26d81e2 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -367,9 +367,10 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd i_wmat.count = i_wmat.count- i.count i_wmat.save() # 更新子计划物料消耗情况 - sp = i_wmat.subproduction_plan - sp.count_real = sp.count_real + i.count - sp.save() + spp = SubProductionProgress.objects.get(subproduction_plan=i_wmat.subproduction_plan, + material=i_wmat.material) + spp.count_real = spp.count_real + i.count + spp.save() # 更新产出 for i in OperationMaterial.objects.filter(operation=op, type=SubprodctionMaterial.SUB_MA_TYPE_OUT): if not i.subproduction_progress.is_main: @@ -378,9 +379,9 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd ins.count = ins.count + i.count ins.save() # 更新子计划物料产出情况 - sp = i.subproduction_progress - sp.count_real = sp.count_real + i.count - sp.save() + spp = i.subproduction_progress + spp.count_real = spp.count_real + i.count + spp.save() # 更新动态产品表 if step.type == Step.STEP_TYPE_NOM: for i in OperationWproduct.objects.filter(operation=op): @@ -435,6 +436,9 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd instance.save() wproduct.save() ows.update(is_hidden=True, child=wproduct) + op.is_submited = True + op.save() + return Response()