fix(shipping-notice,admin-schedule,frontend): 修复发货通知与后台排程的业务bug并优化各模块功能
1. 后端发货通知模块:
清空重试任务旧状态避免残留,新增RPA进度回调接口
优化库存匹配性能,修复人工确认校验逻辑与登录弹窗遮挡问题
新增排程worker启动脚本,清理冗余环境配置与缓存查询开销
2. 前端后台排程模块:
新增任务key归一化工具兼容历史格式,修复参数表单隐藏问题
添加加载错误处理,更新多语言文案替换裸JSON占位符
This commit is contained in:
1 parent
1e5aedb9ed
commit
06c18b3c7c
81 files changed
+3301
-424
No files matched your search
@@ -222,6 +222,82 @@ def test_upload_to_freight_manual_confirm_does_not_hard_reject(app, monkeypatch)
|
||||
assert ok.get("forbidden_next_tools") in (None, [])
|
||||
|
||||
|
||||
def test_upload_to_freight_manual_confirm_ignores_inventory_source_stability(app, monkeypatch) -> None:
|
||||
"""回归锁:人工确认已上传不依赖库存源稳定性。
|
||||
|
||||
原缺陷:upload_to_freight 在 mode 分支之前统一做 is_inventory_source_stable 门禁,
|
||||
库存源未稳定(或冻结指纹/配置版本与运行时不一致)时 manual_confirm 被 failed 拦截,
|
||||
任务永远停在 manual_upload_handoff。修复后仅 auto/retry 路径校验库存源。
|
||||
"""
|
||||
with app.app_context():
|
||||
from app import db
|
||||
from types import SimpleNamespace
|
||||
|
||||
task = ShippingNotice(
|
||||
task_no="SN-STP-MANUAL-CFM-UNSTABLE",
|
||||
source_type="manual",
|
||||
export_file_path="/tmp/m.xlsx",
|
||||
export_file_name="m.xlsx",
|
||||
inventory_source_status="resolved",
|
||||
inventory_source_code="SRC1",
|
||||
inventory_connector_type="crane",
|
||||
inventory_source_config_version="stale-version",
|
||||
inventory_routing_fingerprint="stale-fingerprint",
|
||||
)
|
||||
db.session.add(task)
|
||||
db.session.commit()
|
||||
|
||||
attempt = SimpleNamespace(id=10, artifact_id=3, operator_id=42)
|
||||
|
||||
# 关键:模拟库存源确实不稳定(真实 is_inventory_source_stable 返回 False)。
|
||||
monkeypatch.setattr(
|
||||
"app.services.shipping_notice.fulfillment_workflow.is_inventory_source_stable",
|
||||
lambda _t: False,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"app.services.shipping_notice.fulfillment_workflow.customer_gate_tool_response",
|
||||
lambda *a, **k: None,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"app.services.shipping_notice.fulfillment_workflow.field_conflict_gate_response",
|
||||
lambda *a, **k: None,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"app.services.shipping_notice.fulfillment_workflow._reservation_gate_response",
|
||||
lambda *a, **k: None,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"app.services.shipping_notice.fulfillment_workflow._task_disposition_gate_response",
|
||||
lambda *a, **k: None,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"app.services.shipping_notice.fulfillment_workflow.record_manual_upload",
|
||||
lambda *a, **k: attempt,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"app.services.shipping_notice.fulfillment_audit.record_fulfillment_audit",
|
||||
lambda **k: None,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"app.services.shipping_notice.workflow_ledger_service.find_item_by_current_task_no",
|
||||
lambda **k: None,
|
||||
)
|
||||
|
||||
ok = upload_to_freight({
|
||||
"task_id": task.task_no,
|
||||
"mode": "manual_confirm",
|
||||
"operator_id": 42,
|
||||
"artifact_id": 3,
|
||||
})
|
||||
# 断言:库存源不稳定不得阻断人工确认登记。
|
||||
assert ok["status"] == "ok"
|
||||
|
||||
# 断言:RPA 路径仍受库存源门禁保护(行为不变)。
|
||||
rejected = upload_to_freight({"task_id": task.task_no, "mode": "retry_upload"})
|
||||
assert rejected["status"] == "failed"
|
||||
assert "库存源尚未确定" in str(rejected.get("message") or "")
|
||||
|
||||
|
||||
def test_upload_to_freight_manual_confirm_propagates_close_item_failure(app, monkeypatch) -> None:
|
||||
"""关键断言:绑定 WorkflowItem 关闭失败须向上抛出,不得吞异常后仍返回成功。"""
|
||||
with app.app_context():
|
||||
|
||||
Reference in new issue
Block a user