空运成交后可在本群继续锁舱;调价同步舱位费用桶;出单按空运段骨架落费并保留陆运车型尺寸;导出文件名乱码修复。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
linmianxun
2026-10-14 15:34:24 +08:00
co-authored by Cursor
parent 92bdf56a4d
commit cc8529f569
29 changed files with 1941 additions and 276 deletions
+14 -8
View File
@@ -440,12 +440,17 @@ class HttpLedger:
idem=f"collab-facts:{work_order_no}:{sorted(facts)}",
)
def activate_air_group(self, *, chat_id: str, work_order_no: str) -> dict[str, Any]:
"""空运群激活/切换当前工单。一单一群。"""
def activate_air_group(
self, *, chat_id: str, work_order_no: str, allow_deal: bool = False
) -> dict[str, Any]:
"""空运群激活/切换当前工单。一单一群。allow_deal 只用于已成交后锁舱补参数。"""
body: dict[str, Any] = {"chatId": chat_id, "workOrderNo": work_order_no}
if allow_deal:
body["allowDeal"] = True
return self._post(
"/inquiry/agent/ticket/activateAirGroup",
{"chatId": chat_id, "workOrderNo": work_order_no},
idem=f"air-activate:{chat_id}:{work_order_no}",
body,
idem=f"air-activate:{chat_id}:{work_order_no}:{int(bool(allow_deal))}",
)
def lock_cabin(
@@ -479,9 +484,9 @@ class HttpLedger:
_line = _json.dumps(
{
"sessionId": "e38e4c",
"sessionId": "3ba460",
"runId": "pre-fix",
"hypothesisId": "H-E",
"hypothesisId": "C",
"location": "http_ledger.py:lock_cabin",
"message": "ledger_lock_called",
"data": {
@@ -496,8 +501,9 @@ class HttpLedger:
ensure_ascii=False,
) + "\n"
for _p in (
_Path(r"d:\own\友通达询价智能体(新)\debug-e38e4c.log"),
_Path(r"C:/Users/ytd_extdev_0903/incoming/debug-e38e4c.log"),
_Path(r"d:\own\友通达询价智能体(新)\debug-3ba460.log"),
_Path(r"C:/Users/ytd_extdev_0903/incoming/debug-3ba460.log"),
_Path(r"E:/wwwroot/agent/current/debug-3ba460.log"),
):
try:
_p.parent.mkdir(parents=True, exist_ok=True)
+36 -6
View File
@@ -805,11 +805,13 @@ class MemoryLedger:
return ticket
return None
def activate_air_group(self, *, chat_id: str, work_order_no: str) -> dict[str, Any]:
def activate_air_group(
self, *, chat_id: str, work_order_no: str, allow_deal: bool = False
) -> dict[str, Any]:
"""
空运群当前工单:一单一群,未结案才能激活。
不改六态。
allow_deal 只给已成交后的锁舱补参数:把本群记到这张单上,不改六态。
"""
no = (work_order_no or "").strip()
room = (chat_id or "").strip()
@@ -819,7 +821,9 @@ class MemoryLedger:
return {"ok": False, "error": "ticket_not_found"}
if (ticket.business_line or "").upper() != "AIR":
return {"ok": False, "error": "not_air", "status": ticket.status}
if ticket.status in {"已成交", "未成交", "已关闭"}:
if ticket.status in {"已成交", "未成交", "已关闭"} and not (
allow_deal and ticket.status == "已成交"
):
return {"ok": False, "error": "terminal", "status": ticket.status}
if ticket.collab_chat_id and ticket.collab_chat_id != room:
return {"ok": False, "error": "occupied", "other_chat_id": ticket.collab_chat_id}
@@ -844,17 +848,43 @@ class MemoryLedger:
airline: str = "",
flight_no: str = "",
) -> dict[str, Any]:
"""单测可注入 _cabin_lock_result;默认成功。
"""单测可注入 _cabin_lock_result;默认成功。只有已成交才锁。
纯人工且视图无 TMS 舱位时,缺 option/航司/航班 → lock_incomplete,
对齐主账「现拉仍缺才回」的口径(内存账不会真查 TMS)。
"""
_ = sender_id, operator_name, instruction_text, airline, flight_no
no = (work_order_no or "").strip()
ticket = self.get_ticket(work_order_no=no)
# 与主账一致:只有已成交才锁。单测注入的失败结果也不能绕过这道门。
if ticket is not None and (ticket.status or "") != "已成交":
st = ticket.status or ""
if st == "协商中":
return {
"ok": False,
"error": "lock_negotiating",
"failReason": "工单还在协商中,成交后才能锁舱",
}
if st == "未成交":
return {
"ok": False,
"error": "lock_lost",
"failReason": "工单已是「未成交」,不能锁舱",
}
if st in {"已关闭", "转人工"}:
return {
"ok": False,
"error": "ticket_closed",
"failReason": f"工单已是「{st}」,不能锁舱",
}
return {
"ok": False,
"error": "lock_need_deal",
"failReason": "请销售先确认工单「已成交」",
}
forced = getattr(self, "_cabin_lock_result", None)
if isinstance(forced, dict):
return dict(forced)
no = (work_order_no or "").strip()
ticket = self.get_ticket(work_order_no=no)
quote = dict(ticket.quote or {}) if ticket else {}
if not _memory_quote_can_lock(quote):
return {