陆运补问把货物品名放进选项清单,并按销售原文回显已填项。

空着的运输分类不再被菜单第一项认成已填。空运报价改为货物信息加价格方案,锁舱成功回执补起运地、目的地、航司和航班日期。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-14 17:39:54 +08:00
co-authored by Cursor
parent cc8529f569
commit 9ffba70741
21 changed files with 1129 additions and 130 deletions
+78 -36
View File
@@ -465,10 +465,10 @@ def ask_land_fields(
陆运货物缺项补问。不出核对卡、不出现确定句。
已识别和待补充都标明必填/非必填。跨境/中港空着的通关口岸也列进待补充。
报价日期不进待补充。
报价日期不进待补充。货物品名只在前面的选项清单里问,这里不再放进待填框。
"""
src = dict(facts or {})
skip = {"报价日期"}
skip = {"报价日期", "品名"}
missing = [k for k in missing_keys if k and k not in skip]
land_type = (land_subtype or src.get("运输类型") or "").strip()
optional = _land_optional_keys(land_type)
@@ -1220,26 +1220,29 @@ def sea_quote_detail_text(
history_work_order_no: str = "",
status: str = "已报价",
business_line: str = "SEA",
facts: dict[str, str] | None = None,
) -> str:
"""
完整价格明细文本:来源、工单号、费用行、总价。海运/陆运/空运共用。
完整价格明细文本。海运/陆运仍是来源、工单号、费用行、总价。
空运改成货物信息 + 价格方案。航司、计费重、货型和费用来自 TMS,其余用工单字段。
陆运分段时效跟在各段费用后面,用 TMS 原文;报价有效期写在总成本价下面。
海运时效、报价有效期仍只在按钮卡副标题。
空运:业务确认没有时效,总销售价下面只留报价有效期。
不受卡片引用条字数限制。first_or_same 只兼容调用方。
"""
_ = first_or_same, history_work_order_no, status
src = dict(quote or {})
source = str(src.get("source_label") or "TMS标准报价").replace(" ", "")
lines = [source, f"{work_order_no}价格明细"]
line = (business_line or "").upper()
if line == "AIR":
from agent.schema.air_route_options import route_codes
from agent.policy.air_quote_copy import air_private_quote_text
route = route_codes(None, {}, src)
if route:
lines.append(route)
return air_private_quote_text(
work_order_no=work_order_no,
facts=facts,
quote=src,
)
source = str(src.get("source_label") or "TMS标准报价").replace(" ", "")
lines = [source, f"{work_order_no}价格明细"]
if line == "LAND":
from agent.schema.land_route_options import land_leg_fee_blocks
@@ -1250,8 +1253,8 @@ def sea_quote_detail_text(
if land_line and len(blocks) != 1:
lines.append(land_line)
lines.append(quote_area_fee_text(src, business_line=business_line or "SEA"))
# 空运、陆运的价格明细正文都要带有效期。海运仍放在按钮卡副标题,避免和原口径打架。
if line in {"AIR", "LAND"}:
# 陆运价格明细正文带有效期。海运仍放在按钮卡副标题。空运已在上面单独成文。
if line == "LAND":
lines.append(f"报价有效期:{tms_valid_until_display(src)}")
return "\n".join(lines)
@@ -3011,12 +3014,12 @@ def air_group_brief(
airline_names: list[str] | None = None,
) -> str:
"""
空运群激活摘要:与海运进群同一套结构,字段用空运。
空运群激活摘要。
先 @ 销售和航线,再工单号 + 询价字段 + 协同补充(含电/含磁)+ TMS报价。
TMS 段跟单聊同一套线路分项,总销售价只一行。
已有运输费等分项时,不再叠一行「空运费=总价」;只有空运费这一项时要写出来。
不写「当前工单/询价要点/现在等到哪一步」。
有 TMS 报价:货物信息(含航司、计费重、货型)+ 协同补充 + 新价格段。
没有 TMS 报价:仍是「询价字段」+「TMS 暂无匹配报价」。
品名正好是普货且没人补过时,含电含磁仍写「否」。
人工报价、销售调价有则接在后面,写法不改。
"""
no = (work_order_no or "").strip()
at_bits: list[str] = []
@@ -3027,10 +3030,28 @@ def air_group_brief(
token = f"@{(name or '').strip()}"
if (name or "").strip() and token not in at_bits:
at_bits.append(token)
lines = ([(" ".join(at_bits))] if at_bits else []) + [f"工单号:{no}", "询价字段:"]
lines.extend(
inquiry_field_lines(work_order_no=no, facts=facts, transport_mode="空运")[1:]
tms, manual, adjust = _split_brief_quotes(
quote=quote,
tms_quote=tms_quote,
product_quote=product_quote,
has_price=has_price,
)
if tms:
from agent.schema.air_route_options import project_group_air_quote
tms = project_group_air_quote(tms, facts)
has_tms_price = bool(tms and (tms.get("total") or quote_fee_lines(tms)))
if has_tms_price:
# 有 TMS 报价才换成货物信息。没报价仍走下面的「询价字段」。
from agent.policy.air_quote_copy import air_cargo_lines
lines = ([(" ".join(at_bits))] if at_bits else [])
lines.extend(air_cargo_lines(work_order_no=no, facts=facts, quote=tms))
else:
lines = ([(" ".join(at_bits))] if at_bits else []) + [f"工单号:{no}", "询价字段:"]
lines.extend(
inquiry_field_lines(work_order_no=no, facts=facts, transport_mode="空运")[1:]
)
lines.append("")
lines.append("协同补充字段:")
collab = dict(collab_facts or {})
@@ -3046,20 +3067,12 @@ def air_group_brief(
if val in {"", "-", "—", "-"}:
val = "-"
lines.append(f"{key}:{val}")
tms, manual, adjust = _split_brief_quotes(
quote=quote,
tms_quote=tms_quote,
product_quote=product_quote,
has_price=has_price,
)
if tms:
from agent.schema.air_route_options import project_group_air_quote
tms = project_group_air_quote(tms, facts)
lines.append("")
lines.append("TMS报价:")
if tms and (tms.get("total") or quote_fee_lines(tms)):
lines.extend(quote_detail_lines(tms, business_line="AIR"))
if has_tms_price:
from agent.policy.air_quote_copy import air_price_lines
lines.extend(air_price_lines(tms, facts))
lines.append(group_tms_confirm_hint(business_line="AIR"))
else:
lines.append("TMS 暂无匹配报价")
@@ -3235,16 +3248,37 @@ def air_lock_ok(
option_no: str,
exec_no: str,
quote_no: str,
origin: str = "",
destination: str = "",
airline: str = "",
flight_date: str = "",
) -> str:
"""空运锁舱成功。后台 inquiring.air_lock_ok。"""
"""
空运锁舱成功。后台 inquiring.air_lock_ok。
回执在报价编号下补起运地、目的地、航司、航班日期。
后台旧模板没有这四行时,这里补上,避免被旧句盖掉。
不编造空值;没取到就留空。
"""
origin_text = (origin or "").strip()
destination_text = (destination or "").strip()
airline_text = (airline or "").strip()
flight_text = (flight_date or "").strip()
route = (
f"起运地:{origin_text}\n"
f"目的地:{destination_text}\n"
f"航司:{airline_text}\n"
f"航班日期:{flight_text}"
)
default = (
f"工单{work_order_no} 已通知TMS执行空运锁舱,执行成功。\n"
"TMS空运锁舱成功。\n"
f"操作人:{operator}\n"
f"舱位选项:{option_no}\n"
f"执行编号:{exec_no}\n"
f"报价编号:{quote_no}"
f"报价编号:{quote_no}\n"
f"{route}"
)
return _r(
text = _r(
"inquiring.air_lock_ok",
default,
ticket_no=work_order_no,
@@ -3252,7 +3286,15 @@ def air_lock_ok(
option_no=option_no,
exec_no=exec_no,
quote_no=quote_no,
origin=origin_text,
destination=destination_text,
airline=airline_text,
flight_date=flight_text,
)
body = (text or "").rstrip()
if "起运地:" in body and "航班日期:" in body:
return body
return f"{body}\n{route}" if body else route
# 多段里有空运段时,航线锁舱的失败原因。产品暂不支持,不当 TMS 故障。