feat: add azxs preprocessing support for component category
All checks were successful
NTFY Notification / notify (push) Successful in 13s

Extend M05_PreProcessor to support category-specific preprocessing:
- "接头" category: Full preprocessing (azxs + lcfw mapping, OR merging, parentheses simplification)
- "部件" category: Partial preprocessing (azxs mapping only, OR merging, parentheses simplification)
- Other categories: No preprocessing

Add new function ApplyPreprocessingWithoutLcfw() to handle component category preprocessing.

Add unit tests (PP_09 through PP_12) to verify:
- azxs mapping for component category
- lcfw conditions remain unchanged for component category
- OR condition merging and parentheses simplification

Update CLAUDE.md documentation with category-specific preprocessing table.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-02-11 09:49:38 +08:00
parent 90a62231e0
commit ec579b30b2
3 changed files with 134 additions and 17 deletions

View File

@@ -16,7 +16,7 @@ The system follows a modular architecture with clear separation of concerns:
- **M02_DataIO.bas** - Data input/output operations. Reads source data from "平台配置清单" worksheet and generates categorized output workbooks.
- **M03_Logic.bas** - Core recursive parser for conditional expressions. Handles logical operators (AND/OR), nested parentheses, and key=value/key!=val conditions. Implements Cartesian products for set operations.
- **M04_Config.bas** - Column mapping and header priorities. Defines source data columns (CODE, NAME, QTY, CONDITION, CATEGORY) and standard ordering for output.
- **M05_PreProcessor.bas** - Preprocessing module for condition transformation. Handles value mapping for "接头" category (e.g., azxs=A0→径向, lcfw=M01→低压), duplicate OR condition merging, and nested expression simplification. Uses mapping data from "对照表" worksheet.
- **M05_PreProcessor.bas** - Preprocessing module for condition transformation. Handles category-specific preprocessing: "接头" (azxs+lcfw mapping, OR merging, parentheses simplification), "部件" (azxs mapping only, OR merging, parentheses simplification). Uses mapping data from "对照表" worksheet.
- **M99_TestRunner.bas** - Unit testing framework. Run `RunAllTests()` in VBA Immediate window to execute tests.
### Class Module
@@ -36,14 +36,22 @@ New Excel Workbook + Error Report
### Preprocessing (M05_PreProcessor)
Before parsing conditions, the system applies preprocessing for "接头" (joint) category:
Before parsing conditions, the system applies category-specific preprocessing:
**Supported Categories**:
| Category | azxs Mapping | lcfw Mapping | OR Merging | Parentheses Simplification |
|----------|-------------|--------------|------------|----------------------------|
| 接头 | ✓ | ✓ | ✓ | ✓ |
| 部件 | ✓ | ✗ | ✓ | ✓ |
| Other | ✗ | ✗ | ✗ | ✗ |
**Value Mapping**:
- **azxs** (安装形式): Maps codes to descriptive values
- A0, AT, AH → 径向
- B0, BT, BZ, BH → 下轴向
- Z0, ZT, ZZ, ZH → 中轴向
- **lcfw** (量程范围): Maps range codes to categories
- **lcfw** (量程范围): Maps range codes to categories (接头 category only)
- M01-M11 → 低压
- M12-M16 → 高压
@@ -104,14 +112,18 @@ This runs unit tests for:
- OR operations with union operations
- Nested parentheses handling
- Logic conflict detection
- **Preprocessing tests** (Test_PP_01 to Test_PP_08):
- **Preprocessing tests** (Test_PP_01 to Test_PP_12):
- azxs mapping load (12 values)
- lcfw mapping load (M01-M16)
- Value replacement
- OR condition merging
- Full integration with M03_Logic
- Non-"接头" category handling
- Non-"接头"/"部件" category handling
- Unmapped value handling
- "部件" category azxs mapping (PP_09)
- "部件" category lcfw unchanged (PP_10)
- "部件" category OR merging (PP_11)
- "部件" category parentheses simplification (PP_12)
### Python Skills (Claude Code Integration)