feat: 优化mloginit报错提示
This commit is contained in:
parent
77a50ae162
commit
622d594795
|
@ -498,8 +498,10 @@ class MlogInitSerializer(CustomModelSerializer):
|
||||||
mtype = attrs['mtype']
|
mtype = attrs['mtype']
|
||||||
route: Route = attrs['route']
|
route: Route = attrs['route']
|
||||||
mgroup: Mgroup = attrs['mgroup']
|
mgroup: Mgroup = attrs['mgroup']
|
||||||
|
if route is None:
|
||||||
|
raise ParseError('缺少工艺路线')
|
||||||
if route.process != mgroup.process:
|
if route.process != mgroup.process:
|
||||||
raise ValidationError('工序不匹配')
|
raise ParseError('工序不匹配')
|
||||||
attrs['hour_work'] = route.hour_work
|
attrs['hour_work'] = route.hour_work
|
||||||
attrs['material_in'] = route.material_in
|
attrs['material_in'] = route.material_in
|
||||||
attrs['material_out'] = route.material_out
|
attrs['material_out'] = route.material_out
|
||||||
|
@ -507,7 +509,7 @@ class MlogInitSerializer(CustomModelSerializer):
|
||||||
if mtype == Mlog.MTYPE_OUT:
|
if mtype == Mlog.MTYPE_OUT:
|
||||||
supplier = attrs.get('supplier', None)
|
supplier = attrs.get('supplier', None)
|
||||||
if not supplier:
|
if not supplier:
|
||||||
raise ValidationError('外协必须选择外协单位')
|
raise ParseError('外协必须选择外协单位')
|
||||||
if attrs.get('work_end_time', None):
|
if attrs.get('work_end_time', None):
|
||||||
attrs['handle_date'] = localdate(attrs['work_end_time'])
|
attrs['handle_date'] = localdate(attrs['work_end_time'])
|
||||||
return attrs
|
return attrs
|
||||||
|
|
Loading…
Reference in New Issue