Add strategy pattern architecture for BOM module processing
- Add IModuleProcessor interface defining the processor contract - Implement cProcessor_AppendOnly strategy for modifying existing BOM rows - Implement cProcessor_CloneNew strategy for creating new BOM rows - Add mProcessorFactory module for creating processor instances - Add mSpecAdditionManager module for coordinating spec addition operations - Enhance test suite with business logic layer and pipeline integration tests This implements the Strategy pattern to allow flexible BOM modification behaviors while maintaining clean separation of concerns. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
28
VBA/ClassModules/cProcessor_AppendOnly.cls
Normal file
28
VBA/ClassModules/cProcessor_AppendOnly.cls
Normal file
@@ -0,0 +1,28 @@
|
||||
' ==============================================================================
|
||||
' 模块名称: cProcessor_AppendOnly
|
||||
' 模块类别: 类模块
|
||||
' 模块职责: 通用追加策略。适用于接头、封口片、机芯、盘止钉等。
|
||||
' 逻辑描述: 遍历所有数据,凡是名称与目标匹配的变种,一律注入新条件。
|
||||
' ==============================================================================
|
||||
Option Explicit
|
||||
Implements IModuleProcessor
|
||||
|
||||
Private Sub IModuleProcessor_ProcessSpec( _
|
||||
ByRef allBOMs As Collection, _
|
||||
ByVal targetItemName As String, _
|
||||
ByVal paramName As String, _
|
||||
ByVal newValue As String, _
|
||||
ByRef engine As cConditionEngine)
|
||||
|
||||
Dim rowObj As cBOMRow
|
||||
|
||||
' 遍历整个库
|
||||
For Each rowObj In allBOMs
|
||||
' 只要名称完全匹配 (忽略大小写进行比对)
|
||||
If StrComp(rowObj.ItemName, targetItemName, vbTextCompare) = 0 Then
|
||||
' 利用引擎进行外科手术级别的追加
|
||||
rowObj.Condition = engine.InjectOr(rowObj.Condition, paramName, newValue)
|
||||
End If
|
||||
Next rowObj
|
||||
|
||||
End Sub
|
||||
Reference in New Issue
Block a user