refactor(shipping-line): 统一订单与通知明细项次并移除旧键

This commit is contained in:
hugo committed 2026-09-04 20:46:37 +08:00
1 parent 938f3dd0e8
commit b5d894a923
11 files changed
+331 -302

No files matched your search

@@ -20,7 +20,6 @@ from app.services.shipping_notice.notice_line_values import (
map_notice_header,
norm_header,
normalize_currency,
normalize_line_no,
normalize_required_date,
parse_number,
)
@@ -201,10 +200,6 @@ def normalize_notice_line(
if raw_uom and field_enabled("uom"):
line["uom"] = raw_uom
line_no = normalize_line_no(raw.get("line_no"))
if line_no and field_enabled("line_no"):
line["line_no"] = line_no
reservation_id = extract_reservation_id(raw.get("reservation_id"))
if reservation_id and field_enabled("reservation_id"):
line["reservation_id"] = reservation_id
@@ -217,9 +212,10 @@ def normalize_notice_line(
line["unit_price"] = unit_price
amount = parse_number(raw.get("amount"))
if amount is not None and field_enabled("amount"):
# Schema 使用 canonical line_amount_with_tax;内部通知行仍保留 amount 键供下游消费。
if amount is not None and field_enabled("line_amount_with_tax"):
line["amount"] = amount
elif unit_price is not None and field_enabled("amount"):
elif unit_price is not None and field_enabled("line_amount_with_tax"):
line["amount"] = round(unit_price * qty, 4)
currency = normalize_currency(raw.get("currency"))