feat(shipping-notice): 落地 XFA 拆分、版面签名、统一进度与处理域履约

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hugoandCursor committed 2026-08-06 10:18:37 +08:00
1 parent 3a9fbac2fc
commit d2b3d74def
571 files changed
+78064 -24681

No files matched your search

+10 -10
View File
@@ -29,9 +29,9 @@ def pytest_configure(config):
@pytest.fixture(autouse=True)
def _capture_legacy_order_rows_for_tests(monkeypatch):
"""将旧测试夹具的 lines_json 参数暂存为动态订单输入,生产模型不保留该属性。"""
from app.models import ShippingTask
from app.models import ShippingNotice
original_init = ShippingTask.__init__
original_init = ShippingNotice.__init__
legacy_headers = ('customer_name', 'customer_code', 'ship_to', 'po_number', 'required_date')
def _init(self, **kwargs):
@@ -44,11 +44,11 @@ def _capture_legacy_order_rows_for_tests(monkeypatch):
for key, value in header_values.items():
setattr(self, f'_test_{key}', value)
monkeypatch.setattr(ShippingTask, '__init__', _init)
monkeypatch.setattr(ShippingNotice, '__init__', _init)
for key in (*legacy_headers, 'lines_json'):
storage = f'_test_{key}' if key != 'lines_json' else '_test_order_rows'
monkeypatch.setattr(
ShippingTask,
ShippingNotice,
key,
property(
lambda task, name=storage: getattr(task, name, None),
@@ -189,11 +189,11 @@ def _shipping_test_default_destination(monkeypatch, request):
def seed_task_inventory_source(
task: "ShippingTask",
task: "ShippingNotice",
*,
source_code: str = "DSV360_AWSDU",
) -> None:
"""测试辅助:为直接构造的 ShippingTask 写入稳定库存源独立字段。"""
"""测试辅助:为直接构造的 ShippingNotice 写入稳定库存源独立字段。"""
_ensure_test_task_dynamic_order(task)
from app.services.shipping_notice.inventory_source_rules import (
compute_routing_fingerprint,
@@ -225,7 +225,7 @@ def seed_task_inventory_source(
task.inventory_routing_fingerprint = compute_routing_fingerprint(extract_routing_context(task))
def _ensure_test_task_dynamic_order(task: "ShippingTask") -> None:
def _ensure_test_task_dynamic_order(task: "ShippingNotice") -> None:
"""将 RPA 测试显式构造的旧行样例转换为当前测试所需的动态 FieldValue。"""
from decimal import Decimal
@@ -304,7 +304,7 @@ def _ensure_test_task_dynamic_order(task: "ShippingTask") -> None:
def seed_rpa_inventory_trigger(
task: "ShippingTask",
task: "ShippingNotice",
*,
run_no: str = "RUN-TEST-001",
trigger_path: str | None = None,
@@ -364,7 +364,7 @@ def inventory_csv_with_warehouse(
return buf
def batch_rpa_item_identity(task: "ShippingTask") -> dict[str, str]:
def batch_rpa_item_identity(task: "ShippingNotice") -> dict[str, str]:
"""构造 batch 成功回调 item 须携带的 Source/Warehouse 身份字段。"""
return {
"source_code": str(task.inventory_source_code or ""),
@@ -388,7 +388,7 @@ def scheduled_rpa_batch_item(source_code: str, **overrides) -> dict[str, str]:
def rpa_callback_payload(
task: "ShippingTask",
task: "ShippingNotice",
file_path: str | Path,
*,
run_no: str = "RUN-TEST-001",