陆运选定线路后,私聊明细补报价有效期,群摘要只用已选线路并不再重复标题。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-23 10:04:07 +08:00
co-authored by Cursor
parent 049ee51c3c
commit 6e3e09a316
5 changed files with 188 additions and 6 deletions
@@ -240,6 +240,116 @@ class LandRouteOptionsTests(unittest.TestCase):
self.assertLess(eta1, od2)
self.assertGreater(eta2, fee2)
self.assertIn("总成本价:CNY 17100", text)
valid = text.find("报价有效期:", text.find("总成本价:"))
self.assertGreater(valid, text.find("总成本价:"))
def test_land_detail_and_group_use_selected_route_valid_until(self) -> None:
"""选定广西这条后:私聊明细和群 TMS 段同一套正文,不摊开没选的线路。"""
from agent.policy import inquiry_copy as copy
raw = {
"source": "TMS",
"source_label": "TMS标准报价",
"isMulti": "2",
"currency": "CNY",
"valid_until": "2026-10-31",
"landSegments": [
{
"segmentSequence": 1,
"routeLegSequence": 1,
"origin": "上海",
"destination": "谅山",
"costPrice": 7500.0,
"currency": "CNY",
"transitDays": "N+2",
},
{
"segmentSequence": 1,
"routeLegSequence": 2,
"origin": "谅山",
"destination": "胡志明",
"costPrice": 9600.0,
"currency": "CNY",
"transitDays": "N+3",
},
{
"segmentSequence": 2,
"routeLegSequence": 1,
"origin": "上海",
"destination": "广西壮族自治区",
"costPrice": 7500.0,
"currency": "CNY",
"transitDays": "N+3",
},
{
"segmentSequence": 2,
"routeLegSequence": 2,
"origin": "广西壮族自治区",
"destination": "胡志明",
"costPrice": 12500.0,
"currency": "CNY",
"transitDays": "N+3",
},
],
"fee_lines": [
{"name": "运输费", "amount": "7500.00", "currency": "CNY"},
{"name": "运输费", "amount": "9600.00", "currency": "CNY"},
{"name": "运输费", "amount": "7500.00", "currency": "CNY"},
{"name": "运输费", "amount": "12500.00", "currency": "CNY"},
],
}
routes = group_land_routes(raw)
projected = project_selected_route(raw, routes[1])
detail = copy.sea_quote_detail_text(
work_order_no="WO202609230003",
quote=projected,
business_line="LAND",
)
self.assertIn("TMS标准报价", detail)
self.assertIn("WO202609230003价格明细", detail)
self.assertIn("上海-广西壮族自治区-胡志明", detail)
self.assertIn("上海 → 广西壮族自治区", detail)
self.assertIn("运输费:CNY 7500.00", detail)
self.assertIn("广西壮族自治区 → 胡志明", detail)
self.assertIn("运输费:CNY 12500.00", detail)
self.assertIn("总成本价:CNY 20000", detail)
self.assertIn("报价有效期:2026-10-31", detail)
self.assertGreater(detail.find("报价有效期:"), detail.find("总成本价:"))
self.assertNotIn("9600", detail)
self.assertNotIn("时效:N+3 / N+3", detail)
brief = copy.sea_group_brief(
work_order_no="WO202609230003",
facts={
"运输类型": "国内运输拼车",
"线路类别": "国内长途/零担",
"运输分类": "急件",
"起运港": "上海",
"目的港": "胡志明",
"品名": "衣服",
"体积": "1",
"毛重": "1",
"报价日期": "2026-09-23",
},
quote=projected,
collab_facts={},
sales_name="销",
product_names=["产"],
has_price=True,
tms_quote=raw,
transport_mode="陆运",
)
tms_block = brief.split("TMS报价:", 1)[1].split("有TMS报价时", 1)[0]
self.assertIn("上海-广西壮族自治区-胡志明", tms_block)
self.assertIn("上海 → 广西壮族自治区", tms_block)
self.assertIn("运输费:CNY 12500.00", tms_block)
self.assertIn("总成本价:CNY 20000", tms_block)
self.assertIn("报价有效期:2026-10-31", tms_block)
self.assertNotIn("TMS标准报价", tms_block)
self.assertNotIn("价格明细", tms_block)
self.assertNotIn("9600", tms_block)
self.assertNotIn("总成本价:-", tms_block)
self.assertNotIn("时效:-", tms_block)
self.assertNotIn("时效:N+3 / N+3", tms_block)
def test_h5_lists_segment_costs(self) -> None:
from agent.channel.h5.land_route_page import render_land_route_page