diff --git a/furniture-3d-system/src/server/services/oa-board-sync.service.ts b/furniture-3d-system/src/server/services/oa-board-sync.service.ts index dfd8d3e4..305c916d 100644 --- a/furniture-3d-system/src/server/services/oa-board-sync.service.ts +++ b/furniture-3d-system/src/server/services/oa-board-sync.service.ts @@ -1161,13 +1161,18 @@ function isNewerSourceTaskRow(nextRow: SourceTaskRow, currentRow: SourceTaskRow) if (nextValue.createdAt !== currentValue.createdAt) { return nextValue.createdAt > currentValue.createdAt } + // 同一任务的状态变更沿用原创建时间,源表自增 ID 才能区分最新日志。 + // 例如退回后写入的 CANCELED 必须覆盖此前的 RUNNING。 + if (nextValue.rowId !== currentValue.rowId) { + return nextValue.rowId > currentValue.rowId + } if (nextValue.statusPriority !== currentValue.statusPriority) { return nextValue.statusPriority > currentValue.statusPriority } if (nextValue.resultPriority !== currentValue.resultPriority) { return nextValue.resultPriority > currentValue.resultPriority } - return nextValue.rowId > currentValue.rowId + return false } function buildTaskRecordsWithMappings(