fix(extractor): track per-order RecordCount in operation history
Previously updateBatchStatus wrote the batch-level total recordCount to every row, causing the detail view to show misleading identical counts. Now mergeFiles collects per-order material counts, the handler writes each order's count individually via updateRecordStatus, and batch aggregation uses SUM instead of MAX for accurate totals. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -256,7 +256,14 @@ export function registerExtractorHandlers(): void {
|
||||
: result.errors.length > 0
|
||||
? 'failed'
|
||||
: 'success'
|
||||
await historyDao.updateBatchStatus(batchId, status, result.recordCount)
|
||||
|
||||
// Write per-order record counts
|
||||
for (const { orderNumber, recordCount } of result.orderRecordCounts) {
|
||||
await historyDao.updateRecordStatus(batchId, orderNumber, status, undefined, recordCount)
|
||||
}
|
||||
|
||||
// Update batch status without recordCount (per-order counts are set individually)
|
||||
await historyDao.updateBatchStatus(batchId, status)
|
||||
log.info('Operation history batch status updated', { batchId, status })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user