- 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>
39 lines
1.5 KiB
OpenEdge ABL
39 lines
1.5 KiB
OpenEdge ABL
' ==============================================================================
|
||
' 模块名称: cProcessor_CloneNew
|
||
' 模块类别: 类模块
|
||
' 模块职责: 通用克隆新增策略。适用于弹性元件等需要完全独立成行的规格。
|
||
' 逻辑描述: 找到第一个匹配的母版行,克隆它并赋予纯粹的新规格条件。
|
||
' ==============================================================================
|
||
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
|
||
Dim templateRow As cBOMRow
|
||
Set templateRow = Nothing
|
||
|
||
' 1. 寻找母版 (找到同名的第一条记录即可)
|
||
For Each rowObj In allBOMs
|
||
If StrComp(rowObj.ItemName, targetItemName, vbTextCompare) = 0 Then
|
||
Set templateRow = rowObj
|
||
Exit For
|
||
End If
|
||
Next rowObj
|
||
|
||
' 2. 如果找到了母版,进行克隆
|
||
If Not templateRow Is Nothing Then
|
||
Dim newRow As cBOMRow
|
||
' 调用数据访问层的克隆方法,它会自动把新对象加入到 allBOMs 集合中
|
||
Set newRow = mBOMRepository.InsertNewBOMRow(allBOMs, templateRow)
|
||
|
||
' 新行的选择条件不再是追加,而是直接等于新规格 (例如:lcfw=M19)
|
||
newRow.Condition = paramName & "=" & newValue
|
||
End If
|
||
|
||
End Sub |