feat(freight-rpa): 增加出站报表配置与回调支持,重构相关服务

- 将 RPA 管理 API 扩展至出站报表配置,新增出站相关的回调接口。
- 重构 freight_rpa_report_config_service,支持入站与出站报表配置的管理。
- 更新 ORM 模型,增加出站报表相关的持久化模型。
- 统一命名规范,确保在手、入站与出站的概念一致性。
This commit is contained in:
hugo committed 2026-10-19 18:45:16 +08:00
1 parent 39fe3c05f2
commit 911afa0f73
152 files changed
+9861 -2984

No files matched your search

+22 -8
View File
@@ -5,7 +5,7 @@ backend/app/services/schedule/job_options.py
依赖:models.Agent、shipping_notice.onhand_source_repository。
逻辑:api/schedule/platform_tasks.py options 接口与 job_params 选项范围校验调用;
前端只认识 options_source 字符串,不感知数据来自哪张表/哪个配置文件。
货代 RPA 注册键为 freight_rpa_sources 与 freight_rpa_inbound_sources。
货代 RPA 注册键为 freight_rpa_sources、freight_rpa_inbound_sources 与 freight_rpa_outbound_sources。
"""
from __future__ import annotations
@@ -34,8 +34,8 @@ def _agent_apps_options() -> list[dict[str, Any]]:
]
def _shipping_inventory_sources_options() -> list[dict[str, Any]]:
"""启用中的货代库存源(value=source_code,来自数据库主数据)。"""
def _freight_rpa_sources_options() -> list[dict[str, Any]]:
"""启用中的货代来源站点(value=source_code,来自数据库主数据;供 onhand 排程选源)。"""
from app.services.shipping_notice.onhand_source_repository import list_database_inventory_sources
return [
@@ -52,8 +52,8 @@ def _shipping_inventory_sources_options() -> list[dict[str, Any]]:
]
def _shipping_receipt_sources_options() -> list[dict[str, Any]]:
"""已启用且已配置收料报表的站点,供独立收料排程选择。"""
def _freight_rpa_inbound_sources_options() -> list[dict[str, Any]]:
"""已启用且已配置入站报表的站点,供独立入站排程选择。"""
from app.models import FreightRpaSource, FreightRpaInboundReportConfig
rows = db.session.query(FreightRpaSource, FreightRpaInboundReportConfig).join(
@@ -61,7 +61,20 @@ def _shipping_receipt_sources_options() -> list[dict[str, Any]]:
).filter(FreightRpaSource.enabled.is_(True)).all()
return [{
'label': source.display_name or source.source_code, 'value': source.source_code,
'description': f'{source.connector_type} · 收料已配置',
'description': f'{source.connector_type} · 入站已配置',
} for source, _config in rows]
def _freight_rpa_outbound_sources_options() -> list[dict[str, Any]]:
"""已启用且已配置出站报表的站点,供独立出站排程选择。"""
from app.models import FreightRpaSource, FreightRpaOutboundReportConfig
rows = db.session.query(FreightRpaSource, FreightRpaOutboundReportConfig).join(
FreightRpaOutboundReportConfig, FreightRpaOutboundReportConfig.source_id == FreightRpaSource.id,
).filter(FreightRpaSource.enabled.is_(True)).all()
return [{
'label': source.display_name or source.source_code, 'value': source.source_code,
'description': f'{source.connector_type} · 出站已配置',
} for source, _config in rows]
@@ -102,8 +115,9 @@ def _users_options() -> list[dict[str, Any]]:
# options_source 注册表:新增来源只需在此登记 provider,不动 API 层
_OPTIONS_PROVIDERS: dict[str, Callable[[], list[dict[str, Any]]]] = {
"agent_apps": _agent_apps_options,
"freight_rpa_sources": _shipping_inventory_sources_options,
"freight_rpa_inbound_sources": _shipping_receipt_sources_options,
"freight_rpa_sources": _freight_rpa_sources_options,
"freight_rpa_inbound_sources": _freight_rpa_inbound_sources_options,
"freight_rpa_outbound_sources": _freight_rpa_outbound_sources_options,
"hxops_users": _hxops_users_options,
"users": _users_options,
}