员工岗位可重新启用;调价认空运航线;会话存档跳号补拉;陆运报价按车型列回填
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,8 +7,11 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
from agent.config import get_settings
|
||||
@@ -16,12 +19,14 @@ from agent.policy import inquiry_copy as copy
|
||||
from agent.policy.deal_followup import (
|
||||
DEFAULT_NEGOTIATE_HOURS,
|
||||
TIMEOUT_CODE_DEAL_NEGOTIATE,
|
||||
air_route_keys,
|
||||
next_followup_at,
|
||||
pick_leaders,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
EnqueueFn = Callable[..., tuple[bool, str]]
|
||||
|
||||
# 成交跟进里先认未成交,避免被「成交」误伤。
|
||||
@@ -204,6 +209,7 @@ def finish_deal_outcome(
|
||||
business_line=business_line,
|
||||
)
|
||||
enqueued = 0
|
||||
enqueue_fails: list[str] = []
|
||||
for row in leaders:
|
||||
uid = str(row.get("wecomId") or "").strip()
|
||||
if not uid:
|
||||
@@ -218,9 +224,12 @@ def finish_deal_outcome(
|
||||
if ok:
|
||||
enqueued += 1
|
||||
else:
|
||||
enqueue_fails.append(f"{uid}:{info}")
|
||||
logger.warning("成交通知入队失败 wo=%s uid=%s info=%s", no, uid, info)
|
||||
except Exception:
|
||||
except Exception as exc: # noqa: BLE001
|
||||
enqueue_fails.append(f"{uid}:exc")
|
||||
logger.exception("成交通知入队异常 wo=%s uid=%s", no, uid)
|
||||
_ = exc
|
||||
except Exception:
|
||||
logger.exception("成交通知组装失败,仍继续入账 wo=%s", no)
|
||||
summary = "通知未发出"
|
||||
@@ -383,3 +392,23 @@ def capture_lost_reason(*, ledger: Any, work_order_no: str, reason: str) -> dict
|
||||
|
||||
clear_wait(ledger, work_order_no=no)
|
||||
return out
|
||||
|
||||
|
||||
def ticket_missing_in_ledger(ledger: Any, *, work_order_no: str, sender_id: str = "") -> bool:
|
||||
"""
|
||||
主账已无此工单(清数/删单后)。
|
||||
|
||||
用于丢掉「等原因」孤儿书签,避免死循环「请再发一句」并挡住新询价。
|
||||
"""
|
||||
no = (work_order_no or "").strip()
|
||||
if not no:
|
||||
return True
|
||||
getter = getattr(ledger, "get_for_agent", None)
|
||||
if not callable(getter):
|
||||
return False
|
||||
try:
|
||||
view = getter(work_order_no=no, sender_id=sender_id or "") or {}
|
||||
except Exception:
|
||||
logger.exception("查工单是否存在失败 wo=%s", no)
|
||||
return False
|
||||
return not bool(view.get("found"))
|
||||
|
||||
Reference in New Issue
Block a user