feat(shipping-notice): 新增发货通知自动上传功能与候选资格评估

- 在环境配置中新增 SHIPPING_NOTICE_AUTO_UPLOAD_ENABLED 选项,默认关闭,需显式开启以支持自动上传。
- 引入新的 pytest.ini 文件,增加测试标记以支持自动化测试。
- 删除不再使用的 seed_shipping_notice_agents.py 文件,简化代码库。
- 更新相关 API,增强发货通知与候选资格评估功能,支持多种筛选条件。
- 增强文档与代码注释,反映新的业务逻辑与功能要求。
This commit is contained in:
hugo committed 2026-08-02 19:26:35 +08:00
1 parent cef3d5b26a
commit 3a9fbac2fc
226 files changed
+25010 -2098

No files matched your search

@@ -5,7 +5,8 @@ services/shipping_notice/ui_state.py
依赖:models.ShippingTask/ShippingBatch、state_machine、query_service、constants、stp_progress_contract、
process_gate_projection(统一 Gate 用户摘要)。
逻辑:从 ShippingTask DB 字段经状态机解析 checkpoint/checkpoint_kind/action_buttons,
再补充七步流程与可解释 summary(当前待办、暂停原因、下一自动步骤、操作入口、stp_facts);
再补充七步流程与可解释 summary(当前待办、暂停原因、下一自动步骤、操作入口、
stp_facts、progress_nodes);
若存在 ProcessExecution:阻断时清空 action_buttons;非阻断时仅保留
download_excel / mark_manual_uploaded / refresh(恢复动作仅由 process_gate 驱动);
批次 UI 仅作会话上传集合摘要,不作为履约写操作面。
@@ -462,7 +463,8 @@ def _build_task_summary(
输出可解释任务摘要,供通知卡、人工复核与任务工作台同源消费。
核心逻辑:保留 title/message/issues;补充 stage、checkpoint_kind、current_todo、
pause_reason、next_auto_step、event_at、entry_surface、allowed_actions、stp_facts。
pause_reason、next_auto_step、event_at、entry_surface、allowed_actions、stp_facts、
progress_nodes(固定节点顺序,禁止前端算百分比)。
"""
title = user_facing_task_stage(task)
message_by_checkpoint: dict[str, str] = {
@@ -541,6 +543,10 @@ def _build_task_summary(
}
if stp_facts is not None:
summary['stp_facts'] = stp_facts
# [STEP] 对话侧固定节点梯;前端只渲染 status,不自行推导百分比。
from app.services.shipping_notice.stp_progress_contract import project_task_progress_nodes
summary['progress_nodes'] = project_task_progress_nodes(task)
return summary
@@ -614,9 +620,16 @@ def _process_gate_user_summary_for_task(task: ShippingTask) -> dict[str, Any] |
from app.models import ShippingProcessExecution
from app.services.shipping_notice.process_gate_projection import project_user_gate_summary
task_id = getattr(task, 'id', None)
if task_id is None:
return None
try:
task_pk = int(task_id)
except (TypeError, ValueError):
return None
execution = (
ShippingProcessExecution.query
.filter_by(task_id=int(task.id))
.filter_by(task_id=task_pk)
.order_by(ShippingProcessExecution.id.desc())
.first()
)