From a52d9e2b9c25ecbe20b9223b22632aabf32a3f1d Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 13 Jan 2022 16:12:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=B6=88=E8=80=97=E4=BA=A7?= =?UTF-8?q?=E5=87=BA=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/views.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 36f424b..64555b9 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -610,14 +610,16 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd if op.is_submited: raise exceptions.APIException('该操作已提交') # 校验消耗产出是否正确填写 - omis = OperationMaterial.objects.filter(operation=op, - type=SubprodctionMaterial.SUB_MA_TYPE_IN) - sps_omi_l = omis.values_list('subproduction_plan', flat=True) - omos = OperationMaterial.objects.filter(operation=op, - type=SubprodctionMaterial.SUB_MA_TYPE_OUT) - sps_omo_l = omos.filter(use_scrap=False).values_list('subproduction_plan', flat=True) - if not (set(list(sps_omi_l)) == set(list(sps_omo_l)) and op.step.type == Step.STEP_TYPE_DIV): - raise exceptions.APIException('消耗与产出不一致') + if op.step.type == Step.STEP_TYPE_DIV: + omis = OperationMaterial.objects.filter(operation=op, + type=SubprodctionMaterial.SUB_MA_TYPE_IN) + sps_omi_l = omis.values_list('subproduction_plan', flat=True) + omos = OperationMaterial.objects.filter(operation=op, + type=SubprodctionMaterial.SUB_MA_TYPE_OUT) + sps_omo_l = omos.filter(use_scrap=False).values_list('subproduction_plan', flat=True) + if set(list(sps_omi_l)) != set(list(sps_omo_l)) + raise exceptions.APIException('消耗与产出不一致') + # 实际消耗物料校验 # 检查自定义表单填写