📄 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 = True
Option Explicit
Dim M_HwCkCode As String
Dim M_HwCkMc As String
Dim M_HwCkIsStop As Integer
Dim M_HwCkNo As Double
Dim M_HwCk_id As Integer
Dim M_HwCk_Key As Long
Private Sub Class_Initialize()
M_HwCk_id = -1
End Sub
Public Property Get HwCkCode() As String
HwCkCode = M_HwCkCode
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 Get HwCk_id() As Integer
HwCk_id = M_HwCk_id
End Property
Public Property Get HwCk_Key() As Long
HwCk_Key = M_HwCk_Key
End Property
Public Property Let HwCkCode(VHwCkCode As String)
If Trim(VHwCkCode) = "" Then
Err.Raise Number:=vbObjectError + 1, Description:="仓库编码不能为空!"
Exit Property
End If
If VHwCkCode <> M_HwCkCode Then
If M_HwCk_id = -1 Or VHwCkCode <> M_HwCkCode Then
If gPublicFunction.ExistFlg("FROM HwCkREC WHERE HwCkCode='" + VHwCkCode + "'") = 1 Then
Err.Raise Number:=vbObjectError + 1, Description:="已有仓库编码:" & VHwCkCode
Exit Property
End If
End If
End If
M_HwCkCode = VHwCkCode
End Property
Public Property Let HwCkMc(VHwCkMc As String)
If Trim(VHwCkMc) = "" Then
Err.Raise vbObjectError + 1, , "仓库名称不能为空!"
Exit Property
End If
If VHwCkMc <> M_HwCkMc Then
If M_HwCk_id = -1 Or VHwCkMc <> M_HwCkMc Then
If gPublicFunction.ExistFlg("FROM HwCkREC WHERE HwCkMc='" + VHwCkMc + "'") = 1 Then
Err.Raise Number:=vbObjectError + 1, Description:="已有仓库名称:" & VHwCkMc
Exit Property
End If
End If
M_HwCkMc = VHwCkMc
End If
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 Property Let HwCk_id(vHwCk_id As Integer)
M_HwCk_id = vHwCk_id
End Property
Public Property Let HwCk_Key(vHwCk_Key As Long)
M_HwCk_Key = vHwCk_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_HwCk_id = -1 Then
Cmd.CommandText = "{CALL HwCkREC_INSERT(?,?,?,?)}"
Cmd.Parameters(0) = M_HwCkCode
Cmd.Parameters(1) = M_HwCkMc
Cmd.Parameters(2) = M_HwCkIsStop
Cmd.Parameters(3).Direction = adParamOutput
Cmd.Execute
M_HwCk_id = 1
M_HwCkNo = Cmd.Parameters(3)
Else
Cmd.CommandText = "{CALL HwCkREC_UPDATE(?,?,?,?)}"
Cmd(0) = M_HwCkNo
Cmd(1) = M_HwCkCode
Cmd(2) = M_HwCkMc
Cmd(3) = M_HwCkIsStop
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 "HWCKREC", "HWCKNO", CStr(M_HwCkNo)
On Error GoTo ErrorHandle
Set Cmd = New ADODB.Command
Set Cmd.ActiveConnection = gDbCommon.Conn
Cmd.CommandText = "{call HwCkrec_delete(?)}"
Cmd.Parameters(0) = M_HwCkNo
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(VHwCkCode As String) As Integer
Dim Rs As DbRs
On Error GoTo ErrorHandle
Set Rs = New DbRs
Rs.Fillbydb ("select HwCkCode,HwCkMc,HwCkISSTOP,HwCkNo from HwCkrec where HwCkCode='" + VHwCkCode + "'")
Requery = -1
If Not Rs.EOF Then
Requery = 1
BatchLet Rs!HwCkCode, Rs!HwCkMc, Rs!HwCkIsStop, Rs!HwCkNo
End If
Set Rs = Nothing
Exit Function
ErrorHandle:
Set Rs = Nothing
End Function
Public Sub BatchLet(ParamArray Properties())
M_HwCkCode = Properties(0)
M_HwCkMc = Properties(1)
M_HwCkIsStop = Properties(2)
M_HwCkNo = Properties(3)
M_HwCk_id = 1
End Sub
Public Property Get Name() As String
Name = "HwCk"
End Property
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -