diff --git a/VBA/ClassModules/BomItem.cls b/VBA/ClassModules/BomItem.cls index 3c12ef5..cd212d2 100644 --- a/VBA/ClassModules/BomItem.cls +++ b/VBA/ClassModules/BomItem.cls @@ -1,6 +1,6 @@ '===================================================================== -' 类名: BomItem -' 功能: BOM物料项数据模型 +' 类名:BomItem +' 功能:BOM 物料项数据模型 '===================================================================== Option Explicit @@ -16,71 +16,74 @@ Public Remark As String ' 备注 Public category As String ' 类别 Public ParentCategory As String ' 上层类别 Public CategoryCondition As String ' 类别选用条件 -Public Code66 As String ' 66代码 +Public Code66 As String ' 66 代码 +Public BipRowNumberBase As Long ' BIP 行号基数 ' 匹配状态 Public IsMatched As Boolean ' 是否匹配 Public MatchError As String ' 匹配错误信息 '===================================================================== -' 方法: Class_Initialize -' 功能: 初始化类 +' 方法:Class_Initialize +' 功能:初始化类 '===================================================================== Private Sub Class_Initialize() IsMatched = False MatchError = "" + BipRowNumberBase = 7000 End Sub '===================================================================== -' 方法: LoadFromRow -' 功能: 从工作表行加载数据 -' 参数: ws - 工作表对象 +' 方法:LoadFromRow +' 功能:从工作表行加载数据 +' 参数:ws - 工作表对象 ' row - 行号 '===================================================================== Public Sub LoadFromRow(ws As Worksheet, row As Long) On Error Resume Next - Me.RowNumber = CLng(ws.Cells(row, 1).value) ' A列: 行号 - Me.Module = CStr(ws.Cells(row, 2).value) ' B列: 模块 - Me.code = CStr(ws.Cells(row, 3).value) ' C列: 代号 - Me.Name = CStr(ws.Cells(row, 4).value) ' D列: 名称 - Me.Quantity = CDbl(ws.Cells(row, 5).value) ' E列: 数量 - Me.SelectCondition = CStr(ws.Cells(row, 6).value) ' F列: 选择条件 - Me.Remark = CStr(ws.Cells(row, 7).value) ' G列: 备注 - Me.category = CStr(ws.Cells(row, 8).value) ' H列: 类别 - Me.ParentCategory = CStr(ws.Cells(row, 9).value) ' I列: 上层类别 - Me.CategoryCondition = CStr(ws.Cells(row, 10).value) ' J列: 类别选用条件 - Me.Code66 = CStr(ws.Cells(row, 11).value) ' K列: 66代码 + Me.RowNumber = CLng(ws.Cells(row, 1).value) ' A 列:行号 + Me.Module = CStr(ws.Cells(row, 2).value) ' B 列:模块 + Me.code = CStr(ws.Cells(row, 3).value) ' C 列:代号 + Me.Name = CStr(ws.Cells(row, 4).value) ' D 列:名称 + Me.Quantity = CDbl(ws.Cells(row, 5).value) ' E 列:数量 + Me.SelectCondition = CStr(ws.Cells(row, 6).value) ' F 列:选择条件 + Me.Remark = CStr(ws.Cells(row, 7).value) ' G 列:备注 + Me.category = CStr(ws.Cells(row, 8).value) ' H 列:类别 + Me.ParentCategory = CStr(ws.Cells(row, 9).value) ' I 列:上层类别 + Me.CategoryCondition = CStr(ws.Cells(row, 10).value) ' J 列:类别选用条件 + Me.Code66 = CStr(ws.Cells(row, 11).value) ' K 列:66 代码 + Me.BipRowNumberBase = CLng(ws.Cells(row, 12).value) ' L 列:BIP 行号基数 On Error GoTo 0 End Sub '===================================================================== -' 方法: IsValidItem -' 功能: 判断是否为有效物料(类别字段不为空) -' 返回: Boolean +' 方法:IsValidItem +' 功能:判断是否为有效物料 (类别字段不为空) +' 返回:Boolean '===================================================================== Public Function IsValidItem() As Boolean IsValidItem = (Trim(Me.category) <> "") End Function '===================================================================== -' 方法: HasParentCategory -' 功能: 判断是否有父类别 -' 返回: Boolean +' 方法:HasParentCategory +' 功能:判断是否有父类别 +' 返回:Boolean '===================================================================== Public Function HasParentCategory() As Boolean HasParentCategory = (Trim(Me.ParentCategory) <> "") End Function '===================================================================== -' 方法: ToString -' 功能: 转换为字符串描述 -' 返回: String +' 方法:ToString +' 功能:转换为字符串描述 +' 返回:String '===================================================================== Public Function ToString() As String ToString = "行号:" & Me.RowNumber & _ " | 类别:" & Me.category & _ " | 代号:" & Me.code & _ " | 名称:" & Me.Name -End Function \ No newline at end of file +End Function