refactor: integrate [领料配置] into [平台配置清单] and add category selection conditions

Major changes:
- Remove dependency on separate [领料配置] sheet
- Load all data from [平台配置清单] in a single pass
- Add "类别选用条件" (CategorySelectCondition) field to support dynamic category filtering
- Add "66代码" (Code66) field for 66-system integration
- Refactor completeness check logic to only verify required categories

Data model changes:
- clsMaterialItem: Add CategorySelectCondition and Code66 properties
- clsCategory: Add CategorySelectCondition property and IsRequiredForModel() method
- clsBOMManager: Refactor LoadData() to use single data source
- clsBOMManager: Add GetRequiredCategories() method
- clsBOMManager: Update GetValidMaterialsByModel() to use category selection conditions

New workflow:
- LoadData() now takes only wsPlatform parameter (removed wsConfig)
- Categories are filtered by "类别选用条件" before completeness check
- Categories with empty selection condition are always required
- Categories with non-empty condition are checked against model specifications

Documentation:
- Update CLAUDE.md with new sheet structure
- Add comprehensive refactoring plan document
- Add v2.0 LoadData flow analysis with Mermaid diagrams
- Add platform configuration sheet reference

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-01-29 10:25:28 +08:00
parent fd414f7673
commit a9b3188d23
7 changed files with 1419 additions and 88 deletions

View File

@@ -65,17 +65,33 @@ Model String → Parser → Extractor → Conditions Dictionary → Matcher →
## Data Sheets Structure
The Excel workbook contains two key sheets:
**领料配置** (Picking Configuration)
- Defines category hierarchy
- Specifies which materials require picking
- Columns: 物料代号, 类别名称, 上层类别名称
The Excel workbook contains one main configuration sheet:
**平台配置清单** (Platform Configuration)
- Complete material database
- Rows 1-3: Headers
- Row 4+: Data
- Complete material database with category hierarchy
- All configuration data in one sheet (simplified from previous two-sheet design)
- Row 1-3: Headers and product info
- Row 4+: Material data
**Column Structure** (Row 3):
| Column | Field Name | Description | Example |
|--------|-----------|-------------|---------|
| A | 行号 | Line number | 10, 20, 30 |
| B | 模块 | Module name | 316L部件 |
| C | 代号 | Material code | 01011009557 |
| D | 名称 | Material name | 径向低压接头部件 |
| E | 数量 | Quantity | 1.0 |
| F | 选择条件 | Material selection condition | gclj=M20 AND jycz=1 |
| G | 备注 | Remarks | |
| H | 类别 | Category name | 部件 |
| I | 上层类别 | Parent category name | (empty for root categories) |
| J | 类别选用条件 | Category selection condition | lcfw=M02 |
| K | 66代码 | 66-system code | 66021009557 |
**Category Selection Condition (类别选用条件)**:
- Empty: Category is always required
- Not empty: Category is required only when the condition matches the model specifications
- Uses same syntax as material selection conditions (AND, OR, !=, parentheses)
## Testing
@@ -120,7 +136,11 @@ Run tests from the VBA editor or Excel macros:
## Key Business Logic
- Materials have "selection conditions" expressed as logical formulas
- Not all materials in platform config require picking (filtered by "领料配置" sheet)
- Categories have "category selection conditions" to determine if they are required for a given model
- **Completeness Check Logic**:
- First, determine which categories are required by matching "类别选用条件" with model specifications
- Then, check if each required category has exactly one matching material
- Categories not required for the model are excluded from completeness check
- Supports "部件" (component) vs "零件" (part) picking strategies
- Condition extraction is data-driven (new variables can be added)
- Category tree can have arbitrary depth