feat: 添加物料明细与批次不匹配的校验

This commit is contained in:
caoqianming 2025-09-09 16:38:58 +08:00
parent d84b8e94fd
commit df4b062209
1 changed files with 7 additions and 0 deletions

View File

@ -1275,6 +1275,13 @@ class HandoverSerializer(CustomModelSerializer):
if handoverbw:
item["count"] = len(handoverbw)
t_count += len(handoverbw)
wprIds = [i["wpr"].id for i in handoverbw]
wm_ids = Wpr.objects.filter(id__in=wprIds).values_list("wm_id", flat=True)
if len(wm_ids) == 1 and wm_ids[0] == wm.id:
pass
else:
raise ParseError(f'{ind+1}行-物料明细与批次不匹配')
elif wm.count == item["count"]:
t_count += item["count"]
else: