feat: handover serializer 优化
This commit is contained in:
parent
bc6406f12b
commit
f51bb48428
|
@ -624,12 +624,14 @@ class HandoverSerializer(CustomModelSerializer):
|
||||||
attrs['batch'] = wm.batch
|
attrs['batch'] = wm.batch
|
||||||
elif handoverb:
|
elif handoverb:
|
||||||
wm: WMaterial = handoverb[0]["wm"]
|
wm: WMaterial = handoverb[0]["wm"]
|
||||||
|
if wm:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
raise ParseError('必须指定车间库存')
|
raise ParseError('必须指定车间库存')
|
||||||
attrs['material'] = wm.material
|
attrs['material'] = wm.material
|
||||||
attrs['send_dept'] = wm.belong_dept
|
attrs['send_dept'] = wm.belong_dept
|
||||||
if handoverb[0]["wm"].mgroup:
|
if wm.mgroup:
|
||||||
attrs['send_mgroup'] = handoverb[0]["wm"].mgroup
|
attrs['send_mgroup'] = wm.mgroup
|
||||||
if attrs['material'].process and attrs['material'].process.into_wm_mgroup and 'recive_mgroup' not in attrs:
|
if attrs['material'].process and attrs['material'].process.into_wm_mgroup and 'recive_mgroup' not in attrs:
|
||||||
raise ValidationError('必须指定交接工段')
|
raise ValidationError('必须指定交接工段')
|
||||||
if 'recive_mgroup' in attrs and attrs['recive_mgroup']:
|
if 'recive_mgroup' in attrs and attrs['recive_mgroup']:
|
||||||
|
@ -642,6 +644,8 @@ class HandoverSerializer(CustomModelSerializer):
|
||||||
for ind, item in enumerate(attrs['handoverb']):
|
for ind, item in enumerate(attrs['handoverb']):
|
||||||
wm = item["wm"]
|
wm = item["wm"]
|
||||||
t_count += item["count"]
|
t_count += item["count"]
|
||||||
|
if wm.mgroup != attrs['send_mgroup']:
|
||||||
|
raise ParseError(f'第{ind+1}物料与交接工段不一致')
|
||||||
if attrs["material"] != wm.material:
|
if attrs["material"] != wm.material:
|
||||||
raise ParseError(f'第{ind+1}物料与交接物料不一致')
|
raise ParseError(f'第{ind+1}物料与交接物料不一致')
|
||||||
if wm.notok_sign is not None and attrs['type'] in [Handover.H_NORMAL, Handover.H_TEST]:
|
if wm.notok_sign is not None and attrs['type'] in [Handover.H_NORMAL, Handover.H_TEST]:
|
||||||
|
|
Loading…
Reference in New Issue