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

+16 -16
View File
@@ -2,7 +2,7 @@
backend/tests/test_receipt_excel_empty.py
用途:收料 Excel「有表头无明细」判空回归;钉死标题行不得当表头。
依赖:openpyxl、scripts/freight_rpa/receipt/receipt_excel_empty。
依赖:openpyxl、scripts/freight_rpa/inbound/inbound_excel_empty。
逻辑:构造 DSV 标题+表头无数据簿;复制生产 drop 样例断言 empty。
"""
@@ -16,14 +16,14 @@ import pytest
from openpyxl import Workbook
_REPO_ROOT = Path(__file__).resolve().parents[2]
_RECEIPT_DIR = _REPO_ROOT / 'scripts' / 'freight_rpa' / 'receipt'
if str(_RECEIPT_DIR) not in sys.path:
sys.path.insert(0, str(_RECEIPT_DIR))
_INBOUND_DIR = _REPO_ROOT / 'scripts' / 'freight_rpa' / 'inbound'
if str(_INBOUND_DIR) not in sys.path:
sys.path.insert(0, str(_INBOUND_DIR))
from receipt_excel_empty import ( # noqa: E402
NoReceiptDataError,
enforce_receipt_excel_not_empty,
receipt_excel_has_detail_rows,
from inbound_excel_empty import ( # noqa: E402
NoInboundDataError,
enforce_inbound_excel_not_empty,
inbound_excel_has_detail_rows,
)
_DROP_SAMPLE = (
@@ -72,9 +72,9 @@ def test_title_row_must_not_count_as_detail(tmp_path: Path):
"""
path = tmp_path / 'header_only.xlsx'
_write_dsv_title_header_only(path)
assert receipt_excel_has_detail_rows(path) is False
with pytest.raises(NoReceiptDataError, match='no_receipt_data'):
enforce_receipt_excel_not_empty(path)
assert inbound_excel_has_detail_rows(path) is False
with pytest.raises(NoInboundDataError, match='no_receipt_data'):
enforce_inbound_excel_not_empty(path)
def test_header_plus_data_row_is_not_empty(tmp_path: Path):
@@ -88,8 +88,8 @@ def test_header_plus_data_row_is_not_empty(tmp_path: Path):
assert sheet is not None
sheet.append(['Well Trust', 'HOX1', '0001', 'O', 'KN', 'WB1', 'Inbound', 'Closed', '01/01/2026', '', '0010', 'CBIS', '', '', 'SKU-1'])
workbook.save(path)
assert receipt_excel_has_detail_rows(path) is True
enforce_receipt_excel_not_empty(path)
assert inbound_excel_has_detail_rows(path) is True
enforce_inbound_excel_not_empty(path)
@pytest.mark.skipif(not _DROP_SAMPLE.is_file(), reason='production drop sample not present')
@@ -101,6 +101,6 @@ def test_production_header_only_sample_is_empty(tmp_path: Path):
"""
target = tmp_path / _DROP_SAMPLE.name
shutil.copy2(_DROP_SAMPLE, target)
assert receipt_excel_has_detail_rows(target) is False
with pytest.raises(NoReceiptDataError, match='no_receipt_data'):
enforce_receipt_excel_not_empty(target)
assert inbound_excel_has_detail_rows(target) is False
with pytest.raises(NoInboundDataError, match='no_receipt_data'):
enforce_inbound_excel_not_empty(target)