fix: mlog create 不带mtask时报错2
This commit is contained in:
parent
27e4022d9a
commit
d072a01bf8
|
|
@ -107,8 +107,8 @@ class MlogSerializer(CustomModelSerializer):
|
||||||
material_out = validated_data['material_out']
|
material_out = validated_data['material_out']
|
||||||
if not (mgroup and material_out):
|
if not (mgroup and material_out):
|
||||||
raise ValidationError('缺少工段或产物!')
|
raise ValidationError('缺少工段或产物!')
|
||||||
if not WMaterial.objects.filter(batch=batch).exists():
|
if not WMaterial.objects.filter(batch=batch).exists():
|
||||||
raise ValidationError('批次号不存在')
|
raise ValidationError('批次号不存在')
|
||||||
if Mlog.objects.filter(mtask=mtask, batch=batch, handle_date=handle_date, handle_user=handle_user).exists():
|
if Mlog.objects.filter(mtask=mtask, batch=batch, handle_date=handle_date, handle_user=handle_user).exists():
|
||||||
raise ValidationError('存在相同的日志记录')
|
raise ValidationError('存在相同的日志记录')
|
||||||
return super().create(validated_data)
|
return super().create(validated_data)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue