refactor: integrate [领料配置] into [平台配置清单] and add category selection conditions
Major changes: - Remove dependency on separate [领料配置] sheet - Load all data from [平台配置清单] in a single pass - Add "类别选用条件" (CategorySelectCondition) field to support dynamic category filtering - Add "66代码" (Code66) field for 66-system integration - Refactor completeness check logic to only verify required categories Data model changes: - clsMaterialItem: Add CategorySelectCondition and Code66 properties - clsCategory: Add CategorySelectCondition property and IsRequiredForModel() method - clsBOMManager: Refactor LoadData() to use single data source - clsBOMManager: Add GetRequiredCategories() method - clsBOMManager: Update GetValidMaterialsByModel() to use category selection conditions New workflow: - LoadData() now takes only wsPlatform parameter (removed wsConfig) - Categories are filtered by "类别选用条件" before completeness check - Categories with empty selection condition are always required - Categories with non-empty condition are checked against model specifications Documentation: - Update CLAUDE.md with new sheet structure - Add comprehensive refactoring plan document - Add v2.0 LoadData flow analysis with Mermaid diagrams - Add platform configuration sheet reference Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,9 +6,10 @@ Option Explicit
|
||||
|
||||
Public categoryName As String
|
||||
Public ParentCategoryName As String
|
||||
Public materials As collection ' 存储 clsMaterialItem 对象
|
||||
Public SubCategories As collection ' 存储子类别 clsCategory 对象
|
||||
Public IsLeafCategory As Boolean ' 是否叶子类别(无子类别)
|
||||
Public materials As collection ' 存储 clsMaterialItem 对象
|
||||
Public SubCategories As collection ' 存储子类别 clsCategory 对象
|
||||
Public IsLeafCategory As Boolean ' 是否叶子类别(无子类别)
|
||||
Public CategorySelectCondition As String ' 类别选用条件(用于判断该类别是否需要)
|
||||
|
||||
Private Sub Class_Initialize()
|
||||
Set materials = New collection
|
||||
@@ -37,4 +38,47 @@ End Function
|
||||
' 检查是否有子类别
|
||||
Public Function HasSubCategories() As Boolean
|
||||
HasSubCategories = (SubCategories.Count > 0)
|
||||
End Function
|
||||
|
||||
' ========================================
|
||||
' IsRequiredForModel 方法
|
||||
' 功能: 根据型号条件判断该类别是否需要
|
||||
' 参数:
|
||||
' conditions - 从型号提取的条件字典 (Dictionary对象)
|
||||
' 返回:
|
||||
' True - 该类别需要
|
||||
' False - 该类别不需要
|
||||
'
|
||||
' 判断逻辑:
|
||||
' 1. 如果 CategorySelectCondition 为空字符串
|
||||
' → 该类别总是需要(无条件限制)
|
||||
' 2. 如果 CategorySelectCondition 不为空
|
||||
' → 使用 clsConditionMatcher 匹配条件
|
||||
' → 匹配成功 → 需要
|
||||
' → 匹配失败 → 不需要
|
||||
'
|
||||
' 示例:
|
||||
' 假设型号条件为: lcfw=M16, gclj=M20
|
||||
'
|
||||
' 情况1: CategorySelectCondition = ""
|
||||
' → IsRequiredForModel(conditions) = True
|
||||
'
|
||||
' 情况2: CategorySelectCondition = "lcfw=M16"
|
||||
' → IsRequiredForModel(conditions) = True (匹配)
|
||||
'
|
||||
' 情况3: CategorySelectCondition = "lcfw=M02"
|
||||
' → IsRequiredForModel(conditions) = False (不匹配)
|
||||
'
|
||||
' 情况4: CategorySelectCondition = "gclj=M20 AND jycz=1"
|
||||
' → IsRequiredForModel(conditions) = True (匹配)
|
||||
' ========================================
|
||||
Public Function IsRequiredForModel(conditions As Object) As Boolean
|
||||
If Me.CategorySelectCondition = "" Then
|
||||
' 选用条件为空,该类别总是需要
|
||||
IsRequiredForModel = True
|
||||
Else
|
||||
' 需要用 conditions 去匹配 CategorySelectCondition
|
||||
Dim matcher As New clsConditionMatcher
|
||||
IsRequiredForModel = matcher.IsMatch(Me.CategorySelectCondition, conditions)
|
||||
End If
|
||||
End Function
|
||||
Reference in New Issue
Block a user