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:
1 parent
bf3154033b
commit
ffc0d4a430
147 files changed
+4221
-2678
No files matched your search
@@ -0,0 +1,54 @@
|
||||
"""tt16:RPA 排程任务 key 更名(批次 R,随代码同窗口发布)
|
||||
|
||||
Revision ID: tt16c7d8e9f0a1b2
|
||||
Revises: tt16a7b8c9d0e1f2
|
||||
Create Date: 2026-10-16
|
||||
|
||||
用途:schedule_tasks.platform_api_path 存量的三个 RPA 平台 job key 入站化改名——
|
||||
shipping-inventory-rpa→freight-rpa-onhand(在手/库存)、
|
||||
freight-receipt-rpa→freight-rpa-inbound(入站/收料)、
|
||||
freight-receipt-rpa-retention→freight-rpa-inbound-retention(入站归档保留期清理),
|
||||
与 job_registry.py / freight_onhand_rpa_*、freight_inbound_rpa_* 排程壳改名同窗口发布。
|
||||
依赖:实施时 flask db heads 的单 head 为 tt16a7b8c9d0e1f2(调拨域迁移,其上游即
|
||||
tt15b6a7b8c9d0);本迁移若直挂 tt15 会产生双 head,故按单 head 纪律链在其上。
|
||||
逻辑:列为 platform_api_path(String(500),承载归一化 job key——自 b9c0d1e2f3a4 起
|
||||
排程表无独立 job_key 列,运行时一律读写 platform_api_path,见
|
||||
schedule_contract.normalize_job_key);三键 UPDATE;
|
||||
options_source 键(shipping_inventory_sources / shipping_receipt_sources)
|
||||
绑定业务表名,本批不动(批次 S)。
|
||||
降级:反向映射对称 UPDATE,逐键还原;无表结构变更,SQLite/PG 语句通用。
|
||||
Fix round 1:SQL 列名由计划骨架误写的 job_key 修正为真实列 platform_api_path
|
||||
(计划骨架错误,控制方已认领;契约测试桩表同步改真实列名)。
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision = "tt16c7d8e9f0a1b2"
|
||||
down_revision = "tt16a7b8c9d0e1f2"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
# 升级方向三键对照;downgrade 取反。键值与 job_registry.register_platform_job 一致。
|
||||
_MAPPING = {
|
||||
"shipping-inventory-rpa": "freight-rpa-onhand",
|
||||
"freight-receipt-rpa": "freight-rpa-inbound",
|
||||
"freight-receipt-rpa-retention": "freight-rpa-inbound-retention",
|
||||
}
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""job key 三键前向改名:platform_api_path 旧行 UPDATE 为新键(无表结构变更)。"""
|
||||
for old_key, new_key in _MAPPING.items():
|
||||
op.execute(
|
||||
f"UPDATE schedule_tasks SET platform_api_path='{new_key}' "
|
||||
f"WHERE platform_api_path='{old_key}'"
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""job key 三键反向还原:platform_api_path 新键 UPDATE 回旧键(与 upgrade 对称)。"""
|
||||
for old_key, new_key in _MAPPING.items():
|
||||
op.execute(
|
||||
f"UPDATE schedule_tasks SET platform_api_path='{old_key}' "
|
||||
f"WHERE platform_api_path='{new_key}'"
|
||||
)
|
||||
Reference in new issue
Block a user