fix: ftestwork validate bug
This commit is contained in:
parent
46d586430e
commit
71cbda504c
|
@ -155,6 +155,7 @@ class FtestWorkCreateUpdateSerializer(CustomModelSerializer):
|
|||
|
||||
def validate(self, attrs):
|
||||
qct = attrs.get("qct", None)
|
||||
ftestworkdefect = attrs.get("ftestworkdefect", [])
|
||||
type2 = attrs.get('type2', 20)
|
||||
if type2 == 20: # 如果是全检
|
||||
attrs['count_sampling'] = attrs['count']
|
||||
|
@ -168,7 +169,9 @@ class FtestWorkCreateUpdateSerializer(CustomModelSerializer):
|
|||
attrs['material'] = wm.material
|
||||
attrs['batch'] = wm.batch
|
||||
count_notok_json = attrs.get('count_notok_json', None)
|
||||
if qct is None: # 没有qct时按原有逻辑处理
|
||||
if qct or ftestworkdefect: # 没有qct时按原有逻辑处理
|
||||
pass
|
||||
else:
|
||||
if count_notok_json is None:
|
||||
raise ValidationError('不合格项不能为空')
|
||||
count_notok = 0
|
||||
|
|
Loading…
Reference in New Issue