fix: routeserializer优化routepack process校验3
This commit is contained in:
parent
f5482285f2
commit
313e9ed1cd
|
@ -215,8 +215,9 @@ class RouteSerializer(CustomModelSerializer):
|
|||
def create(self, validated_data):
|
||||
process = validated_data['process']
|
||||
routepack = validated_data.get('routepack', None)
|
||||
if routepack and Route.objects.filter(routepack=routepack, process=process).exists():
|
||||
raise ValidationError('已选择该工序!')
|
||||
if routepack:
|
||||
if Route.objects.filter(routepack=routepack, process=process).exists():
|
||||
raise ValidationError('已选择该工序!')
|
||||
else:
|
||||
material = validated_data.get('material', None)
|
||||
if material and process and Route.objects.filter(material=material, process=process).exists():
|
||||
|
|
Loading…
Reference in New Issue