feat(shipping-notice): 收敛订单处理状态与履约门禁
This commit is contained in:
1 parent
bffcd55b40
commit
70dd0051b8
153 files changed
+10916
-4296
No files matched your search
@@ -15,7 +15,7 @@ def _norm(value: Any) -> str:
|
||||
return str(value or "").strip()
|
||||
|
||||
|
||||
def _line_key(row: dict[str, Any], fields: list[str]) -> tuple[str, ...] | None:
|
||||
def _match_identity(row: dict[str, Any], fields: list[str]) -> tuple[str, ...] | None:
|
||||
"""按配置字段列表构造确定性匹配键;任一字段为空时该行不可匹配。"""
|
||||
values = tuple(_norm(row.get(field)).casefold() for field in fields)
|
||||
return values if values and all(values) else None
|
||||
@@ -27,7 +27,7 @@ def _aggregate_inventory(
|
||||
"""按用户配置的库存匹配字段组合汇总唯一数量字段。"""
|
||||
totals: dict[tuple[str, ...], float] = {}
|
||||
for row in inventory_lines:
|
||||
key = _line_key(row, match_fields)
|
||||
key = _match_identity(row, match_fields)
|
||||
if key is None:
|
||||
continue
|
||||
try:
|
||||
@@ -70,7 +70,7 @@ def match_notice_lines(
|
||||
# [STEP 2] 逐订单行计算 ok/partial/shortage 并收集缺口明细。
|
||||
total_lines = len(notice_lines)
|
||||
for index, line in enumerate(notice_lines, start=1):
|
||||
order_key = _line_key(line, order_fields)
|
||||
order_key = _match_identity(line, order_fields)
|
||||
try:
|
||||
required = float(line.get("__required_qty") or 0)
|
||||
except (TypeError, ValueError):
|
||||
|
||||
Reference in new issue
Block a user