📄 producedrawmaterialdao.cls
字号:
Set cmdProc = New ADODB.Command
Set cmdProc.ActiveConnection = MainForm.g_application.m_databaseCon.m_adoConnection
' 执行存储过程的命令的设置
cmdProc.CommandText = "producedrawmaterial_findaid1" ' 指定存储过程的名子
cmdProc.CommandType = adCmdStoredProc
cmdProc.Parameters.Refresh
cmdProc.Parameters(1) = cdmid ' 参数
On Error GoTo Cwcl
' 执行命令 把查询到的结果放在recSet中
With recSet
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open cmdProc
End With
With recSet
If Not .EOF Then
producedrawmaterial_findid1 = True
Else
producedrawmaterial_findid1 = False
End If
End With
Exit Function
Cwcl:
producedrawmaterial_findid1 = False
Exit Function
End Function
'**************************************
'* 功 能 描 述 :根据发料ID取得该领料的列表
'* 输 入 参 数 :无
'* 输 出 能 数 :True - 数据库连接成功
'* False - 数据库连接失败
'**************************************
Public Function FindById(recSet As ADODB.Recordset, cdmid As String) As Boolean
Dim cmdProc As ADODB.Command ' 执行存储过程的命令
FindById = False
Set cmdProc = New ADODB.Command
Set cmdProc.ActiveConnection = MainForm.g_application.m_databaseCon.m_adoConnection
' 执行存储过程的命令的设置
cmdProc.CommandText = "producedrawmaterial_findid" ' 指定存储过程的名子
cmdProc.CommandType = adCmdStoredProc
cmdProc.Parameters.Refresh
cmdProc.Parameters(1) = cdmid ' 参数
On Error GoTo Cwcl
' 执行命令 把查询到的结果放在recSet中
With recSet
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open cmdProc
End With
With recSet
If Not .EOF Then
FindById = True
Else
FindById = False
End If
End With
Exit Function
Cwcl:
FindById = False
Exit Function
End Function
'**************************************
'* 功 能 描 述 :查找仓库名称列表
'* 输 入 参 数 :无
'* 输 出 参 数 :true -查找成功
'* false -查找失败
'**************************************
Public Function porduce_warehouse1(recSet As ADODB.Recordset, warehouseid As String) As Boolean
Dim cmdProc As ADODB.Command ' 执行存储过程的命令
porduce_warehouse1 = False
Set cmdProc = New ADODB.Command
Set cmdProc.ActiveConnection = MainForm.g_application.m_databaseCon.m_adoConnection
' 执行存储过程的命令的设置
cmdProc.CommandText = "position_show1" ' 指定存储过程的名子
cmdProc.CommandType = adCmdStoredProc
cmdProc.Parameters.Refresh
cmdProc.Parameters(1) = warehouseid
On Error GoTo Cwcl
' 执行命令 把查询到的结果放在recSet中
With recSet
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open cmdProc
End With
With recSet
If Not .EOF Then
porduce_warehouse1 = True
Else
porduce_warehouse1 = False
End If
End With
Exit Function
Cwcl:
porduce_warehouse1 = False
Exit Function
End Function
Public Function FindidAll(recSet As ADODB.Recordset, produceId As String) As Boolean
Dim cmdProc As ADODB.Command ' 执行存储过程的命令
FindidAll = False
Set cmdProc = New ADODB.Command
Set cmdProc.ActiveConnection = MainForm.g_application.m_databaseCon.m_adoConnection
' 执行存储过程的命令的设置
cmdProc.CommandText = "producedrawmaterial_findidall" ' 指定存储过程的名子
cmdProc.CommandType = adCmdStoredProc
cmdProc.Parameters.Refresh
cmdProc.Parameters(1) = produceId
On Error GoTo Cwcl
' 执行命令 把查询到的结果放在recSet中
With recSet
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open cmdProc
End With
With recSet
If Not .EOF Then
FindidAll = True
Else
FindidAll = False
End If
End With
Exit Function
Cwcl:
FindidAll = False
Exit Function
End Function
Public Function Findidmax(recSet As ADODB.Recordset, cooperateId As String, bomId As String) As Boolean
Dim cmdProc As ADODB.Command ' 执行存储过程的命令
Findidmax = False
Set cmdProc = New ADODB.Command
Set cmdProc.ActiveConnection = MainForm.g_application.m_databaseCon.m_adoConnection
' 执行存储过程的命令的设置
cmdProc.CommandText = "producedrawmaterial_findidmax" ' 指定存储过程的名子
cmdProc.CommandType = adCmdStoredProc
cmdProc.Parameters.Refresh
cmdProc.Parameters(1) = cooperateId
cmdProc.Parameters(2) = bomId
On Error GoTo Cwcl
' 执行命令 把查询到的结果放在recSet中
With recSet
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open cmdProc
End With
With recSet
If Not .EOF Then
Findidmax = True
Else
Findidmax = False
End If
End With
Exit Function
Cwcl:
Findidmax = False
Exit Function
End Function
'**************************************
'* 功 能 描 述 :保存领料记
'* 输 入 参 数 :无
'* 输 出 能 数 :True - 发料成功
'* False - 发料失败
'**************************************
Public Function producedraw_add(recSet As ADODB.Recordset, _
produceId As String, employeeid As String, _
quantity As Double, drawdate As Date, _
warehouseid As String, name As String, processno As String) As String
Dim cmdProc As ADODB.Command ' 执行存储过程的命令
producedraw_add = ""
Set cmdProc = New ADODB.Command
Set cmdProc.ActiveConnection = MainForm.g_application.m_databaseCon.m_adoConnection
' 执行存储过程的命令的设置
cmdProc.CommandText = "producedraw_add" ' 指定存储过程的名子
cmdProc.CommandType = adCmdStoredProc
cmdProc.Parameters.Refresh
cmdProc.Parameters(1) = produceId ' 参数
cmdProc.Parameters(2) = employeeid ' 参数
cmdProc.Parameters(3) = quantity ' 参数
cmdProc.Parameters(4) = drawdate ' 参数
cmdProc.Parameters(5) = warehouseid ' 参数
cmdProc.Parameters(6) = name ' 参数
cmdProc.Parameters(7) = processno
cmdProc.Parameters(8) = "0000"
' 执行命令 把查询到的结果放在recSet中
MainForm.g_application.m_databaseCon.m_adoConnection.BeginTrans ' 开始事务
On Error GoTo Cwcl
cmdProc.Execute
producedraw_add = cmdProc.Parameters(8)
MainForm.g_application.m_databaseCon.m_adoConnection.CommitTrans ' 结束事务
Exit Function
Cwcl:
MainForm.g_application.m_databaseCon.m_adoConnection.RollbackTrans ' 回滚事务
producedraw_add = ""
End Function
'**************************************
'* 功 能 描 述 :查询取得所有发料单的列表
'* 输 入 参 数 :无
'* 输 出 能 数 :True - 数据库连接成功
'* False - 数据库连接失败
'**************************************
Public Function producedrawmaterial_findidList(recSet As ADODB.Recordset) As Boolean
Dim cmdProc As ADODB.Command ' 执行存储过程的命令
producedrawmaterial_findidList = False
Set cmdProc = New ADODB.Command
Set cmdProc.ActiveConnection = MainForm.g_application.m_databaseCon.m_adoConnection
' 执行存储过程的命令的设置
cmdProc.CommandText = "producedrawmaterial_findidList" ' 指定存储过程的名子
cmdProc.CommandType = adCmdStoredProc
On Error GoTo Cwcl
' 执行命令 把查询到的结果放在recSet中
With recSet
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open cmdProc
End With
With recSet
If Not .EOF Then
producedrawmaterial_findidList = True
Else
producedrawmaterial_findidList = False
End If
End With
Exit Function
Cwcl:
producedrawmaterial_findidList = False
Exit Function
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -