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

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

@ -30,7 +30,8 @@ class ProductInboundService:
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}] 占用,请核查。")
# ============================================================
@ -318,6 +319,7 @@ class ProductInboundService:
items = []
for item in current_items:
# [注意] 因为Model层已经修改了 to_dict 内部的 material -> base所以这里直接调 to_dict 即可
d = item.to_dict()
# 格式化日期