diff --git a/src/main/ipc/validation-handler.ts b/src/main/ipc/validation-handler.ts index 80d3f82..7cca723 100644 --- a/src/main/ipc/validation-handler.ts +++ b/src/main/ipc/validation-handler.ts @@ -291,12 +291,38 @@ export function registerValidationHandlers(): void { sourceNumbers = await getSourceNumbersFromInputs(sharedIds, dbService) log.info(`Got ${sourceNumbers.length} source numbers from shared Production IDs`) + + // Check if we got any order numbers from the shared Production IDs + if (sourceNumbers.length === 0) { + return { + success: false, + error: '共享的 Production ID 没有找到对应的订单数据。请确保在数据提取页面输入了有效的 Production ID 并成功获取了订单数据。', + stats: { + totalRecords: 0, + matchedCount: 0, + markedCount: 0 + } + } + } } else if (request.productionIdFile) { // Read from file const inputs = readProductionIds(request.productionIdFile) log.info(`Read ${inputs.length} inputs from file`) sourceNumbers = await getSourceNumbersFromInputs(inputs, dbService) log.info(`Got ${sourceNumbers.length} source numbers`) + + // Check if we got any order numbers from the file + if (sourceNumbers.length === 0) { + return { + success: false, + error: '文件中的 Production ID 没有找到对应的订单数据。请检查 Production ID 是否正确,或确保数据库中有对应的订单数据。', + stats: { + totalRecords: 0, + matchedCount: 0, + markedCount: 0 + } + } + } } } @@ -316,7 +342,7 @@ export function registerValidationHandlers(): void { if (materialRecords.length === 0) { return { success: false, - error: 'No material records found', + error: '未找到物料记录。请检查数据库中是否有对应订单的物料数据。', stats: { totalRecords: 0, matchedCount: 0,