feat(shipping-notice): 新增货代客户管理功能,支持客户导入、识别证据管理与客户确认

This commit is contained in:
hugo committed 2026-07-16 08:16:19 +08:00
1 parent b595e157e9
commit 4fbaed2b4c
176 files changed
+14011 -994

No files matched your search

@@ -8,7 +8,6 @@ services/shipping_notice/notice_lines.py
from __future__ import annotations
import re
from typing import Any
from app.services.shipping_notice.notice_line_constants import (
@@ -46,13 +45,6 @@ _map_notice_header = map_notice_header
_parse_number = parse_number
def derive_hub_code(source_type: Any) -> str:
"""从已知库存来源提示中派生 Hub Code,如 VMI-FRA01→FRA01、DBS DUB→DUB。"""
text = re.sub(r"\s+", " ", str(source_type or "").strip().upper())
match = re.fullmatch(r"(?:VMI|DBS)[\s_-]+([A-Z0-9]+)", text)
return match.group(1) if match else ""
def normalize_notice_line(raw: dict[str, Any] | None) -> dict[str, Any] | None:
"""
标准化单条发货通知订单行。
@@ -153,20 +145,23 @@ def normalize_notice_line(raw: dict[str, Any] | None) -> dict[str, Any] | None:
optional_aliases = {
"po_number": ("po_number", "poNumber", "PO", "PO Number"),
"allocation_id": ("allocation_id", "allocationId", "Allocation ID"),
"source_type": ("source_type", "sourceType", "Source Type"),
"source_type": (
"source_type",
"sourceType",
"Source Type",
"hub_code",
"hubCode",
"Hub Code",
"Hub",
"HUB",
),
"customer_sku": ("customer_sku", "customerSku", "allocated_hhpn", "Allocated HHPN"),
"hub_code": ("hub_code", "hubCode", "Hub Code", "Hub", "HUB"),
}
for field, aliases in optional_aliases.items():
value = next((str(raw.get(alias) or "").strip() for alias in aliases if raw.get(alias)), "")
if value:
line[field] = value
if not line.get("hub_code"):
hub_code = derive_hub_code(line.get("source_type"))
if hub_code:
line["hub_code"] = hub_code
remark = str(raw.get("remark") or raw.get("note") or "").strip()
if remark:
line["remark"] = remark
@@ -466,7 +461,6 @@ __all__ = [
"enrich_notice_with_document_currency",
"enrich_notice_with_document_required_date",
"enrich_notice_with_document_reservation",
"derive_hub_code",
"adjudicate_notice_lines",
"normalize_notice_line",
"normalize_notice_lines",