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:
Misaka_Company
2026-03-19 14:09:29 +08:00
parent 76a75c9a05
commit d17d7c5864
6 changed files with 274 additions and 24 deletions

View File

@@ -0,0 +1,27 @@
' ==============================================================================
' 模块名称: mProcessorFactory
' 模块类别: 标准模块 (Standard Module)
' 模块职责: 负责根据传入的策略类型标识,实例化并返回对应的业务策略对象
' ==============================================================================
Option Explicit
' ------------------------------------------------------------------------------
' 函数名称: GetProcessor
' 函数功能: 根据策略别名,返回对应的 IModuleProcessor 实现类
' 参数说明: strategyType - 策略标识 (例如 "APPEND" 或 "CLONE")
' ------------------------------------------------------------------------------
Public Function GetProcessor(ByVal strategyType As String) As IModuleProcessor
Select Case UCase(Trim(strategyType))
Case "APPEND"
' 返回追加策略实例
Set GetProcessor = New cProcessor_AppendOnly
Case "CLONE"
' 返回克隆新增策略实例
Set GetProcessor = New cProcessor_CloneNew
Case Else
' 如果传入了未知的策略,主动抛出异常阻断运行
Err.Raise vbObjectError + 513, "ProcessorFactory", "未知的业务处理策略: " & strategyType
End Select
End Function