feat(freight-rpa): 批次R解耦编排层并切换 onhand/inbound 契约

将 RPA 编排收编至 freight_rpa,回调迁 /api/freight-rpa/*。
共享目录与 Worker 契约一次切换至 onhand/inbound/upload,
并补 outbound 骨架与 tt16 排程 job key 迁移。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hugoandCursor committed 2026-10-17 23:18:48 +08:00
1 parent bf3154033b
commit ffc0d4a430
147 files changed
+4221 -2678

No files matched your search

@@ -22,8 +22,8 @@ from pathlib import Path
def _load_worker():
repo_root = next((_p for _p in Path(__file__).resolve().parents if (_p / "backend").is_dir() and (_p / "frontend").is_dir()), Path(__file__).resolve().parents[2])
module_path = repo_root / "scripts" / "freight_rpa" / "inventory" / "inventory_rpa_worker.py"
spec = importlib.util.spec_from_file_location("inventory_rpa_worker_crane_smoke", module_path)
module_path = repo_root / "scripts" / "freight_rpa" / "onhand" / "onhand_rpa_worker.py"
spec = importlib.util.spec_from_file_location("onhand_rpa_worker_crane_smoke", module_path)
assert spec and spec.loader
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
@@ -2,7 +2,7 @@
scripts/freight_rpa/crane_report_export.py
用途:Crane On Hand Details Query 异步报表导出(Run Report → Schedule Report → Scheduled Reports 下载)。
依赖:Playwright Page、download_artifact_fallback;由 inventory_rpa_worker._export_crane_inventory_source 委托调用。
依赖:Playwright Page、download_artifact_fallback;由 onhand_rpa_worker._export_crane_onhand_source 委托调用。
逻辑:不填写页面查询条件;必须先 Run Report 产出查询结果,再 Schedule 异步导出;
轮询仅在 scheduled-reports 路由进行;expect_download 超时时按下载目录新文件做短窗口兜底。
"""
@@ -18,13 +18,13 @@ _RPA_ROOT = next(
for _c in _Path(__file__).resolve().parents
if (_c / "connectors").is_dir()
and (_c / "common").is_dir()
and (_c / "inventory").is_dir()
and (_c / "receipt").is_dir()
and (_c / "onhand").is_dir()
and (_c / "inbound").is_dir()
),
None,
)
if _RPA_ROOT is not None:
for _rel in ("", "common", "connectors", "connectors/dsv", "connectors/crane", "inventory", "receipt"):
for _rel in ("", "common", "connectors", "connectors/dsv", "connectors/crane", "onhand", "inbound"):
_dir = str(_RPA_ROOT) if not _rel else str(_RPA_ROOT / _rel)
if _dir not in _sys.path:
_sys.path.insert(0, _dir)
@@ -1167,7 +1167,7 @@ def export_crane_inventory_report(
browser_timeout_ms: 浏览器操作超时。
select_or_fill: worker 提供的下拉/输入填充函数。
click_text: worker 提供的文本点击函数(file_download 直出模式备用)。
trigger: inventory_export / batch trigger,用于生成唯一 Description。
trigger: onhand_export / batch trigger,用于生成唯一 Description。
Returns:
Playwright Download 或 FilesystemDownloadArtifact。