feat: implement material validation UI in CleanerPage
New Features: - Material validation from database (full table or filtered by ProductionID) - Checkbox selection for materials to delete with auto-select for marked items - Manager-based filtering (Admin only) - Two-phase deletion: confirm (mark in DB) + execute (delete from ERP) - Export results to CSV - Hide/show checked items feature (User mode) - Share Production IDs between ExtractorPage and CleanerPage - Persist page state using sessionStorage Bug Fixes: - Fix MySQL query rowCount for INSERT/UPDATE/DELETE operations - Add AUTO_INCREMENT to MaterialsToBeDeleted.ID (preserved 43 records) - Add UNIQUE constraint on MaterialsToBeDeleted.MaterialCode Files Added: - src/main/ipc/validation-handler.ts - src/main/types/validation.types.ts - src/main/services/database/materials-to-be-deleted-dao.ts - src/main/services/database/discrete-material-plan-dao.ts Files Modified: - src/renderer/src/pages/CleanerPage.tsx (complete rewrite) - src/renderer/src/pages/ExtractorPage.tsx - src/renderer/src/App.tsx (add navigation tabs) - src/main/services/database/mysql.ts - src/preload/index.ts + index.d.ts
This commit is contained in:
@@ -6,6 +6,7 @@ import type { CleanerInput } from '../main/types/cleaner.types'
|
||||
import type { ResolverInput } from '../main/ipc/resolver-handler'
|
||||
import type { LoginRequest } from '../main/ipc/auth-handler'
|
||||
import type { UserInfo } from '../main/types/user.types'
|
||||
import type { ValidationRequest } from '../main/types/validation.types'
|
||||
|
||||
// Custom APIs for renderer
|
||||
const api = {
|
||||
@@ -61,6 +62,28 @@ const api = {
|
||||
isSqlServerConnected: () => ipcRenderer.invoke('database:sqlserver:isConnected'),
|
||||
querySqlServer: (sql: string, params?: Record<string, unknown>) =>
|
||||
ipcRenderer.invoke('database:sqlserver:query', sql, params)
|
||||
},
|
||||
|
||||
// Validation service
|
||||
validation: {
|
||||
validate: (request: ValidationRequest) => ipcRenderer.invoke('validation:validate', request),
|
||||
setSharedProductionIds: (productionIds: string[]) =>
|
||||
ipcRenderer.invoke('validation:setSharedProductionIds', productionIds),
|
||||
getSharedProductionIds: () =>
|
||||
ipcRenderer.invoke('validation:getSharedProductionIds')
|
||||
},
|
||||
|
||||
// Materials service
|
||||
materials: {
|
||||
upsertBatch: (materials: { materialCode: string; managerName: string }[]) =>
|
||||
ipcRenderer.invoke('materials:upsertBatch', { materials }),
|
||||
delete: (materialCodes: string[]) =>
|
||||
ipcRenderer.invoke('materials:delete', { materialCodes }),
|
||||
getManagers: () => ipcRenderer.invoke('materials:getManagers'),
|
||||
getByManager: (managerName: string) =>
|
||||
ipcRenderer.invoke('materials:getByManager', managerName),
|
||||
getAll: () => ipcRenderer.invoke('materials:getAll'),
|
||||
getStatistics: () => ipcRenderer.invoke('materials:getStatistics')
|
||||
}
|
||||
} as const
|
||||
|
||||
|
||||
Reference in New Issue
Block a user