修复出库时候找不到名称等问题

This commit is contained in:
dxc
2026-02-10 11:13:07 +08:00
parent bccbeaadce
commit e876505a1b
7 changed files with 49 additions and 40 deletions

View File

@ -32,7 +32,8 @@ class SemiInboundService:
exists = query.first()
if exists:
occupied_name = exists.material.name if (hasattr(exists, 'material') and exists.material) else "未知物料"
# [修改] material -> base
occupied_name = exists.base.name if (hasattr(exists, 'base') and exists.base) else "未知物料"
raise ValueError(f"序列号【{serial_number}】已存在!被半成品 [{occupied_name}] 占用,请核查。")
# 2. 批号 (BN) 校验 - 同物料下不能重复开单
@ -420,6 +421,7 @@ class SemiInboundService:
items = []
for item in current_items:
# [注意] 因为Model层已经修改了 to_dict 内部的 material -> base所以这里直接调 to_dict 即可
d = item.to_dict()
# 格式化展示日期