feat(shipping-notice): 新增通用解析能力,优化性能并清理遗留废弃代码

This commit is contained in:
hugo committed 2026-08-23 00:27:18 +08:00
1 parent 935bf26fa6
commit 7cfd5d167e
230 files changed
+9337 -10989

No files matched your search

@@ -49,7 +49,7 @@ export function getPrimaryDocumentName(
/**
* 汇总正式 OT 任务文件数(不含 order_intake)。
* 核心逻辑:优先 summary.total_files;缺失时对 needs_action+processing+completed 的 file_count 求和。
* 核心逻辑:优先 summary.total_files;缺失时仅对 status_groups 的活动状态求和。
* @param projection - 会话 processing 投影
*/
export function resolveFormalTaskFileCount(
@@ -60,10 +60,12 @@ export function resolveFormalTaskFileCount(
if (Number.isFinite(fromSummary) && fromSummary >= 0 && projection.summary?.total_files != null) {
return fromSummary;
}
const groups = projection.status_groups;
const tasks = [
...(projection.needs_action || []),
...(projection.processing || []),
...(projection.completed || []),
...(groups?.failed || []),
...(groups?.waiting_human || []),
...(groups?.processing || []),
...(groups?.completed || []),
];
return tasks.reduce((sum, task) => {
const count = Number(task.file_count);
@@ -83,10 +85,13 @@ export function resolveFormalTaskCount(
if (Number.isFinite(fromSummary) && fromSummary >= 0 && projection.summary?.total_tasks != null) {
return fromSummary;
}
const groups = projection.status_groups;
return (
(projection.needs_action?.length || 0)
+ (projection.processing?.length || 0)
+ (projection.completed?.length || 0)
+ (projection.history?.length || 0)
(groups?.failed.length || 0)
+ (groups?.waiting_human.length || 0)
+ (groups?.processing.length || 0)
+ (groups?.completed.length || 0)
+ (groups?.cancelled.length || 0)
+ (groups?.archived.length || 0)
);
}