?? partlistform.frm
字號(hào):
partsingleform.m_operatorType = 0
partsingleform.show 1
refreshlist
Case "xg" ' 修改
ret = yhqxpd(MainForm.g_application.m_userId, Trim(str(PART_MODIFY))) ' 權(quán)限判斷
If Not ret Then
MainForm.g_msgText = "該功能您無權(quán)操作!"
HMsgBox MainForm.g_msgText, 0, 1
Exit Sub
End If
partsingleform.m_operatorType = 1
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) <> "" Then
partsingleform.m_partId = Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
partsingleform.show 1
If q = 1 Then
RefreshQueryList
Else
refreshlist
End If
End If
Case "bom" ' 設(shè)計(jì)BOM
BomDesign
Case "sc" ' 刪除
ret = yhqxpd(MainForm.g_application.m_userId, Trim(str(PART_MODIFY))) ' 權(quán)限判斷
If Not ret Then
MainForm.g_msgText = "該功能您無權(quán)操作!"
HMsgBox MainForm.g_msgText, 0, 1
Exit Sub
End If
Call delete
Call refreshlist
Case "cx" ' 查詢
ret = yhqxpd(MainForm.g_application.m_userId, Trim(str(PART_CX))) ' 權(quán)限判斷
If Not ret Then
MainForm.g_msgText = "該功能您無權(quán)操作!"
HMsgBox MainForm.g_msgText, 0, 1
Exit Sub
End If
Call Query
Case "sx" '刷 新
q = 0
Call refreshlist
Case "tc" '退 出
Unload Me
End Select
End Sub
'**************************************
'* 功 能 描 述 :點(diǎn)BOM設(shè)計(jì)按鈕時(shí)的處理函數(shù)
'* 輸 入 參 數(shù) :無
'* 輸 出 能 數(shù) :無
'**************************************
Private Function BomDesign()
Dim bf As New BomSingleMForm
Dim ret As Boolean
ret = yhqxpd(MainForm.g_application.m_userId, Trim(str(BOMTABLE_DESIGN))) ' 權(quán)限判斷
If Not ret Then
MainForm.g_msgText = "該功能您無權(quán)操作!"
HMsgBox MainForm.g_msgText, 0, 1
Exit Function
End If
bf.m_operatorType = 3
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) <> "" Then
bf.m_materialId = Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) ' 產(chǎn)品ID
bf.show 1
End If
Set bf = Nothing
End Function
'**************************************
'* 功 能 描 述 :刷新零件列表
'* 輸 入 參 數(shù) :無
'* 輸 出 能 數(shù) :無
'**************************************
Private Sub refreshlist()
Dim currentrow As Integer ' 當(dāng)前插入的行
m_partDAO.FindAll m_recordset
' Set hfg_houseList.DataSource = m_recordset ' 數(shù)據(jù)源綁定到顯示控件
hfg_houseList.clear
hfg_houseList.Rows = 2
RefreshListTitle
GetRecordToList m_recordset
m_recordset.Close
End Sub
'**************************************
'* 功 能 描 述 :刪除一條記錄
'* 輸 入 參 數(shù) :無
'* 輸 出 能 數(shù) :無
'**************************************
Private Sub delete()
Dim ret As Integer
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) = "" Then
MainForm.g_msgText = "請(qǐng)選擇一條記錄!"
HMsgBox MainForm.g_msgText, 0, 1
End If
MainForm.g_msgText = "確定刪除這條記錄嗎?"
ret = HMsgBox(MainForm.g_msgText, 2, 2)
If ret = 1 Then
m_partDAO.DeleteById m_recordset, _
Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
End If
End Sub
'**************************************
'* 功 能 描 述 :刷新列表的標(biāo)題欄
'* 輸 入 參 數(shù) :無
'* 輸 出 能 數(shù) :無
'**************************************
Private Sub RefreshListTitle()
hfg_houseList.Cols = 13
hfg_houseList.Rows = 2
hfg_houseList.TextMatrix(0, 0) = "零件ID"
hfg_houseList.TextMatrix(0, 1) = "零件名稱"
hfg_houseList.TextMatrix(0, 2) = "代號(hào)"
hfg_houseList.TextMatrix(0, 3) = "凈重量"
hfg_houseList.TextMatrix(0, 4) = "材料"
hfg_houseList.TextMatrix(0, 5) = "狀態(tài)"
hfg_houseList.TextMatrix(0, 6) = "備注"
hfg_houseList.TextMatrix(0, 7) = "入庫合格率"
hfg_houseList.TextMatrix(0, 8) = "使用"
hfg_houseList.TextMatrix(0, 9) = "執(zhí)行標(biāo)準(zhǔn)"
hfg_houseList.TextMatrix(0, 10) = "受控文件地址"
hfg_houseList.TextMatrix(0, 11) = "受控日期"
hfg_houseList.TextMatrix(0, 12) = "bomid"
'設(shè)置列對(duì)齊方式 7-右對(duì)齊 5-居中對(duì)齊 2-左對(duì)齊
hfg_houseList.ColAlignment(0) = 2
hfg_houseList.ColAlignment(1) = 2
hfg_houseList.ColAlignment(2) = 2
hfg_houseList.ColAlignment(3) = 8
hfg_houseList.ColAlignment(4) = 2
hfg_houseList.ColAlignment(5) = 2
hfg_houseList.ColAlignment(6) = 2
hfg_houseList.ColAlignment(7) = 8
hfg_houseList.ColAlignment(8) = 2
hfg_houseList.ColAlignment(9) = 2
hfg_houseList.ColAlignment(10) = 2
hfg_houseList.ColAlignment(11) = 2
hfg_houseList.ColAlignment(12) = 2
hfg_houseList.ColWidth(0) = 1
hfg_houseList.ColWidth(4) = 1
hfg_houseList.ColWidth(8) = 1
hfg_houseList.ColWidth(12) = 1
End Sub
'**************************************
'* 功 能 描 述 :查詢記錄
'* 輸 入 參 數(shù) :無
'* 輸 出 能 數(shù) :無
'**************************************
Private Sub Query()
q = 1
Dim ret As Boolean
QueryFom.m_currentQuery = QUERY_PART
QueryFom.m_operateType = 1
QueryFom.show vbModal
' 如果此原料已有BOM記錄,則調(diào)出些條BOM的信息
m_idList = MainForm.g_application.m_queryResultId
RefreshQueryList ' 顯示查詢到的結(jié)果
End Sub
Private Sub RefreshQueryList()
Dim ret As Boolean
' 顯示查詢到的結(jié)果
On Error GoTo EXITFUN
MainForm.g_application.m_databaseCon.m_adoConnection.BeginTrans ' 開始事務(wù)
InsertQueryIdList m_idList ' 把要顯示的記錄ID列表插入臨時(shí)表
ret = m_partDAO.FindPartIdList(m_recordset) ' 查找記錄
MainForm.g_application.m_databaseCon.m_adoConnection.CommitTrans ' 提交事務(wù)
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 ' 回滾事務(wù)
End Sub
'**************************************
'* 功 能 描 述 :從數(shù)據(jù)集中取出記錄在列表中顯示
'* 輸 入 參 數(shù) :無
'* 輸 出 能 數(shù) :無
'**************************************
Private Sub GetRecordToList(recSet As ADODB.Recordset)
Dim currentrow As Integer
With m_recordset
currentrow = 1
Do While Not .EOF
If currentrow > hfg_houseList.Rows - 1 Then
hfg_houseList.AddItem ""
End If
'[>>自定義填充內(nèi)容
hfg_houseList.TextMatrix(currentrow, 0) = Trim(.Fields("零件ID"))
hfg_houseList.TextMatrix(currentrow, 1) = Trim(.Fields("零件名稱"))
hfg_houseList.TextMatrix(currentrow, 2) = Trim(.Fields("代號(hào)"))
hfg_houseList.TextMatrix(currentrow, 3) = Trim(.Fields("重量"))
hfg_houseList.TextMatrix(currentrow, 4) = Trim(.Fields("材料"))
hfg_houseList.TextMatrix(currentrow, 5) = Trim(.Fields("狀態(tài)"))
hfg_houseList.TextMatrix(currentrow, 6) = Trim(.Fields("備注"))
hfg_houseList.TextMatrix(currentrow, 7) = Trim(.Fields("入庫合格率")) & "%"
hfg_houseList.TextMatrix(currentrow, 8) = Trim(.Fields("使用"))
hfg_houseList.TextMatrix(currentrow, 9) = Trim(.Fields("標(biāo)準(zhǔn)"))
hfg_houseList.TextMatrix(currentrow, 10) = Trim(.Fields("受控文件地址"))
hfg_houseList.TextMatrix(currentrow, 11) = Trim(.Fields("受控日期"))
hfg_houseList.TextMatrix(currentrow, 12) = Trim(.Fields("bomid"))
'<<]
'設(shè)置數(shù)據(jù)行高度(Fixed)
hfg_houseList.RowHeight(currentrow) = 300
'動(dòng)態(tài)集指針加1,同時(shí)將計(jì)數(shù)器加1(Fixed)
.MoveNext
currentrow = currentrow + 1
Loop
' hfg_houseList.FixedCols = 2
End With
Text1.text = Trim(m_recordset.RecordCount)
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -