?? positionlistform.frm
字號:
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) <> "" Then
positionsingleform.m_positionId = Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
positionsingleform.show 1
If q = 1 Then
RefreshQueryList
Else
refreshlist
End If
End If
Case "sc" ' 刪除
ret = yhqxpd(MainForm.g_application.m_userId, Trim(str(POSITION_NEW))) ' 庫位新增刪除權限判斷
If Not ret Then
MainForm.g_msgText = "該功能您無權操作!"
HMsgBox MainForm.g_msgText, 0, 1
Exit Sub
End If
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_positionDAO.FindAll m_recordset, _
Trim(whid)
' 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
If CDbl(hfg_houseList.TextMatrix(hfg_houseList.row, 3)) > 0 Then
MainForm.g_msgText = "請選擇一條庫存量為0的記錄!"
HMsgBox MainForm.g_msgText, 0, 1
Exit Sub
End If
MainForm.g_msgText = "確定刪除這條記錄嗎?"
Dim f As String
f = HMsgBox(MainForm.g_msgText, 2, 1)
If f = 1 Then
m_positionDAO.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, 1) = "倉庫ID"
hfg_houseList.TextMatrix(0, 2) = "庫位名稱"
hfg_houseList.TextMatrix(0, 3) = "庫存的數量"
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) = "存物ID"
hfg_houseList.TextMatrix(0, 9) = "存物類別"
hfg_houseList.TextMatrix(0, 10) = "存物有效期"
hfg_houseList.TextMatrix(0, 11) = "架號"
hfg_houseList.TextMatrix(0, 12) = "層號"
hfg_houseList.TextMatrix(0, 13) = "位號"
hfg_houseList.TextMatrix(0, 14) = "備注"
'設置列對齊方式 8-右對齊 5-居中對齊 2-左對齊
hfg_houseList.ColAlignment(0) = 2
hfg_houseList.ColAlignment(1) = 2
hfg_houseList.ColAlignment(2) = 2
hfg_houseList.ColAlignment(3) = 8
hfg_houseList.ColAlignment(4) = 8
hfg_houseList.ColAlignment(5) = 8
hfg_houseList.ColAlignment(6) = 8
hfg_houseList.ColAlignment(7) = 8
hfg_houseList.ColAlignment(8) = 2
hfg_houseList.ColAlignment(9) = 2
hfg_houseList.ColAlignment(10) = 2
hfg_houseList.ColAlignment(11) = 8
hfg_houseList.ColAlignment(12) = 8
hfg_houseList.ColAlignment(13) = 8
hfg_houseList.ColAlignment(14) = 2
hfg_houseList.ColWidth(0) = 0
hfg_houseList.ColWidth(1) = 0
hfg_houseList.ColWidth(10) = 0
hfg_houseList.ColWidth(8) = 0
End Sub
'**************************************
'* 功 能 描 述 :查詢記錄
'* 輸 入 參 數 :無
'* 輸 出 能 數 :無
'**************************************
Private Sub Query()
q = 1
QueryFom.m_currentQuery = QUERY_POSITION
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_positionDAO.position_findByldList(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("庫位ID"))
hfg_houseList.TextMatrix(currentrow, 1) = Trim(.Fields("倉庫ID"))
hfg_houseList.TextMatrix(currentrow, 2) = Trim(.Fields("庫位名稱"))
hfg_houseList.TextMatrix(currentrow, 3) = 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("存物ID"))
hfg_houseList.TextMatrix(currentrow, 9) = Trim(.Fields("存物類別"))
hfg_houseList.TextMatrix(currentrow, 10) = Trim(.Fields("存物有效期"))
hfg_houseList.TextMatrix(currentrow, 11) = Trim(.Fields("架號"))
hfg_houseList.TextMatrix(currentrow, 12) = Trim(.Fields("層號"))
hfg_houseList.TextMatrix(currentrow, 13) = Trim(.Fields("位號"))
hfg_houseList.TextMatrix(currentrow, 14) = Trim(.Fields("備注"))
'<<]
If hfg_houseList.TextMatrix(currentrow, 9) = "0" Then
m_positionDAO.show_goods g_recordset '獲得商品名稱列表
With g_recordset
Do While Not .EOF
If hfg_houseList.TextMatrix(currentrow, 8) = Trim(.Fields(0)) Then
hfg_houseList.TextMatrix(currentrow, 8) = Trim(.Fields(1))
End If
.MoveNext
Loop
End With
g_recordset.Close
End If
If hfg_houseList.TextMatrix(currentrow, 9) = "2" Then
m_positionDAO.show_production g_recordset '獲得產品名稱列表
With g_recordset
Do While Not .EOF
If hfg_houseList.TextMatrix(currentrow, 8) = Trim(.Fields(0)) Then
hfg_houseList.TextMatrix(currentrow, 8) = Trim(.Fields(1))
End If
.MoveNext
Loop
End With
g_recordset.Close
End If
If hfg_houseList.TextMatrix(currentrow, 9) = "1" Then
m_positionDAO.show_part g_recordset '獲得零件名稱列表
With g_recordset
Do While Not .EOF
If hfg_houseList.TextMatrix(currentrow, 8) = Trim(.Fields(0)) Then
hfg_houseList.TextMatrix(currentrow, 8) = Trim(.Fields(1))
End If
.MoveNext
Loop
End With
g_recordset.Close
End If '設置數據行高度(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 + -