Refactor strategy pattern to implement separation of concerns

- Update IModuleProcessor interface to accept targetBOMs collection instead of targetItemName string
- Remove filtering logic from strategy implementations (AppendOnly, CloneNew)
- Add LoadData method to mSpecAdditionManager for UI initialization
- Rename ExecuteAddition to ExecutePipeline with refined parameters
- Enhance test suite to simulate fine-grained UI selection behavior
- Enable precise row-level control by delegating filtering to UI layer

This refactoring achieves better separation of concerns where:
- Strategy layer focuses purely on execution logic
- UI layer handles selection and filtering
- Manager layer coordinates the pipeline flow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-03-19 15:04:24 +08:00
parent d17d7c5864
commit b73e39eeee
5 changed files with 92 additions and 109 deletions

View File

@@ -1,28 +1,24 @@
' ==============================================================================
' 模块名称: cProcessor_AppendOnly
' 模块类别: 类模块
' 模块职责: 通用追加策略。适用于接头、封口片、机芯、盘止钉等。
' 逻辑描述: 遍历所有数据,凡是名称与目标匹配的变种,一律注入新条件
' 模块职责: 通用追加策略。
' 逻辑描述: 无脑遍历传入的 targetBOMs 集合,利用引擎进行条件追加
' ==============================================================================
Option Explicit
Implements IModuleProcessor
Private Sub IModuleProcessor_ProcessSpec( _
ByRef allBOMs As Collection, _
ByVal targetItemName As String, _
ByRef targetBOMs As Collection, _
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
' UI targetBOMs
For Each rowObj In targetBOMs
rowObj.Condition = engine.InjectOr(rowObj.Condition, paramName, newValue)
Next rowObj
End Sub