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