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
@@ -548,10 +548,9 @@ def workspace_shipping_task_detail(task_no: str):
|
||||
task = get_task_visible_to_user(task_no, user.id, is_admin=is_admin)
|
||||
if not task:
|
||||
raise NotFoundError('Not found')
|
||||
return _ok({
|
||||
**serialize_task_detail(task, viewer_user_id=user.id, is_admin=is_admin),
|
||||
'ui_state': build_task_ui_state(task, include_stage_context=True),
|
||||
})
|
||||
return _ok(serialize_task_detail(
|
||||
task, viewer_user_id=user.id, is_admin=is_admin, include_stage_context=True,
|
||||
))
|
||||
|
||||
|
||||
@workspace_shipping_notice_bp.route('/shipping-tasks/<task_no>/audit-timeline', methods=['GET'])
|
||||
@@ -877,9 +876,43 @@ def workspace_mark_manual_uploaded(task_no: str):
|
||||
run_task_auto_progress(
|
||||
str(task.task_no), trigger='manual_upload_confirmed', operator_id=int(user.id),
|
||||
)
|
||||
# 终态兜底:确认上传必须收口正式 Execution Gate,不允许依赖 auto_progress/Job 链。
|
||||
_ensure_uploaded_execution_gates_closed(task, actor_id=int(user.id))
|
||||
return _ok(result)
|
||||
|
||||
|
||||
def _ensure_uploaded_execution_gates_closed(task: ShippingNotice, *, actor_id: int) -> None:
|
||||
"""人工确认上传(终态)后兜底收口正式 Execution 门禁,禁止依赖 auto_progress/Job 链。
|
||||
|
||||
核心逻辑:upload_manual_confirmed 是业务终态事实;只有把正式 Execution 的前置履约
|
||||
Gate 一并收口,批次中心/对话卡才不会因陈旧「库存不足」Gate 把阶段回退成「通知准备」。
|
||||
``auto_progress_enabled()`` 可能为 False(``run_task_auto_progress`` 提前返回),
|
||||
或 ``submit_auto_progress`` 存在活动 Job / 候选集等早退分支而跳过 sync,故此处兜底:
|
||||
仅当 Execution 尚未 completed 时显式同步(幂等,重复无害)。已 completed 时不重复处理,
|
||||
避免与 ``_active_execution_for_task`` 将 completed Execution 误判为可重建。
|
||||
|
||||
Args:
|
||||
task: 已确认人工上传的正式 ShippingNotice。
|
||||
actor_id: 触发确认的服务端用户主键。
|
||||
"""
|
||||
from app.services.shipping_notice.process_gate_bridge import (
|
||||
find_execution_for_task,
|
||||
sync_fulfillment_gates_from_task,
|
||||
)
|
||||
|
||||
execution = find_execution_for_task(task)
|
||||
if execution is None:
|
||||
return
|
||||
if str(getattr(execution, 'status', '') or '').strip().lower() == 'completed':
|
||||
return
|
||||
sync_fulfillment_gates_from_task(
|
||||
execution=execution,
|
||||
actor_type='user',
|
||||
actor_id=actor_id,
|
||||
)
|
||||
db.session.flush()
|
||||
|
||||
|
||||
def _confirm_notice_uploaded(*, business_no: str, user_id: int, artifact_id: int | None = None) -> dict[str, Any]:
|
||||
"""
|
||||
按发货通知单号确认唯一 Excel 已上传;内部 task_no 仅用于既有状态机和审计追溯。
|
||||
@@ -916,6 +949,8 @@ def _confirm_notice_uploaded(*, business_no: str, user_id: int, artifact_id: int
|
||||
run_task_auto_progress(
|
||||
str(task.task_no), trigger='manual_upload_confirmed', operator_id=user_id,
|
||||
)
|
||||
# 终态兜底:确认上传必须收口正式 Execution Gate,不允许依赖 auto_progress/Job 链。
|
||||
_ensure_uploaded_execution_gates_closed(task, actor_id=user_id)
|
||||
return {'business_no': str(task.business_no), **dict(result or {})}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user