feat(shipping-notice): 人工重取库存前置候选刷新并放开行级库存源下拉

- 人工重试库存准备前置幂等重判:任务级整单重路由、行级定向重评目标行,复用裁决与冻结链路,零新动作码零契约变更
- 新版候选集 supersede 时内置失效旧库存事实,导出归档与查询服务同步适配
- 行级「库存源」下拉抽纯函数合并选项:歧义行候选置顶 + 全部已启用源去重兜底,任一已启用源可人工指定
- 库存源门禁归一 Notice→OT 身份解析;任务中心抽屉与表格接入行级重取入口
- 同步四语言文案、技术文档与实施计划
This commit is contained in:
hugo committed 2026-10-13 15:04:40 +08:00
1 parent e38e5a63fe
commit ea94fb28db
35 files changed
+2675 -83

No files matched your search

@@ -61,7 +61,11 @@ from app.services.shipping_notice.lifecycle_projection import (
LIFECYCLE_STAGES,
project_lifecycle,
)
from app.services.shipping_notice.query_service import resolve_task_export_download, serialize_task_summary
from app.services.shipping_notice.query_service import (
can_download_task_export,
resolve_task_export_download,
serialize_task_summary,
)
from app.services.shipping_notice.state_machine import (
UserMode,
)
@@ -1162,6 +1166,8 @@ def build_task_ui_state(
task: ShippingNotice,
*,
include_stage_context: bool = False,
viewer_user_id: int | None = None,
viewer_is_admin: bool = False,
) -> dict[str, Any]:
"""
构建单票任务 UI State。
@@ -1170,6 +1176,14 @@ def build_task_ui_state(
禁止 Chat、通知卡与任务中心分别推导状态;
可点击用户动作只由 Gate 与已验证 Artifact 授权产生。
Gate 摘要只查一次,再派生 position/user_mode,禁止再走 resolve_task_ui_state 二次查库。
Args:
task: 源任务实体。
include_stage_context: 是否附带 stage_context(工作面只读事实)。
viewer_user_id: 当前查看者;给定时时 download_excel 动作按导出统一谓词
(can_download_task_export:创建者或管理员)门禁下发;为 None 时维持
聊天链路旧口径(仅按 Artifact 授权,聊天会话与创建者同源)。
viewer_is_admin: 查看者是否平台管理员(配合 viewer_user_id 使用)。
"""
from app.services.shipping_notice.state_machine import (
_review_status_fallback_ui_state,
@@ -1210,7 +1224,12 @@ def build_task_ui_state(
# [AUTHORITY] Gate 负责当前可写恢复动作;Excel 下载是已产出文件的只读动作,
# 两者不能相互覆盖。即使当前 Gate 阻断并清空旧动作,也只在
# Artifact 已通过 resolve_task_export_download 校验时补入下载授权。
if resolve_task_export_download(task) is not None:
# 下载动作与导出端点消费同一谓词:viewer 已知时按创建者/管理员门禁,
# 避免非创建者"看得到点不动";viewer 未知(聊天链路)维持 Artifact 口径。
if resolve_task_export_download(task) is not None and (
viewer_user_id is None
or can_download_task_export(task, user_id=int(viewer_user_id), is_admin=viewer_is_admin)
):
download_action = _unified_action({
'id': 'download_excel',
'label': '下载 Excel',