refector: 检验撤回根据count_notok进行update_mb

This commit is contained in:
caoqianming 2024-04-24 16:22:36 +08:00
parent e33b4e5902
commit 7b83cd1095
1 changed files with 4 additions and 3 deletions

View File

@ -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)