📄 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 + -