fix: handover需要进行3层校验
This commit is contained in:
parent
31ef257a60
commit
7cca8b7277
|
@ -951,8 +951,18 @@ class HandoverSerializer(CustomModelSerializer):
|
||||||
if 'send_dept' not in attrs and 'send_mgroup' not in attrs:
|
if 'send_dept' not in attrs and 'send_mgroup' not in attrs:
|
||||||
raise ParseError('送料车间和送料工段必须有一个')
|
raise ParseError('送料车间和送料工段必须有一个')
|
||||||
t_count = 0
|
t_count = 0
|
||||||
|
tracking = attrs["material"].tracking
|
||||||
for ind, item in enumerate(attrs['handoverb']):
|
for ind, item in enumerate(attrs['handoverb']):
|
||||||
wm = item["wm"]
|
wm = item["wm"]
|
||||||
|
if tracking == Material.MA_TRACKING_SINGLE:
|
||||||
|
handoverbw = item["handoverbw"]
|
||||||
|
if handoverbw:
|
||||||
|
t_count += len(handoverbw)
|
||||||
|
elif wm.count == item["count"]:
|
||||||
|
t_count += item["count"]
|
||||||
|
else:
|
||||||
|
raise ParseError(f'第{ind+1}行-请提供交接物料明细编号')
|
||||||
|
else:
|
||||||
t_count += item["count"]
|
t_count += item["count"]
|
||||||
# if wm.mgroup and wm.mgroup != attrs['send_mgroup']:
|
# if wm.mgroup and wm.mgroup != attrs['send_mgroup']:
|
||||||
# raise ParseError(f'第{ind+1}物料与交接工段不一致')
|
# raise ParseError(f'第{ind+1}物料与交接工段不一致')
|
||||||
|
@ -970,9 +980,6 @@ class HandoverSerializer(CustomModelSerializer):
|
||||||
recive_mgroup = attrs.get("recive_mgroup", None)
|
recive_mgroup = attrs.get("recive_mgroup", None)
|
||||||
if recive_mgroup is None:
|
if recive_mgroup is None:
|
||||||
raise ParseError('返工交接需指定工段')
|
raise ParseError('返工交接需指定工段')
|
||||||
material:Material = attrs["material"]
|
|
||||||
if material.tracking == Material.MA_TRACKING_SINGLE:
|
|
||||||
attrs["count"] = len(attrs["handoverb"])
|
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
Loading…
Reference in New Issue