From f269b0714045da7f3e0bfc0cec55668cad126615 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 1 Mar 2022 09:45:52 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E5=8D=95=E4=B8=AA=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=BC=96=E5=8F=B7=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 9e53ef9..d405773 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -315,7 +315,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet): remark = vdata.get('remark', '') fifo = FIFO.objects.create(type=FIFO.FIFO_TYPE_DO_IN, is_audited=True, auditor=request.user, inout_date=timezone.now(), - create_by=request.user, remark=remark) + create_by=request.user, remark=remark, number='RK'+ranstr(7)) # 创建入库明细 fifoitem = FIFOItem() fifoitem.warehouse = warehouse From 2d834246fab55895bfe58ff4352c7c85cb045256 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 1 Mar 2022 10:27:45 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=B8=80=E4=BA=9Bbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/pm/views.py | 2 +- hb_server/apps/wpm/serializers.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hb_server/apps/pm/views.py b/hb_server/apps/pm/views.py index cb02d67..4257e9f 100644 --- a/hb_server/apps/pm/views.py +++ b/hb_server/apps/pm/views.py @@ -98,7 +98,7 @@ class ProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, CreateModel for index, i in enumerate(subps): steps = Step.objects.filter(usedstep__subproduction=i, usedstep__subproduction__is_deleted=False, usedstep__is_deleted=False, is_deleted=False - ).values('id', 'number', 'name', 'usedstep__remark', need_test=F('usedstep__need_test')) + ).order_by('number').values('id', 'number', 'name', 'usedstep__remark', need_test=F('usedstep__need_test')) instance = SubProductionPlan.objects.create(production_plan=production_plan, subproduction=i, start_date=production_plan.start_date, end_date=production_plan.end_date, workshop=i.process.workshop, process=i.process, create_by=request.user, diff --git a/hb_server/apps/wpm/serializers.py b/hb_server/apps/wpm/serializers.py index b5c702f..61ae4b5 100644 --- a/hb_server/apps/wpm/serializers.py +++ b/hb_server/apps/wpm/serializers.py @@ -64,6 +64,8 @@ class PickSerializer(serializers.Serializer): fifo = FIFO.objects.create(type=FIFO.FIFO_TYPE_DO_OUT, inout_date=timezone.now(), create_by=self.context['request'].user, number = 'CK' + ranstr(7)) + if len(picks)<=0: + raise exceptions.APIException('没有领料项目') for i in picks: isLowLevel = False # 更新出库详情 @@ -116,8 +118,9 @@ class PickSerializer(serializers.Serializer): subproduction_plan=sp) sp.is_picked=True sp.state = SubProductionPlan.SUBPLAN_STATE_WORKING #生产中 - sp.state_date_real = timezone.now() #实际开工日期 - sp.save() + if sp.start_date_real is None: + sp.start_date_real = timezone.now()#实际开工日期 + sp.save() # 创建领料记录 pick = Pick() pick.subproduction_plan = sp From bf1f2ab4e9afc141775ddb4f2fc9bfaeb8cd4c27 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 1 Mar 2022 10:34:39 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=B6=88=E8=80=97?= =?UTF-8?q?=E7=89=A9=E6=96=99=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index d405773..8d77fed 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -660,8 +660,9 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd if set(list(sps_omi_l)) != set(list(sps_omo_l)): raise exceptions.APIException('消耗与产出不一致') else: - if omis.exists() and processId !=1: # 不是冷加工 - raise exceptions.APIException('请选择消耗物料') + pass + # if omis.exists() and processId !=1: # 不是冷加工 + # raise exceptions.APIException('请选择消耗物料') # 检查自定义表单填写 if OperationRecord.objects.filter(operation=op, is_filled=False).exists(): From 4c6b0c36bfb45c7c9d4a2b738212a4b40727391b Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 1 Mar 2022 10:42:55 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=8D=8A=E6=88=90=E5=93=81=E6=A3=80?= =?UTF-8?q?=E7=B4=A2=E4=BB=A5=E5=8F=8A=E6=9D=83=E9=99=90=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/system/views.py | 4 ++-- hb_server/apps/wpm/views.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hb_server/apps/system/views.py b/hb_server/apps/system/views.py index 3664054..06de18c 100644 --- a/hb_server/apps/system/views.py +++ b/hb_server/apps/system/views.py @@ -200,9 +200,9 @@ class PermissionViewSet(ModelViewSet): queryset = Permission.objects.all() serializer_class = PermissionSerializer pagination_class = None - search_fields = ['name'] + search_fields = ['name', 'method'] ordering_fields = ['sort'] - ordering = ['pk'] + ordering = ['sort'] class OrganizationViewSet(ModelViewSet): diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 8d77fed..c27f599 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -163,7 +163,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet): 'to_order').prefetch_related('wp_child') serializer_class = WProductListSerializer filterset_class = WProductFilterSet - search_fields = ['number'] + search_fields = ['number', 'material__name', 'subproduction_plan__number'] ordering_fields = ['id'] ordering = ['id'] From 5861ed474506193a62e20e85db91244d410d22eb Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 1 Mar 2022 10:43:21 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=8D=8A=E6=88=90=E5=93=81=E6=A3=80?= =?UTF-8?q?=E7=B4=A2=E4=BB=A5=E5=8F=8A=E6=9D=83=E9=99=90=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/system/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hb_server/apps/system/views.py b/hb_server/apps/system/views.py index 06de18c..3677e66 100644 --- a/hb_server/apps/system/views.py +++ b/hb_server/apps/system/views.py @@ -201,7 +201,7 @@ class PermissionViewSet(ModelViewSet): serializer_class = PermissionSerializer pagination_class = None search_fields = ['name', 'method'] - ordering_fields = ['sort'] + ordering_fields = ['sort', 'id', 'method'] ordering = ['sort'] From 5771e6d55554c9522f00f83f6977ae7179749432 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 1 Mar 2022 11:26:34 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E5=8E=BB=E9=99=A4ng=5Fsign=20=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/services.py | 3 ++- hb_server/apps/wpm/signals.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hb_server/apps/wpm/services.py b/hb_server/apps/wpm/services.py index acf5cf0..f836273 100644 --- a/hb_server/apps/wpm/services.py +++ b/hb_server/apps/wpm/services.py @@ -76,8 +76,9 @@ class WpmService(object): if wt.step.process == test.step.process: wproduct.ng_sign = None ticket = wt.ticket - ticket_data = wt.ticket_data + ticket_data = ticket.ticket_data ticket_data['retest_result'] = 1 + ticket.ticket_data = ticket_data ticket.update_by = user ticket.save() # 创建处理日志 diff --git a/hb_server/apps/wpm/signals.py b/hb_server/apps/wpm/signals.py index 67ba2d2..874859a 100644 --- a/hb_server/apps/wpm/signals.py +++ b/hb_server/apps/wpm/signals.py @@ -71,7 +71,9 @@ def handleTicket(sender, instance, created, **kwargs): elif decision in [WProduct.NG_ACCEPT, WProduct.NG_PERMIT]: wp.act_state = WProduct.WPR_ACT_STATE_OK - if wp.test_wproduct.filter(is_submited=True).order_by('-id').last().type == TestRecord.TEST_PROCESS_RE: + # 获取最后一次检验 + test= wp.test_wproduct.filter(is_submited=True).order_by('-id').last() + if test.type == TestRecord.TEST_PROCESS_RE or test.is_midtesting: wp.act_state = WProduct.WPR_ACT_STATE_DOWAIT wp.ng_sign = decision wt.save() From 242c311490aaea01f32e37ea19c8ed59a4f5cd6c Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 1 Mar 2022 11:35:58 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=9C=89=E6=AD=A3?= =?UTF-8?q?=E5=9C=A8=E8=BF=9B=E8=A1=8C=E7=9A=84=E5=B7=A5=E5=BA=8F=E4=B8=AD?= =?UTF-8?q?=E6=A3=80=E9=AA=8C=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index c27f599..cb2ad0f 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -713,6 +713,10 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd wp.act_state = WProduct.WPR_ACT_STATE_DOWAIT if needTest: wp.act_state = WProduct.WPR_ACT_STATE_TOTEST + if wp.test:# 如果有正在进行的工序中检验 + wp.test.is_midtesting = False + wp.test.is_submited = False + wp.test.save() wp.operation = None wp.update_by = request.user From 20c70b3d11b3232934bb4e88d3fbd733df7ba160 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 1 Mar 2022 11:37:14 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=9C=89=E6=AD=A3?= =?UTF-8?q?=E5=9C=A8=E8=BF=9B=E8=A1=8C=E7=9A=84=E5=B7=A5=E5=BA=8F=E4=B8=AD?= =?UTF-8?q?=E6=A3=80=E9=AA=8C=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/views.py | 1 - 1 file changed, 1 deletion(-) diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index cb2ad0f..59a4086 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -714,7 +714,6 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd if needTest: wp.act_state = WProduct.WPR_ACT_STATE_TOTEST if wp.test:# 如果有正在进行的工序中检验 - wp.test.is_midtesting = False wp.test.is_submited = False wp.test.save()