📄 hwck.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 = "HwCk"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'QQ:75347626
'MSN:whailin2000@hotmail.com
Option Explicit
Dim m_HwCkMc As String
Dim m_HwCkIsStop As Integer
Dim m_HwCkNo As Double
Dim m_HwCkId As Integer
Dim m_HwCkKey As Integer
Private Sub Class_Initialize()
m_HwCkId = -1
End Sub
Public Property Get Name() As String
Name = "HwCk"
End Property
Public Property Get HwCkId() As Integer
HwCkId = m_HwCkId
End Property
Public Property Get HwCkKey() As Integer
HwCkKey = m_HwCkKey
End Property
Public Property Get HwCkMc() As String
HwCkMc = m_HwCkMc
End Property
Public Property Get HwCkIsStop() As Integer
HwCkIsStop = m_HwCkIsStop
End Property
Public Property Get HwCkNo() As Double
HwCkNo = m_HwCkNo
End Property
Public Property Let HwCkId(vHwCkId As Integer)
m_HwCkId = vHwCkId
End Property
Public Property Let HwCkKey(vHwCkKey As Integer)
m_HwCkKey = vHwCkKey
End Property
Public Property Let HwCkMc(vHwCkMc As String)
If Trim(vHwCkMc) = "" Then
Err.Raise vbObjectError + 1, , "仓库名称不能为空!"
Exit Property
End If
If m_HwCkMc <> vHwCkMc Then
Dim Rs As ADODB.Recordset
Set Rs = Conn.Execute("SELECT * FROM HWCKREC WHERE HwCkMc='" & vHwCkMc & "'")
If Not Rs.EOF Then
Rs.Close
Set Rs = Nothing
Err.Raise vbObjectError + 1, , "仓库名称已经存在!"
Exit Property
End If
Rs.Close
Set Rs = Nothing
End If
m_HwCkMc = vHwCkMc
End Property
Public Property Let HwCkIsStop(vHwCkIsStop As Integer)
If vHwCkIsStop <> 0 And vHwCkIsStop <> 1 Then
Err.Raise vbObjectError + 1, , "停用标志只能为0或1!"
Exit Property
End If
m_HwCkIsStop = vHwCkIsStop
End Property
Public Sub Save()
On Error GoTo Errorhandle
If m_HwCkId = -1 Then
Cmd.CommandText = "{CALL HwCkREC_INSERT(?,?,?)}"
Cmd(0) = m_HwCkMc
Cmd(1) = m_HwCkIsStop
Cmd(2).Direction = adParamOutput
Else
Cmd.CommandText = "{CALL HwCkREC_UPDATE(?,?,?)}"
Cmd(0) = m_HwCkNo
Cmd(1) = m_HwCkMc
Cmd(2) = m_HwCkIsStop
End If
Conn.BeginTrans
Cmd.Execute
Conn.CommitTrans
If m_HwCkId = -1 Then
m_HwCkNo = Cmd(2)
m_HwCkId = 1
End If
Exit Sub
Errorhandle:
Conn.RollbackTrans
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Public Sub Del()
On Error GoTo Errorhandle
Cmd.CommandText = "{CALL HwCkREC_DELETE(?)}"
Cmd(0) = m_HwCkNo
Conn.BeginTrans
Cmd.Execute
Conn.CommitTrans
Exit Sub
Errorhandle:
Conn.RollbackTrans
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Public Function Requery(vHwCkCode As String, Optional vHwCkNo As Double = 0) As Integer
Dim mRs As ADODB.Recordset
On Error GoTo Errorhandle
Requery = -1
Set mRs = Conn.Execute("SELECT HwCkMC,HwCkISSTOP,HwCkNO FROM HwCkREC WHERE (HwCkMc='" & vHwCkCode & "' OR HWCKNO=" & CStr(vHwCkNo) & ")")
If Not mRs.EOF Then
BatchLet mRs!HwCkMc, mRs!HwCkIsStop, mRs!HwCkNo
Requery = 1
End If
Set mRs = Nothing
Exit Function
Errorhandle:
Set mRs = Nothing
Err.Raise vbObjectError + 1, , Err.Description
End Function
Public Sub BatchLet(ParamArray Properties() As Variant)
m_HwCkMc = Properties(0)
m_HwCkIsStop = Properties(1)
m_HwCkNo = Properties(2)
m_HwCkId = 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -