Files
AutoBOM/VBA/ClassModules/BomItem.cls
Misaka_Company 596a2d0ad2 chore: clean up whitespace and update gitignore
- Remove trailing whitespace in BIPUploadModule.bas
- Add missing newline at end of BomItem.cls
- Update .gitignore: rename Claude to AI Agent, add .sisyphus/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 17:23:59 +08:00

89 lines
3.4 KiB
OpenEdge ABL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'=====================================================================
' 类名BomItem
' 功能BOM 物料项数据模型
'=====================================================================
Option Explicit
' 物料属性
Public RowNumber As Long ' 行号
Public Module As String ' 模块
Public code As String ' 代号
Public Name As String ' 名称
Public Quantity As Double ' 数量
Public SelectCondition As String ' 选择条件
Public Remark As String ' 备注
Public category As String ' 类别
Public ParentCategory As String ' 上层类别
Public CategoryCondition As String ' 类别选用条件
Public Code66 As String ' 66 代码
Public BipRowNumberBase As Long ' BIP 行号基数
' 匹配状态
Public IsMatched As Boolean ' 是否匹配
Public MatchError As String ' 匹配错误信息
'=====================================================================
' 方法Class_Initialize
' 功能:初始化类
'=====================================================================
Private Sub Class_Initialize()
IsMatched = False
MatchError = ""
BipRowNumberBase = 7000
End Sub
'=====================================================================
' 方法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.BipRowNumberBase = CLng(ws.Cells(row, 12).value) ' L 列BIP 行号基数
On Error GoTo 0
End Sub
'=====================================================================
' 方法IsValidItem
' 功能:判断是否为有效物料 (类别字段不为空)
' 返回Boolean
'=====================================================================
Public Function IsValidItem() As Boolean
IsValidItem = (Trim(Me.category) <> "")
End Function
'=====================================================================
' 方法HasParentCategory
' 功能:判断是否有父类别
' 返回Boolean
'=====================================================================
Public Function HasParentCategory() As Boolean
HasParentCategory = (Trim(Me.ParentCategory) <> "")
End Function
'=====================================================================
' 方法ToString
' 功能:转换为字符串描述
' 返回String
'=====================================================================
Public Function ToString() As String
ToString = "行号:" & Me.RowNumber & _
" | 类别:" & Me.category & _
" | 代号:" & Me.code & _
" | 名称:" & Me.Name
End Function