落地空运群内协同与锁舱出站。
群里按 BOT 通道激活当前工单、航线报价和成交跟进;没有 TMS 报价编号时用工单字段补齐仍调锁舱,避免被本地规则拦住。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
"""
|
||||
产品文字报价待确认:等选在 TMS 上改还是不用 TMS。
|
||||
|
||||
短协调,不当六态、不当 checkpoint。Worker 重启后仍能读到刚才那份价。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from agent.redis_coord.keys import PENDING_PRODUCT_QUOTE
|
||||
from agent.redis_coord.runtime import get_redis_runtime
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_TTL_SEC = 2 * 24 * 3600
|
||||
|
||||
|
||||
def save_pending_product_quote(work_order_no: str, quote: dict[str, Any]) -> None:
|
||||
"""记下刚抽出的产品价,等产品选怎么用 TMS。"""
|
||||
no = (work_order_no or "").strip()
|
||||
if not no or not isinstance(quote, dict) or not quote:
|
||||
return
|
||||
try:
|
||||
client = get_redis_runtime().client
|
||||
client.raw.set(
|
||||
client.key(PENDING_PRODUCT_QUOTE, no),
|
||||
json.dumps(quote, ensure_ascii=False),
|
||||
ex=_TTL_SEC,
|
||||
)
|
||||
except Exception:
|
||||
logger.exception("写待确认产品报价失败 wo=%s", no)
|
||||
|
||||
|
||||
def load_pending_product_quote(work_order_no: str) -> dict[str, Any]:
|
||||
"""取出待确认产品价。没有或过期返回空。"""
|
||||
no = (work_order_no or "").strip()
|
||||
if not no:
|
||||
return {}
|
||||
try:
|
||||
client = get_redis_runtime().client
|
||||
raw = client.raw.get(client.key(PENDING_PRODUCT_QUOTE, no))
|
||||
if not raw:
|
||||
return {}
|
||||
if isinstance(raw, bytes):
|
||||
raw = raw.decode("utf-8")
|
||||
data = json.loads(raw)
|
||||
return dict(data) if isinstance(data, dict) else {}
|
||||
except Exception:
|
||||
logger.exception("读待确认产品报价失败 wo=%s", no)
|
||||
return {}
|
||||
|
||||
|
||||
def clear_pending_product_quote(work_order_no: str) -> None:
|
||||
"""出单后清掉,避免下一句误用旧价。"""
|
||||
no = (work_order_no or "").strip()
|
||||
if not no:
|
||||
return
|
||||
try:
|
||||
client = get_redis_runtime().client
|
||||
client.raw.delete(client.key(PENDING_PRODUCT_QUOTE, no))
|
||||
except Exception:
|
||||
logger.exception("清待确认产品报价失败 wo=%s", no)
|
||||
Reference in New Issue
Block a user