feat: ftestworkcreate type2处理

This commit is contained in:
caoqianming 2024-08-13 13:42:00 +08:00
parent 8e7e60c600
commit 0a0b6b72ba
1 changed files with 4 additions and 1 deletions

View File

@ -62,9 +62,12 @@ class QuaStatUpdateSerializer(CustomModelSerializer):
class FtestWorkCreateUpdateSerializer(CustomModelSerializer):
class Meta:
model = FtestWork
fields = ['id', 'wm', 'test_date', 'count', 'count_sampling', 'count_ok', 'count_notok', 'count_notok_json']
fields = ['id', 'wm', 'type', 'type2', 'test_date', 'count', 'count_sampling', 'count_ok', 'count_notok', 'count_notok_json']
def validate(self, attrs):
type2 = attrs.get('type2', 20)
if type2 == 20: # 如果是全检
attrs['count_sampling'] = attrs['count']
if 'wm' not in attrs:
raise ValidationError('请选择车间库存')
wm:WMaterial = attrs['wm']