Files
AutoBOM/VBA/ClassModules/clsCategory.cls
Misaka_Company 05601ec1fc Add initial implementation of BOM management classes and data structure
- Created clsBOMManager for managing BOM data
- Added clsCategory and clsMaterialItem for category and material representation
- Implemented methods for loading and organizing BOM data from Excel
- Introduced .gitignore to exclude unnecessary files
- Added metadata JSON for module tracking
2026-01-20 08:53:01 +08:00

40 lines
1.1 KiB
OpenEdge ABL

' ========================================
' 类模块: clsCategory
' 用途: 表示物料类别及其层级关系
' ========================================
Option Explicit
Public categoryName As String
Public ParentCategoryName As String
Public Materials As Collection ' 存储 clsMaterialItem 对象
Public SubCategories As Collection ' 存储子类别 clsCategory 对象
Public IsLeafCategory As Boolean ' 是否叶子类别(无子类别)
Private Sub Class_Initialize()
Set Materials = New Collection
Set SubCategories = New Collection
IsLeafCategory = True
End Sub
' 添加物料
Public Sub AddMaterial(mat As clsMaterialItem)
Materials.Add mat, mat.code
End Sub
' 添加子类别
Public Sub AddSubCategory(cat As clsCategory)
SubCategories.Add cat, cat.categoryName
IsLeafCategory = False
End Sub
' 获取物料(按代号)
Public Function GetMaterial(code As String) As clsMaterialItem
On Error Resume Next
Set GetMaterial = Materials(code)
On Error GoTo 0
End Function
'
Public Function HasSubCategories() As Boolean
HasSubCategories = (SubCategories.Count > 0)
End Function