From fd2141598e3c5536b5c2449157f80a0a084e1126 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 23 Nov 2021 14:37:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E9=97=B4=E6=93=8D=E4=BD=9Cbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/views.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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()