落地陆运私聊文字询价:选项核对后再建单查价,并按线路拉产品进群。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
"""
|
||||
陆运 TMS 出站拼参:分类和中港装载方式不得带出。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
||||
if ROOT not in sys.path:
|
||||
sys.path.insert(0, ROOT)
|
||||
|
||||
from agent.schema.tms_land_query import assemble_land_query
|
||||
|
||||
|
||||
class TmsLandQueryTest(unittest.TestCase):
|
||||
def test_outbound_omits_class_and_hk_load(self):
|
||||
facts = {
|
||||
"运输类型": "中港",
|
||||
"线路类别": "东南亚",
|
||||
"运输分类": "急件",
|
||||
"中港装载方式": "零担/集拼",
|
||||
"起运港": "广州",
|
||||
"目的港": "香港",
|
||||
"品名": "衣服",
|
||||
"车型/数量": "9米6/1",
|
||||
"通关口岸": "皇岗",
|
||||
}
|
||||
got = assemble_land_query(facts)
|
||||
self.assertTrue(got["ok"])
|
||||
out = got["outbound"]
|
||||
self.assertEqual(out["landTransportType"], "CHINA_HK")
|
||||
self.assertEqual(out["routeCategory"], "SOUTHEAST_ASIA")
|
||||
self.assertNotIn("landRouteCategory", out)
|
||||
self.assertEqual(out["vehicleType"], "9米6")
|
||||
self.assertEqual(str(out["quantity"]), "1")
|
||||
self.assertEqual(out["customsPort"], "皇岗")
|
||||
self.assertNotIn("运输分类", out)
|
||||
self.assertNotIn("landClass", out)
|
||||
self.assertNotIn("hkLoadType", out)
|
||||
self.assertNotIn("中港装载方式", out)
|
||||
|
||||
def test_hk_full_truck_omits_vehicle(self):
|
||||
facts = {
|
||||
"运输类型": "中港",
|
||||
"线路类别": "东南亚",
|
||||
"中港装载方式": "整车",
|
||||
"起运港": "广州",
|
||||
"目的港": "香港",
|
||||
"品名": "衣服",
|
||||
}
|
||||
got = assemble_land_query(facts)
|
||||
self.assertTrue(got["ok"])
|
||||
out = got["outbound"]
|
||||
self.assertNotIn("vehicleType", out)
|
||||
self.assertNotIn("quantity", out)
|
||||
|
||||
def test_domestic_ftl_splits_combo(self):
|
||||
facts = {
|
||||
"运输类型": "国内运输整车",
|
||||
"线路类别": "国内长途/零担",
|
||||
"起运港": "广州",
|
||||
"目的港": "深圳",
|
||||
"品名": "衣服",
|
||||
"车型/数量": "9米6*2",
|
||||
}
|
||||
out = assemble_land_query(facts)["outbound"]
|
||||
self.assertEqual(out["vehicleType"], "9米6")
|
||||
self.assertEqual(out["quantity"], "2")
|
||||
|
||||
def test_domestic_has_no_customs(self):
|
||||
facts = {
|
||||
"运输类型": "国内运输拼车",
|
||||
"线路类别": "国内长途/零担",
|
||||
"起运港": "广州",
|
||||
"目的港": "深圳",
|
||||
"品名": "衣服",
|
||||
"体积": "100CBM",
|
||||
"毛重": "50kg",
|
||||
}
|
||||
out = assemble_land_query(facts)["outbound"]
|
||||
self.assertNotIn("customsPort", out)
|
||||
self.assertIn("volumeCbm", out)
|
||||
self.assertEqual(out["landTransportType"], "DOMESTIC_LTL")
|
||||
self.assertEqual(out["routeCategory"], "DOMESTIC_LONG_LTL")
|
||||
|
||||
def test_wo011_pinche_city_dist_uses_tms_enums(self):
|
||||
facts = {
|
||||
"运输类型": "国内运输拼车",
|
||||
"线路类别": "国内城配/拖车/打包",
|
||||
"起运港": "泉州市",
|
||||
"目的港": "南京市",
|
||||
"品名": "通信机柜及线缆配件",
|
||||
"体积": "10CBM",
|
||||
"毛重": "10KG",
|
||||
}
|
||||
got = assemble_land_query(facts)
|
||||
self.assertTrue(got["ok"])
|
||||
out = got["outbound"]
|
||||
self.assertEqual(out["landTransportType"], "DOMESTIC_LTL")
|
||||
self.assertEqual(out["routeCategory"], "DOMESTIC_CITY_DIST")
|
||||
self.assertNotIn("landRouteCategory", out)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user