style: format changed files with prettier
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -64,7 +64,12 @@ export function registerCleanerHistoryHandlers(): void {
|
||||
*/
|
||||
ipcMain.handle(
|
||||
IPC_CHANNELS.CLEANER_HISTORY_GET_BATCH_DETAILS,
|
||||
async (_event, batchId: string): Promise<IpcResult<{ executions: CleanerExecutionRecord[]; orders: CleanerOrderRecord[] }>> => {
|
||||
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<IpcResult<CleanerMaterialRecord[]>> => {
|
||||
async (
|
||||
_event,
|
||||
batchId: string,
|
||||
attemptNumber: number,
|
||||
orderNumber: string
|
||||
): Promise<IpcResult<CleanerMaterialRecord[]>> => {
|
||||
return withErrorHandling(async () => {
|
||||
const currentUser = SessionManager.getInstance().getUserInfo()
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -26,7 +26,9 @@ export const cleanerApi = {
|
||||
},
|
||||
|
||||
// Cleaner operation history
|
||||
getHistoryBatches: (options?: GetCleanerBatchesOptions): Promise<IpcResult<CleanerBatchStats[]>> =>
|
||||
getHistoryBatches: (
|
||||
options?: GetCleanerBatchesOptions
|
||||
): Promise<IpcResult<CleanerBatchStats[]>> =>
|
||||
invokeIpc(IPC_CHANNELS.CLEANER_HISTORY_GET_BATCHES, options),
|
||||
|
||||
getHistoryBatchDetails: (
|
||||
@@ -43,7 +45,12 @@ export const cleanerApi = {
|
||||
attemptNumber: number,
|
||||
orderNumber: string
|
||||
): Promise<IpcResult<CleanerMaterialRecord[]>> =>
|
||||
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<IpcResult<{ deleted: boolean }>> =>
|
||||
invokeIpc(IPC_CHANNELS.CLEANER_HISTORY_DELETE_BATCH, batchId)
|
||||
|
||||
@@ -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<CleanerOperationHistoryModal
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [expandedBatches, setExpandedBatches] = useState<Set<string>>(new Set())
|
||||
const [expandedOrders, setExpandedOrders] = useState<Set<string>>(new Set())
|
||||
const [batchExecutions, setBatchExecutions] = useState<Map<string, ExecutionRecord[]>>(
|
||||
new Map()
|
||||
)
|
||||
const [batchExecutions, setBatchExecutions] = useState<Map<string, ExecutionRecord[]>>(new Map())
|
||||
const [batchOrders, setBatchOrders] = useState<Map<string, CleanerHistoryOrderRecord[]>>(
|
||||
new Map()
|
||||
)
|
||||
const [orderMaterials, setOrderMaterials] = useState<
|
||||
Map<string, CleanerHistoryMaterialRecord[]>
|
||||
>(new Map())
|
||||
const [orderMaterials, setOrderMaterials] = useState<Map<string, CleanerHistoryMaterialRecord[]>>(
|
||||
new Map()
|
||||
)
|
||||
const [selectedAttempt, setSelectedAttempt] = useState<Map<string, number>>(new Map())
|
||||
const [deleting, setDeleting] = useState<Set<string>>(new Set())
|
||||
const [allUsers, setAllUsers] = useState<string[]>([])
|
||||
@@ -545,9 +540,7 @@ export const CleanerOperationHistoryModal: React.FC<CleanerOperationHistoryModal
|
||||
{/* Execution records */}
|
||||
{executions.length > 0 && (
|
||||
<div className="px-4 py-3 bg-gray-50/50 border-b border-gray-100">
|
||||
<div className="text-xs font-medium text-gray-500 mb-2">
|
||||
执行记录
|
||||
</div>
|
||||
<div className="text-xs font-medium text-gray-500 mb-2">执行记录</div>
|
||||
{executions.length > 1 && (
|
||||
<div className="flex gap-1 mb-2">
|
||||
{executions.map((exec) => (
|
||||
@@ -659,8 +652,7 @@ export const CleanerOperationHistoryModal: React.FC<CleanerOperationHistoryModal
|
||||
const orderKey = `${batch.batchId}:${currentAttempt ?? order.attemptNumber}:${order.orderNumber}`
|
||||
const isOrderExpanded = expandedOrders.has(orderKey)
|
||||
const materials = orderMaterials.get(orderKey) || []
|
||||
const isLoadingMaterials =
|
||||
loadingMaterials.has(orderKey)
|
||||
const isLoadingMaterials = loadingMaterials.has(orderKey)
|
||||
|
||||
return (
|
||||
<React.Fragment key={orderKey}>
|
||||
@@ -805,7 +797,8 @@ export const CleanerOperationHistoryModal: React.FC<CleanerOperationHistoryModal
|
||||
</tr>
|
||||
)}
|
||||
</React.Fragment>
|
||||
)})}
|
||||
)
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user