让成交卡等报价文件真正发出后再出现,并收紧 PDF 顶部留白,避免抬头被裁或空一截。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -44,3 +44,7 @@ STREAM_WAKE = "stream:wake"
|
||||
IDEMPOTENCY = "idem"
|
||||
RATE_LIMIT = "ratelimit"
|
||||
TOKEN_WECOM = "token:wecom"
|
||||
TOKEN_COPY_TICKET = "token:copy_ticket"
|
||||
TOKEN_JSAPI = "token:jsapi"
|
||||
# Worker 出完报价文件后写给 HTTP:短协调,不当六态
|
||||
QUOTE_FILE_READY = "quote_file_ready"
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
"""
|
||||
报价文件完成短协调。
|
||||
|
||||
Worker LibreOffice 出完文件后写键;HTTP 进程读键,把 wait_file 切到成交跟进。
|
||||
不当六态、不当 checkpoint。TTL 一周,过期当未完成。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from agent.redis_coord.keys import QUOTE_FILE_READY
|
||||
from agent.redis_coord.runtime import get_redis_runtime
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_TTL_SEC = 7 * 24 * 3600
|
||||
|
||||
|
||||
def mark_quote_file_ready(work_order_no: str) -> None:
|
||||
"""Worker 出完报价文件后调用;HTTP 进程据此结束「请稍候」。"""
|
||||
no = (work_order_no or "").strip()
|
||||
if not no:
|
||||
return
|
||||
try:
|
||||
client = get_redis_runtime().client
|
||||
client.raw.set(client.key(QUOTE_FILE_READY, no), "1", ex=_TTL_SEC)
|
||||
logger.info("报价文件已就绪 wo=%s", no)
|
||||
except Exception:
|
||||
logger.exception("写报价文件就绪键失败 wo=%s", no)
|
||||
|
||||
|
||||
def is_quote_file_ready(work_order_no: str) -> bool:
|
||||
"""HTTP 读:文件是否已经发出。读失败当未完成,继续请稍候。"""
|
||||
no = (work_order_no or "").strip()
|
||||
if not no:
|
||||
return False
|
||||
try:
|
||||
client = get_redis_runtime().client
|
||||
return bool(client.raw.get(client.key(QUOTE_FILE_READY, no)))
|
||||
except Exception:
|
||||
logger.exception("读报价文件就绪键失败 wo=%s", no)
|
||||
return False
|
||||
Reference in New Issue
Block a user