feat(freight-rpa): 库存/收料改名在手/入站,报表归属RPA,类名统一FreightRpa

把 shipping 侧 inventory/receipt 词根迁到 onhand/inbound,29 张表与
枚举/权限/前端/i18n 同步改名;在手与入站报表配置及文件改由 freight_rpa
持有,发货与调拨仅按 source_code 消费;ORM 类加 FreightRpa 前缀,
上传动作改为 freight_rpa_upload。含类名与上传动作改名规格文档。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hugoandCursor committed 2026-10-19 10:46:06 +08:00
1 parent ffc0d4a430
commit 39fe3c05f2
453 files changed
+17945 -8646

No files matched your search

+11 -11
View File
@@ -186,13 +186,13 @@ def requery_items_api(matching_no: str):
@in_transit_transfer_bp.route("/sources/inbound-files", methods=["POST"])
@require_transfer_permission
def download_source_inbound_files_api():
"""按选中来源打包下载各自最新归档入站文件(ShippingReceiptReport RPA 产物,zip);记录访问审计。"""
"""按选中来源打包下载各自最新归档入站文件(ShippingInboundReport RPA 产物,zip);记录访问审计。"""
import io
import zipfile
from pathlib import Path as _Path
from app import db
from app.models import ShippingReceiptReportFile
from app.models import FreightRpaInboundReportFile
from app.services.file_assets.storage import file_asset_storage
from app.services.in_transit_transfer.audit import build_transfer_audit_event
from app.services.in_transit_transfer.inbound_file_gate import usable_inbound_file_condition
@@ -210,15 +210,15 @@ def download_source_inbound_files_api():
if not code:
continue
report = (
ShippingReceiptReportFile.query
.join(ShippingReceiptReportFile.unit_run)
FreightRpaInboundReportFile.query
.join(FreightRpaInboundReportFile.unit_run)
.filter(
ShippingReceiptReportFile.unit_run.has(source_code=code),
FreightRpaInboundReportFile.unit_run.has(source_code=code),
# 可用门禁(未清理 + 当天业务日抓取 + 未过保留期)与徽标/匹配取文件同口径,
# 单一事实来源见 inbound_file_gate。
usable_inbound_file_condition(),
)
.order_by(ShippingReceiptReportFile.created_at.desc(), ShippingReceiptReportFile.id.desc())
.order_by(FreightRpaInboundReportFile.created_at.desc(), FreightRpaInboundReportFile.id.desc())
.first()
)
if report is None:
@@ -761,11 +761,11 @@ def transfer_sources_api():
供前端门禁(无 ready 文件时禁止确认匹配)与状态标识;保留期已到或非当天
(业务日)抓取且未清理均投影 expired。只读复用已启用库存来源。
"""
from app.models import ShippingInventorySource
from app.models import FreightRpaSource
from app.services.in_transit_transfer.source_file_status import resolve_source_file_status
rows = ShippingInventorySource.query.filter_by(enabled=True).order_by(
ShippingInventorySource.connector_type, ShippingInventorySource.source_code,
rows = FreightRpaSource.query.filter_by(enabled=True).order_by(
FreightRpaSource.connector_type, FreightRpaSource.source_code,
).all()
return _ok([
{
@@ -782,7 +782,7 @@ def transfer_sources_api():
@in_transit_transfer_bp.route("/sources/<source_code>/retry-rpa", methods=["POST"])
@require_transfer_permission
def retry_source_rpa_api(source_code: str):
"""对指定来源重新触发一次入站 RPA 抓取(复用货代 ShippingReceiptReport trigger 链路,shipping_notice 域术语保留)。
"""对指定来源重新触发一次入站 RPA 抓取(复用货代 ShippingInboundReport trigger 链路,shipping_notice 域术语保留)。
【AI 触发时机】来源入站文件不可用需要恢复时调用:解析失败(parse_failed)先
本地重解析已归档文件;文件缺失/失效(none/expired/failed)才重新触发 RPA 抓取。
@@ -847,7 +847,7 @@ def retry_sources_rpa_batch_api():
【AI 触发时机】聊天侧「批量重试 RPA」按钮提交多个来源编码时调用;
逐来源调用单来源端点会产生 N 个 trigger 文件,Worker 每文件开/关一次浏览器;
合并单文件后 Worker 单次登录串行导出全部来源(与 ShippingReceiptReport RPA 排程路径同效率)。
合并单文件后 Worker 单次登录串行导出全部来源(与 ShippingInboundReport RPA 排程路径同效率)。
请求体:{"source_codes": ["DSV360_AWSBI", ...]}。逐来源解析失败分层与
fail-closed 语义同单来源端点;单源配置缺失跳过并记录,不阻断其余来源。