From 7b83cd109561a11841d113221e18ed0035896b22 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 24 Apr 2024 16:22:36 +0800 Subject: [PATCH] =?UTF-8?q?refector:=20=E6=A3=80=E9=AA=8C=E6=92=A4?= =?UTF-8?q?=E5=9B=9E=E6=A0=B9=E6=8D=AEcount=5Fnotok=E8=BF=9B=E8=A1=8Cupdat?= =?UTF-8?q?e=5Fmb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/inm/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/inm/views.py b/apps/inm/views.py index c32d0634..e8ca6026 100644 --- a/apps/inm/views.py +++ b/apps/inm/views.py @@ -266,9 +266,10 @@ class MIOItemViewSet(ListModelMixin, BulkCreateModelMixin, BulkDestroyModelMixin mio: MIO = ins.mio if ins.test_date is None: raise ParseError('该明细还未检验') - InmService.update_mb_item(ins, 1, 'count_notok', mio.type, mio.belong_dept) - ins.test_date = None - ins.save() + if ins.count_notok > 0: + InmService.update_mb_item(ins, 1, 'count_notok', mio.type, mio.belong_dept) + ins.test_date = None + ins.save() return Response() @action(methods=['post'], detail=True, perms_map={'post': 'mioitem.test'}, serializer_class=MIOItemPurInTestSerializer)