陆运多条线路按段展示 TMS 费用名和时效,选定后再写回该条成本。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -171,6 +171,129 @@ class AirGroupCollabTests(unittest.TestCase):
|
||||
self.assertNotIn("当前工单:", text)
|
||||
self.assertNotIn("贸易条款", text)
|
||||
|
||||
def test_air_group_brief_tms_total_only_once(self) -> None:
|
||||
"""群摘要 TMS 段总销售价只一行,禁止重复。"""
|
||||
tms = {
|
||||
"source": "TMS",
|
||||
"source_label": "TMS标准报价",
|
||||
"total": "183370.0",
|
||||
"currency": "CNY",
|
||||
"eta": "-",
|
||||
"valid_until": "2026-09-30",
|
||||
"fee_lines": [
|
||||
{"name": "运输费", "amount": "11.0", "currency": "CNY"},
|
||||
],
|
||||
}
|
||||
text = copy.air_group_brief(
|
||||
work_order_no="WO202609220018",
|
||||
facts={"起运港": "珠海", "目的港": "克拉克"},
|
||||
quote=tms,
|
||||
collab_facts={},
|
||||
has_price=True,
|
||||
tms_quote=tms,
|
||||
)
|
||||
tms_block = text.split("TMS报价:", 1)[1]
|
||||
self.assertEqual(tms_block.count("总销售价:"), 1)
|
||||
self.assertIn("总销售价:CNY 183370.0", tms_block)
|
||||
self.assertNotIn("时效", tms_block)
|
||||
self.assertIn("报价有效期:2026-09-30", tms_block)
|
||||
|
||||
def test_air_group_brief_uses_route_fees_not_air_freight_total(self) -> None:
|
||||
"""
|
||||
群摘要必须跟单聊同一套线路分项。
|
||||
主账快照若只有「空运费=总价」,仍要列出该线路运输费/提送货费/人工费。
|
||||
"""
|
||||
tms = {
|
||||
"source": "TMS",
|
||||
"source_label": "TMS标准报价",
|
||||
"total": "183370.0",
|
||||
"freight": "183370.0",
|
||||
"currency": "CNY",
|
||||
"eta": "-",
|
||||
"valid_until": "2026-09-30",
|
||||
"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},
|
||||
],
|
||||
}
|
||||
],
|
||||
}
|
||||
text = copy.air_group_brief(
|
||||
work_order_no="WO202609220018",
|
||||
facts={"起运港": "珠海", "目的港": "克拉克", "originCode": "ZUH"},
|
||||
quote=tms,
|
||||
collab_facts={},
|
||||
has_price=True,
|
||||
tms_quote=tms,
|
||||
)
|
||||
tms_block = text.split("TMS报价:", 1)[1]
|
||||
self.assertIn("运输费:CNY 11.0", tms_block)
|
||||
self.assertIn("提送货费:CNY 6.0", tms_block)
|
||||
self.assertIn("人工费:CNY 123.0", tms_block)
|
||||
self.assertIn("总销售价:CNY 183370", tms_block)
|
||||
self.assertEqual(tms_block.count("总销售价:"), 1)
|
||||
self.assertNotIn("空运费", tms_block)
|
||||
|
||||
def test_air_group_brief_multi_route_does_not_borrow_other_air_freight(self) -> None:
|
||||
"""多条线路:只出对上起运港那条的分项,禁止套整单空运费或另一条的运输费。"""
|
||||
tms = {
|
||||
"source": "TMS",
|
||||
"total": "200040",
|
||||
"freight": "183370.00",
|
||||
"currency": "CNY",
|
||||
"valid_until": "2026-09-30",
|
||||
"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},
|
||||
],
|
||||
},
|
||||
{
|
||||
"originAirportCode": "SZX",
|
||||
"destinationAirportCode": "CRK",
|
||||
"salePrice": 200040,
|
||||
"currency": "CNY",
|
||||
"departureCharges": [],
|
||||
},
|
||||
],
|
||||
}
|
||||
text = copy.air_group_brief(
|
||||
work_order_no="WO202609220018",
|
||||
facts={"起运港": "深圳", "目的港": "克拉克", "originCode": "SZX"},
|
||||
quote=tms,
|
||||
collab_facts={},
|
||||
has_price=True,
|
||||
tms_quote=tms,
|
||||
)
|
||||
tms_block = text.split("TMS报价:", 1)[1]
|
||||
self.assertNotIn("空运费", tms_block)
|
||||
self.assertNotIn("运输费", tms_block)
|
||||
self.assertIn("总销售价:CNY 200040", tms_block)
|
||||
self.assertEqual(tms_block.count("总销售价:"), 1)
|
||||
|
||||
def test_work_order_only_is_activate_not_quote(self) -> None:
|
||||
from agent.routing.air_group_intent import INTENT_ACTIVATE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user