From 4024fee8657adbc4cd37a782ab42462fe2369e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=89=8D=E6=98=8E?= <909355014@qq.com> Date: Wed, 29 Jun 2022 11:33:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E5=90=8E=E6=8F=90=E4=BA=A4=E7=9A=84?= =?UTF-8?q?=E6=9C=AC=E4=BA=A7=E5=93=81=E6=9C=AC=E5=B7=A5=E5=BA=8F=E8=87=AA?= =?UTF-8?q?=E6=A3=80=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/models.py | 4 ++-- hb_server/apps/wpm/views.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hb_server/apps/wpm/models.py b/hb_server/apps/wpm/models.py index 78e3a3f..45c5fcb 100644 --- a/hb_server/apps/wpm/models.py +++ b/hb_server/apps/wpm/models.py @@ -139,9 +139,9 @@ class WProduct(CommonAModel): @property def last_wp_test(self): """ - 最后提交的本产品工序自检 + 最后提交的本产品本工序自检 """ - return self.test_wproduct.filter(is_submited=True).order_by('-id').first() + return self.test_wproduct.filter(is_submited=True, type=TestRecord.TEST_PROCESS, subproduction_plan=self.subproduction_plan).order_by('-id').first() class WprouctTicket(CommonAModel): diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index c20918c..012b103 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -203,7 +203,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet): form=form) if wproduct.act_state == WProduct.WPR_ACT_STATE_TORETEST: # 查找最近一条检验记录 - trs = wproduct.last_process_test + trs = wproduct.last_wp_test savedict['origin_test'] = trs if not trs: raise exceptions.APIException('原工序检验记录不存在') @@ -707,7 +707,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd if step == newstep: wp.act_state = WProduct.WPR_ACT_STATE_TOTEST - last_test = wp.last_process_test + last_test = wp.last_wp_test if last_test and reuseForm: last_test.is_midtesting = False last_test.is_submited = False @@ -718,7 +718,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd wp.act_state = WProduct.WPR_ACT_STATE_DOWAIT if needTest: #子工序若需要检验 wp.act_state = WProduct.WPR_ACT_STATE_TOTEST - last_test = wp.last_process_test + last_test = wp.last_wp_test if last_test and reuseForm: last_test.is_midtesting = True last_test.is_submited = False @@ -770,7 +770,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd wproduct.subproduction_plan = oms_w.subproduction_plan if step == newstep: wproduct.act_state = WProduct.WPR_ACT_STATE_TOTEST - last_test = wproduct.last_process_test + last_test = wproduct.last_wp_test if last_test and reuseForm: last_test.is_midtesting = False last_test.is_submited = False @@ -781,7 +781,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd wproduct.act_state = WProduct.WPR_ACT_STATE_DOWAIT if needTest: wproduct.act_state = WProduct.WPR_ACT_STATE_TOTEST - last_test = wproduct.last_process_test + last_test = wproduct.last_wp_test if last_test and reuseForm: last_test.is_midtesting = True last_test.is_submited = False