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

📄 bomsinglemform.frm

📁 即时通讯
💻 FRM
📖 第 1 页 / 共 5 页
字号:
         EndProperty
         BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "BomSingleMForm.frx":3B92
            Key             =   "Order"
         EndProperty
      EndProperty
   End
   Begin VB.Menu PM_treeOperator 
      Caption         =   "PM_treeOperator"
      Visible         =   0   'False
      Begin VB.Menu m_newFirstBom 
         Caption         =   "新建根BOM"
         Visible         =   0   'False
      End
      Begin VB.Menu m_newChild 
         Caption         =   "新增下级"
      End
      Begin VB.Menu m_modiFirstNode 
         Caption         =   "修改根BOM"
         Visible         =   0   'False
      End
      Begin VB.Menu m_expandAll 
         Caption         =   "全部展开"
      End
      Begin VB.Menu m_collapseAll 
         Caption         =   "全部折叠"
      End
      Begin VB.Menu m_calCost 
         Caption         =   "计算成本"
      End
   End
   Begin VB.Menu PM_listOperator 
      Caption         =   "PM_listOperator"
      Visible         =   0   'False
      Begin VB.Menu m_newRow 
         Caption         =   "新增物料"
      End
      Begin VB.Menu m_deleteRow 
         Caption         =   "删除物料"
      End
      Begin VB.Menu m_selectMateral 
         Caption         =   "选择Bom"
         Begin VB.Menu m_selectGoods 
            Caption         =   "原料"
         End
         Begin VB.Menu m_selectPart 
            Caption         =   "零件"
         End
         Begin VB.Menu m_selectProduction 
            Caption         =   "产品"
         End
         Begin VB.Menu m_selectProcess 
            Caption         =   "工序"
         End
         Begin VB.Menu m_selectBom 
            Caption         =   "BOM"
         End
      End
      Begin VB.Menu m_copyBom 
         Caption         =   "复制BOM"
      End
   End
End
Attribute VB_Name = "BomSingleMForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private m_bomDAO As BomDAO             ' 仓库数据库操作类
Private m_recordset As ADODB.Recordset ' 数据操作数据集对象

Public m_operatorType As Integer       ' 操作类型  0 - 新增  1 - 修改 2 - 产品调用 3 - 零件调用
Public m_materialId As String          ' 当调用类型为2\3时,传递过来的产品或零件的ID号
'Public m_bomId As String               ' 管理的BOM表的BOM ID(树中当前选中的)
Private m_parentBom   As BomNode         '  树中当前选中的BOM节点,列表中节点的父节点
Public m_currentLevel As Integer       ' 当前操作树所选择的层 1 - 产品层(只有一个结点) 0 - 树结点中为空
Public m_currentNode  As Integer       ' 当前选中的树结点的序号

Public m_detailRowCount As Integer     ' 明细列表的总行总
Private m_onTextChange  As Boolean     ' 输入框改变事件是否可行 事件执行开关
Private m_currentSelectNode As Node    ' 当前选中的节点
Private m_parentNode As Node           ' 当前选中节点的父节点
'**************************************
'*    功 能 描 述 :把列表中的记录更新到树中的操作
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub C_modify_Click()
    ' 检查当前编辑的父结点是原料结点则不能保存其下一级的各结点
    If m_currentLevel > 1 Then
        If m_parentBom.materialType = 0 Then
            MainForm.g_msgText = "现在的父结点是零件,不能新增子BOM"
            HMsgBox MainForm.g_msgText, hxxdOKOnly, hxxdError
            Exit Sub
        End If
    End If
    ' 保存进树中
    SaveListToTree
End Sub

Private Sub C_readTree_Click()
'    Dim q As queryType
'    Dim s As String
'    q.name = "jackyc"
'    s = q.name
End Sub

Private Sub C_setSupplier_Click()
    If Trim(HFG_detail.TextMatrix(HFG_detail.row, 7)) <> "" Then
        BomSupplierListForm.m_operatorType = 0
        BomSupplierListForm.m_bomId = Trim(HFG_detail.TextMatrix(HFG_detail.row, 7))
        BomSupplierListForm.show 1
        
        ' 刷新此上的数据
        TV_bomManage_NodeClick TV_bomManage.SelectedItem
    Else
        MainForm.g_msgText = "所编辑BOM还没有存盘,请存盘后再设置其供应商!"
        HMsgBox MainForm.g_msgText, hxxdOKOnly, hxxdError
    End If
End Sub
'**************************************
'*    功 能 描 述 :调用零件的工序管理程序
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub Command1_Click()
    Dim partProcessFrom As BomPartProcessForm
    
    Set partProcessFrom = New BomPartProcessForm
    
    partProcessFrom.m_operatorType = 0
    partProcessFrom.show 1
    
    ' 设置完成后把此按钮不显示
    Command1.Visible = False
End Sub

Private Sub Form_Load()
    Set m_bomDAO = New BomDAO
    Set m_recordset = New ADODB.Recordset
    
    m_onTextChange = True
    
    Me.caption = "BOM表明细管理"
'    Me.Height = 7515
'    Me.Width = 8985
    SetToCenter Me
    
    RefreshListTitle
    
    ' 新建BOM树的根节点
    'CreateLastNode
    
    If m_operatorType = 0 Then              ' 新增
        m_currentLevel = 0                  ' 当前操作的层为产品层
        m_currentNode = 0                   ' 当前没有选中的BOM树节点
        m_detailRowCount = 1                ' 明细里面的数据行的行数
        
        HFG_detail.TextMatrix(1, 10) = "0"
    End If
    If m_operatorType = 2 Then              ' 产品调用
        MainForm.g_application.m_queryResultId = m_materialId
        
        SelectedProduction                  ' 显示产品信息
    End If
    If m_operatorType = 3 Then              ' 零件调用
        MainForm.g_application.m_queryResultId = m_materialId
        
        SelectedPart                        ' 显示零件信息
    End If
End Sub
'**************************************
'*    功 能 描 述 :刷新BOM明细列表的标题栏
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub RefreshListTitle()
    HFG_detail.Cols = 12
    
    HFG_detail.TextMatrix(0, 0) = "."
    HFG_detail.TextMatrix(0, 1) = "BOM名称"
    HFG_detail.TextMatrix(0, 2) = "工序名称"
    HFG_detail.TextMatrix(0, 3) = "工序费用"
    HFG_detail.TextMatrix(0, 4) = "BOM成本"
    HFG_detail.TextMatrix(0, 5) = "数量"                   ' 明细的数量
    HFG_detail.TextMatrix(0, 6) = "备注"
    HFG_detail.TextMatrix(0, 7) = "bomId"                  ' 明细联接到的BOM记录
    HFG_detail.TextMatrix(0, 8) = "bomDetailId"            ' 当为空时 - 新增明细(非根结点情况) 当不空时 - 修改明细(数量)
    HFG_detail.TextMatrix(0, 9) = "materialType"           ' 0-原料 1-零件 2-产品
    HFG_detail.TextMatrix(0, 10) = "materialId"            ' 物料ID
    HFG_detail.TextMatrix(0, 11) = "relatePartId"            ' 相关零件的ID
    
    
    
                '设置列对齐方式  7-右对齐 5-居中对齐 2-左对齐
    HFG_detail.ColAlignment(0) = 2
    HFG_detail.ColAlignment(1) = 2
    HFG_detail.ColAlignment(2) = 2
    HFG_detail.ColAlignment(3) = 8
    HFG_detail.ColAlignment(4) = 8
    HFG_detail.ColAlignment(5) = 8
    HFG_detail.ColAlignment(6) = 2
    HFG_detail.ColAlignment(7) = 2
    HFG_detail.ColAlignment(8) = 2
    HFG_detail.ColAlignment(9) = 2
    HFG_detail.ColAlignment(10) = 2
    HFG_detail.ColAlignment(11) = 2
    
    HFG_detail.ColWidth(0) = 200
    HFG_detail.ColWidth(7) = 0
    HFG_detail.ColWidth(8) = 0
    HFG_detail.ColWidth(9) = 0
    HFG_detail.ColWidth(10) = 0
    HFG_detail.ColWidth(11) = 0

End Sub

Private Sub Form_Resize()
    ' 调整输入数据面板位置
    If Me.Width - Frame1.Width - 200 > 0 Then
        Frame1.Left = Me.Width - Frame1.Width - 200
    End If
    ' -----------------------------------------
    If Me.Width - Frame1.Width - 200 > 0 Then
        Frame2.Left = Me.Width - Frame1.Width - 200
    End If
    If Frame1.Height + 30 > 0 Then
        Frame2.Top = Frame1.Height + 30
    End If
    If Me.Height - Frame1.Height - 450 > 0 Then
        Frame2.Height = Me.Height - Frame1.Height - 450
    End If
    If Frame2.Height - 375 > 0 Then
        HFG_detail.Height = Frame2.Height - 375
    End If
    ' -----------------------------------------------
    If Me.Width - Frame1.Width - 300 > 0 Then
        Frame3.Width = Me.Width - Frame1.Width - 300
    End If
    If Me.Height - 450 > 0 Then
        Frame3.Height = Me.Height - 450
    End If
    If Frame3.Height - 345 > 0 Then
        TV_bomManage.Height = Frame3.Height - 345
    End If
    If Frame3.Width - 340 > 0 Then
        TV_bomManage.Width = Frame3.Width - 340
    End If
End Sub

'**************************************
'*    功 能 描 述 :列表的点击操作
'*    输 入 参 数 :无
'*    输 出 能 数 :无
'**************************************
Private Sub HFG_detail_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button And vbRightButton Then       ' 用户点击右键,调出快捷菜单
        If Trim(HFG_detail.TextMatrix(1, 10)) <> "" And _
        Trim(HFG_detail.TextMatrix(1, 9)) = "2" And _
        m_currentLevel <= 1 Then                             ' 只有产品才可以复制BOM
            m_copyBom.Visible = True
        Else
            m_copyBom.Visible = False
        End If
        
        ' 控制菜单的显示
        If m_currentLevel <= 1 Then    ' 修改第一级
            m_newRow.Visible = False
            m_deleteRow.Visible = False
            m_selectGoods.Visible = False
            m_selectPart.Visible = True
            m_selectProduction.Visible = True
            m_selectProcess.Visible = False
            m_selectBom.Visible = False
        Else
            If m_parentBom.materialType = "2" Then      ' 上一为产品
                m_newRow.Visible = True
                m_deleteRow.Visible = True
                m_selectGoods.Visible = False
                m_selectPart.Visible = True
                m_selectProduction.Visible = False
                m_selectProcess.Visible = False
                m_selectBom.Visible = False
            End If
            If m_parentBom.materialType = "1" Then     ' 上一为零件
                m_newRow.Visible = False
                m_deleteRow.Visible = True
                m_selectGoods.Visible = True
                m_selectPart.Visible = False
                m_selectProduction.Visible = False
                m_selectProcess.Visible = True
                m_selectBom.Visible = False
                If hasChild(TV_bomManage.SelectedItem) Then
                    m_selectGoods.Visible = False
                End If
            End If
            If m_parentBom.materialType = "3" Then     ' 上一为工序
                m_newRow.Visible = False
                m_deleteRow.Visible = True
                m_selectGoods.Visible = True
                m_selectPart.Visible = False
                m_selectProduction.Visible = False
                m_selectProcess.Visible = True
                m_selectBom.Visible = False
                If hasChild(TV_bomManage.SelectedItem) Then
                    m_selectGoods.Visible = False
                End If
            End If
        End If
        

⌨️ 快捷键说明

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