⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hwbfrc.cls

📁 制造业产供销与往来系统源码,包括进销存及全部控件!
💻 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 = "HwBfRc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Dim M_HwBfRcCode As String
Dim M_HwBfRcMc As String
Dim M_HwBfRcIsStop As Integer
Dim M_HwBfRcNo As Double

Dim M_HwBfRc_id As Integer
Dim M_HwBfRc_Key As Long

Private Sub Class_Initialize()

M_HwBfRc_id = -1

End Sub

Public Property Get HwBfRcCode() As String

HwBfRcCode = M_HwBfRcCode

End Property

Public Property Get HwBfRcMc() As String

HwBfRcMc = M_HwBfRcMc

End Property

Public Property Get HwBfRcIsStop() As Integer

HwBfRcIsStop = M_HwBfRcIsStop

End Property

Public Property Get HwBfRcNo() As Double

HwBfRcNo = M_HwBfRcNo

End Property

Public Property Get HwBfRc_id() As Integer

    HwBfRc_id = M_HwBfRc_id

End Property

Public Property Get HwBfRc_Key() As Long

    HwBfRc_Key = M_HwBfRc_Key

End Property

Public Property Let HwBfRcCode(VHwBfRcCode As String)

If Trim(VHwBfRcCode) = "" Then
   Err.Raise Number:=vbObjectError + 1, Description:="报废原因码不能为空!"
   Exit Property
End If

If VHwBfRcCode <> M_HwBfRcCode Then
    If M_HwBfRc_id = -1 Or VHwBfRcCode <> M_HwBfRcCode Then
       If gPublicFunction.ExistFlg("FROM HwBfRcREC WHERE HwBfRcCode='" + VHwBfRcCode + "'") = 1 Then
          Err.Raise Number:=vbObjectError + 1, Description:="已有报废原因码:" & VHwBfRcCode
          Exit Property
       End If
    End If
End If
    
M_HwBfRcCode = VHwBfRcCode

End Property

Public Property Let HwBfRcMc(VHwBfRcMc As String)

If Trim(VHwBfRcMc) = "" Then
   Err.Raise vbObjectError + 1, , "报废原因说明不能为空!"
   Exit Property
End If

If VHwBfRcMc <> M_HwBfRcMc Then
    If M_HwBfRc_id = -1 Or VHwBfRcMc <> M_HwBfRcMc Then
       If gPublicFunction.ExistFlg("FROM HwBfRcREC WHERE HwBfRcMc='" + VHwBfRcMc + "'") = 1 Then
          Err.Raise Number:=vbObjectError + 1, Description:="已有报废原因说明:" & VHwBfRcMc
          Exit Property
       End If
    End If
    M_HwBfRcMc = VHwBfRcMc
End If

End Property

Public Property Let HwBfRcIsStop(VHwBfRcIsStop As Integer)

If VHwBfRcIsStop <> 0 And VHwBfRcIsStop <> 1 Then
   Err.Raise vbObjectError + 1, , "停用标志只能为0或1!"
   Exit Property
End If

M_HwBfRcIsStop = VHwBfRcIsStop

End Property

Public Property Let HwBfRc_id(vHwBfRc_id As Integer)

M_HwBfRc_id = vHwBfRc_id

End Property

Public Property Let HwBfRc_Key(vHwBfRc_Key As Long)

M_HwBfRc_Key = vHwBfRc_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_HwBfRc_id = -1 Then
   
       Cmd.CommandText = "{CALL HwBfRcREC_INSERT(?,?,?,?)}"
       
       Cmd.Parameters(0) = M_HwBfRcCode
       Cmd.Parameters(1) = M_HwBfRcMc
       Cmd.Parameters(2) = M_HwBfRcIsStop
       Cmd.Parameters(3).Direction = adParamOutput
       
       Cmd.Execute
       
       M_HwBfRc_id = 1
   
       M_HwBfRcNo = Cmd.Parameters(3)
      
   Else
   
       Cmd.CommandText = "{CALL HwBfRcREC_UPDATE(?,?,?,?)}"
       
       Cmd(0) = M_HwBfRcNo
       
       Cmd(1) = M_HwBfRcCode
       Cmd(2) = M_HwBfRcMc
       Cmd(3) = M_HwBfRcIsStop
       
       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 "HWBFRCREC", "HWBFRCNO", CStr(M_HwBfRcNo)
   
On Error GoTo ErrorHandle

   Set Cmd = New ADODB.Command
   
   Set Cmd.ActiveConnection = gDbCommon.Conn
   
   Cmd.CommandText = "{call HwBfRcrec_delete(?)}"
   
   Cmd.Parameters(0) = M_HwBfRcNo
   
   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(VHwBfRcCode As String) As Integer
   Dim Rs As DbRs
On Error GoTo ErrorHandle

   Set Rs = New DbRs
   
   Rs.Fillbydb ("select HwBfRcCode,HwBfRcMc,HwBfRcISSTOP,HwBfRcNo from HwBfRcrec where HwBfRcCode='" + VHwBfRcCode + "'")
   Requery = -1
   If Not Rs.EOF Then
      Requery = 1
      BatchLet Rs!HwBfRcCode, Rs!HwBfRcMc, Rs!HwBfRcIsStop, Rs!HwBfRcNo
   End If
 
   Set Rs = Nothing

Exit Function
ErrorHandle:
   Set Rs = Nothing
End Function

Public Sub BatchLet(ParamArray Properties())

M_HwBfRcCode = Properties(0)
M_HwBfRcMc = Properties(1)
M_HwBfRcIsStop = Properties(2)
M_HwBfRcNo = Properties(3)

M_HwBfRc_id = 1

End Sub

Public Property Get Name() As String

Name = "HwBfRc"

End Property



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -