# Quick Reference - BLDI Pressure Gauge Classification Tool ## Macros Overview | Macro | Description | Shortcut | |-------|-------------|----------| | `RunClassification` | Classify all data in column A | Alt + F8 → Run | | `RunClassificationOnSelection` | Classify selected cells | Alt + F8 → Run | | `ClearClassifications` | Clear results in column B | Alt + F8 → Run | | `TestClassifierLogic` | Run all 12 PRD test cases | Alt + F8 → Run | | `TestParsingMethods` | Test parsing functions | Alt + F8 → Run | | `TestPerformance` | Benchmark 1000 records | Alt + F8 → Run | | `TestSingleInput` | Interactive single test | Alt + F8 → Run | ## Typical Workflow ### 1. Setup Data ``` A (型号代码) B (产品分类) ┌─────────────────────────────────────────────────┐ 1 │ Header row (optional) │ 2 │ PYTH-100.A0.531.M201.M02|BP-088.2312...|FBP.. │ 3 │ Y-040.Z0.200.M104.M07|BP-037.1007.M07.0A2 │ 4 │ ... │ └─────────────────────────────────────────────────┘ ``` ### 2. Run Classification - `Alt + F8` → `RunClassification` → `Run` ### 3. View Results Column B is automatically filled with classifications. ## Classification Categories | Category | Code Pattern | Priority | |----------|--------------|----------| | 喷涂产品 | Flange ends with `P` OR `F6AP`/`F6BP` in head | 1 | | 卫生型隔膜表 | `F6A` or `F6B` in head (non-spray) | 2 | | 隔膜表 | Main model starts with `P` | 3 | | 差压表 | Main model starts with `YC` | 4 | | 膜盒压力表 | Main model starts with `YE` | 5 | | 精密压力表 | Main model starts with `YB` | 6 | | 电接点压力表 | Main model starts with `YX` | 7 | | 常规表 | Main model starts with `Y` | 8 | | 其他 | Everything else | 9 | ## VBA Editor Shortcuts | Action | Shortcut | |--------|----------| | Open VBA Editor | `Alt + F11` | | Run Macro | `F5` (in editor) or `Alt + F8` (Excel) | | Immediate Window | `Ctrl + G` | | Project Explorer | `Ctrl + R` | | Properties Window | `F4` | | Save | `Ctrl + S` | ## Code Structure ``` GaugeClassifier (Class Module) ├── Classify() → Main classification logic ├── GetHead() → Extract: "PYTH-100.A0...|BP..." → "PYTH-100.A0..." ├── GetFlange() → Extract: Last section starting with "F" └── GetMainModel() → Extract: "PYTH-100.A0..." → "PYTH" MainModule (Standard Module) ├── RunClassification() → Process column A ├── RunClassificationOnSelection() → Process selection └── ClearClassifications() → Clear column B TestModule (Standard Module) ├── TestClassifierLogic() → Run 12 PRD tests ├── TestParsingMethods() → Test parsing ├── TestPerformance() → Benchmark 1000 records └── TestSingleInput() → Interactive test ``` ## Common Issues & Solutions | Problem | Solution | |---------|----------| | "No data found" | Ensure data starts from A2, not A1 | | Wrong classifications | Check model code format (use `\|` separator) | | Macro not visible | Check Trust Center settings, enable macros | | Compile error | Verify GaugeClassifier is a Class Module | | Slow performance | Normal for 10k+ records (~0.5 sec) | ## Model Code Format ``` [表头]|[表盘]|[附件]|[法兰隔膜] Example: PYTH-100.A0.531.M201.M02|BP-088.2312.M02.0A3|FBP-251040.RF1.049.13.M20F.B.DPA └───────────┬────────────┘ └────────┬─────────┘ └──────────┬─────────────┘ Head Section Dial Section Flange Section Head: Everything before first | Flange: Last section if starts with F MainModel: First word before - in head ``` ## Testing Quick Reference ### Run All Tests ``` 1. Alt + F11 (VBA Editor) 2. Ctrl + G (Immediate Window) 3. Alt + F8 → TestClassifierLogic → Run 4. Check results in Immediate Window ``` ### Expected Test Output ``` ======================================== GaugeClassifier Test Results ======================================== [✓ PASS] Test 1: 喷涂产品 [✓ PASS] Test 2: 卫生型隔膜表 ... [✓ PASS] Test 12: 其他 ======================================== Summary: Total: 12 Passed: 12 Failed: 0 ======================================== ``` ## Performance Benchmarks | Records | Expected Time | Notes | |---------|---------------|-------| | 100 | ~0.01s | Instant | | 1,000 | ~0.05s | Very fast | | 10,000 | ~0.5s | Fast | | 100,000 | ~5s | Acceptable | ## File Locations ``` 生产周期核对/ ├── VBA/ │ ├── ClassModules/ │ │ └── GaugeClassifier.cls ← Core logic │ └── Modules/ │ ├── MainModule.bas ← Excel I/O │ └── TestModule.bas ← Test suite ├── README.md ← Full documentation ├── INSTALL.md ← Installation guide └── QUICK_REFERENCE.md ← This file ``` ## Emergency Procedures ### Clear All Classifications ```vba ' Run: ClearClassifications Alt + F8 → ClearClassifications → Run ``` ### Reset Installation ``` 1. Alt + F11 2. Remove: GaugeClassifier, MainModule, TestModule 3. Re-import all .cls and .bas files 4. Run TestClassifierLogic to verify ``` ### Manual Classification Test ```vba ' In Immediate Window (Ctrl + G): ?New GaugeClassifier.Classify("PYTH-100.A0.531|BP-088.2312|FBP-251040") ' Output: 喷涂产品 ``` ## Tips & Tricks 1. **Bulk Processing**: Use `RunClassification` for large datasets (>100 rows) 2. **Quick Test**: Use `RunClassificationOnSelection` for ad-hoc testing 3. **Debug Mode**: Set breakpoint in `Classify()` function to step through 4. **Custom Input**: Modify `dataRange` in `MainModule` for different columns 5. **Performance**: Avoid volatile functions in adjacent columns ## Support Resources - **Full Documentation**: See `README.md` - **Installation Help**: See `INSTALL.md` - **Test Cases**: See `TestModule.bas` for all 12 PRD tests - **VBA Help**: Press `F1` in VBA Editor