feat: 询价流程接入事件异常等待起停

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-21 18:28:35 +08:00
co-authored by Cursor
parent fc1b85113d
commit a878b046d2
11 changed files with 131 additions and 5 deletions
+11 -1
View File
@@ -133,12 +133,17 @@ def finish_deal_outcome(
result = writer(work_order_no=no, to_status=status, **extra) or {}
if not result.get("ok"):
return {"ok": False, "error": result.get("error") or "transition_failed", "phase": "ledger_fail"}
from agent.policy.event_exception import WAIT_LOST_REASON, clear_wait, start_wait
if status == "未成交":
phase = "wait_lost_reason"
start_wait(ledger, work_order_no=no, wait_kind=WAIT_LOST_REASON)
elif status == "协商中":
phase = "wait_deal"
clear_wait(ledger, work_order_no=no)
else:
phase = "done"
clear_wait(ledger, work_order_no=no)
return {
"ok": True,
"phase": phase,
@@ -157,4 +162,9 @@ def capture_lost_reason(*, ledger: Any, work_order_no: str, reason: str) -> dict
patcher = getattr(ledger, "patch_lost_reason", None)
if not callable(patcher):
return {"ok": False, "error": "no_patch"}
return patcher(work_order_no=no, lost_reason=text) or {"ok": False}
out = patcher(work_order_no=no, lost_reason=text) or {"ok": False}
if out.get("ok"):
from agent.policy.event_exception import clear_wait
clear_wait(ledger, work_order_no=no)
return out