📄 hwfl.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "HwFl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Dim M_HwFlCode As String
Dim M_HwFlMc As String
Dim M_HwFlIsStop As Integer
Dim M_HwFlNo As Double
Dim M_HwFl_id As Integer
Dim M_HwFl_Key As Long
Private Sub Class_Initialize()
M_HwFl_id = -1
End Sub
Public Property Get HwFlCode() As String
HwFlCode = M_HwFlCode
End Property
Public Property Get HwFlMc() As String
HwFlMc = M_HwFlMc
End Property
Public Property Get HwFlIsStop() As Integer
HwFlIsStop = M_HwFlIsStop
End Property
Public Property Get HwFlNo() As Double
HwFlNo = M_HwFlNo
End Property
Public Property Get HwFl_id() As Integer
HwFl_id = M_HwFl_id
End Property
Public Property Get HwFl_Key() As Long
HwFl_Key = M_HwFl_Key
End Property
Public Property Let HwFlCode(VHwFlCode As String)
If Trim(VHwFlCode) = "" Then
Err.Raise Number:=vbObjectError + 1, Description:="货物分类码不能为空!"
Exit Property
End If
If VHwFlCode <> M_HwFlCode Then
If M_HwFl_id = -1 Or VHwFlCode <> M_HwFlCode Then
If gPublicFunction.ExistFlg("FROM HwFlREC WHERE HwFlCode='" + VHwFlCode + "'") = 1 Then
Err.Raise Number:=vbObjectError + 1, Description:="已有货物分类码:" & VHwFlCode
Exit Property
End If
End If
End If
M_HwFlCode = VHwFlCode
End Property
Public Property Let HwFlMc(VHwFlMc As String)
If Trim(VHwFlMc) = "" Then
Err.Raise vbObjectError + 1, , "货物分类名称不能为空!"
Exit Property
End If
If VHwFlMc <> M_HwFlMc Then
If M_HwFl_id = -1 Or VHwFlMc <> M_HwFlMc Then
If gPublicFunction.ExistFlg("FROM HwFlREC WHERE HwFlMc='" + VHwFlMc + "'") = 1 Then
Err.Raise Number:=vbObjectError + 1, Description:="已有货物分类名称:" & VHwFlMc
Exit Property
End If
End If
M_HwFlMc = VHwFlMc
End If
End Property
Public Property Let HwFlIsStop(VHwFlIsStop As Integer)
If VHwFlIsStop <> 0 And VHwFlIsStop <> 1 Then
Err.Raise vbObjectError + 1, , "停用标志只能为0或1!"
Exit Property
End If
M_HwFlIsStop = VHwFlIsStop
End Property
Public Property Let HwFl_id(vHwFl_id As Integer)
M_HwFl_id = vHwFl_id
End Property
Public Property Let HwFl_Key(vHwFl_Key As Long)
M_HwFl_Key = vHwFl_Key
End Property
Public Sub DbSave()
Dim Cmd As ADODB.Command
Dim mSqlStr As String
On Error GoTo ErrorHandle
Set Cmd = New ADODB.Command
Set Cmd.ActiveConnection = gDbCommon.Conn
If M_HwFl_id = -1 Then
Cmd.CommandText = "{CALL HwFlREC_INSERT(?,?,?,?)}"
Cmd.Parameters(0) = M_HwFlCode
Cmd.Parameters(1) = M_HwFlMc
Cmd.Parameters(2) = M_HwFlIsStop
Cmd.Parameters(3).Direction = adParamOutput
Cmd.Execute
M_HwFl_id = 1
M_HwFlNo = Cmd.Parameters(3)
Else
Cmd.CommandText = "{CALL HwFlREC_UPDATE(?,?,?,?)}"
Cmd(0) = M_HwFlNo
Cmd(1) = M_HwFlCode
Cmd(2) = M_HwFlMc
Cmd(3) = M_HwFlIsStop
Cmd.Execute
End If
Set Cmd = Nothing
Exit Sub
ErrorHandle:
Set Cmd = Nothing
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Public Sub DbDel()
Dim Cmd As ADODB.Command
gPublicFunction.CheckCanBeDelete "HWFLREC", "HWFLNO", CStr(M_HwFlNo)
On Error GoTo ErrorHandle
Set Cmd = New ADODB.Command
Set Cmd.ActiveConnection = gDbCommon.Conn
Cmd.CommandText = "{call HwFlrec_delete(?)}"
Cmd.Parameters(0) = M_HwFlNo
gDbCommon.Conn.BeginTrans
Cmd.Execute
gDbCommon.Conn.CommitTrans
Set Cmd = Nothing
Exit Sub
ErrorHandle:
Set Cmd = Nothing
gDbCommon.Conn.RollbackTrans
End Sub
Public Function Requery(VHwFlCode As String) As Integer
Dim Rs As DbRs
On Error GoTo ErrorHandle
Set Rs = New DbRs
Rs.Fillbydb ("select HwFlCode,HwFlMc,HwFlISSTOP,HwFlNo from HwFlrec where HwFlCode='" + VHwFlCode + "'")
Requery = -1
If Not Rs.EOF Then
Requery = 1
BatchLet Rs!HwFlCode, Rs!HwFlMc, Rs!HwFlIsStop, Rs!HwFlNo
End If
Set Rs = Nothing
Exit Function
ErrorHandle:
Set Rs = Nothing
End Function
Public Sub BatchLet(ParamArray Properties())
M_HwFlCode = Properties(0)
M_HwFlMc = Properties(1)
M_HwFlIsStop = Properties(2)
M_HwFlNo = Properties(3)
M_HwFl_id = 1
End Sub
Public Property Get Name() As String
Name = "HwFl"
End Property
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -