fix: mloginit在返工时不接收route
This commit is contained in:
parent
000ea6fc27
commit
6033216869
|
@ -628,21 +628,20 @@ class MlogInitSerializer(CustomModelSerializer):
|
|||
}
|
||||
|
||||
def validate(self, attrs):
|
||||
route: Route = attrs.get('route', None)
|
||||
mgroup: Mgroup = attrs['mgroup']
|
||||
is_fix:bool = attrs.get('is_fix', False)
|
||||
attrs['mtype'] = mgroup.mtype
|
||||
if is_fix:
|
||||
attrs["route"] = None
|
||||
elif route is None:
|
||||
raise ParseError('缺少工艺路线')
|
||||
if route and route.process != mgroup.process:
|
||||
raise ParseError('工序不匹配')
|
||||
if is_fix:
|
||||
attrs['hour_work'] = None
|
||||
attrs['material_in'] = None
|
||||
attrs['material_out'] = None
|
||||
if route:
|
||||
else:
|
||||
route: Route = attrs.get('route', None)
|
||||
if not route:
|
||||
raise ParseError('缺少工艺路线')
|
||||
if route and route.process != mgroup.process:
|
||||
raise ParseError('工序不匹配')
|
||||
attrs['hour_work'] = route.hour_work
|
||||
attrs['material_in'] = route.material_in
|
||||
attrs['material_out'] = route.material_out
|
||||
|
|
Loading…
Reference in New Issue