feat: implement BOM auto-extraction system
All checks were successful
NTFY Notification / notify (push) Successful in 11s
All checks were successful
NTFY Notification / notify (push) Successful in 11s
Add complete BOM auto-extraction system with the following modules: - M06_ModelParser: Parse product model strings to extract parameters (azxs, bkxs, gclj, jycz, lcfw, fjgn) - Extracts header part from full model (ignores dial/attachment parts) - Splits process connection and material code (G123 -> G12, 3) - Supports multiple additional features with comma/dot separators - M07_BOMMatcher: Match materials in BOM library - Exact match, wildcard (empty cell), negative match (!=) - Special fjgn contains matching logic - Array-based performance optimization for bulk operations - M08_ComponentProcessor: Handle component material special logic - Component inventory check (interface reserved) - Sub-component extraction (joint + elastic element) - Combination validation rules (1 component OR 1 joint + 1 element) - M09_BOMExtractor: Main extraction orchestrator - Reads input models from worksheet - Processes each model and matches all material types - Outputs to "BOM提取结果" worksheet - Error reporting and non-blocking design - M06B_TestRunner: Comprehensive unit tests - 8 test cases for model parsing - 5 test cases for BOM matching - 5 test cases for component processing - M04_Config: Add BOM extraction constants - BOM library filename and configuration - Input/output column definitions - Output column enumeration - M01_Main: Add RunBOMExtraction entry point Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
' ==============================================================================
|
||||
Option Explicit
|
||||
|
||||
' ------------------------------------------------------------------------------
|
||||
' 入口1: 运行BOM转换系统(原功能)
|
||||
' 功能: 从"平台配置清单"读取数据,解析条件规则,生成分类BOM
|
||||
' ------------------------------------------------------------------------------
|
||||
Public Sub RunBOMConversion()
|
||||
Dim wsSrc As Worksheet
|
||||
Dim arrData As Variant
|
||||
@@ -126,6 +130,23 @@ MainErrorHandler:
|
||||
Resume ExitHandler
|
||||
End Sub
|
||||
|
||||
' ------------------------------------------------------------------------------
|
||||
' 入口2: 运行BOM自动提取系统(新功能)
|
||||
' 功能: 从产品型号中提取参数,匹配BOM库,输出标准BOM清单
|
||||
'
|
||||
' 使用方法:
|
||||
' 1. 在当前工作簿中准备"产品型号"列的工作表
|
||||
' 2. 确保BOM库.xlsx在同一目录下
|
||||
' 3. 运行此函数
|
||||
'
|
||||
' 输出: 在"BOM提取结果"工作表中显示提取结果
|
||||
' ------------------------------------------------------------------------------
|
||||
Public Sub RunBOMExtraction()
|
||||
Dim result As String
|
||||
result = M09_BOMExtractor.RunBOMExtraction()
|
||||
MsgBox result, vbInformation, "BOM提取"
|
||||
End Sub
|
||||
|
||||
' ==============================================================================
|
||||
' 过程: GeneratePreprocessingReport
|
||||
' 职责: 生成预处理条件转换对比报表,展示"接头"类别的条件转换结果
|
||||
@@ -457,7 +478,7 @@ Private Function ContainsAzxsChange( _
|
||||
|
||||
regex.Global = True
|
||||
regex.IgnoreCase = True
|
||||
regex.Pattern = "(azxs)( *=|!= *)([a-zA-Z0-9]{2})"
|
||||
regex.pattern = "(azxs)( *=|!= *)([a-zA-Z0-9]{2})"
|
||||
|
||||
' 提取原始azxs值
|
||||
Dim origMatches As Object
|
||||
@@ -499,7 +520,7 @@ Private Function ContainsLcfwChange( _
|
||||
|
||||
regex.Global = True
|
||||
regex.IgnoreCase = True
|
||||
regex.Pattern = "(lcfw)( *=|!= *)([a-zA-Z]\d{1,3})"
|
||||
regex.pattern = "(lcfw)( *=|!= *)([a-zA-Z]\d{1,3})"
|
||||
|
||||
' 提取原始lcfw值
|
||||
Dim origMatches As Object
|
||||
@@ -585,7 +606,7 @@ Private Function ExtractFieldMappings( _
|
||||
|
||||
regex.Global = True
|
||||
regex.IgnoreCase = True
|
||||
regex.Pattern = pattern
|
||||
regex.pattern = pattern
|
||||
|
||||
' 从原始条件中提取所有该字段的值
|
||||
Dim origMatches As Object
|
||||
|
||||
Reference in New Issue
Block a user