feat: implement CleanerService for ERP material deletion

**Core Implementation (src/main/services/erp/cleaner.ts):**
- CleanerService class with dry-run mode support
- Material deletion logic with safety constraints:
  - Row numbers 7000-7999 are protected
  - Materials with pending quantity are skipped
  - Materials not in delete list are ignored
- Order processing with nested iframe navigation
- Progress callback support for UI integration

**Types (src/main/types/cleaner.types.ts):**
- CleanerInput: order numbers, material codes, dry-run flag
- CleanerResult: processing statistics and details
- OrderCleanDetail: per-order breakdown

**Tests:**
- Unit tests for shouldDeleteMaterial logic
- Integration tests for order processing
- Dry-run mode validation
- Navigation tests

Reference: playwrite/utils/discrete_material_plan_cleaner.py

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-03-01 14:53:49 +08:00
parent 937ad85e9b
commit 8f6ca7b453
4 changed files with 858 additions and 14 deletions

View File

@@ -1,21 +1,21 @@
export interface CleanerInput {
orderNumbers: string[];
materialCodes: string[];
dryRun: boolean;
onProgress?: (message: string, progress: number) => void;
orderNumbers: string[]
materialCodes: string[]
dryRun: boolean
onProgress?: (message: string, progress?: number) => void
}
export interface CleanerResult {
ordersProcessed: number;
materialsDeleted: number;
materialsSkipped: number;
errors: string[];
details: OrderCleanDetail[];
ordersProcessed: number
materialsDeleted: number
materialsSkipped: number
errors: string[]
details: OrderCleanDetail[]
}
export interface OrderCleanDetail {
orderNumber: string;
materialsDeleted: number;
materialsSkipped: number;
errors: string[];
}
orderNumber: string
materialsDeleted: number
materialsSkipped: number
errors: string[]
}