feat(shipping-notice,receipt-report): 新增收料报表功能并优化发货通知流程
清理废弃的shipping xfa ocr automark相关代码和job配置 新增收料报表管理的前端页面、路由和侧边栏入口 新增后端收料报表配置接口、数据库模型和RPA脚本 优化发货通知流程的重试策略,将shipping相关job默认不自动重试 移除废弃的库存源确认相关逻辑,更新流程门禁规则 重构订单模板的值适配器模块,新增坐标OCR值适配器 清理前端shipping菜单和action的废弃选项 更新相关文档和测试用例,调整.gitignore忽略规则
This commit is contained in:
1 parent
260465b72d
commit
1b6483a4ea
466 files changed
+32115
-33796
No files matched your search
@@ -20,6 +20,11 @@ from app.services.schedule.shipping_inventory_rpa_finalize import (
|
||||
recover_all_stale_awaiting_rpa_schedule_runs,
|
||||
recover_stale_awaiting_rpa_schedule_runs,
|
||||
)
|
||||
from app.services.schedule.freight_receipt_rpa_finalize import (
|
||||
recover_all_stale_receipt_rpa_schedule_runs,
|
||||
recover_stale_receipt_rpa_schedule_runs,
|
||||
is_awaiting_receipt_rpa_schedule_run,
|
||||
)
|
||||
from app.services.schedule.timezone_util import compute_next_run_at, utc_now_naive
|
||||
|
||||
_worker_initialized = False
|
||||
@@ -126,6 +131,7 @@ def enqueue_manual_schedule_run(
|
||||
if task is None:
|
||||
raise LookupError(f"schedule task {task_id} not found")
|
||||
recover_stale_awaiting_rpa_schedule_runs(task)
|
||||
recover_stale_receipt_rpa_schedule_runs(task)
|
||||
active = _active_run(task.id)
|
||||
if active is not None:
|
||||
job = (
|
||||
@@ -180,6 +186,10 @@ def enqueue_due_schedule_runs(*, limit: int = 5) -> int:
|
||||
|
||||
created = 0
|
||||
for task in tasks:
|
||||
# 每轮都回收当前任务已超时的外部 RPA 回调,不能仅依赖 worker 启动时扫一次;
|
||||
# 这只是终态化失败,不会自动重新导出。
|
||||
recover_stale_awaiting_rpa_schedule_runs(task)
|
||||
recover_stale_receipt_rpa_schedule_runs(task)
|
||||
if _active_run(task.id) is None:
|
||||
_create_queued_run(task, trigger_type="cron", triggered_by_user_id=None)
|
||||
_advance_next_run(task)
|
||||
@@ -229,7 +239,7 @@ def prepare_schedule_queue() -> int:
|
||||
legacy_running = db.session.query(ScheduleRun).filter(ScheduleRun.status == "running").all()
|
||||
interrupted = 0
|
||||
for run in legacy_running:
|
||||
if is_awaiting_rpa_schedule_run(run):
|
||||
if is_awaiting_rpa_schedule_run(run) or is_awaiting_receipt_rpa_schedule_run(run):
|
||||
continue
|
||||
active_job = (
|
||||
db.session.query(Job.id)
|
||||
@@ -254,6 +264,9 @@ def prepare_schedule_queue() -> int:
|
||||
recovered = recover_all_stale_awaiting_rpa_schedule_runs()
|
||||
if recovered:
|
||||
current_app.logger.info("[schedule-worker] recovered %d stale awaiting RPA runs", recovered)
|
||||
receipt_recovered = recover_all_stale_receipt_rpa_schedule_runs()
|
||||
if receipt_recovered:
|
||||
current_app.logger.info("[schedule-worker] recovered %d stale receipt RPA runs", receipt_recovered)
|
||||
from app.services.shipping_notice.inventory_rpa_callback_cleanup import (
|
||||
recover_pending_rpa_callback_cleanup_jobs,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user