feat(in-transit-transfer): inbound/outbound 幂等重命名与解析用途分层
- receipt→inbound 三件套改名(回调桥/文件门禁/触发服务),回调链幂等去重,迁移 tt14 同步台账键与测试基建 - 库存解析用途分层 onhand/inbound/outbound(迁移 tt15):解析档案、文件存储与下载名按用途隔离,管理端表单同步 - 「成熟」概念退役(迁移 tt16):数据无成熟属性,日期边界由调用方入参严格判定 - backlog 新增重解析服务,在途重识别投影 processing,EML 父项不再停留处理中 - 收料 RPA 回调/归档/排程链路同步改名挂点,运维脚本复位假完成状态 - 文档随批:ADR 0003 模块边界决策、10-15/10-16 计划与设计、调拨文档族与 demand/tec/funclist - 同步 chat/errors 文案四语言、调拨前端卡片与 e2e、测试全家
This commit is contained in:
1 parent
43dceaf027
commit
8102a1fe44
151 files changed
+8057
-2382
No files matched your search
@@ -1,7 +1,8 @@
|
||||
"""
|
||||
services/shipping_notice/inventory_file_store.py
|
||||
|
||||
用途:管理货代发货任务库存快照文件、任务 link 与解析结果投影。
|
||||
用途:管理货代发货任务库存快照文件、任务 link 与解析结果投影;构造下载展示名
|
||||
(build_inventory_download_name:企微压缩包短名规则 + exported_at 数据截止时间点)。
|
||||
依赖:models.ShippingInventoryFile/ShippingTaskInventoryLink、inventory_snapshot、export._storage_root。
|
||||
逻辑:inventory_workflow 上传或解析库存时写入库存快照(Link 挂在正式 OT);
|
||||
fulfillment_workflow / Excel 导出经 resolve_inventory_lines_for_execution:
|
||||
@@ -15,6 +16,7 @@ import re
|
||||
import hashlib
|
||||
import shutil
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
@@ -190,10 +192,88 @@ def resolve_task_inventory_download(task: ShippingNotice) -> tuple[Path, str] |
|
||||
path = Path(storage_path).resolve()
|
||||
if not path.is_file():
|
||||
return None
|
||||
filename = str(inv_file.source_file_name or f'{inv_file.inventory_file_no}{path.suffix or ".xlsx"}').strip()
|
||||
filename = build_inventory_download_name(
|
||||
inv_file, source_file_name=inv_file.source_file_name, path=path,
|
||||
)
|
||||
return path, filename
|
||||
|
||||
|
||||
_DOWNLOAD_SEQ_PREFIX_RE = re.compile(r'^(\d{1,4})_')
|
||||
_DOWNLOAD_RUN_TS_RE = re.compile(r'RUN(\d{8,14})')
|
||||
# 规范名形态:{seq}_{source}_{warehouse}_{12位时间}.<后缀>。source/warehouse 为单 token
|
||||
# ([^_]+,\w 会把下划线吞进段里导致 worker 长名被误判为规范名);时间固定 12 位
|
||||
# (exported_at / rpa_run_no / mtime 三条回退路径均格式化为 %Y%m%d%H%M)。命中即原样返回。
|
||||
_DOWNLOAD_CANONICAL_RE = re.compile(r'^\d{1,4}_[^_]+_[^_]+_\d{12}\.[A-Za-z0-9]{3,5}$')
|
||||
_DOWNLOAD_NAME_SANITIZE_RE = re.compile(r'[^\w.\-]+')
|
||||
|
||||
|
||||
def build_inventory_download_name(
|
||||
inv_file: ShippingInventoryFile,
|
||||
*,
|
||||
source_file_name: str | None,
|
||||
path: Path | None = None,
|
||||
) -> str:
|
||||
"""构造库存快照的下载展示名:复用企微压缩包短名规则并附加数据截止时间点。
|
||||
|
||||
【AI 触发时机】:任务级/行级库存文件下载接口构造 download_name 时调用;
|
||||
上传、解析、匹配链路禁止使用——登记名 source_file_name 保持 worker 原始名作审计。
|
||||
|
||||
核心逻辑:目标格式 `{seq}_{source}_{warehouse}_{yyyyMMddHHmm}.xlsx`(seq 取 worker
|
||||
原名前缀,与企微压缩包内文件一一对应,取不到则省略);时间点取 exported_at
|
||||
(数据截止时刻),缺失时回退 rpa_run_no 内嵌 RUN 时间戳,再回退托管文件 mtime;
|
||||
warehouse 连续重复段去重(AWSDU_AWSDU → AWSDU);已是规范名或 source/warehouse
|
||||
信息不足时原样返回(幂等,禁止凭空造名)。
|
||||
|
||||
Args:
|
||||
inv_file: 库存快照行(source_code/warehouse_id/warehouse_code/exported_at/rpa_run_no)。
|
||||
source_file_name: worker 原始文件名(如 006_inventory_RUN…_DSV360_AWSDU_AWSDU_….xlsx)。
|
||||
path: 托管文件路径;exported_at 与 rpa_run_no 均缺失时用其 mtime 兜底时间点。
|
||||
|
||||
Returns:
|
||||
下载展示文件名;worker 原始名缺失时回退 inventory_file_no + 后缀(既有行为)。
|
||||
"""
|
||||
base = str(source_file_name or '').strip()
|
||||
if not base:
|
||||
suffix = Path(path or base).suffix or '.xlsx'
|
||||
return f'{inv_file.inventory_file_no}{suffix.lower()}'
|
||||
if _DOWNLOAD_CANONICAL_RE.match(base):
|
||||
return base
|
||||
seq_match = _DOWNLOAD_SEQ_PREFIX_RE.match(base)
|
||||
seq = f"{int(seq_match.group(1)):03d}" if seq_match else ''
|
||||
source = str(inv_file.source_code or '').strip()
|
||||
warehouse_candidates = [
|
||||
str(inv_file.warehouse_id or '').strip(),
|
||||
str(inv_file.warehouse_code or '').strip(),
|
||||
]
|
||||
warehouse = next((item for item in warehouse_candidates if item), '')
|
||||
timestamp = ''
|
||||
if inv_file.exported_at is not None:
|
||||
timestamp = inv_file.exported_at.strftime('%Y%m%d%H%M')
|
||||
if not timestamp:
|
||||
run_ts = _DOWNLOAD_RUN_TS_RE.search(str(inv_file.rpa_run_no or ''))
|
||||
if run_ts:
|
||||
timestamp = run_ts.group(1)[:12]
|
||||
if not timestamp and path is not None:
|
||||
try:
|
||||
timestamp = datetime.fromtimestamp(path.stat().st_mtime).strftime('%Y%m%d%H%M')
|
||||
except OSError:
|
||||
timestamp = ''
|
||||
parts = [part for part in (seq, source, warehouse, timestamp) if part]
|
||||
if not source or not warehouse or not timestamp or not parts:
|
||||
# source/warehouse/时间点任一缺失都不足以构造规范名,保持原名避免误导。
|
||||
return base
|
||||
sanitized = [_DOWNLOAD_NAME_SANITIZE_RE.sub('_', part).strip('_') for part in parts]
|
||||
# token 级连续重复去重(worker 曾把 site+warehouse 同值拼成 AWSDU_AWSDU):
|
||||
# 按下划线拆开折叠相邻重复段,同时覆盖段内与跨段重复。
|
||||
tokens: list[str] = []
|
||||
for part in sanitized:
|
||||
for token in part.split('_'):
|
||||
if token and (not tokens or tokens[-1] != token):
|
||||
tokens.append(token)
|
||||
suffix = Path(base).suffix or '.xlsx'
|
||||
return "_".join(tokens) + suffix.lower()
|
||||
|
||||
|
||||
def read_inventory_file_lines(inv_file: ShippingInventoryFile) -> tuple[list[dict[str, Any]], dict[str, Any]]:
|
||||
"""读取库存文件的唯一行事实;缓存为空时按已发布解析方案解析并固化到文件层。"""
|
||||
cached_rows = [
|
||||
|
||||
@@ -23,6 +23,7 @@ from app.models import (
|
||||
ShippingInventorySource,
|
||||
ShippingInventoryStructureAnalysis,
|
||||
ShippingOrderField,
|
||||
ShippingReceiptReportConfig,
|
||||
)
|
||||
|
||||
|
||||
@@ -56,9 +57,9 @@ def _required_catalog_field_ids(fields: dict[str, ShippingInventoryField]) -> se
|
||||
return match_ids | quantity_ids
|
||||
|
||||
|
||||
# 异动(movement)用途的定死字段端点与必需字段集(领域定死,不依赖库存字段目录)。
|
||||
# 入站(inbound)用途的定死字段端点与必需字段集(领域定死,不依赖库存字段目录)。
|
||||
def _required_movement_field_ids(definition: dict[str, Any]) -> set[str]:
|
||||
"""校验 movement 用途的解析定义只引用定死领域字段,且必需字段齐全。"""
|
||||
"""校验 inbound 用途的解析定义只引用定死领域字段,且必需字段齐全。"""
|
||||
from app.services.in_transit_transfer.movement_contract import MOVEMENT_FIELDS
|
||||
|
||||
movement_codes = {field.code for field in MOVEMENT_FIELDS}
|
||||
@@ -79,13 +80,13 @@ def _required_movement_field_ids(definition: dict[str, Any]) -> set[str]:
|
||||
return mapped_codes
|
||||
|
||||
|
||||
def _validate_definition(raw: Any, *, purpose: str = 'inventory') -> dict[str, Any]:
|
||||
def _validate_definition(raw: Any, *, purpose: str = 'onhand') -> dict[str, Any]:
|
||||
"""校验字段目录 ID 到来源表头的映射及订单明细匹配键,禁止自由脚本。
|
||||
|
||||
Args:
|
||||
raw: 解析定义对象。
|
||||
purpose: 'inventory'(沿用库存字段目录与 match_keys)或
|
||||
'movement'(端点用定死 MOVEMENT_FIELDS,无 match_keys)。
|
||||
purpose: 'onhand'/'outbound'(沿用库存字段目录与 match_keys)或
|
||||
'inbound'(端点用定死 MOVEMENT_FIELDS,无 match_keys)。
|
||||
"""
|
||||
if not isinstance(raw, dict):
|
||||
raise ValidationError('Parsing profile definition must be an object', code='SHIPPING.INVENTORY_PARSING_PROFILE_INVALID')
|
||||
@@ -98,7 +99,7 @@ def _validate_definition(raw: Any, *, purpose: str = 'inventory') -> dict[str, A
|
||||
if header_row_index is not None and (not isinstance(header_row_index, int) or header_row_index < 1):
|
||||
raise ValidationError('header_row_index is invalid', code='SHIPPING.INVENTORY_PARSING_PROFILE_INVALID')
|
||||
|
||||
if purpose == 'movement':
|
||||
if purpose == 'inbound':
|
||||
_required_movement_field_ids(raw)
|
||||
return {
|
||||
'sheet_name': str(raw.get('sheet_name') or '').strip() or None,
|
||||
@@ -232,8 +233,8 @@ def save_draft(data: dict[str, Any], *, actor_id: int | None, profile_id: int |
|
||||
next_version = int(db.session.query(func.max(ShippingInventoryParsingProfile.version)).filter_by(profile_code=code).scalar() or 0) + 1
|
||||
profile = ShippingInventoryParsingProfile(profile_code=code, version=next_version, created_by=actor_id)
|
||||
db.session.add(profile)
|
||||
purpose = str(data.get('purpose') or profile.purpose or 'inventory').strip().lower()
|
||||
if purpose not in {'inventory', 'movement'}:
|
||||
purpose = str(data.get('purpose') or profile.purpose or 'onhand').strip().lower()
|
||||
if purpose not in {'onhand', 'inbound', 'outbound'}:
|
||||
raise ValidationError('purpose is invalid', code='SHIPPING.INVENTORY_PARSING_PROFILE_INVALID')
|
||||
if profile_id and purpose != profile.purpose:
|
||||
raise ValidationError(
|
||||
@@ -289,13 +290,13 @@ def publish(profile_id: int, *, actor_id: int | None) -> dict[str, Any]:
|
||||
)
|
||||
from app.services.shipping_notice.order_schema import service as order_schema_service
|
||||
|
||||
# movement 用途无订单匹配键(端点为定死异动字段),跳过订单 Schema 契约校验;inventory 维持原约束。
|
||||
# inbound 用途无订单匹配键(端点为定死异动字段),跳过订单 Schema 契约校验;onhand/outbound 维持原约束。
|
||||
referenced_field_ids = {
|
||||
str(item.get('order_field_id') or '')
|
||||
for item in (profile.definition_json or {}).get('match_keys', [])
|
||||
if isinstance(item, dict)
|
||||
}
|
||||
if profile.purpose != 'movement':
|
||||
if profile.purpose != 'inbound':
|
||||
published_field_ids = {
|
||||
str(item.get('field_id') or '')
|
||||
for item in order_schema_service.get_published_contract().get('fields', [])
|
||||
@@ -315,13 +316,17 @@ def publish(profile_id: int, *, actor_id: int | None) -> dict[str, Any]:
|
||||
|
||||
|
||||
def retire(profile_id: int) -> dict[str, Any]:
|
||||
"""退役无库存源引用的 published Profile,避免使现有 Source 静默失效。"""
|
||||
"""退役无库存源/收料报表配置引用的 published Profile,避免使现有绑定静默失效。"""
|
||||
profile = db.session.get(ShippingInventoryParsingProfile, profile_id)
|
||||
if profile is None:
|
||||
raise NotFoundError('Parsing profile not found', code='SHIPPING.INVENTORY_PARSING_PROFILE_NOT_FOUND')
|
||||
if profile.status != 'published':
|
||||
raise ConflictError('Only published parsing profile can be retired', code='SHIPPING.INVENTORY_PARSING_PROFILE_RETIRE_INVALID')
|
||||
if ShippingInventorySource.query.filter_by(parsing_profile_id=profile.id).count():
|
||||
bound_sources = ShippingInventorySource.query.filter_by(parsing_profile_id=profile.id).count()
|
||||
# 收料报表配置(ShippingReceiptReportConfig)同样绑定解析 Profile:退役前必须一并核查,
|
||||
# 否则入站文件解析链(inbound purpose)会静默失去规则。
|
||||
bound_receipt_configs = ShippingReceiptReportConfig.query.filter_by(parsing_profile_id=profile.id).count()
|
||||
if bound_sources or bound_receipt_configs:
|
||||
raise ConflictError('Rebind inventory sources before retiring profile', code='SHIPPING.INVENTORY_PARSING_PROFILE_RETIRE_BLOCKED')
|
||||
profile.status = 'retired'
|
||||
db.session.commit()
|
||||
|
||||
@@ -453,7 +453,7 @@ def create_profile_draft(analysis_id: int, data: dict[str, Any], *, actor_id: in
|
||||
saved = inventory_parsing_profile.save_draft({
|
||||
'profile_code': data.get('profile_code'),
|
||||
'display_name': data.get('display_name'),
|
||||
# 用途随请求透传(缺省沿用既有草稿/默认 inventory):movement 草稿端点为定死领域字段。
|
||||
# 用途随请求透传(缺省沿用既有草稿/默认 onhand):inbound 草稿端点为定死领域字段。
|
||||
'purpose': data.get('purpose'),
|
||||
'file_format': analysis.file_format,
|
||||
'sample_analysis_id': analysis.id,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
通过收料回调桥推进在途调拨的 waiting_rpa_callback 来源任务(B3 接线);
|
||||
每笔终态回调回写 ScheduleRun 进度计数(对齐库存 inventory-batch-progress)。
|
||||
依赖:models(ShippingReceiptReportFile/ShippingReceiptRpaUnitRun)、file_asset_storage、
|
||||
audit_service、freight_receipt_rpa_finalize、in_transit_transfer.receipt_callback_bridge(惰性导入)、
|
||||
audit_service、freight_receipt_rpa_finalize、in_transit_transfer.inbound_callback_bridge(惰性导入)、
|
||||
in_transit_transfer.evidence_sync(惰性导入,仅 success 终态)。
|
||||
逻辑:success/empty/failed 三个终态分支各自 commit 后调用 _advance_transfer_source_job;
|
||||
empty 落库 error_code=no_receipt_data(对齐库存 no_inventory_data);
|
||||
@@ -70,8 +70,8 @@ def _advance_transfer_source_job(
|
||||
"""
|
||||
try:
|
||||
from app import db
|
||||
from app.services.in_transit_transfer.receipt_callback_bridge import advance_source_job_from_receipt_callback
|
||||
advanced = advance_source_job_from_receipt_callback(
|
||||
from app.services.in_transit_transfer.inbound_callback_bridge import advance_source_job_from_inbound_callback
|
||||
advanced = advance_source_job_from_inbound_callback(
|
||||
source_code=unit.source_code, file_no=file_no, file_sha256=file_sha256,
|
||||
callback_ok=ok, error_code=error_code, error_message=error_message,
|
||||
)
|
||||
|
||||
@@ -104,6 +104,9 @@ class _ConversationProjectionLoadContext:
|
||||
# 冻结选择计划中每个 Intake 的附件项(含已选/跳过状态),用于把尚未物化的
|
||||
# 「已选但未识别」附件展示出来,便于排查未识别原因。
|
||||
planned_attachments_by_intake_no: dict[str, list[dict[str, Any]]]
|
||||
# reparse_pending Case 且后继 Run 仍 queued/processing 的文档 id 集合;
|
||||
# EML 聚合叶子据此把在途重识别投影为 processing(与摘要 _status 同判词)。
|
||||
active_reparse_document_ids: set[int]
|
||||
prefetched_gate_attempts: list[ShippingProcessGateAttempt]
|
||||
read_cache: dict[str, Any]
|
||||
|
||||
@@ -346,12 +349,32 @@ def _conversation_projection_load_context(
|
||||
str(getattr(intake, 'source_type', '') or '').strip().lower() == 'eml'
|
||||
for intake in intakes
|
||||
)
|
||||
# [STEP] 在途重解析文档集:reparse_pending Case 的后继 Run 仍 queued/processing
|
||||
# 时系统正在重新识别该文件。EML 聚合叶子据此统一改判 processing,避免 Case
|
||||
# 被排除后退化成无入口 waiting_human(与摘要 _status 同判词,回归盲窗)。
|
||||
active_reparse_document_ids: set[int] = set()
|
||||
reparse_source_run_ids = {
|
||||
int(case.run_id)
|
||||
for case in read_cache['current_case_by_document_id'].values()
|
||||
if case.confirmed_task_id is None
|
||||
and case.run_id is not None
|
||||
and str(case.status or '').strip().lower() == 'reparse_pending'
|
||||
}
|
||||
if reparse_source_run_ids:
|
||||
for successor in ShippingOrderProcessingRun.query.filter(
|
||||
ShippingOrderProcessingRun.reparse_of_run_id.in_(reparse_source_run_ids),
|
||||
ShippingOrderProcessingRun.status.in_(('queued', 'processing')),
|
||||
).all():
|
||||
marker = (successor.input_snapshot_json or {}).get('review_reparse')
|
||||
if isinstance(marker, dict) and int(marker.get('document_id') or 0) > 0:
|
||||
active_reparse_document_ids.add(int(marker['document_id']))
|
||||
return _ConversationProjectionLoadContext(
|
||||
documents_by_intake_id=documents_by_intake_id,
|
||||
intakes_by_no={str(intake.intake_no): intake for intake in intakes},
|
||||
planned_attachments_by_intake_no=(
|
||||
_frozen_attachment_plan_by_intake(intake_ids) if has_eml_intake else {}
|
||||
),
|
||||
active_reparse_document_ids=active_reparse_document_ids,
|
||||
prefetched_gate_attempts=prefetched_gate_attempts,
|
||||
read_cache=read_cache,
|
||||
)
|
||||
@@ -2721,6 +2744,25 @@ def _eml_aggregate_document_children(
|
||||
summary['candidate_count'] = int(
|
||||
has_current_candidate
|
||||
)
|
||||
if (
|
||||
existing is None
|
||||
and load_context is not None
|
||||
and int(document.id) in load_context.active_reparse_document_ids
|
||||
):
|
||||
# [STEP] 重解析后继 Run 在途:该文档正在重新识别。无 OT 叶子按旧
|
||||
# Case/Unit 事实会退化成无入口 waiting_human(回归盲窗),这里与摘要
|
||||
# _status 同判词改判 processing,保留接收解析阶段入口、不下发任何动作。
|
||||
leaf.update({
|
||||
'status': 'processing',
|
||||
'stage': 'document_parsing',
|
||||
'user_status': 'running',
|
||||
'user_stage': 'document_parsing',
|
||||
'user_group': 'processing',
|
||||
'blocking_reason': None,
|
||||
'available_actions': [],
|
||||
'primary_action': None,
|
||||
'intake_parse_authorized': True,
|
||||
})
|
||||
leaf['source_summary'] = summary
|
||||
# 文件主动作保留 Case / Gate 已裁决的真实动作码。生命周期导航由
|
||||
# ui_state.lifecycle_entries 单独表达,不能为消除重复而篡改业务动作。
|
||||
@@ -4053,7 +4095,8 @@ def project_conversation_processing_summary(
|
||||
绑定的可复核 Candidate;不得用「Case 存在」或「文档上另有未绑定 Candidate」
|
||||
抬升 candidate_count / waiting_review→order_review。
|
||||
|
||||
开放 Case 的用户态须先认活跃 STP Job(queued/running → running),再认草稿
|
||||
开放 Case 的用户态须先认在途重解析后继 Run(reparse_pending → running),
|
||||
再认活跃 STP Job(queued/running → running),再认草稿
|
||||
can_auto_create+can_build 未超时(waiting_to_start → running),与工作台
|
||||
project_case_user_status 同源;不得仅因 Case 未确认就判 waiting_human。
|
||||
"""
|
||||
@@ -4310,6 +4353,39 @@ def project_conversation_processing_summary(
|
||||
)
|
||||
}
|
||||
|
||||
# [STEP] 开放 Case 的在途重解析探测:reparse_pending Case 的后继 Run
|
||||
# (reparse_of_run_id 指向源 Run)仍 queued/processing 时,系统正在重新识别
|
||||
# 该文件。摘要首屏禁止加载 Plan/Unit,故只按谱系列 + 快照标记判定,命中即判
|
||||
# processing(回归 2026-10-14 批次中心重解析盲窗:五阶段按钮全消 + 冻结待人工)。
|
||||
active_reparse_by_document_id: dict[int, str] = {}
|
||||
reparse_source_run_ids = {
|
||||
int(case.run_id)
|
||||
for case in current_case_by_document_id.values()
|
||||
if case.confirmed_task_id is None
|
||||
and case.run_id is not None
|
||||
and str(case.status or '').strip().lower() == 'reparse_pending'
|
||||
}
|
||||
if reparse_source_run_ids:
|
||||
for successor in (
|
||||
ShippingOrderProcessingRun.query.options(load_only(
|
||||
ShippingOrderProcessingRun.id,
|
||||
ShippingOrderProcessingRun.reparse_of_run_id,
|
||||
ShippingOrderProcessingRun.status,
|
||||
ShippingOrderProcessingRun.input_snapshot_json,
|
||||
)).filter(
|
||||
ShippingOrderProcessingRun.reparse_of_run_id.in_(reparse_source_run_ids),
|
||||
ShippingOrderProcessingRun.status.in_(('queued', 'processing')),
|
||||
).order_by(ShippingOrderProcessingRun.id.desc()).all()
|
||||
):
|
||||
marker = (successor.input_snapshot_json or {}).get('review_reparse')
|
||||
if not isinstance(marker, dict):
|
||||
continue
|
||||
reparse_document_id = int(marker.get('document_id') or 0)
|
||||
if reparse_document_id > 0:
|
||||
active_reparse_by_document_id.setdefault(
|
||||
reparse_document_id, str(successor.status or ''),
|
||||
)
|
||||
|
||||
# [STEP] 开放 Case 批量预取活跃 STP Job(与 full 会话投影同构前缀),
|
||||
# 供摘要 _status 在判 waiting_human 前与工作台同源认「系统仍在建单」。
|
||||
_OPEN_CASE_STATUSES_FOR_STP = {
|
||||
@@ -4446,6 +4522,10 @@ def project_conversation_processing_summary(
|
||||
if case is not None and case.confirmed_task_id is None and case_status in _OPEN_CASE_STATUSES_FOR_STP:
|
||||
# 活跃 STP 或 waiting_to_start = 系统仍在建单;与 project_case_user_status 对齐。
|
||||
doc_id = int(case.document_id) if case.document_id is not None else int(document.id)
|
||||
if doc_id in active_reparse_by_document_id:
|
||||
# 重解析后继 Run 在途(queued/processing):系统正在重新识别本文件,
|
||||
# 先于 STP/草稿判 running;终态由 finalize_document_reparse 收口改判。
|
||||
return 'running', 'document_parsing', None
|
||||
stp_status = active_stp_status_by_document_id.get(doc_id)
|
||||
if stp_status in {'queued', 'running'}:
|
||||
mapped = project_case_user_status(case, {'status': stp_status})
|
||||
@@ -4618,6 +4698,12 @@ def project_conversation_processing_summary(
|
||||
'variant': 'primary',
|
||||
'label_key': 'shipping.actions.open_order_review',
|
||||
}
|
||||
if int(document.id) in active_reparse_by_document_id:
|
||||
# 重解析在途:不下发任何动作(服务端幂等复用在途后继),但保留接收解析
|
||||
# 阶段入口,否则批次中心该行会退化成无五阶段按钮的 waiting_human。
|
||||
available_actions = []
|
||||
primary_action = None
|
||||
intake_parse_authorized = True
|
||||
leaf = {
|
||||
'work_item_type': 'order_task',
|
||||
'work_item_no': f'DOCUMENT:{document.id}',
|
||||
|
||||
Reference in new issue
Block a user