refactor(shipping-notice): 统一料号字段,移除过时的 SKU 相关字段,更新相关逻辑以支持新字段命名

This commit is contained in:
hugo committed 2026-07-16 20:02:33 +08:00
1 parent dde25344ca
commit 46eb63f5bb
111 files changed
+3116 -1250

No files matched your search

@@ -8,7 +8,7 @@ def test_format_parse_summary_single_line():
ship_to="Wistron Corporation, Czech Republic",
lines=[
{
"sku": "504-010213-001",
"part_number": "504-010213-001",
"reservation_id": "1000140351",
"qty": 9,
"uom": "PCS",
@@ -22,11 +22,11 @@ def test_format_parse_summary_single_line():
assert "【发货通知解析确认】任务编号:SN-20260604-7249E4D7" in msg
assert "| 采购单号 | 16754796 |" in msg
assert "| 预订单号 | 1000140351 |" in msg
assert "| 料号 | 504-010213-001 |" in msg
assert "| 内部料号 | 504-010213-001 |" in msg
po_idx = msg.index("| 采购单号 |")
rid_idx = msg.index("| 预订单号 |")
sku_idx = msg.index("| 料号 |")
assert po_idx < rid_idx < sku_idx
part_idx = msg.index("| 内部料号 |")
assert po_idx < rid_idx < part_idx
assert "| 数量 | 9 PCS |" in msg
assert "| 单价 | $1,607.72 |" in msg
assert "| 金额 | $14,469.48 |" in msg
@@ -41,8 +41,8 @@ def test_format_parse_summary_multiple_lines():
task_no="SN-1",
po_number="PO-1",
lines=[
{"sku": "A", "qty": 1, "reservation_id": "R1"},
{"sku": "B", "qty": 2, "reservation_id": "R2"},
{"part_number": "A", "qty": 1, "reservation_id": "R1"},
{"part_number": "B", "qty": 2, "reservation_id": "R2"},
],
)
assert "【明细 1】" in msg
@@ -53,7 +53,7 @@ def test_format_parse_summary_multiple_lines():
def test_format_parse_summary_includes_warnings():
msg = format_parse_summary(
task_no="SN-1",
lines=[{"sku": "A", "qty": 1}],
lines=[{"part_number": "A", "qty": 1}],
warnings=["订单行未解析到 Reservation ID"],
low_confidence=True,
)