feat(shipping_notice): 添加重新上传发货通知功能
- 新增接口支持覆盖当前任务的发货通知 - 重新解析时重置任务状态,避免重复任务 - 增加库存 RPA 等待时间的复查逻辑 - 更新状态机以处理文本抽取失败的情况 - 增强测试用例以覆盖新功能
This commit is contained in:
1 parent
f434402530
commit
7f1d5dfbcd
20 files changed
+691
-26
No files matched your search
@@ -79,10 +79,20 @@ def _requeue_external_wait_job(task_no: str, *, job: Job | None = None) -> None:
|
||||
"""把等待 RPA 回调的任务重新放回队列,供 worker 下一轮做超时/重试判断。"""
|
||||
if not _should_requeue_waiting_external_result(task_no):
|
||||
return
|
||||
recheck_seconds = max(
|
||||
float(current_app.config.get('SHIPPING_NOTICE_RPA_WAIT_RECHECK_SECONDS', 10) or 10),
|
||||
1,
|
||||
)
|
||||
scheduled_at = None
|
||||
from app.services.shipping_notice.query_service import get_task_by_ref
|
||||
|
||||
task = get_task_by_ref(task_no)
|
||||
if task and str(task.pending_human_reason or '').strip() == PH_RPA_PENDING:
|
||||
from app.services.shipping_notice.inventory_rpa_workflow import next_inventory_rpa_recheck_at
|
||||
|
||||
scheduled_at = next_inventory_rpa_recheck_at(task)
|
||||
if scheduled_at is None:
|
||||
recheck_seconds = max(
|
||||
float(current_app.config.get('SHIPPING_NOTICE_RPA_WAIT_RECHECK_SECONDS', 10) or 10),
|
||||
1,
|
||||
)
|
||||
scheduled_at = datetime.utcnow() + timedelta(seconds=recheck_seconds)
|
||||
enqueue(
|
||||
JobType.SHIPPING_NOTICE_RUN,
|
||||
{
|
||||
@@ -95,7 +105,7 @@ def _requeue_external_wait_job(task_no: str, *, job: Job | None = None) -> None:
|
||||
message='等待 RPA 回传,稍后自动复查',
|
||||
max_attempts=int(current_app.config.get('SHIPPING_NOTICE_JOB_MAX_ATTEMPTS', 3) or 3),
|
||||
dedupe_active=False,
|
||||
scheduled_at=datetime.utcnow() + timedelta(seconds=recheck_seconds),
|
||||
scheduled_at=scheduled_at,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user