📄 checkstandardform.frm
字号:
End If
Else
Exit Sub
End If
End Sub
'**************************************
'* 功 能 描 述 :工具栏按钮的单击操作按钮
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "xz" ' 新增
checkstandardsingleform.m_operatorType = 0
checkstandardsingleform.show 1
refreshlist
Case "xg" ' 修改
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) <> "" Then
checkstandardsingleform.m_operatorType = 1
checkstandardsingleform.m_checkstandardid = Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
checkstandardsingleform.show 1
If q = 1 Then
RefreshQueryList
Else
refreshlist
End If
Else
Exit Sub
End If
Case "sc" ' 删除
Call delete
Call refreshlist
Case "cx" ' 查询
Call Query
Case "sx" '刷 新
q = 0
Call refreshlist
Case "tc" '退 出
Unload Me
End Select
End Sub
'**************************************
'* 功 能 描 述 :刷新检验值列表
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub refreshlist()
Dim currentrow As Integer ' 当前插入的行
m_checkstandardDAO.FindAll m_recordset
' Set hfg_houseList.DataSource = m_recordset ' 数据源绑定到显示控件
hfg_houseList.clear
hfg_houseList.Rows = 2
RefreshListTitle
GetRecordToList m_recordset
m_recordset.Close
End Sub
'**************************************
'* 功 能 描 述 :删除一条记录
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub delete()
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) = "" Then
MainForm.g_msgText = "请选择一条记录!"
HMsgBox MainForm.g_msgText, 0, 1
Exit Sub
End If
MainForm.g_msgText = "确定删除这条记录吗?"
Dim f As String
f = HMsgBox(MainForm.g_msgText, 2, 2)
If f = 1 Then
m_checkstandardDAO.DeleteById m_recordset, _
Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
End If
End Sub
'**************************************
'* 功 能 描 述 :刷新列表的标题栏
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub RefreshListTitle()
hfg_houseList.TextMatrix(0, 0) = "检验类型ID"
hfg_houseList.TextMatrix(0, 9) = "检验类型名称"
hfg_houseList.TextMatrix(0, 10) = "量程"
hfg_houseList.TextMatrix(0, 11) = "分度值"
hfg_houseList.TextMatrix(0, 4) = "精度要求"
hfg_houseList.TextMatrix(0, 5) = "小数位"
hfg_houseList.TextMatrix(0, 6) = "计测单位"
hfg_houseList.TextMatrix(0, 7) = "标准器"
hfg_houseList.TextMatrix(0, 8) = "标准器英文"
hfg_houseList.TextMatrix(0, 1) = "产品名称"
hfg_houseList.TextMatrix(0, 2) = "检验值名称"
hfg_houseList.TextMatrix(0, 3) = "检验项名称"
'设置列对齐方式 7-右对齐 5-居中对齐 2-左对齐
hfg_houseList.ColAlignment(0) = 2
hfg_houseList.ColAlignment(1) = 2
hfg_houseList.ColAlignment(2) = 2
hfg_houseList.ColAlignment(3) = 2
hfg_houseList.ColAlignment(4) = 8
hfg_houseList.ColAlignment(5) = 8
hfg_houseList.ColAlignment(6) = 2
hfg_houseList.ColAlignment(7) = 2
hfg_houseList.ColAlignment(8) = 2
hfg_houseList.ColAlignment(9) = 2
hfg_houseList.ColAlignment(10) = 8
hfg_houseList.ColAlignment(11) = 8
hfg_houseList.ColWidth(0) = 1
End Sub
'**************************************
'* 功 能 描 述 :查询记录
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub Query()
q = 1
Dim ret As Boolean
QueryFom.m_currentQuery = QUERY_CHECKSTANDARD
QueryFom.m_operateType = 1
QueryFom.show vbModal
' 如果此原料已有BOM记录,则调出些条BOM的信息
m_idList = MainForm.g_application.m_queryResultId
RefreshQueryList ' 显示查询到的结果
End Sub
Private Sub RefreshQueryList()
Dim ret As Boolean
' 显示查询到的结果
On Error GoTo EXITFUN
MainForm.g_application.m_databaseCon.m_adoConnection.BeginTrans ' 开始事务
InsertQueryIdList m_idList ' 把要显示的记录ID列表插入临时表
ret = m_checkstandardDAO.checkstandard_findidList(m_recordset) ' 查找记录
MainForm.g_application.m_databaseCon.m_adoConnection.CommitTrans ' 提交事务
hfg_houseList.clear
hfg_houseList.Rows = 2
RefreshListTitle
If ret Then
GetRecordToList m_recordset
End If
Text1.text = Trim(m_recordset.RecordCount)
m_recordset.Close
Exit Sub
EXITFUN:
MainForm.g_application.m_databaseCon.m_adoConnection.RollbackTrans ' 回滚事务
End Sub
'**************************************
'* 功 能 描 述 :从数据集中取出记录在列表中显示
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub GetRecordToList(recSet As ADODB.Recordset)
Dim currentrow As Integer
With m_recordset
' hfg_houseList.Rows = m_recordset.RecordCount
currentrow = 1
Do While Not .EOF
If currentrow > hfg_houseList.Rows - 1 Then
hfg_houseList.AddItem ""
End If
'[>>自定义填充内容
hfg_houseList.TextMatrix(currentrow, 0) = Trim(.Fields("检验要求编号"))
hfg_houseList.TextMatrix(currentrow, 9) = Trim(.Fields("检验要求名称"))
hfg_houseList.TextMatrix(currentrow, 10) = Trim(.Fields("量程")) & Trim(.Fields("计测单位"))
hfg_houseList.TextMatrix(currentrow, 11) = Trim(.Fields("分度值"))
hfg_houseList.TextMatrix(currentrow, 4) = Trim(.Fields("精度要求"))
hfg_houseList.TextMatrix(currentrow, 5) = Trim(.Fields("小数位"))
hfg_houseList.TextMatrix(currentrow, 6) = Trim(.Fields("计测单位"))
hfg_houseList.TextMatrix(currentrow, 7) = Trim(.Fields("标准器"))
hfg_houseList.TextMatrix(currentrow, 8) = Trim(.Fields("标准器英文"))
m_checkstandardDAO.production_id g_recordset, Trim(.Fields("产品名称"))
hfg_houseList.TextMatrix(currentrow, 1) = Trim(g_recordset.Fields("name") & " ")
g_recordset.Close
m_checkvaluegroupDAO.Findcheckvaluegroup g_recordset, Trim(.Fields("检验值名称"))
If g_recordset.EOF Then
hfg_houseList.TextMatrix(currentrow, 2) = "无检验值"
Else
hfg_houseList.TextMatrix(currentrow, 2) = Trim(g_recordset.Fields("name") & " ")
End If
g_recordset.Close
m_checkoptiongroupDAO.CheckOptionGroup_findbyid g_recordset, Trim(.Fields("检验项名称"))
If g_recordset.EOF Then
hfg_houseList.TextMatrix(currentrow, 3) = "无检验项"
Else
hfg_houseList.TextMatrix(currentrow, 3) = Trim(g_recordset.Fields("name"))
End If
g_recordset.Close
'<<]
'设置数据行高度(Fixed)
hfg_houseList.RowHeight(currentrow) = 200
'动态集指针加1,同时将计数器加1(Fixed)
.MoveNext
currentrow = currentrow + 1
Loop
End With
Text1.text = Trim(m_recordset.RecordCount)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -