From 8c8d7af1ba73333c931d69f751c1bb74ad2aa4f4 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 7 Nov 2024 09:01:53 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20count=5Frunning=5Fstate=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=9B=B4=E5=A4=9A=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/em/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/em/views.py b/apps/em/views.py index 3060bb0e..c3172530 100644 --- a/apps/em/views.py +++ b/apps/em/views.py @@ -105,6 +105,11 @@ class EquipmentViewSet(CustomModelViewSet): count_stop=Count(Case(When(running_state=30, then=1), output_field=IntegerField())), count_fail=Count(Case(When(running_state=40, then=1), output_field=IntegerField())), count_offline=Count(Case(When(running_state=50, then=1), output_field=IntegerField())), + count_ok=Count(Case(When(state=Equipment.EQUIP_STATE_OK, then=1), output_field=IntegerField())), + count_limit=Count(Case(When(state=Equipment.EQUIP_STATE_LIMIT, then=1), output_field=IntegerField())), + count_fix=Count(Case(When(state=Equipment.EQUIP_STATE_FIX, then=1), output_field=IntegerField())), + count_disable=Count(Case(When(state=Equipment.EQUIP_STATE_DISABLE, then=1), output_field=IntegerField())), + count_scrap=Count(Case(When(state=Equipment.EQUIP_STATE_SCRAP, then=1), output_field=IntegerField())), ) json_result = { "count": result["count"], From 79b1317cc61d2233bf76d921bce4de4a37bbbbc5 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 7 Nov 2024 09:03:54 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20count=5Frunning=5Fstate=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=9B=B4=E5=A4=9A=E4=BF=A1=E6=81=AF2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/em/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/em/views.py b/apps/em/views.py index c3172530..2f4f98e2 100644 --- a/apps/em/views.py +++ b/apps/em/views.py @@ -118,6 +118,11 @@ class EquipmentViewSet(CustomModelViewSet): "count_stop": result["count_stop"], "count_fail": result["count_fail"], "count_offline": result["count_offline"], + "count_ok": result["count_ok"], + "count_limit": result["count_limit"], + "count_fix": result["count_fix"], + "count_disable": result["count_disable"], + "count_scrap": result["count_scrap"] } return Response(json_result) From 6eec19948860fec4c6cd6641bc0729edba1b9e32 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 7 Nov 2024 09:40:32 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20mlog=20create=E6=97=B6=E6=A0=A1?= =?UTF-8?q?=E9=AA=8Cmtask=E6=98=AF=E5=90=A6=E6=98=AF=E4=B8=8B=E8=BE=BE?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/serializers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index 6a7f95e2..2ac94141 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -286,6 +286,9 @@ class MlogSerializer(CustomModelSerializer): def create(self, validated_data): material_out = validated_data['material_out'] + mtask:Mtask = validated_data.get('mtask', None) + if mtask and mtask.state != Mtask.MTASK_ASSGINED: + raise ParseError('该任务非下达中不可选择') with transaction.atomic(): mlogb = validated_data.pop('mlogb', []) instance: Mlog = super().create(validated_data)