Commit Graph

64 Commits

Author SHA1 Message Date
Misaka
65bf79fa44 fix: add missing spec-compliant methods and fields to Excel parser
Add missing spec-compliant methods and fields while keeping the working
implementation that correctly handles the complex Excel structure.

Changes:
- Add public isOrderRow() method to detect order title rows
- Add public extractOrderNumber() method to extract order numbers
- Add public parseMaterialRow() method for spec compliance
- Rename internal parseMaterialRow() to parseMaterialRowInternal()
- Add missing pendingQty field to DiscreteMaterialPlan type

All tests pass (23/23).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-01 13:08:04 +08:00
Misaka
d9e0091602 feat: implement Excel parser service
Implement Excel parsing module for ERP exported files following TDD principles.

Key features:
- Parse Excel files with multiple orders per file
- Extract order header information (production order, product code, etc.)
- Extract material data rows with 13 fields
- Handle empty orders gracefully
- Detect footer rows (制单人/打印人)
- Map Chinese field names to English property names
- Support field name mapping from Python reference

Implementation:
- ExcelParser class with parse() method
- DiscreteMaterialPlan and ExcelParseOptions types
- OrderHeader interface for order metadata
- Test fixtures with realistic Excel structure
- Comprehensive unit tests (3 tests, all passing)

Reference: playwrite/utils/excel_converter.py

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-01 13:01:50 +08:00
Misaka
f6b19b50f3 feat: implement Extractor service with download capability
Implement Task 3.1: Core Extractor Logic with TDD approach.

Changes:
- Add ExtractorService class with batch processing and download support
- Update ERP_LOCATORS with extractor-specific selectors from Python reference
- Add integration tests for single and multiple order extraction
- Add unit tests for batch creation logic
- Update existing tests to skip gracefully without ERP credentials

Features:
- Navigate to discrete material plan page with nested iframes
- Setup query interface (search icon, order query, limit settings)
- Batch download with configurable batch size (default: 100)
- Progress callback support for real-time updates
- Error handling for individual batch failures
- File download handling with proper wait strategies

Reference: playwrite/utils/discrete_material_plan_extractor.py

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-01 12:46:15 +08:00
Misaka
f045d66b65 feat: implement ERP authentication service
Implement ErpAuthService with TDD approach:
- Add login(), close(), getSession(), isActive() methods
- Use Playwright chromium with headless:false for debugging
- Manage browser lifecycle and session state
- Handle authentication flow with ERP_LOCATORS
- Add integration tests for login scenarios
- Add unit tests for session management
- Fix dotenv config path in test setup

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-01 12:34:54 +08:00
Misaka
87f6229d49 Update package-lock.json
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-01 12:22:26 +08:00
Misaka
c66dc2ecf8 feat: define ERP page element locators
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-01 12:21:58 +08:00
Misaka
9ac8707921 feat: configure Vitest testing framework
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-01 12:12:33 +08:00
Misaka
3222e03cea feat: define core TypeScript interfaces
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-01 11:53:59 +08:00
Misaka
4364c71bf9 fix: resolve environment configuration issues from code review
- Remove UTF-8 BOM from .env file
- Add missing ERP settings (ERP_HEADLESS, ERP_IGNORE_HTTPS_ERRORS, ERP_AUTO_CLOSE_BROWSER) to .env.example
- Add legacy configurations to .env.example

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-01 11:51:46 +08:00
Misaka
752cfc28a1 feat: add environment configuration template
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-01 11:44:59 +08:00
Misaka
82d3130188 feat: add core dependencies for Playwright migration
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-01 11:35:01 +08:00
Misaka
9ef1c3baa2 Update .gitignore to include .env and ensure .claude is ignored 2026-03-01 11:14:08 +08:00
Misaka
14089eb64c Add .claude to gitignore
Exclude Claude Code's configuration directory from version control.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-28 20:38:12 +08:00
Misaka
0077005cdd first commit 2026-02-28 20:36:59 +08:00