陆运多条线路按段展示 TMS 费用名和时效,选定后再写回该条成本。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-22 18:28:29 +08:00
co-authored by Cursor
parent e769eb9c1d
commit 49faa35f47
23 changed files with 2323 additions and 55 deletions
@@ -22,6 +22,7 @@ from agent.schema.air_route_options import (
needs_route_pick,
option_fee_lines,
parse_air_options,
project_group_air_quote,
project_selected_quote,
route_codes,
route_line,
@@ -220,6 +221,73 @@ class AirRouteOptionsTests(unittest.TestCase):
self.assertIn("总销售价", detail)
self.assertIn("200040", detail)
def test_group_air_quote_projects_route_fees_and_drops_total_alias(self) -> None:
"""群摘要投影:该线路分项留下,空运费=总价丢掉。"""
quote = {
"total": "183370.0",
"freight": "183370.0",
"currency": "CNY",
"fee_lines": [
{"name": "空运费", "amount": "183370.00", "currency": "CNY"},
],
"airOptions": [
{
"originAirportCode": "ZUH",
"transferAirportCode": "CHG",
"destinationAirportCode": "CRK",
"salePrice": 183370,
"currency": "CNY",
"departureCharges": [
{"chargeName": "运输费", "currency": "CNY", "unitPrice": 11.0},
{"chargeName": "提送货费", "currency": "CNY", "unitPrice": 6.0},
{"chargeName": "人工费", "currency": "CNY", "unitPrice": 123.0},
],
}
],
}
projected = project_group_air_quote(quote, {"originCode": "ZUH"})
names = [str(x.get("name") or "") for x in (projected.get("fee_lines") or [])]
self.assertEqual(names, ["运输费", "提送货费", "人工费"])
self.assertNotIn("空运费", names)
self.assertEqual(copy.quote_fee_lines(projected)[0][0], "运输费")
def test_air_detail_text_hides_eta_keeps_valid_until(self) -> None:
"""空运没有时效;价格明细只留报价有效期。"""
text = copy.sea_quote_detail_text(
work_order_no="WO202609220013",
quote={
"source_label": "TMS标准报价",
"selected_air_option": {
"originAirportCode": "NKG",
"destinationAirportCode": "KUL",
},
"fee_lines": [
{"name": "增点费", "amount": "100.0", "currency": "CNY"},
{"name": "拆板费", "amount": "100.0", "currency": "USD"},
],
"total": "5001.0",
"currency": "CNY",
"eta": "3天",
"valid_until": "2026-09-30",
},
business_line="AIR",
)
self.assertEqual(
text,
"\n".join(
[
"TMS标准报价",
"WO202609220013价格明细",
"NKG-KUL",
"增点费:CNY 100.0",
"拆板费:USD 100.0",
"总销售价:CNY 5001.0",
"报价有效期:2026-09-30",
]
),
)
self.assertNotIn("时效", text)
def test_h5_page_lists_route_and_fees(self) -> None:
from agent.channel.h5.air_route_page import render_air_route_page
from agent.channel.h5.air_route_store import build_air_route_url