Commit Graph

18 Commits

Author SHA1 Message Date
Misaka_Company
57adf860ac feat: add additional features (fjgn) support
- Add fjgn (附加功能) field extraction from instrument characteristics
- Extract additional features from model number's instrument feature field
- Merge all fields from index 5 onwards to handle dot separators in features
- Remove oil-fill type (Y+digit) suffix from additional features
- Normalize separators (comma and dot) to comma for consistent parsing
- Implement multi-value matching for fjgn conditions (contains logic)
  - fjgn=N1: true if fjgn contains N1
  - fjgn!=N1: true if fjgn does not contain N1
- Add fjgn to condition config in MainModule and BIPUploadModule

Fixes issue where additional features with dot separators (e.g., N3.N2.Y3)
were incorrectly parsed by merging all fields from index 5 onwards.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-02 11:04:19 +08:00
Misaka_Company
a22ee42119 chore: remove auto-generated metadata from file headers
- Remove "作者: Auto-generated" and date fields from module headers
- Clean up unnecessary metadata comments

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-02 10:09:40 +08:00
Misaka_Company
6e45d6bdd2 refactor: standardize variable naming and file formatting
- Rename Quantity to quantity in BomItem for consistent naming convention
- Update references in MainModule to use lowercase quantity
- Add newlines at end of files for consistency
- Update vba_metadata.json with new source path and document module

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-02 10:01:57 +08:00
Misaka
73491c104b fix: clear error messages between BOM extractions
Fix bug where error messages from previous orders were accumulating:
- Add ClearErrorMessages() public method to BomExtractor class
- Initialize pErrorMessages as new collection in ExtractBom()
- Replace commented-out pErrorMessages.Clear with proper initialization
- Ensures each order's error information is independent

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-01 22:42:00 +08:00
Misaka
c5f2d804fb feat: add component priority exclusion feature
Add support for excluding "部件" category based on component priority flag:
- BomExtractor: Add exclude categories functionality
  - Add pExcludeCategories collection member
  - Add SetExcludeCategories() and ClearExcludeCategories() methods
  - Modify DetermineRequiredCategories() to skip excluded categories

- BIPUploadModule: Read and use component priority field
  - Read component priority from column E of [产品订单] worksheet
  - Pass component priority to ProcessSingleOrder()
  - When priority is "否"/"0"/"FALSE", exclude "部件" category
  - Only extract sub-category materials when component priority is disabled

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-01 22:25:10 +08:00
Misaka
79dc7cbf72 feat: add core VBA source code modules
Add VBA directory with essential project code including:
- ClassModules: BomExtractor, BomItem, ConditionEvaluator, ProductModelParser
- Modules: MainModule, TestModule
- Forms and DocumentModules
- vba_metadata.json for module metadata

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-01 16:18:17 +08:00
Misaka_Company
2b9ba2de9c clear 2026-01-29 17:05:28 +08:00
Misaka_Company
c9cf84ed4d fix: update modules to use new LoadData interface and fix completeness check logic
Changes:
1. Update all modules to use LoadData(wsPlatform) instead of LoadData(wsConfig, wsPlatform)
   - modModelParserExamples.bas: Update 7 example procedures
   - modBOMProcessor.bas: Update 4 procedures
   - modModelParserTest.bas: Update 2 test procedures

2. Fix completeness check logic in GetValidMaterialsByModel
   - Only check root categories to avoid duplicate checking of subcategories
   - Previously, all required categories (including subcategories) were checked,
     causing subcategories to be added to missing list multiple times
   - Now only checks categories with ParentCategoryName = ""
   - CheckCategoryCompleteness already recursively checks all subcategories

3. Improve completeness judgment logic for categories with subcategories
   - Method 1: Parent category has 1 matching material → Complete
   - Method 2: Parent category has 0 matching materials, but all subcategories are complete → Complete
   - Other cases → Incomplete

Impact:
- Fixes "category missing" errors in Example9_BatchProcessOrders_WithCheck
- Eliminates duplicate entries in missing categories list
- Properly handles category hierarchy where parent categories are satisfied through subcategories

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-29 12:38:50 +08:00
Misaka_Company
a9b3188d23 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>
2026-01-29 10:25:28 +08:00
Misaka_Company
845b25f27a feat: add azxs and bkxs condition extraction
Added two new extraction rules to clsConditionExtractor:
- azxs (安装形式): Extract installation form code from InstallForm field
- bkxs (表壳形式): Extract shell form code from ShellForm field

Examples:
- azxs: A0 (径向无边), Z0 (中轴向无边)
- bkxs: 532 (53=304外壳+安装式, 2=外卡式)

These new conditions can now be used in material selection expressions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-27 15:46:50 +08:00
Misaka_Company
255bcdb5fe refactor: remove debug output and update order logic
- Commented out verbose Debug.Print statements in `GetMaterialsByModel` and `FilterCategoryWithSubcategories` to reduce console noise.
- Added validation checks to ensure required worksheets ('平台配置清单', '产品订单') exist before loading data.
- Refactored order processing logic to aggregate results into a Collection for structured output generation, including headers.
2026-01-26 09:13:27 +08:00
Misaka_Company
40a9fe99f4 feat: track and return missing material categories in BOM
- Update GetValidMaterialsByModel to aggregate and return missing
  category names under the "MissingCategories" key.
- Remove debug print statements and unused variables to improve
  code cleanliness.
- Enhance result visualization to display completeness status
  with color formatting and detailed material tables.
2026-01-21 09:51:37 +08:00
Misaka_Company
112a89a2a4 feat: Add GetValidMaterialsByModel and completeness check
Implemented logic to retrieve materials based on a model string and verify if the resulting set is complete.

Added:
- `GetValidMaterialsByModel`: Parses the model, extracts conditions, and matches materials against root categories.
- `CheckCategoryCompleteness`: Recursively validates categories to ensure exactly one material match per required category (leaf or parent).

This enables the BOM Manager to return a collection of materials alongside a boolean flag indicating if the collection satisfies the structural completeness rules.
2026-01-20 18:13:11 +08:00
Misaka_Company
f3fc5b4cbd feat(clsBOMManager): add optional autoFallback param
Added the `autoFallback` optional parameter to `GetMaterialsByModel`.
This flag controls whether the search automatically descends to
subcategories when no matches are found in the target category.

- Defaults to True to maintain previous recursive behavior.
- When False, the search is restricted strictly to the specified category.
- Updated documentation with usage examples and logic explanations.
2026-01-20 16:24:49 +08:00
Misaka_Company
388ccc4e7a refactor: add subcategory fallback logic for material filtering
Refactored the material retrieval logic in GetMaterialsByModel to
automatically search within subcategories if no matches are found in the
specified parent category.

- Added FilterCategoryWithSubcategories helper function to handle recursive
  searching and fallback logic.
- Restructured main function to delegate filtering to the new helper.
- Enhanced code comments to clarify the step-by-step matching process.
2026-01-20 15:31:43 +08:00
Misaka_Company
7f89f37f35 docs: improve GetMaterialsByModel documentation
Enhanced the documentation for the GetMaterialsByModel method in clsBOMManager to clarify the core BOM logic. Replaced brief comments with a structured explanation covering the workflow (model parsing, condition extraction, material matching), detailed parameter descriptions, return value specifications (clsMaterialItem properties), and usage notes. This helps developers better understand the interaction between clsModelParser, clsConditionExtractor, and clsConditionMatcher.
2026-01-20 15:06:53 +08:00
Misaka_Company
a1347017e3 docs: expand AutoBOM architecture and implementation details
Refine project overview to include specific business context (Blaidy Company) and the main workbook file. Restructure the architecture section into a layered object-oriented design (Data, Processing, Application layers) and define the responsibilities of core VBA classes.

Add new technical documentation sections covering:
- Model number format parsing structure
- Condition expression language syntax
- Category hierarchy logic and picking strategies
- Material matching pipeline flow

Include VBA code examples for key methods such as CollectAllMaterials and GetMaterialsByCategoryAndModel to illustrate recursive traversal and material retrieval logic. Clarify the structure of key Excel configuration sheets.
2026-01-20 13:42:03 +08:00
Misaka_Company
05601ec1fc Add initial implementation of BOM management classes and data structure
- Created clsBOMManager for managing BOM data
- Added clsCategory and clsMaterialItem for category and material representation
- Implemented methods for loading and organizing BOM data from Excel
- Introduced .gitignore to exclude unnecessary files
- Added metadata JSON for module tracking
2026-01-20 08:53:01 +08:00