From 32931cecad536a2bb7a0981e8797d514242c406b Mon Sep 17 00:00:00 2001 From: Misaka_Company Date: Mon, 13 Apr 2026 12:35:31 +0800 Subject: [PATCH] style: format changed files with prettier Co-Authored-By: Claude Opus 4.6 --- src/main/ipc/cleaner-history-handler.ts | 14 +- .../cleaner/cleaner-application-service.ts | 3 +- .../database/cleaner-operation-history-dao.ts | 11 +- src/preload/api/cleaner.ts | 11 +- .../CleanerOperationHistoryModal.tsx | 305 +++++++++--------- 5 files changed, 180 insertions(+), 164 deletions(-) diff --git a/src/main/ipc/cleaner-history-handler.ts b/src/main/ipc/cleaner-history-handler.ts index e04142c..e1bd8d6 100644 --- a/src/main/ipc/cleaner-history-handler.ts +++ b/src/main/ipc/cleaner-history-handler.ts @@ -64,7 +64,12 @@ export function registerCleanerHistoryHandlers(): void { */ ipcMain.handle( IPC_CHANNELS.CLEANER_HISTORY_GET_BATCH_DETAILS, - async (_event, batchId: string): Promise> => { + async ( + _event, + batchId: string + ): Promise< + IpcResult<{ executions: CleanerExecutionRecord[]; orders: CleanerOrderRecord[] }> + > => { return withErrorHandling(async () => { const currentUser = SessionManager.getInstance().getUserInfo() @@ -94,7 +99,12 @@ export function registerCleanerHistoryHandlers(): void { */ ipcMain.handle( IPC_CHANNELS.CLEANER_HISTORY_GET_MATERIAL_DETAILS, - async (_event, batchId: string, attemptNumber: number, orderNumber: string): Promise> => { + async ( + _event, + batchId: string, + attemptNumber: number, + orderNumber: string + ): Promise> => { return withErrorHandling(async () => { const currentUser = SessionManager.getInstance().getUserInfo() diff --git a/src/main/services/cleaner/cleaner-application-service.ts b/src/main/services/cleaner/cleaner-application-service.ts index 52e2fb0..776373a 100644 --- a/src/main/services/cleaner/cleaner-application-service.ts +++ b/src/main/services/cleaner/cleaner-application-service.ts @@ -481,8 +481,7 @@ export class CleanerApplicationService { : 'success' // Build error message from execution-level errors (excluding per-order errors) - const execErrorMessage = - result.errors.length > 0 ? result.errors.join('\n') : undefined + const execErrorMessage = result.errors.length > 0 ? result.errors.join('\n') : undefined // Update execution status await historyDao.updateExecutionStatus( diff --git a/src/main/services/database/cleaner-operation-history-dao.ts b/src/main/services/database/cleaner-operation-history-dao.ts index 84fb6e1..e7aa574 100644 --- a/src/main/services/database/cleaner-operation-history-dao.ts +++ b/src/main/services/database/cleaner-operation-history-dao.ts @@ -752,8 +752,15 @@ export class CleanerOperationHistoryDAO { attemptNumber: row.AttemptNumber as number, userId: row.UserId as number, username: row.Username as string, - operationTime: row.OperationTime instanceof Date ? row.OperationTime : new Date(row.OperationTime as string), - endTime: row.EndTime ? (row.EndTime instanceof Date ? row.EndTime : new Date(row.EndTime as string)) : null, + operationTime: + row.OperationTime instanceof Date + ? row.OperationTime + : new Date(row.OperationTime as string), + endTime: row.EndTime + ? row.EndTime instanceof Date + ? row.EndTime + : new Date(row.EndTime as string) + : null, status: row.Status as string, isDryRun: !!(row.IsDryRun as number), totalOrders: row.TotalOrders as number, diff --git a/src/preload/api/cleaner.ts b/src/preload/api/cleaner.ts index 8ecd5d3..8fb8186 100644 --- a/src/preload/api/cleaner.ts +++ b/src/preload/api/cleaner.ts @@ -26,7 +26,9 @@ export const cleanerApi = { }, // Cleaner operation history - getHistoryBatches: (options?: GetCleanerBatchesOptions): Promise> => + getHistoryBatches: ( + options?: GetCleanerBatchesOptions + ): Promise> => invokeIpc(IPC_CHANNELS.CLEANER_HISTORY_GET_BATCHES, options), getHistoryBatchDetails: ( @@ -43,7 +45,12 @@ export const cleanerApi = { attemptNumber: number, orderNumber: string ): Promise> => - invokeIpc(IPC_CHANNELS.CLEANER_HISTORY_GET_MATERIAL_DETAILS, batchId, attemptNumber, orderNumber), + invokeIpc( + IPC_CHANNELS.CLEANER_HISTORY_GET_MATERIAL_DETAILS, + batchId, + attemptNumber, + orderNumber + ), deleteHistoryBatch: (batchId: string): Promise> => invokeIpc(IPC_CHANNELS.CLEANER_HISTORY_DELETE_BATCH, batchId) diff --git a/src/renderer/src/components/CleanerOperationHistoryModal.tsx b/src/renderer/src/components/CleanerOperationHistoryModal.tsx index c422076..cc4f0fa 100644 --- a/src/renderer/src/components/CleanerOperationHistoryModal.tsx +++ b/src/renderer/src/components/CleanerOperationHistoryModal.tsx @@ -98,10 +98,7 @@ const formatDateTime = (dateStr: string | Date | null | undefined): string => { return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` } -const formatDuration = ( - startTime: string | Date | null, - endTime: string | Date | null -) => { +const formatDuration = (startTime: string | Date | null, endTime: string | Date | null) => { if (!startTime || !endTime) return '-' const start = typeof startTime === 'string' ? new Date(startTime) : startTime const end = typeof endTime === 'string' ? new Date(endTime) : endTime @@ -130,15 +127,13 @@ export const CleanerOperationHistoryModal: React.FC(null) const [expandedBatches, setExpandedBatches] = useState>(new Set()) const [expandedOrders, setExpandedOrders] = useState>(new Set()) - const [batchExecutions, setBatchExecutions] = useState>( - new Map() - ) + const [batchExecutions, setBatchExecutions] = useState>(new Map()) const [batchOrders, setBatchOrders] = useState>( new Map() ) - const [orderMaterials, setOrderMaterials] = useState< - Map - >(new Map()) + const [orderMaterials, setOrderMaterials] = useState>( + new Map() + ) const [selectedAttempt, setSelectedAttempt] = useState>(new Map()) const [deleting, setDeleting] = useState>(new Set()) const [allUsers, setAllUsers] = useState([]) @@ -545,9 +540,7 @@ export const CleanerOperationHistoryModal: React.FC 0 && (
-
- 执行记录 -
+
执行记录
{executions.length > 1 && (
{executions.map((exec) => ( @@ -659,153 +652,153 @@ export const CleanerOperationHistoryModal: React.FC - - toggleOrderExpansion( - batch.batchId, - currentAttempt ?? order.attemptNumber, - order.orderNumber - ) - } - > - - {isOrderExpanded ? ( - - ) : ( - - )} - - - {order.orderNumber} - - - + + toggleOrderExpansion( + batch.batchId, + currentAttempt ?? order.attemptNumber, + order.orderNumber + ) + } > - {statusIcons[order.status]} - {statusLabels[order.status] || order.status} - - - - {order.materialsDeleted} - - - {order.materialsSkipped} - - - {order.materialsFailed || '-'} - - - {order.uncertainDeletions || '-'} - - - {order.errorMessage || '-'} - - + + {isOrderExpanded ? ( + + ) : ( + + )} + + + {order.orderNumber} + + + + {statusIcons[order.status]} + {statusLabels[order.status] || order.status} + + + + {order.materialsDeleted} + + + {order.materialsSkipped} + + + {order.materialsFailed || '-'} + + + {order.uncertainDeletions || '-'} + + + {order.errorMessage || '-'} + + - {/* Material details */} - {isOrderExpanded && ( - - - {isLoadingMaterials ? ( -
- 加载物料详情... -
- ) : materials.length > 0 ? ( - - - - - - - - - - - - - {materials.map((mat, idx) => ( - - - - - - - - - ))} - -
- 物料编码 - - 物料名称 - - 行号 - - 结果 - - 原因 - - 尝试次数 -
- {mat.materialCode} - - {mat.materialName} - - {mat.rowNumber} - - - {mat.result === 'deleted' - ? '已删除' - : mat.result === 'skipped' - ? '已跳过' - : mat.result === 'failed' - ? '失败' - : mat.result === 'uncertain' - ? '不确定' - : mat.result} - - - {mat.reason || '-'} - - {mat.attemptCount > 1 ? ( - - {mat.attemptCount} - - ) : ( - '1' - )} -
- ) : ( -
- 暂无物料详情 -
- )} - - - )} - - )})} + {/* Material details */} + {isOrderExpanded && ( + + + {isLoadingMaterials ? ( +
+ 加载物料详情... +
+ ) : materials.length > 0 ? ( + + + + + + + + + + + + + {materials.map((mat, idx) => ( + + + + + + + + + ))} + +
+ 物料编码 + + 物料名称 + + 行号 + + 结果 + + 原因 + + 尝试次数 +
+ {mat.materialCode} + + {mat.materialName} + + {mat.rowNumber} + + + {mat.result === 'deleted' + ? '已删除' + : mat.result === 'skipped' + ? '已跳过' + : mat.result === 'failed' + ? '失败' + : mat.result === 'uncertain' + ? '不确定' + : mat.result} + + + {mat.reason || '-'} + + {mat.attemptCount > 1 ? ( + + {mat.attemptCount} + + ) : ( + '1' + )} +
+ ) : ( +
+ 暂无物料详情 +
+ )} + + + )} + + ) + })}