落地多段联运私聊:齐了才建单拉群,附件只收格子值,核对改正不再整单重开。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -59,6 +59,9 @@ SEA_DISPLAY = {key: label for key, label in SEA_REQUIRED_FIELDS}
|
||||
|
||||
# 陆运销售侧名称:卡片写始发站/货物品名;内部仍用合同键起运港/品名。
|
||||
LAND_DISPLAY = {
|
||||
"运输类型": "运输类型",
|
||||
"线路类别": "线路类别",
|
||||
"运输分类": "运输分类",
|
||||
"起运港": "始发站",
|
||||
"目的港": "目的地",
|
||||
"品名": "货物品名",
|
||||
@@ -208,6 +211,7 @@ _ALIASES = {
|
||||
"货好时间": "货好时间",
|
||||
"提货地址": "提货地址",
|
||||
"收货地址": "收货地址",
|
||||
"送货地址": "收货地址",
|
||||
"贸易条款": "贸易条款",
|
||||
"货源地(非必填)": "货源地",
|
||||
"货好时间(非必填)": "货好时间",
|
||||
@@ -234,6 +238,7 @@ def normalize_facts(facts: dict[str, Any] | None) -> dict[str, str]:
|
||||
out: dict[str, str] = {}
|
||||
for raw_key, raw_val in (facts or {}).items():
|
||||
key = str(raw_key).strip()
|
||||
key = re.sub(r"(必填)|(非必填)|\(必填\)|\(非必填\)", "", key).strip()
|
||||
key = _ALIASES.get(key, key)
|
||||
if raw_val is None:
|
||||
continue
|
||||
@@ -528,6 +533,9 @@ def validate_required_fields(
|
||||
"business_line": line,
|
||||
}
|
||||
if line == "LAND":
|
||||
from agent.schema.land_options import scrub_land_placeholder_ports
|
||||
|
||||
normalized = scrub_land_placeholder_ports(normalized)
|
||||
land_subtype = (land_subtype or "").strip() or str(
|
||||
normalized.get("运输类型") or ""
|
||||
).strip()
|
||||
|
||||
@@ -33,6 +33,26 @@ LAND_CLASSES = (
|
||||
"急件",
|
||||
)
|
||||
|
||||
# 报价单模板码,不能当始发站/目的地。
|
||||
_TEMPLATE_PORT_CODES = frozenset({"DOM", "FTL", "LTL", "INTL"})
|
||||
|
||||
|
||||
def scrub_land_placeholder_ports(facts: dict[str, str] | None) -> dict[str, str]:
|
||||
"""
|
||||
丢掉报价模板里的 DOM/FTL 这类站点码。
|
||||
|
||||
这些不是城市或港口,当已填会让多段误出确定卡。返回新 dict,不改入参。
|
||||
"""
|
||||
out: dict[str, str] = {}
|
||||
for key, raw in dict(facts or {}).items():
|
||||
val = str(raw).strip()
|
||||
if not val:
|
||||
continue
|
||||
if key in {"起运港", "目的港", "始发站", "目的地"} and val.upper() in _TEMPLATE_PORT_CODES:
|
||||
continue
|
||||
out[str(key)] = val
|
||||
return out
|
||||
|
||||
# 填写样例,同时作为拉群门禁:对不上的类型+线路可以查价,但不能拉群。
|
||||
SAMPLE_PAIRS = (
|
||||
("国内运输拼车", "国内长途/零担"),
|
||||
@@ -66,7 +86,9 @@ _ROUTE_ALIASES = (
|
||||
("国内长途/零担", "国内长途/零担"),
|
||||
("中港/中亚/中欧", "中港/中亚/中欧"),
|
||||
("国内城配", "国内城配/拖车/打包"),
|
||||
("国内长途/零担", "国内长途/零担"),
|
||||
("国内长途", "国内长途/零担"),
|
||||
("国内零担", "国内长途/零担"),
|
||||
("东南亚", "东南亚"),
|
||||
)
|
||||
|
||||
|
||||
@@ -54,8 +54,15 @@ def harvest_sea_class(text: str, current: dict[str, str] | None = None) -> dict[
|
||||
kept = canonicalize_sea_class(str(merged.get("运输分类") or ""))
|
||||
if kept:
|
||||
merged["运输分类"] = kept
|
||||
else:
|
||||
merged.pop("运输分类", None)
|
||||
return merged
|
||||
from agent.schema.land_options import canonicalize_land_class
|
||||
|
||||
# 多段陆运补「急件」时,不能按海运名单把已收的陆运分类清掉。
|
||||
land_kept = canonicalize_land_class(str(merged.get("运输分类") or ""))
|
||||
if land_kept:
|
||||
merged["运输分类"] = land_kept
|
||||
return merged
|
||||
merged.pop("运输分类", None)
|
||||
return merged
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user