From 8a162fbe58c89f69a1df0a29f8e0b8289571b802 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 13 Jan 2022 16:06:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E8=80=97=E4=BA=A7=E5=87=BA=E6=A0=A1?= =?UTF-8?q?=E9=AA=8Cbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/serializers.py | 3 ++- hb_server/apps/wpm/views.py | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hb_server/apps/wpm/serializers.py b/hb_server/apps/wpm/serializers.py index c78f4bc..b8c4ad5 100644 --- a/hb_server/apps/wpm/serializers.py +++ b/hb_server/apps/wpm/serializers.py @@ -261,7 +261,8 @@ class OperationListSerializer(serializers.ModelSerializer): if obj.step.type == Step.STEP_TYPE_NOM: count_work = OperationWproduct.objects.filter(operation=obj).count() else: - count_work = 0 + count_work = OperationMaterial.objects.filter(operation=obj).annotate(count_work=Sum('count')) + print(count_work) return count_work def get_equip_(self, obj): diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 30accd4..36f424b 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -616,9 +616,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd 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)) and op.step.type == Step.STEP_TYPE_DIV: - pass - else: + if not (set(list(sps_omi_l)) == set(list(sps_omo_l)) and op.step.type == Step.STEP_TYPE_DIV): raise exceptions.APIException('消耗与产出不一致') # 实际消耗物料校验