📄 hwpdrc.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 = "HwPdRc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Dim M_HwPdRcCode As String
Dim M_HwPdRcMc As String
Dim M_HwPdRcIsStop As Integer
Dim M_HwPdRcNo As Double
Dim M_HwPdRc_id As Integer
Dim M_HwPdRc_Key As Long
Private Sub Class_Initialize()
M_HwPdRc_id = -1
End Sub
Public Property Get HwPdRcCode() As String
HwPdRcCode = M_HwPdRcCode
End Property
Public Property Get HwPdRcMc() As String
HwPdRcMc = M_HwPdRcMc
End Property
Public Property Get HwPdRcIsStop() As Integer
HwPdRcIsStop = M_HwPdRcIsStop
End Property
Public Property Get HwPdRcNo() As Double
HwPdRcNo = M_HwPdRcNo
End Property
Public Property Get HwPdRc_id() As Integer
HwPdRc_id = M_HwPdRc_id
End Property
Public Property Get HwPdRc_Key() As Long
HwPdRc_Key = M_HwPdRc_Key
End Property
Public Property Let HwPdRcCode(VHwPdRcCode As String)
If Trim(VHwPdRcCode) = "" Then
Err.Raise Number:=vbObjectError + 1, Description:="盘点差异原因码不能为空!"
Exit Property
End If
If VHwPdRcCode <> M_HwPdRcCode Then
If M_HwPdRc_id = -1 Or VHwPdRcCode <> M_HwPdRcCode Then
If gPublicFunction.ExistFlg("FROM HwPdRcREC WHERE HwPdRcCode='" + VHwPdRcCode + "'") = 1 Then
Err.Raise Number:=vbObjectError + 1, Description:="已有盘点差异原因码:" & VHwPdRcCode
Exit Property
End If
End If
End If
M_HwPdRcCode = VHwPdRcCode
End Property
Public Property Let HwPdRcMc(VHwPdRcMc As String)
If Trim(VHwPdRcMc) = "" Then
Err.Raise vbObjectError + 1, , "盘点差异原因说明不能为空!"
Exit Property
End If
If VHwPdRcMc <> M_HwPdRcMc Then
If M_HwPdRc_id = -1 Or VHwPdRcMc <> M_HwPdRcMc Then
If gPublicFunction.ExistFlg("FROM HwPdRcREC WHERE HwPdRcMc='" + VHwPdRcMc + "'") = 1 Then
Err.Raise Number:=vbObjectError + 1, Description:="已有盘点差异原因说明:" & VHwPdRcMc
Exit Property
End If
End If
M_HwPdRcMc = VHwPdRcMc
End If
End Property
Public Property Let HwPdRcIsStop(VHwPdRcIsStop As Integer)
If VHwPdRcIsStop <> 0 And VHwPdRcIsStop <> 1 Then
Err.Raise vbObjectError + 1, , "停用标志只能为0或1!"
Exit Property
End If
M_HwPdRcIsStop = VHwPdRcIsStop
End Property
Public Property Let HwPdRc_id(vHwPdRc_id As Integer)
M_HwPdRc_id = vHwPdRc_id
End Property
Public Property Let HwPdRc_Key(vHwPdRc_Key As Long)
M_HwPdRc_Key = vHwPdRc_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_HwPdRc_id = -1 Then
Cmd.CommandText = "{CALL HwPdRcREC_INSERT(?,?,?,?)}"
Cmd.Parameters(0) = M_HwPdRcCode
Cmd.Parameters(1) = M_HwPdRcMc
Cmd.Parameters(2) = M_HwPdRcIsStop
Cmd.Parameters(3).Direction = adParamOutput
Cmd.Execute
M_HwPdRc_id = 1
M_HwPdRcNo = Cmd.Parameters(3)
Else
Cmd.CommandText = "{CALL HwPdRcREC_UPDATE(?,?,?,?)}"
Cmd(0) = M_HwPdRcNo
Cmd(1) = M_HwPdRcCode
Cmd(2) = M_HwPdRcMc
Cmd(3) = M_HwPdRcIsStop
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 "HWPDRCREC", "HWPDRCNO", CStr(M_HwPdRcNo)
On Error GoTo ErrorHandle
Set Cmd = New ADODB.Command
Set Cmd.ActiveConnection = gDbCommon.Conn
Cmd.CommandText = "{call HwPdRcrec_delete(?)}"
Cmd.Parameters(0) = M_HwPdRcNo
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(VHwPdRcCode As String) As Integer
Dim Rs As DbRs
On Error GoTo ErrorHandle
Set Rs = New DbRs
Rs.Fillbydb ("select HwPdRcCode,HwPdRcMc,HwPdRcISSTOP,HwPdRcNo from HwPdRcrec where HwPdRcCode='" + VHwPdRcCode + "'")
Requery = -1
If Not Rs.EOF Then
Requery = 1
BatchLet Rs!HwPdRcCode, Rs!HwPdRcMc, Rs!HwPdRcIsStop, Rs!HwPdRcNo
End If
Set Rs = Nothing
Exit Function
ErrorHandle:
Set Rs = Nothing
End Function
Public Sub BatchLet(ParamArray Properties())
M_HwPdRcCode = Properties(0)
M_HwPdRcMc = Properties(1)
M_HwPdRcIsStop = Properties(2)
M_HwPdRcNo = Properties(3)
M_HwPdRc_id = 1
End Sub
Public Property Get Name() As String
Name = "HwPdRc"
End Property
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -