feat: handover_submit增强校验

This commit is contained in:
caoqianming 2025-09-09 15:39:13 +08:00
parent bc555b7bea
commit 6d09e5e4f3
2 changed files with 3 additions and 0 deletions

View File

@ -1273,6 +1273,7 @@ class HandoverSerializer(CustomModelSerializer):
if tracking == Material.MA_TRACKING_SINGLE:
handoverbw = item.get("handoverbw", [])
if handoverbw:
item["count"] = len(handoverbw)
t_count += len(handoverbw)
elif wm.count == item["count"]:
t_count += item["count"]

View File

@ -929,6 +929,8 @@ def handover_submit(handover:Handover, user: User, now: Union[datetime.datetime,
for item in handoverbws:
wpr:Wpr = item.wpr
Wpr.change_or_new(wpr=wpr, wm=wm_to, old_wm=wpr.wm, old_mb=wpr.mb)
if wm_to.count != Wpr.objects.filter(wm=wm_to).count():
raise ParseError("交接与明细数量不一致2,操作失败")
handover.submit_user = user
handover.submit_time = now