落地销售调价:按自然语言改价并单独记销售价,拉群和后台不再把调后价当成 TMS 原价。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-20 14:40:20 +08:00
co-authored by Cursor
parent e4743541f7
commit 26dd5d72a1
36 changed files with 2795 additions and 176 deletions
+38 -10
View File
@@ -265,7 +265,7 @@ class AirTextInquiryTests(unittest.TestCase):
self.assertIn("已报价", self.flow.session_of("u1").status)
self.assertIn(copy.BTN_SKIP_COLLAB, joined)
self.assertIn("价格明细", joined)
self.assertIn("总销售价合计", joined)
self.assertIn("总销售价", joined)
self.assertIn("时效:", joined)
self.assertIn("报价有效期:", joined)
self.assertNotIn("相同询价内容检索", joined)
@@ -328,7 +328,7 @@ class AirTextInquiryTests(unittest.TestCase):
follow = file_extras[-1].get("followup_card") or {}
self.assertTrue(str(follow.get("task_id") or "").startswith("deal-"))
deal_rows = {r["keyname"]: r["value"] for r in follow.get("horizontal_content_list") or []}
self.assertIn("总销售价合计", deal_rows)
self.assertIn("总销售价", deal_rows)
self.assertNotIn("历史报价", deal_rows)
self.assertNotIn("工单状态", deal_rows)
self.assertNotIn("来源", deal_rows)
@@ -616,7 +616,35 @@ class AirTextInquiryTests(unittest.TestCase):
self.flow.on_button(sender_id="u5", action=copy.BTN_SKIP_COLLAB, reply=self._reply)
phase = self.flow.on_button(sender_id="u5", action=copy.BTN_REJECT, reply=self._reply)
self.assertEqual(phase, "wait_adjust")
self.assertIn("报价加 10%", self.replies[-1])
self.assertIn("提货费加 10%", self.replies[-1])
def test_private_adjust_percent_refreshes_card(self) -> None:
self.flow.on_text(
sender_id="u-adj",
text="空运",
reply=self._reply,
injected_facts=COMPLETE_AIR,
injected_mode="AIR",
)
self.replies.clear()
phase = self.flow.on_text(
sender_id="u-adj",
text="空运费加 10%",
reply=self._reply,
)
self.assertEqual(phase, "wait_collab")
joined = "\n".join(self.replies)
self.assertIn("已识别调价指令", joined)
self.assertIn("空运费", joined)
sess = self.flow.session_of("u-adj")
self.assertEqual(sess.status, "已报价")
rows = sess.quote.get("fee_rows") or sess.quote.get("fee_lines") or []
air = next(x for x in rows if "空运费" in str(x.get("name") or ""))
self.assertIn("1320", str(air.get("amount") or ""))
self.replies.clear()
self.flow.on_button(sender_id="u-adj", action=copy.BTN_SKIP_COLLAB, reply=self._reply)
scheme = "\n".join(self.replies)
self.assertIn("1320", scheme)
def test_adopt_pdf(self) -> None:
self.flow.on_text(
@@ -748,7 +776,7 @@ class AirTextInquiryTests(unittest.TestCase):
quote_text = card["quote_area"]["quote_text"]
self.assertNotIn("title", card["quote_area"])
self.assertIn("空运费:USD 1,200", quote_text)
self.assertIn("总销售价合计:USD 1,280", quote_text)
self.assertIn("总销售价:USD 1,280", quote_text)
self.assertNotIn("时效:", quote_text)
numeric = copy.tms_hit_wecom_payload(
work_order_no="WO202609140048",
@@ -761,7 +789,7 @@ class AirTextInquiryTests(unittest.TestCase):
},
)["template_card"]["quote_area"]["quote_text"]
self.assertIn("空运费:CNY 14669.60", numeric)
self.assertIn("总销售价合计:CNY 14669.60", numeric)
self.assertIn("总销售价:CNY 14669.60", numeric)
self.assertEqual(copy.money_text("14669.60", ""), "14669.60")
self.assertNotIn(copy.collab_hint("WO202609140001"), quote_text)
sub = card["sub_title_text"]
@@ -816,7 +844,7 @@ class AirTextInquiryTests(unittest.TestCase):
quote_text = card["quote_area"]["quote_text"]
self.assertNotIn("title", card["quote_area"])
self.assertIn("空运费:USD 1,200", quote_text)
self.assertIn("总销售价合计:USD 1,280", quote_text)
self.assertIn("总销售价:USD 1,280", quote_text)
self.assertNotIn("sub_title_text", card)
rows = {x["keyname"]: x["value"] for x in card["horizontal_content_list"]}
self.assertEqual(rows["工单号"], "WO202609140001")
@@ -864,11 +892,11 @@ class AirTextInquiryTests(unittest.TestCase):
"valid_until": "2026-08-24",
"source_label": "TMS 标准报价",
}
text = copy.deal_card(work_order_no="WO202608210017", quote=quote)
text = copy.deal_card(work_order_no="WO202608210017", quote=quote, business_line="AIR")
self.assertIn("询价工单 WO202608210017", text)
self.assertIn("报价单已发送,请跟进成交状态", text)
self.assertIn("咨询成交状态:请选择成交 / 未成交 / 协商中(未成交需补充原因)。", text)
self.assertIn("总销售价合计:CNY 722.5", text)
self.assertIn("总销售价:CNY 722.5", text)
self.assertIn("时效:2天", text)
self.assertNotIn("时效(要求/TMS)", text)
self.assertNotIn("- / -", text)
@@ -877,7 +905,7 @@ class AirTextInquiryTests(unittest.TestCase):
self.assertNotIn("工单状态", text)
self.assertNotIn("来源:", text)
self.assertNotIn("总成本价合计", text)
payload = copy.deal_wecom_payload(work_order_no="WO202608210017", quote=quote)
payload = copy.deal_wecom_payload(work_order_no="WO202608210017", quote=quote, business_line="AIR")
card = payload["template_card"]
self.assertEqual(payload["msgtype"], "template_card")
self.assertEqual(card["card_type"], "button_interaction")
@@ -889,7 +917,7 @@ class AirTextInquiryTests(unittest.TestCase):
self.assertEqual(
rows,
{
"总销售价合计": "CNY 722.5",
"总销售价": "CNY 722.5",
"时效": "2天",
"报价有效期": "2026-08-24",
},