协商中再问按后台超时小时顺延并可强制清跟进时刻;工单与账号支持按筛选导出 Excel。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
linmianxun
2026-10-13 12:34:03 +08:00
co-authored by Cursor
parent 97f0219dfd
commit 0b2f0b76c4
36 changed files with 867 additions and 64 deletions
+61 -4
View File
@@ -330,12 +330,32 @@ class HttpLedger:
return out if out.get("ok") else {"ok": False, "error": out.get("error") or "patch_lost_reason_failed"}
def claim_due_negotiate(self) -> list[dict[str, Any]]:
"""认领到期协商再问,主账会清空再问时刻防重发。"""
"""
认领到期协商再问。
主账应用 UpdateWrapper 清空 next_followup_at;若旧包仍用 updateById
写不进 null,这里对每单再调 clearNextFollowup 强制清掉,避免每分钟连发。
"""
out = self._post("/inquiry/agent/ticket/claimDueNegotiate", {})
rows = out.get("tickets") or out.get("result") or []
if isinstance(rows, list):
return [dict(x) for x in rows if isinstance(x, dict)]
return []
if not isinstance(rows, list):
return []
claimed: list[dict[str, Any]] = []
for raw in rows:
if not isinstance(raw, dict):
continue
row = dict(raw)
no = str(row.get("work_order_no") or row.get("workOrderNo") or "").strip()
if no:
try:
self._post(
"/inquiry/agent/ticket/clearNextFollowup",
{"workOrderNo": no, "work_order_no": no},
)
except Exception:
logger.exception("强制清空再问时刻失败 wo=%s", no)
claimed.append(row)
return claimed
def match_sea_staff(self, *, origin: str, destination: str) -> list[dict[str, Any]]:
"""主账按线路返回启用的海运产品岗。"""
@@ -451,6 +471,43 @@ class HttpLedger:
body["airline"] = airline.strip().upper()
if (flight_no or "").strip():
body["flightNo"] = flight_no.strip().upper()
# #region agent log
try:
import json as _json
import time as _time
from pathlib import Path as _Path
_line = _json.dumps(
{
"sessionId": "e38e4c",
"runId": "pre-fix",
"hypothesisId": "H-E",
"location": "http_ledger.py:lock_cabin",
"message": "ledger_lock_called",
"data": {
"wo": work_order_no,
"optionNo": option_no,
"airline": (airline or "").strip(),
"flightNo": (flight_no or "").strip(),
"instruction_head": (instruction_text or "")[:80],
},
"timestamp": int(_time.time() * 1000),
},
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"),
):
try:
_p.parent.mkdir(parents=True, exist_ok=True)
with _p.open("a", encoding="utf-8") as _fh:
_fh.write(_line)
except Exception:
pass
except Exception:
pass
# #endregion
return self._post(
"/inquiry/agent/tms/lockCabin",
body,