From a6591c341c788219bdb51f89b8dcf4e2a44fa0cb Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 13 Jan 2022 16:08:11 +0800 Subject: [PATCH] =?UTF-8?q?operation=20list=20count=5Fwork=20=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/serializers.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hb_server/apps/wpm/serializers.py b/hb_server/apps/wpm/serializers.py index b8c4ad5..bf90ce3 100644 --- a/hb_server/apps/wpm/serializers.py +++ b/hb_server/apps/wpm/serializers.py @@ -261,8 +261,7 @@ class OperationListSerializer(serializers.ModelSerializer): if obj.step.type == Step.STEP_TYPE_NOM: count_work = OperationWproduct.objects.filter(operation=obj).count() else: - count_work = OperationMaterial.objects.filter(operation=obj).annotate(count_work=Sum('count')) - print(count_work) + count_work = OperationMaterial.objects.filter(operation=obj).aggregate(count_work=Sum('count'))['count_work'] return count_work def get_equip_(self, obj):