fix: routeserializer优化routepack process校验2
This commit is contained in:
parent
757bf89d71
commit
f5482285f2
|
|
@ -216,11 +216,11 @@ class RouteSerializer(CustomModelSerializer):
|
||||||
process = validated_data['process']
|
process = validated_data['process']
|
||||||
routepack = validated_data.get('routepack', None)
|
routepack = validated_data.get('routepack', None)
|
||||||
if routepack and Route.objects.filter(routepack=routepack, process=process).exists():
|
if routepack and Route.objects.filter(routepack=routepack, process=process).exists():
|
||||||
raise ValidationError('已选择该工序')
|
raise ValidationError('已选择该工序!')
|
||||||
else:
|
else:
|
||||||
material = validated_data.get('material', None)
|
material = validated_data.get('material', None)
|
||||||
if material and process and Route.objects.filter(material=material, process=process).exists():
|
if material and process and Route.objects.filter(material=material, process=process).exists():
|
||||||
raise ValidationError('已选择该工序')
|
raise ValidationError('已选择该工序!!')
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
instance = super().create(validated_data)
|
instance = super().create(validated_data)
|
||||||
material_out = instance.material_out
|
material_out = instance.material_out
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue