feat(shipping-notice): 收敛复核状态隔离、STP 重试幂等与 XFA 合成预览标注

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hugoandCursor committed 2026-08-07 02:58:28 +08:00
1 parent 84a881b554
commit 74270adc22
149 files changed
+20111 -3871

No files matched your search

@@ -191,19 +191,46 @@ export function buildProgressRangeHint(
}
/**
* 构建订单处理工作台五域摘要(默认紧凑条用,非完整 15 阶)。
* 构建订单处理工作台五域摘要(压缩业务域一行)。
*
* 核心逻辑:当前索引落在域内 → current/blocked/failed;整域已过 → passed;否则 pending。
* 核心逻辑:若传入 authoritativeNodes(来自 projection.stageNodes),仅据此聚合,禁止第二套启发式;
* 未传时回退当前 stage 索引(兼容详情抽屉等非工作台主条场景)。
*
* @param projection - 统一投影
* @param authoritativeNodes - 可选权威 15 阶节点(工作台主条必须传入)
*/
export function buildReviewProgressDomainSummary(
projection: ShippingProcessingProjection | null | undefined,
authoritativeNodes?: Array<{ absoluteIndex: number; status: ShippingProcessingStageNodeStatus }> | null,
): ProgressDomainSummaryItem[] {
if (!projection) return [];
const currentIndex = stageAbsoluteIndex(projection.stage);
const statusNorm = String(projection.status || '').trim().toLowerCase();
return REVIEW_PROGRESS_DOMAIN_RANGES.map((domain) => {
let state: ProgressDomainState = 'pending';
if (currentIndex > domain.end) {
if (authoritativeNodes?.length) {
// [STEP] 仅由权威节点聚合:域内含 blocked/failed → 对应态;含 running/当前阶 → current;全 passed/skipped → passed。
const slice = authoritativeNodes.filter(
(node) => node.absoluteIndex >= domain.start && node.absoluteIndex <= domain.end,
);
if (slice.some((node) => node.status === 'failed')) {
state = 'failed';
} else if (slice.some((node) => node.status === 'blocked')) {
state = 'blocked';
} else if (
slice.some((node) => node.status === 'running')
|| (currentIndex >= domain.start && currentIndex <= domain.end)
) {
state = 'current';
} else if (
slice.length > 0
&& slice.every((node) => node.status === 'passed' || node.status === 'skipped')
) {
state = 'passed';
} else if (currentIndex > domain.end) {
state = 'passed';
}
} else if (currentIndex > domain.end) {
state = 'passed';
} else if (currentIndex >= domain.start && currentIndex <= domain.end) {
if (statusNorm === 'failed' || statusNorm === 'cancelled') state = 'failed';