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)