feat(schedule): 新增平台任务参数契约与动态选项支持

This commit is contained in:
hugo committed 2026-07-09 13:19:36 +08:00
1 parent 2ce1aca023
commit 8b5b0b49bf
76 files changed
+7103 -1203

No files matched your search

+6 -4
View File
@@ -2,7 +2,7 @@
scripts/rpa/dsv_export_smoke.py
用途:本地手动验证指定 DSV 360 库存源(默认 BYAWSATL01)的浏览器导出全流程。
依赖:Playwright(msedge)、FREIGHT_RPA_DSV_USERNAME/PASSWORD、backend/config/shipping_inventory_sources.json。
依赖:Playwright(msedge)、FREIGHT_RPA_DSV_USERNAME/PASSWORD、backend/config/shipping_inventory_sources.yaml。
逻辑:加载 rpa_inventory_source → _download_inventory_with_browser → 输出 Excel 路径。
用法(仓库根目录):
@@ -20,6 +20,8 @@ import traceback
from datetime import datetime
from pathlib import Path
import yaml
def _repo_root() -> Path:
return Path(__file__).resolve().parents[2]
@@ -36,11 +38,11 @@ def _load_worker():
def _build_source_from_config(source_code: str) -> dict:
"""
从 JSON 配置构造 worker 兼容的 rpa_inventory_source(不依赖 Flask 上下文)。
从 YAML 配置构造 worker 兼容的 rpa_inventory_source(不依赖 Flask 上下文)。
核心逻辑:复用与 inventory_sources._build_legacy_query 相同的 query 口径。
"""
config_path = _repo_root() / "backend" / "config" / "shipping_inventory_sources.json"
payload = json.loads(config_path.read_text(encoding="utf-8"))
config_path = _repo_root() / "backend" / "config" / "shipping_inventory_sources.yaml"
payload = yaml.safe_load(config_path.read_text(encoding="utf-8"))
raw = next(
(item for item in (payload.get("sources") or []) if str(item.get("source_code") or "").upper() == source_code.upper()),
None,