⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 partlistform.frm

📁 即时通讯
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            partsingleform.m_operatorType = 0
            partsingleform.show 1
            refreshlist
        Case "xg"                         ' 修改
            ret = yhqxpd(MainForm.g_application.m_userId, Trim(str(PART_MODIFY)))       ' 权限判断
            
            If Not ret Then
                MainForm.g_msgText = "该功能您无权操作!"
                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"                        ' 设计BOM
            BomDesign
        Case "sc"                         ' 删除
               ret = yhqxpd(MainForm.g_application.m_userId, Trim(str(PART_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(PART_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 = 3
    If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) <> "" Then
        bf.m_materialId = Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))  ' 产品ID
        bf.show 1
    End If
    
    Set bf = Nothing
End Function
'**************************************
'*    功 能 描 述 :刷新零件列表
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub refreshlist()
    Dim currentrow As Integer                 ' 当前插入的行

        
    m_partDAO.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, 0)) = "" Then
        MainForm.g_msgText = "请选择一条记录!"
        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
'**************************************
'*    功 能 描 述 :刷新列表的标题栏
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
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) = "代号"
    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) = "使用"
    hfg_houseList.TextMatrix(0, 9) = "执行标准"
    hfg_houseList.TextMatrix(0, 10) = "受控文件地址"
    hfg_houseList.TextMatrix(0, 11) = "受控日期"
    hfg_houseList.TextMatrix(0, 12) = "bomid"
    
                                                                                                    '设置列对齐方式  7-右对齐 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) = 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

'**************************************
'*    功 能 描 述 :查询记录
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub Query()
    q = 1
    Dim ret As Boolean
    QueryFom.m_currentQuery = QUERY_PART
    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_partDAO.FindPartIdList(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
        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("零件名称"))
            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("使用"))
            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("bomid"))
            '<<]
            '设置数据行高度(Fixed)
            hfg_houseList.RowHeight(currentrow) = 300
     
            '动态集指针加1,同时将计数器加1(Fixed)
            .MoveNext
            currentrow = currentrow + 1
        Loop
        
'        hfg_houseList.FixedCols = 2
    End With
    Text1.text = Trim(m_recordset.RecordCount)
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -