feat(shipping-notice): 库存缺口料号兜底自动放行并新增料号可用量列
- 匹配器按料号二次汇总 part_available_qty 随行级匹配事实持久化(新列,迁移 0a575f3a) - 缺口行料号总库存满足需求时系统自动放行,复用人工放行同一落库/审计/门禁链路,证据按预约优先→料号兜底自动带出 - 前端库存匹配表原「可用数量」列改为「预约数量」,其后新增「可用数量」(料号总库存)列 - DSV 连接器防误点「忘记密码」链接并参数化料号报表取数,库存 worker 按料号查询配套 - 收料就绪与来源状态联动调整;casdoor 未识别认证错误日志保留原始异常堆栈 - 同步门禁/投影/持久化测试、调拨卡片文案四语言与文档
This commit is contained in:
1 parent
4e97553f42
commit
386f93108c
62 files changed
+4000
-219
No files matched your search
@@ -459,6 +459,56 @@ def test_refresh_pointers_keeps_invalidated_when_downstream_still_passed(gate_ex
|
||||
assert gate_execution.status == 'blocked'
|
||||
|
||||
|
||||
def test_refresh_pointers_bumps_task_progress_version_without_notice(gate_execution):
|
||||
"""无 Notice 绑定时 Gate 指针事实变化必须递增 OT progress_version。
|
||||
|
||||
复现:通知准备/库存匹配阶段 Notice 尚未生成,历史实现只回填 stage、不推进版本;
|
||||
统一投影 progress_version 冻结导致工作台 [REFRESH_ON_CHANGE] 永不重拉任务详情,
|
||||
RPA 重取成功后行级可用数量/缺口停留在旧快照(界面显示「库存文件未准备」)。
|
||||
"""
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from app.services.shipping_notice import process_gate_service
|
||||
|
||||
task = db.session.get(ShippingOrderTask, int(gate_execution.task_id))
|
||||
version_before = int(task.progress_version or 1)
|
||||
|
||||
now = datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
for gate in ShippingProcessGate.query.filter_by(execution_id=int(gate_execution.id)).all():
|
||||
if gate.gate_code in {
|
||||
'document_materialization', 'layout_parsing', 'document_profile_routing',
|
||||
'order_field_extraction', 'field_completeness', 'reservation_validation',
|
||||
'customer_resolution', 'duplicate_detection', 'field_conflict_resolution',
|
||||
'task_creation', 'order_freeze_readiness', 'inventory_source_routing',
|
||||
'inventory_preparation', 'inventory_field_mapping', 'inventory_matching',
|
||||
}:
|
||||
gate.status = 'passed'
|
||||
gate.passed_at = now
|
||||
elif gate.gate_code == 'inventory_sufficiency':
|
||||
gate.status = 'blocked_manual'
|
||||
gate.blocking_reason_code = 'inventory_shortage_review_required'
|
||||
gate.next_action_code = 'open_shortage_review'
|
||||
elif gate.gate_code == 'excel_readiness':
|
||||
gate.status = 'blocked_manual'
|
||||
gate.blocking_reason_code = 'excel_not_ready'
|
||||
# 其余保持 pending
|
||||
db.session.flush()
|
||||
|
||||
process_gate_service._refresh_execution_pointers(gate_execution)
|
||||
db.session.flush()
|
||||
|
||||
# 关键断言:缺口落定属于真实事实变化,无 Notice 也必须经中央写入口推进版本。
|
||||
assert gate_execution.current_gate_code == 'inventory_sufficiency'
|
||||
assert gate_execution.status == 'blocked'
|
||||
assert int(task.progress_version or 1) == version_before + 1
|
||||
|
||||
process_gate_service._refresh_execution_pointers(gate_execution)
|
||||
db.session.flush()
|
||||
|
||||
# 关键断言:事实未变的重复刷新不得递增版本,避免轮询期被放大成详情刷新风暴。
|
||||
assert int(task.progress_version or 1) == version_before + 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user