feat: 海运有价卡按三段费用带小计展示

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-20 17:50:46 +08:00
co-authored by Cursor
parent 79caddef0e
commit 698ac43878
4 changed files with 135 additions and 2 deletions
@@ -382,6 +382,33 @@ class SeaTmsCardTests(unittest.TestCase):
self.assertNotIn("运输分类", ready["tms_facts"])
self.assertEqual(ready["facts"]["运输分类"], "Port to Port")
def test_sea_quote_text_uses_three_buckets(self) -> None:
quote = {
"total": "6952.77",
"currency": "CNY",
"source_label": "TMS 标准报价",
"polCostItems": [
{"name": "操作费", "amount": "1020", "currency": "CNY"},
{"name": "舱单", "amount": "50", "currency": "CNY"},
],
"oceanCostItems": [{"name": "海运费", "amount": "575", "currency": "USD"}],
"podCostItems": [
{"name": "文件费", "amount": "450", "currency": "CNY"},
{"name": "设备费", "amount": "30", "currency": "CNY"},
],
"fee_total_polCostItems": "1070",
"fee_total_oceanCostItems": "4038",
"fee_total_podCostItems": "470",
}
text = copy.sea_quote_detail_text(work_order_no="WO202609200002", quote=quote)
self.assertIn("始发港费用\n操作费:CNY 1020", text)
self.assertIn("始发港费用小计:CNY 1070", text)
self.assertIn("海运费:USD 575", text)
self.assertIn("海运费小计:CNY 4038", text)
self.assertIn("目的港费用小计:CNY 470", text)
self.assertIn("总成本价:CNY 6952.77", text)
self.assertNotIn("时效", text)
def test_long_fee_lines_go_to_text_not_clipped_card(self) -> None:
"""海运多项费用:完整明细必须在文本里,卡片引用条不得半截。"""
long_quote = {