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

📄 cooperatedrowmaterqdform.frm

📁 即时通讯
💻 FRM
📖 第 1 页 / 共 2 页
字号:
'**************************************
'*    模 块 名 称 :发料列表管理用户操作界面
'*    功 能 描 述 :发料列表管理用户操作界面
'*    程序员姓名  : 石春晓
'*    最后修改人  : 石春晓
'*    最后修改时间:2005/09/14
'**************************************
Option Explicit
Private m_cooperatedrowmaterDAO As cooperatedrowmaterDAO        ' 发料数据库操作类
Private m_recordset As ADODB.Recordset        ' 数据操作数据集对象
Private g_recordset As ADODB.Recordset        ' 数据操作数据集对象
Public cooperateId As String
Private m_idList As String                      ' 在执行查询时查询到的ID列表字符串
Private q As Integer

'**************************************
'*    功 能 描 述 :窗体加载函数
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub Form_Load()
    Set m_cooperatedrowmaterDAO = New cooperatedrowmaterDAO
    Set m_recordset = New ADODB.Recordset
    Set g_recordset = New ADODB.Recordset
    Me.caption = "发料清单"
    
    RefreshListTitle
    
    Me.Height = 6030
    Me.Width = 9600
    SetToCenter Me
    If cooperateId <> "" Then
        RefreshList1
    Else
        refreshlist
    End If
End Sub


Private Sub Form_Resize()
      hfg_houseList.Height = Me.Height - 1400
    hfg_houseList.Width = Me.Width - 350
    
'    Image1.Stretch = False
    
    If (hfg_houseList.Height > hfg_houseList.Height - 300) Or (hfg_houseList.Width > hfg_houseList.Width - 200) Then
        hfg_houseList.Height = hfg_houseList.Height + 400
        hfg_houseList.Width = hfg_houseList.Width + 200
'
'        Image1.Stretch = True
    End If
End Sub

Private Sub hfg_houseList_DblClick()
    ' 预览
    cooperatedrowmaterForm.f = 1
    If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) <> "" Then
        cooperatedrowmaterForm.m_cdmId = Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
        cooperatedrowmaterForm.show 1
        If q = 1 Then
            RefreshQueryList
        Else
            If cooperateId = "" Then
                Call refreshlist
            Else
                Call RefreshList1
            End If
        End If
    End If
End Sub

'**************************************
'*    功 能 描 述 :工具栏按钮的单击操作按钮
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
    Select Case Button.Key
        Case "xz"                         ' 新增
            cooperatedrowmaterForm.f = 0
            cooperatedrowmaterForm.cooperateId = cooperateId
            cooperatedrowmaterForm.show 1
            cooperatedrowmaterForm.cooperateId = ""
            If cooperateId = "" Then
                Call refreshlist
            Else
                Call RefreshList1
            End If
        Case "xg"                         ' 预览
            cooperatedrowmaterForm.f = 1
            If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) <> "" Then
                cooperatedrowmaterForm.m_cdmId = Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
                cooperatedrowmaterForm.show 1
                If q = 1 Then
                    RefreshQueryList
                Else
                    If cooperateId = "" Then
                        Call refreshlist
                    Else
                        Call RefreshList1
                    End If
                End If
            End If
        Case "sc"                         ' 删除
            Call delete
            Call refreshlist
        Case "cx"                         ' 查询
            Call Query
        Case "sx"                         '刷 新
            If cooperateId = "" Then
                Call refreshlist
            Else
                Call RefreshList1
            End If
        Case "tc"                         '退 出
            cooperateId = ""
            Unload Me
    End Select
End Sub
'**************************************
'*    功 能 描 述 :刷新仓库列表
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub refreshlist()
    q = 0
    m_cooperatedrowmaterDAO.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()
'    If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) = "" Then
'        MainForm.g_msgText = "请选择一条记录!"
'        HMsgBox MainForm.g_msgText, 0, 1
'    End If
'
'    m_cooperatedrowmaterDAO.DeleteById m_recordset, _
'            Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
End Sub
'**************************************
'*    功 能 描 述 :刷新列表的标题栏
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub RefreshListTitle()
        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) = "仓库名称"
        
        
            
                                    '设置列对齐方式  7-右对齐 5-居中对齐 2-左对齐
        hfg_houseList.ColAlignment(0) = 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) = 8
        hfg_houseList.ColAlignment(6) = 8
        hfg_houseList.ColAlignment(7) = 2
        hfg_houseList.ColAlignment(8) = 2
            
          hfg_houseList.ColWidth(0) = 1
End Sub

'**************************************
'*    功 能 描 述 :查询记录
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub Query()
    q = 1
    QueryFom.m_currentQuery = QUERY_COOPERATEDRAWMATERIAL
    QueryFom.m_operateType = 1
    QueryFom.show 1
    ' 如果此原料已有BOM记录,则调出些条BOM的信息
    m_idList = MainForm.g_application.m_queryResultId
    RefreshQueryList
End Sub

Private Sub RefreshList1()

      q = 0
    m_cooperatedrowmaterDAO.FindidAll g_recordset, Trim(cooperateId)
'    Set hfg_houseList.DataSource = m_recordset        ' 数据源绑定到显示控件

    hfg_houseList.clear
    hfg_houseList.Rows = 2
    RefreshListTitle
    GetRecordToList g_recordset
    g_recordset.Close

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_cooperatedrowmaterDAO.cooperatedrowmaterial_findidList(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 recSet
        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(0) & " ")
            hfg_houseList.TextMatrix(currentrow, 1) = Trim(.Fields(1) & " ")
            hfg_houseList.TextMatrix(currentrow, 2) = Trim(.Fields(2) & " ")
            hfg_houseList.TextMatrix(currentrow, 3) = Trim(.Fields(3) & " ")
            hfg_houseList.TextMatrix(currentrow, 4) = Trim(.Fields(4) & " ")
            hfg_houseList.TextMatrix(currentrow, 5) = Trim(.Fields(5) & " ")
            hfg_houseList.TextMatrix(currentrow, 6) = Trim(.Fields(6) & " ")
            hfg_houseList.TextMatrix(currentrow, 7) = Trim(.Fields(7) & " ")
            hfg_houseList.TextMatrix(currentrow, 8) = Trim(.Fields(8) & " ")
        
            '<<]
            '设置数据行高度(Fixed)
            hfg_houseList.RowHeight(currentrow) = 200
     
            '动态集指针加1,同时将计数器加1(Fixed)
            .MoveNext
            currentrow = currentrow + 1
        Loop
    End With
    Text1.text = Trim(recSet.RecordCount)
End Sub

⌨️ 快捷键说明

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