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

+1 -1
View File
@@ -67,7 +67,7 @@ def update_schedule_task_config(task_id: int):
config_data = data.get('config', data)
if isinstance(config_data, dict) and config_data:
# platform_job 仅白名单且 enabled 的任务(如 shipping-inventory-rpa)允许写 ScheduleTaskConfig
# platform_job 仅白名单且 enabled 的任务(如 freight-rpa-onhand)允许写 ScheduleTaskConfig
if task.schedule_type != SCHEDULE_TYPE_DATA_PIPELINE and not platform_job_allows_config(task.platform_api_path):
raise ValidationError(
f"platform_job '{task.platform_api_path}' does not accept ScheduleTaskConfig"
+4 -4
View File
@@ -2,7 +2,7 @@
backend/app/api/schedule/rpa_workers.py
用途:管理端查询货代库存/收料 RPA Worker 在线状态与就绪摘要。
依赖:schedule.blueprint、rpa_worker_heartbeat.serialize_rpa_worker_status。
依赖:schedule.blueprint、freight_rpa.common.worker_heartbeat.serialize_rpa_worker_status。
逻辑:ScheduleWorkbenchPanel 在库存或收料 RPA 排程工作台展示对应 worker 心跳状态。
"""
@@ -13,7 +13,7 @@ from flask import request
from app.api.schedule.blueprint import schedule_admin_bp
from app.core.decorators import require_admin
from app.core.response import ok
from app.services.shipping_notice.rpa_worker_heartbeat import serialize_rpa_worker_status
from app.services.freight_rpa.common.worker_heartbeat import serialize_rpa_worker_status
@schedule_admin_bp.route('/rpa-workers/status', methods=['GET'])
@@ -23,7 +23,7 @@ def get_rpa_workers_status():
返回 RPA Worker 心跳摘要(在线/离线、最后心跳时间、就绪原因)。
Query:
scope: inventory(默认)或 receipt。
scope: onhand(默认)或 inbound。
"""
scope = str(request.args.get('scope') or 'inventory').strip().lower() or 'inventory'
scope = str(request.args.get('scope') or 'onhand').strip().lower() or 'onhand'
return ok(serialize_rpa_worker_status(scope=scope))
+7 -7
View File
@@ -21,11 +21,11 @@ from app.core.errors import ConflictError, NotFoundError
from app.models import ScheduleRun, ScheduleTask, ShippingReceiptReportFile, ShippingReceiptRpaUnitRun
from app.services.schedule.query_service import get_run, list_runs, serialize_run
from app.services.schedule.queue_service import enqueue_manual_schedule_run
from app.services.schedule.shipping_inventory_rpa_archive import resolve_inventory_raw_zip_download
from app.services.schedule.shipping_receipt_rpa_archive import resolve_receipt_raw_zip_download
from app.services.shipping_notice.receipt_report_notification import deliver_receipt_file
from app.services.schedule.freight_onhand_rpa_archive import resolve_inventory_raw_zip_download
from app.services.schedule.freight_inbound_rpa_archive import resolve_receipt_raw_zip_download
from app.services.freight_rpa.inbound.report_archive import deliver_inbound_file
from app.services.shipping_notice.audit_service import append_shipping_audit_event
from app.services.shipping_notice.receipt_rpa import write_receipt_export_batch_trigger
from app.services.freight_rpa.inbound.trigger_io import SCHEMA, write_inbound_export_batch_trigger
@schedule_admin_bp.route('/schedules/<int:task_id>/run', methods=['POST'])
@@ -152,7 +152,7 @@ def resend_receipt_report_file(file_id: int):
if report_file is None or report_file.archive_deleted_at is not None:
raise NotFoundError('Receipt report file not found')
user = get_current_user()
outcome = deliver_receipt_file(report_file.id, force=True)
outcome = deliver_inbound_file(report_file.id, force=True)
append_shipping_audit_event(
event_type='shipping_receipt_report_notification_resent', aggregate_type='shipping_receipt_file',
aggregate_id=str(report_file.id), actor_type='admin', actor_id=getattr(user, 'id', None),
@@ -247,9 +247,9 @@ def retry_receipt_rpa_unit(unit_id: int):
}
retry.trigger_snapshot_json = trigger_unit
run = retry.schedule_run
trigger_path = write_receipt_export_batch_trigger(
trigger_path = write_inbound_export_batch_trigger(
f'{run.run_no}-retry-{retry.id}', [trigger_unit],
{'schedule_run_id': run.id, 'schedule_task_id': run.schedule_task_id, 'schema_version': 'shipping_receipt_rpa.v1', 'retry_of_unit_id': failed.id},
{'schedule_run_id': run.id, 'schedule_task_id': run.schedule_task_id, 'schema_version': SCHEMA, 'retry_of_unit_id': failed.id},
)
if not trigger_path:
db.session.rollback()