refactor(business): 编辑出参取校验返回值省重查,submit_change 批量预载
- update_receipt 取 _ensure_shipment_of_business 返回值组装出参 (shipment_id 已赋为 payload 新值,与 get_with_refs 重查同源), 省一次三表 join;update_shipment 同理取锁定行的 business_no - 删 business_repository.count_items(无任何调用的死代码,删除保护 实际走 has_docs) - submit_change 校验段定义与岗位各一条 IN 批量预载(逐条查询在批次 扩大时是写侧 N+1);岗位字典键 casefold 归一保持与单条版 ci 校对 等价的命中语义;旧值留痕保持逐条(窗口函数优化留待 M3 一并设计) Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
1 parent
5ef48abf47
commit
409e26614f
6 files changed
+57
-19
No files matched your search
@@ -317,7 +317,8 @@ def update_shipment(
|
||||
total = shipment_repository.sum_item_amount(session, shipment_id)
|
||||
shipment.total_amount = total if total is not None else Decimal("0")
|
||||
_recalc_totals(session, business)
|
||||
out = _to_out(shipment_repository.get_with_business_no(session, shipment_id))
|
||||
# business_id 创建时定死不可改挂,锁定的 business.business_no 与重查同源
|
||||
out = _to_out((shipment, business.business_no))
|
||||
shipment_no = shipment.shipment_no
|
||||
session.commit()
|
||||
# commit 后不再触碰 ORM 属性(audit_service 约定):单号已固化
|
||||
|
||||
Reference in new issue
Block a user