角色业务范围收紧工单与模板;报价日期不当费用;未选舱不迁已报价;另开一票可清违禁 hold

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
linmianxun
2026-10-15 21:00:01 +08:00
co-authored by Cursor
parent a0c705683f
commit 277cdc1c28
39 changed files with 2083 additions and 217 deletions
@@ -202,15 +202,27 @@ def assemble_air_query(facts: dict[str, Any] | None) -> dict[str, Any]:
包装只看销售是否说了,散货等原文原样保留。
"""
src = dict(facts or {})
# 摘要占位「-」当空:不能拿去 resolve 机场,否则 TMS 回 1003 起飞机场无法匹配。
_dash = frozenset({"-", "—", "-"})
origin = str(src.get("起运港") or src.get("起运地") or "").strip()
if origin in _dash:
origin = ""
dest = str(src.get("目的港") or "").strip()
if dest in _dash:
dest = ""
cargo = str(src.get("品名") or "").strip()
if cargo in _dash:
cargo = ""
pieces = _first_number(str(src.get("件数") or ""))
weight = _first_number(str(src.get("毛重") or ""))
volume = volume_cbm_number(str(src.get("体积") or ""))
pack_raw = str(src.get("包装方式") or src.get("包装类型") or "").strip()
if pack_raw in _dash:
pack_raw = ""
pack_code = resolve_package_type(pack_raw)
quote_date = str(src.get("报价日期") or "").strip()
if quote_date in _dash:
quote_date = ""
# 三字码必须按当前地名重算,禁止沿用上一句的 NKG/KUL
origin_code = resolve_airport_code(origin)
dest_code = resolve_airport_code(dest)
@@ -240,6 +252,10 @@ def assemble_air_query(facts: dict[str, Any] | None) -> dict[str, Any]:
ok = not missing
out_facts = dict(src)
# 横杠占位从出站 facts 清掉,避免建单把「-」写入起运港列。
for _k in ("起运港", "起运地"):
if str(out_facts.get(_k) or "").strip() in _dash:
out_facts.pop(_k, None)
if origin:
out_facts["起运港"] = origin
if origin_code:
@@ -247,6 +263,8 @@ def assemble_air_query(facts: dict[str, Any] | None) -> dict[str, Any]:
else:
out_facts.pop("originCode", None)
else:
out_facts.pop("起运港", None)
out_facts.pop("起运地", None)
out_facts.pop("originCode", None)
if dest:
out_facts["目的港"] = dest