📄 productionlistform.frm
字号:
Else
refreshlist
End If
End If
Case "bom" ' BOM设置
bomDesign
Case "sc" ' 删除
ret = yhqxpd(MainForm.g_application.m_userId, Trim(str(PRODUCTION_MODIFY))) ' 权限判断
If Not ret Then
MainForm.g_msgText = "该功能您无权操作!"
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(PRODUCTION_CX))) ' 权限判断
If Not ret Then
MainForm.g_msgText = "该功能您无权操作!"
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
'**************************************
'* 功 能 描 述 :点BOM设计按钮时的处理函数
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Function bomDesign()
Dim bf As New BomSingleMForm
Dim ret As Boolean
ret = yhqxpd(MainForm.g_application.m_userId, Trim(str(BOMTABLE_DESIGN))) ' 权限判断
If Not ret Then
MainForm.g_msgText = "该功能您无权操作!"
HMsgBox MainForm.g_msgText, 0, 1
Exit Function
End If
bf.m_operatorType = 2
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 8)) <> "" Then
bf.m_materialId = Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 8)) ' 产品ID
bf.show 1
End If
Set bf = Nothing
End Function
'**************************************
'* 功 能 描 述 :刷新产品列表
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub refreshlist()
Dim currentrow As Integer ' 当前插入的行
m_productionDAO.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()
Dim ret As Integer
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 8)) = "" Then
MainForm.g_msgText = "请选择一条记录!"
HMsgBox MainForm.g_msgText, 0, 1
End If
MainForm.g_msgText = "确定删除这条记录吗?"
ret = HMsgBox(MainForm.g_msgText, 2, 1)
If ret = 1 Then
m_productionDAO.DeleteById m_recordset, _
Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 8))
End If
End Sub
'**************************************
'* 功 能 描 述 :刷新列表的标题栏
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub RefreshListTitle()
hfg_houseList.Cols = 21
hfg_houseList.Rows = 2
hfg_houseList.TextMatrix(0, 8) = "产品ID"
hfg_houseList.TextMatrix(0, 1) = "产品名称"
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, 0) = "序号"
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) = "最低经销价"
hfg_houseList.TextMatrix(0, 15) = "最低销售价"
hfg_houseList.TextMatrix(0, 16) = "销售提成"
hfg_houseList.TextMatrix(0, 17) = "备注"
hfg_houseList.TextMatrix(0, 18) = "检验类型"
hfg_houseList.TextMatrix(0, 19) = "检验值组"
hfg_houseList.TextMatrix(0, 20) = "检验项组"
'设置列对齐方式 8-右对齐 5-居中对齐 2-左对齐
hfg_houseList.ColAlignment(8) = 2
hfg_houseList.ColAlignment(1) = 2
hfg_houseList.ColAlignment(2) = 2
hfg_houseList.ColAlignment(3) = 2
hfg_houseList.ColAlignment(4) = 2
hfg_houseList.ColAlignment(5) = 2
hfg_houseList.ColAlignment(6) = 2
hfg_houseList.ColAlignment(7) = 2
hfg_houseList.ColAlignment(0) = 8
hfg_houseList.ColAlignment(9) = 8
hfg_houseList.ColAlignment(10) = 8
hfg_houseList.ColAlignment(11) = 8
hfg_houseList.ColAlignment(12) = 8
hfg_houseList.ColAlignment(13) = 8
hfg_houseList.ColAlignment(14) = 8
hfg_houseList.ColAlignment(15) = 8
hfg_houseList.ColAlignment(16) = 8
hfg_houseList.ColAlignment(17) = 2
hfg_houseList.ColAlignment(18) = 2
hfg_houseList.ColAlignment(19) = 2
hfg_houseList.ColAlignment(20) = 2
hfg_houseList.ColWidth(8) = 0
hfg_houseList.ColWidth(18) = 0
hfg_houseList.ColWidth(19) = 0
hfg_houseList.ColWidth(20) = 0
End Sub
'**************************************
'* 功 能 描 述 :查询记录
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub Query()
q = 1
QueryFom.m_currentQuery = QUERY_PRODUCTION1
QueryFom.m_operateType = 1
QueryFom.show vbModal
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_productionDAO.production_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
Dim bd As New BomDAO
Dim bomStatus 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
'[>>自定义填充内容
If .Fields(0) <> "" Then hfg_houseList.TextMatrix(currentrow, 8) = Trim(.Fields(0))
If .Fields(2) <> "" Then hfg_houseList.TextMatrix(currentrow, 1) = Trim(.Fields(2))
If .Fields(9) <> "" Then hfg_houseList.TextMatrix(currentrow, 2) = Trim(.Fields(9))
If .Fields(12) <> "" Then hfg_houseList.TextMatrix(currentrow, 3) = Trim(.Fields(12))
If .Fields(8) <> "" Then hfg_houseList.TextMatrix(currentrow, 4) = Trim(.Fields(8))
If .Fields(10) <> "" Then hfg_houseList.TextMatrix(currentrow, 5) = Trim(.Fields(10))
If .Fields(23) <> "" Then hfg_houseList.TextMatrix(currentrow, 6) = Trim(.Fields(23))
If .Fields(1) <> "" Then hfg_houseList.TextMatrix(currentrow, 7) = Trim(.Fields(1))
If .Fields(24) <> "" Then hfg_houseList.TextMatrix(currentrow, 0) = Trim(.Fields(24))
If .Fields(14) <> "" Then hfg_houseList.TextMatrix(currentrow, 9) = Trim(.Fields(14))
If .Fields(3) <> "" Then hfg_houseList.TextMatrix(currentrow, 10) = "¥" & Trim(.Fields(3))
If .Fields(5) <> "" Then hfg_houseList.TextMatrix(currentrow, 11) = "¥" & Trim(.Fields(5))
If .Fields(13) <> "" Then hfg_houseList.TextMatrix(currentrow, 12) = "¥" & Trim(.Fields(13))
If .Fields(4) <> "" Then hfg_houseList.TextMatrix(currentrow, 13) = "$" & Trim(.Fields(4))
If .Fields(6) <> "" Then hfg_houseList.TextMatrix(currentrow, 14) = "¥" & Trim(.Fields(6))
If .Fields(7) <> "" Then hfg_houseList.TextMatrix(currentrow, 15) = "¥" & Trim(.Fields(7))
If .Fields(11) <> "" Then hfg_houseList.TextMatrix(currentrow, 16) = Trim(.Fields(11)) & "%"
If .Fields(25) <> "" Then hfg_houseList.TextMatrix(currentrow, 17) = Trim(.Fields(25))
If .Fields(16) <> "" Then hfg_houseList.TextMatrix(currentrow, 18) = Trim(.Fields(16))
If .Fields(17) <> "" Then hfg_houseList.TextMatrix(currentrow, 19) = Trim(.Fields(17))
If .Fields(18) <> "" Then hfg_houseList.TextMatrix(currentrow, 20) = Trim(.Fields(18))
bomStatus = bd.GetMaterialBomStatus(Trim(.Fields(0)))
If bomStatus = 0 Then ' 没有BOM
hfg_houseList.TextMatrix(currentrow, 0) = hfg_houseList.TextMatrix(currentrow, 0) & " |NB"
ElseIf bomStatus = 1 Then ' BOM正在设置供应商
hfg_houseList.TextMatrix(currentrow, 0) = hfg_houseList.TextMatrix(currentrow, 0) & " |BS"
ElseIf bomStatus = 2 Then ' BOM供应商设完
hfg_houseList.TextMatrix(currentrow, 0) = hfg_houseList.TextMatrix(currentrow, 0) & " |BF"
End If
'<<]
'设置数据行高度(Fixed)
hfg_houseList.RowHeight(currentrow) = 300
'动态集指针加1,同时将计数器加1(Fixed)
.MoveNext
currentrow = currentrow + 1
Loop
End With
Text1.text = Trim(m_recordset.RecordCount)
Set bd = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -