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:
105
src/main/types/validation.types.ts
Normal file
105
src/main/types/validation.types.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* Validation IPC API type definitions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Material validation result
|
||||
*/
|
||||
export interface ValidationResult {
|
||||
materialName: string
|
||||
materialCode: string
|
||||
specification: string
|
||||
model: string
|
||||
managerName: string
|
||||
isMarkedForDeletion: boolean
|
||||
matchedTypeKeyword?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Material validation request
|
||||
*/
|
||||
export interface ValidationRequest {
|
||||
/** Validation mode: 'database_full' or 'database_filtered' */
|
||||
mode: 'database_full' | 'database_filtered'
|
||||
/** Production ID file path (for database_filtered mode) */
|
||||
productionIdFile?: string
|
||||
/** Use shared Production IDs from extractor page */
|
||||
useSharedProductionIds?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation response
|
||||
*/
|
||||
export interface ValidationResponse {
|
||||
success: boolean
|
||||
results?: ValidationResult[]
|
||||
error?: string
|
||||
stats?: {
|
||||
totalRecords: number
|
||||
matchedCount: number
|
||||
markedCount: number
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Material upsert request
|
||||
*/
|
||||
export interface MaterialUpsertRequest {
|
||||
materialCode: string
|
||||
managerName: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Material upsert batch request
|
||||
*/
|
||||
export interface MaterialUpsertBatchRequest {
|
||||
materials: { materialCode: string; managerName: string }[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Material delete request
|
||||
*/
|
||||
export interface MaterialDeleteRequest {
|
||||
materialCodes: string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Material query by manager request
|
||||
*/
|
||||
export interface MaterialQueryByManagerRequest {
|
||||
managerName: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Material operations response
|
||||
*/
|
||||
export interface MaterialOperationResponse {
|
||||
success: boolean
|
||||
count?: number
|
||||
stats?: {
|
||||
total: number
|
||||
success: number
|
||||
failed: number
|
||||
}
|
||||
error?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Manager filter response
|
||||
*/
|
||||
export interface ManagerFilterResponse {
|
||||
managers: string[]
|
||||
materials?: MaterialRecordSummary[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Material record summary
|
||||
*/
|
||||
export interface MaterialRecordSummary {
|
||||
materialCode: string
|
||||
materialName: string
|
||||
specification: string
|
||||
model: string
|
||||
managerName: string
|
||||
isMarked: boolean
|
||||
}
|
||||
Reference in New Issue
Block a user