feat: add automatic database import after ERP data extraction

- Add DataImportService for reading Excel and importing to database
- Extend DiscreteMaterialPlanDAO with deleteBySourceNumbers and batchInsert
- Auto-trigger database write after successful Excel merge
- Support batch delete by SourceNumber and batch insert (1000/batch)
- Update ExtractorPage UI to show import results
- Fix SQL Server query to handle undefined recordset for DELETE/INSERT

Co-Authored-By: Claude (glm-5) <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-03-04 11:26:54 +08:00
parent abe51d17fa
commit 63ea81e0d6
8 changed files with 887 additions and 5 deletions

View File

@@ -92,8 +92,8 @@ export class SqlServerService implements IDatabaseService {
const result = await request.query(sqlString)
// Convert recordset to array of objects
const rows = result.recordset as Record<string, unknown>[]
// Convert recordset to array of objects (may be undefined for DELETE/INSERT/UPDATE)
const rows = (result.recordset as Record<string, unknown>[]) || []
// Extract column names from the first row if available
const columns = rows.length > 0 ? Object.keys(rows[0]) : []