feat: ftestworkcreate type2处理
This commit is contained in:
parent
8e7e60c600
commit
0a0b6b72ba
|
|
@ -62,9 +62,12 @@ class QuaStatUpdateSerializer(CustomModelSerializer):
|
||||||
class FtestWorkCreateUpdateSerializer(CustomModelSerializer):
|
class FtestWorkCreateUpdateSerializer(CustomModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = FtestWork
|
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):
|
def validate(self, attrs):
|
||||||
|
type2 = attrs.get('type2', 20)
|
||||||
|
if type2 == 20: # 如果是全检
|
||||||
|
attrs['count_sampling'] = attrs['count']
|
||||||
if 'wm' not in attrs:
|
if 'wm' not in attrs:
|
||||||
raise ValidationError('请选择车间库存')
|
raise ValidationError('请选择车间库存')
|
||||||
wm:WMaterial = attrs['wm']
|
wm:WMaterial = attrs['wm']
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue