将 RPA 编排收编至 freight_rpa,回调迁 /api/freight-rpa/*。 共享目录与 Worker 契约一次切换至 onhand/inbound/upload, 并补 outbound 骨架与 tt16 排程 job key 迁移。 Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
"""
|
|
backend/app/api/schedule/rpa_workers.py
|
|
|
|
用途:管理端查询货代库存/收料 RPA Worker 在线状态与就绪摘要。
|
|
依赖:schedule.blueprint、freight_rpa.common.worker_heartbeat.serialize_rpa_worker_status。
|
|
逻辑:ScheduleWorkbenchPanel 在库存或收料 RPA 排程工作台展示对应 worker 心跳状态。
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
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.freight_rpa.common.worker_heartbeat import serialize_rpa_worker_status
|
|
|
|
|
|
@schedule_admin_bp.route('/rpa-workers/status', methods=['GET'])
|
|
@require_admin
|
|
def get_rpa_workers_status():
|
|
"""
|
|
返回 RPA Worker 心跳摘要(在线/离线、最后心跳时间、就绪原因)。
|
|
|
|
Query:
|
|
scope: onhand(默认)或 inbound。
|
|
"""
|
|
scope = str(request.args.get('scope') or 'onhand').strip().lower() or 'onhand'
|
|
return ok(serialize_rpa_worker_status(scope=scope))
|