完善空运锁舱与海运报价单单选回填,并增强模板预览与协同字段盖写。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -38,6 +38,64 @@ class FakeBotGroup:
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
class AirSheetQuoteTotalTests(unittest.TestCase):
|
||||
"""群填表报价包必须带 TMS 总销售价,不能把附加费之和当预估费用。"""
|
||||
|
||||
def test_sheet_quote_replaces_fee_sum_total_with_tms_sale_price(self) -> None:
|
||||
from agent.policy.air_group_ops import _sheet_quote_with_tms_sale_total
|
||||
|
||||
thin = {
|
||||
"total": "200",
|
||||
"currency": "CNY",
|
||||
"fee_lines": [
|
||||
{"name": "增点费", "amount": "100", "currency": "CNY"},
|
||||
{"name": "拆板费", "amount": "100", "currency": "USD"},
|
||||
],
|
||||
}
|
||||
tms = {
|
||||
"source": "TMS",
|
||||
"total": "7918.25",
|
||||
"currency": "CNY",
|
||||
"chargeableWeightKg": "833.5",
|
||||
"airOptions": [
|
||||
{
|
||||
"optionNo": "AIR-1",
|
||||
"salePrice": 7918.25,
|
||||
"currency": "CNY",
|
||||
"departureCharges": [
|
||||
{"chargeName": "增点费", "unitPrice": 100, "currency": "CNY"},
|
||||
{"chargeName": "拆板费", "unitPrice": 100, "currency": "USD"},
|
||||
],
|
||||
}
|
||||
],
|
||||
}
|
||||
out = _sheet_quote_with_tms_sale_total(thin, tms=tms, facts={"起运港": "南京", "目的港": "吉隆坡"})
|
||||
self.assertIn("7918.25", str(out.get("total") or ""))
|
||||
self.assertNotEqual(str(out.get("total") or "").strip(), "200")
|
||||
self.assertTrue(out.get("airOptions") or out.get("selected_air_option"))
|
||||
|
||||
def test_sheet_quote_keeps_product_total_when_not_fee_sum(self) -> None:
|
||||
from agent.policy.air_group_ops import _sheet_quote_with_tms_sale_total
|
||||
|
||||
product = {
|
||||
"total": "9000",
|
||||
"currency": "CNY",
|
||||
"source_label": "航线报价",
|
||||
"fee_lines": [
|
||||
{"name": "增点费", "amount": "100", "currency": "CNY"},
|
||||
{"name": "拆板费", "amount": "100", "currency": "USD"},
|
||||
],
|
||||
}
|
||||
tms = {
|
||||
"source": "TMS",
|
||||
"total": "7918.25",
|
||||
"currency": "CNY",
|
||||
"airOptions": [{"optionNo": "AIR-1", "salePrice": 7918.25, "currency": "CNY"}],
|
||||
}
|
||||
out = _sheet_quote_with_tms_sale_total(product, tms=tms, facts={})
|
||||
self.assertEqual(str(out.get("total") or "").strip(), "9000")
|
||||
|
||||
|
||||
class AirGroupCollabTests(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
from agent.redis_coord.air_inbound import reset_air_inbound_for_tests
|
||||
|
||||
Reference in New Issue
Block a user