feat: ftestwork增加校验

This commit is contained in:
caoqianming 2024-09-19 15:08:54 +08:00
parent 305fda44c2
commit 5628a1ff83
1 changed files with 2 additions and 0 deletions

View File

@ -93,6 +93,8 @@ class FtestWorkCreateUpdateSerializer(CustomModelSerializer):
else:
raise ValidationError(f'不合格项{k_2}必须为非负整数')
attrs['count_notok'] = count_notok
if type2 == 20 and attrs['count'] != attrs['count_ok'] + attrs['count_notok']:
raise ValidationError('全检时总数必须等于合格数+不合格数')
elif 'mb' in attrs and attrs['mb']:
attrs['wm'] = None
attrs['material'] = attrs['mb'].material