From 7a819b49fb34aa133ad77a9b687c7df48fd33cfd Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 24 Nov 2021 14:02:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=B9=E5=B1=82=E6=8E=A5=E5=8F=A3bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/pm/signals.py | 1 + hb_server/apps/wpm/views.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hb_server/apps/pm/signals.py b/hb_server/apps/pm/signals.py index 40bc5d3..e1876a9 100644 --- a/hb_server/apps/pm/signals.py +++ b/hb_server/apps/pm/signals.py @@ -13,6 +13,7 @@ def update_subplan_main(sender, instance, created, **kwargs): subplan.main_product = instance.material subplan.main_count = instance.count subplan.main_count_real = instance.count_real + subplan.main_count_ok = instance.count_ok if instance.count_ok >= instance.count and instance.count_ok > 0: subplan.state = SubProductionPlan.SUBPLAN_STATE_DONE elif instance.count_ok < instance.count and instance.count_ok > 0: diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index a9a6599..5c93c0a 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -38,7 +38,7 @@ class WPlanViewSet(ListModelMixin, GenericViewSet): serializer_class = SubProductionPlanListSerializer filterset_fields = ['production_plan', 'process', 'state', 'main_product', 'workshop'] ordering_fields = [] - ordering = ['-id'] + ordering = ['-update_time'] @action(methods=['post', 'get'], detail=True, perms_map={'post':'*', 'get':'*'}, serializer_class=PickHalfSerializer) @transaction.atomic @@ -418,8 +418,6 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd for x in range(i.count): WProduct.objects.create(**wpr) elif step.type == Step.STEP_TYPE_COMB: - # 隐藏原半成品 - ows = OperationWproduct.objects.filter(operation=op) if i.subproduction_progress.is_main: newstep, hasNext = WpmServies.get_next_step(i.subproduction_plan, step) wproduct = WProduct() @@ -438,7 +436,9 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd instance.count_real = instance.count_real + 1 # 这个地方可能会有问题,不够严谨 instance.save() wproduct.save() - ows.update(is_hidden=True, child=wproduct) + # 隐藏原半成品 + wps = WProduct.objects.filter(ow_wproduct__operation = op) + wps.update(is_hidden=True, child=wproduct) op.is_submited = True op.save() return Response()