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

📄 +

📁 VB开发的ERP系统
💻
📖 第 1 页 / 共 5 页
字号:
            '调入用户查询结果动态集
            Sqlstr = "SELECT PlanMainID From MRP_PlanMain Where MakeDate='" & Xtrq & "'  ORDER BY PlanMainID"
            Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
      
            '处理新增状态
            Sub_OperStatus (10)
            '新增单据
            Call Sub_AddBill
        Case "2"   '查询单据(单据列表)
            '设置工具条显示
            With Tlb_Action
                .Buttons("xz").Visible = False             '新增
                .Buttons("xg").Visible = True             '修改
                .Buttons("sc").Visible = True             '删除
                .Buttons("fgh0").Visible = True           '分隔行
                .Buttons("zh").Visible = True             '增行
                .Buttons("sh").Visible = True             '删行
                .Buttons("fgh1").Visible = True           '分隔行
                .Buttons("bc").Visible = True             '保存
                .Buttons("fq").Visible = True             '放弃
                .Buttons("shsh").Visible = False           '审核
                .Buttons("shqs").Visible = False           '弃审
                .Buttons("fgh4").Visible = False           '分隔行
                .Buttons("first").Visible = True          '首张
                .Buttons("prev").Visible = True           '上张
                .Buttons("next").Visible = True           '下张
                .Buttons("last").Visible = True           '末张
                .Buttons("fgh5").Visible = True           '分割行
                .Buttons("Finish").Visible = False           '完成
                .Buttons("AbandonFinish").Visible = False           '弃完
            End With
            Lab_BillId.Caption = XT_BillID
            Str_QueryCondi = Xtcdcsfz
            Call Sub_ShowBill
            Call Sub_OperStatus("10")
      
            '调入用户查询结果动态集
                        
            Sqlstr = "Select Distinct PlanMainID From MRP_V_MPSList a " & Str_QueryCondi & " Order by PlanMainID"
            Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
            Rec_Query.Find "PlanMainID=" & Val(Lab_BillId.Caption)
        Case "3"   '审核
            '设置工具条显示
            With Tlb_Action
                .Buttons("xz").Visible = False             '新增
                .Buttons("xg").Visible = False             '修改
                .Buttons("sc").Visible = False             '删除
                .Buttons("fgh0").Visible = False           '分隔行
                .Buttons("zh").Visible = False             '增行
                .Buttons("sh").Visible = False             '删行
                .Buttons("fgh1").Visible = False           '分隔行
                .Buttons("bc").Visible = False             '保存
                .Buttons("fq").Visible = False             '放弃
                .Buttons("shsh").Visible = True           '审核
                .Buttons("shqs").Visible = True           '弃审
                .Buttons("fgh2").Visible = False           '分隔行
                .Buttons("fgh4").Visible = True           '分隔行
                .Buttons("first").Visible = True          '首张
                .Buttons("prev").Visible = True           '上张
                .Buttons("next").Visible = True           '下张
                .Buttons("last").Visible = True           '末张
                .Buttons("fgh5").Visible = True           '分割行
                .Buttons("Finish").Visible = True           '完成
                .Buttons("AbandonFinish").Visible = True           '弃完
            End With
            Lab_BillId.Caption = XT_BillID
            Str_QueryCondi = Xtcdcsfz
            Call Sub_ShowBill
            Call Sub_OperStatus("10")
            '设置操作状态为浏览
            Lab_OperStatus.Caption = "1"

            '录入文本框
            For jsqte = Max_Text_Index To 0 Step -1
                LrText(jsqte).Enabled = False
                
                Sqlstr = "Select Distinct PlanMainID From MRP_V_MPSList a " & Str_QueryCondi & " Order by PlanMainID"
                Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
                Rec_Query.Find "PlanMainID=" & Val(Lab_BillId.Caption)
            Next jsqte
    End Select
  
    '<<]
  
End Sub

Private Sub Sub_ShowBill()                                          '根据当前单据ID显示整张单据内容
   
    '过程默认参数为当前窗体中单据ID:Lab_BillID
    Dim Sqlstr As String                           '临时使用字符串
    Dim RecTemp As New ADODB.Recordset             '临时使用动态集
    Dim jsqte As Long                              '临时计数器
    
    Screen.MousePointer = 11
    '禁止网格刷新动作,为加快网格显示速度(Fixed)
    WglrGrid.Redraw = False
    
    '本张单据查询字符串
    Sqlstr = "Select * From MRP_V_MPSList Where PlanMainID ='" & Trim(Lab_BillId.Caption) & "'  Order by PlanMainID"
    Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
      
    With RecTemp
        WglrGrid.Rows = WglrGrid.FixedRows
        If .EOF Then
            For jsqte = 0 To Max_Text_Index
                LrText(jsqte).Text = ""
                LrText(ag).Text = ""
            Next jsqte
            WglrGrid.Clear 1
            Call Sub_AdjustGrid
            WglrGrid.Redraw = True
            Screen.MousePointer = 0
            Exit Sub
        Else
            '[>>显示单据头
            TextChangeLock = True     '文本框加锁
            LrText(0).Text = Trim(.Fields("kjYear"))                                                 '生产年度
            LrText(1).Text = Trim(.Fields("Period"))                                                 '生产月份
            LrText(2).Text = IIf(.Fields("IfAdd") = False, "正常", "追补")                           '计划类型
            LrText(3).Text = Format(Trim(.Fields("MakeDate") & ""), "yyyy-mm-dd")                    '制单日期                           '制单日期
            LrText(4).Text = Trim(.Fields("Maker") & "")                                             '制单人
            LrText(5).Text = Trim(.Fields("Checker") & "")                                           '审核人
            Select Case Fn_GetBillState
                Case 0
                    LrText(6) = "未审核"
                Case 1
                    LrText(6) = "审核"
                Case 2
                    LrText(6) = "生成"
                Case 3
                    LrText(6) = "完成"
            End Select
            LrText(7) = Trim(.Fields("MPSNumber") & "")                                               '计划单号
            TextChangeLock = False    '文本框解锁
            '<<]
        End If
        jsqte = WglrGrid.FixedRows
        Do While Not .EOF
            WglrGrid.AddItem ""
            '[>>显示单据分录
            WglrGrid.TextMatrix(jsqte, 0) = "*"                                                                                 '数据有效行标识(必填)
            WglrGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("DeptName") & "")                          '部门名称
            WglrGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("DeptCode") & "")                          '部门编码
            WglrGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("MNumber") & "")                           '物料编码
            WglrGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("MName") & "")                             '物料名称
            WglrGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("Model") & "")                             '规格型号
            WglrGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("PrimaryUnitName") & "")                   '计量单位
            WglrGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = Format(Trim(.Fields("BeginDate") & ""), "yyyy-mm-dd")   '生产开始日期
            WglrGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = Format(Trim(.Fields("EndDate") & ""), "yyyy-mm-dd")     '生产结束日期
            WglrGrid.TextMatrix(jsqte, Sydz("009", GridStr(), Szzls)) = Trim(.Fields("TotalOutput") & "")                       '总产量
            WglrGrid.TextMatrix(jsqte, Sydz("010", GridStr(), Szzls)) = Trim(.Fields("DayOutput") & "")                         '日产量
            WglrGrid.TextMatrix(jsqte, Sydz("011", GridStr(), Szzls)) = Trim(.Fields("Remark") & "")                            '备注
            
            '<<]
                   
            WglrGrid.RowHeight(jsqte) = Sjhgd
            .MoveNext
            jsqte = jsqte + 1
        Loop
    End With
 
            
    '调整网格(Fixed)
    Call Sub_AdjustGrid
      
    '计算合计数据(Fixed)
    For jsqte = Qslz To WglrGrid.Cols - 1
        Call Sjhj(jsqte)
    Next jsqte
    
    '将网格刷新解禁(Fixed)
    WglrGrid.Redraw = True
       
    '设置审核弃审按钮状态
    Call Sub_CheckStatus
       
    Screen.MousePointer = 0
End Sub

Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)             '用户点击工具条
     
    '屏蔽文本框,下拉组合框有效性判断
    Valilock = True
     
    '屏蔽网格失去焦点产生的有效性判断
    Changelock = True
         
    Select Case Button.Key
        Case "yl"                                            '预 览
            If Fun_Drfrmyxxpd Then
                BillGridPrint WglrGrid, LrText, GridStr(), Szzls, GridCode, TextGroupCode, XtReportCode, False, , False
            End If
        Case "dy"                                            '打 印
            If Fun_Drfrmyxxpd Then
                Dim yhAnswer As Integer      '打印提示
                
                '用户确认是否打印单据
                Tsxx = "请确认是否打印当前单据?"
                yhAnswer = Xtxxts(Tsxx, 2, 2)
                If yhAnswer = 2 Then
                    Exit Sub
                End If
                BillGridPrint WglrGrid, LrText, GridStr(), Szzls, GridCode, TextGroupCode, XtReportCode, True, , False
            End If
        Case "xz"                                            '新 增
            Call Sub_AddBill
        Case "xg"                                            '修 改
            Call Sub_EditBill
        Case "sc"                                            '删 除
            Call Sub_DeleteBill
        Case "zh"                                            '增 行
            Call zjlrfl
        Case "sh"                                            '删 行
            Call Scdqfl
        Case "bc"                                            '保 存
            If Fun_Drfrmyxxpd Then Call Sub_SaveBill

        Case "fq"                                            '放 弃
            Call Sub_AbandonBill
        Case "shsh"                                          '审 核
            Call Sub_Checkbill
        Case "shqs"                                          '弃 审
            Call Sub_AbandonCheck
        Case "first"                                         '首 张
            Call Sub_First
        Case "prev"                                          '上 张
            Call Sub_Prev
        Case "next"                                          '下 张
            Call Sub_Next
        Case "last"                                          '末 张
            Call Sub_Last
        Case "bz"                                            '帮 助
            Call F1bz
        Case "fh"                                            '退 出
            If Fun_Drfrmyxxpd Then Unload Me
        Case "Finish"                                        '完成
            Call Sub_Finish
        
        Case "AbandonFinish"                                 '弃完
            Call Sub_AbandonFinish
        
    End Select
       
    '解 锁
    Valilock = False
    Changelock = False
    TextChangeLock = False
        
End Sub



Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)     '支持热键操作
    
    Select Case KeyCode
        Case vbKeyF5          '增加单据
            If Tlb_Action.Buttons("xz").Enabled And Tlb_Action.Buttons("xz").Visible Then
                Call Sub_AddBill
            End If
        Case vbKeyF3          '修改单据
            If Tlb_Action.Buttons("xg").Enabled And Tlb_Action.Buttons("xg").Visible Then
                Call Sub_EditBill
            End If
        Case vbKeyF6          '保存单据
            If Tlb_Action.Buttons("bc").Enabled And Tlb_Action.Buttons("bc").Visible Then
                If Fun_Drfrmyxxpd Then Call Sub_SaveBill
            End If
    End Select

End Sub

Private Sub Sub_OperStatus(Str_Status As String)                 '工具条依据不同状态所进行的变化
    
    With Tlb_Action
        Select Case Str_Status
            Case "10"   '浏览((列表)调入单据处理时的进入状态、(列表)新增状态时放弃录入)
                '工具条
                .Buttons("dy").Enabled = True       '打印
                .Buttons("yl").Enabled = True       '预览
                .Buttons("xz").Enabled = True       '新增
                .Buttons("xg").Enabled = True       '修改
                .Buttons("sc").Enabled = True       '删除
                .Buttons("zh").Enabled = False      '增行
                .Buttons("sh").Enabled = False      '删行
                .Buttons("bc").Enabled = False      '保存
                .Buttons("fq").Enabled = False      '放弃
                .Buttons("first").Enabled = True    '首张
                .Buttons("prev").Enabled = True     '上张
                .Buttons("next").Enabled = True     '下张
                .Buttons("last").Enabled = True     '末张
                .Buttons("bz").Enabled = True       '帮助
                .Buttons("fh").Enabled = True       '退出
        
                '设置审核弃审按钮状态
                Call Sub_CheckStatus

⌨️ 快捷键说明

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