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

📄

📁 VB开发的ERP系统
💻
📖 第 1 页 / 共 5 页
字号:
            If Not Security_Log(Str_RightClose, Xtczybm, 1, True) Then
                Exit Sub
            End If
            If Tlb_Action.Buttons("close").Value = tbrPressed Then
                Call Sub_ClosePlanBill
                Tlb_Action.Buttons("close").Caption = "恢复"
                Tlb_Action.Buttons("close").Image = "hf"
            Else
                Call Sub_UnClosePlanBill
                Tlb_Action.Buttons("close").Caption = "关闭"
                Tlb_Action.Buttons("close").Image = "gb"
            End If
    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
        
                '设置文本框录入状态
                Call Sub_LrtextStatus(False)
                Chk_JJPlan.Enabled = False
            Case "20"   '新增单据((录入)新增一张单据 、(列表)新增一张单据)
                '工具条
                .Buttons("dy").Enabled = False      '打印
                .Buttons("yl").Enabled = False      '预览
                .Buttons("xz").Enabled = False      '新增
                .Buttons("xg").Enabled = False      '修改
                .Buttons("sc").Enabled = False      '删除
                .Buttons("zh").Enabled = True       '增行
                .Buttons("sh").Enabled = True       '删行
                .Buttons("bc").Enabled = True       '保存
                .Buttons("fq").Enabled = True       '放弃
                .Buttons("shsh").Enabled = False    '审核
                .Buttons("shqs").Enabled = False    '弃审
                .Buttons("first").Enabled = False   '首张
                .Buttons("prev").Enabled = False    '上张
                .Buttons("next").Enabled = False    '下张
                .Buttons("last").Enabled = False    '末张
                .Buttons("bz").Enabled = True       '帮助
                .Buttons("fh").Enabled = True       '退出
                .Buttons("exec").Value = tbrUnpressed
                .Buttons("exec").Caption = "下达"
                .Buttons("exec").Image = "xd"
                .Buttons("exec").Enabled = False
                .Buttons("close").Caption = "关闭"
                .Buttons("close").Image = "gb"
                .Buttons("close").Value = tbrUnpressed
                .Buttons("close").Enabled = False
                '设置文本框录入状态
                Call Sub_LrtextStatus(True)
                Chk_JJPlan.Enabled = True
            Case "30"   '修改((录入)调入修改功能、(列表)调入修改功能)
                '工具条
                .Buttons("dy").Enabled = False      '打印
                .Buttons("yl").Enabled = False      '预览
                .Buttons("xz").Enabled = False      '新增
                .Buttons("xg").Enabled = False      '修改
                .Buttons("sc").Enabled = False      '删除
                .Buttons("zh").Enabled = True       '增行
                .Buttons("sh").Enabled = True       '删行
                .Buttons("bc").Enabled = True       '保存
                .Buttons("fq").Enabled = True       '放弃
                .Buttons("shsh").Enabled = False    '审核
                .Buttons("shqs").Enabled = False    '弃审
                .Buttons("first").Enabled = False   '首张
                .Buttons("prev").Enabled = False    '上张
                .Buttons("next").Enabled = False    '下张
                .Buttons("last").Enabled = False    '末张
                .Buttons("bz").Enabled = True       '帮助
                .Buttons("fh").Enabled = True       '退出
                
                '设置文本框录入状态
                Call Sub_LrtextStatus(True)
                Chk_JJPlan.Enabled = True
        End Select
    End With

End Sub

Private Sub Sub_LrtextStatus(TextEnabled As Boolean)                            '设置录入文本框状态

    '录入文本框状态设置
    If TextEnabled Then
        For jsqte = Max_Text_Index To 0 Step -1
            '判断文本框是否可编辑
            If Textboolean(jsqte, 5) Then
                LrText(jsqte).Enabled = True
            Else
                LrText(jsqte).Enabled = False
            End If
        Next jsqte
    Else
        For jsqte = Max_Text_Index To 0 Step -1
            LrText(jsqte).Enabled = False
        Next jsqte
    End If

End Sub

Private Sub Sub_CheckStatus()                                       '设置审核弃审按钮状态(亦可设置其他动作按钮状态)
    
    '根据当前单据状态来确定审核弃审按钮状态
    If Trim(LrText(9).Text) <> "" And Trim(LrText(10).Text) = "" Then
        Tlb_Action.Buttons("shsh").Enabled = True      '审核
    Else
        Tlb_Action.Buttons("shsh").Enabled = False   '审核
    End If
    If Trim(LrText(9).Text) <> "" And Trim(LrText(10).Text) <> "" Then
        Tlb_Action.Buttons("shqs").Enabled = True      '弃审
    Else
        Tlb_Action.Buttons("shqs").Enabled = False   '弃审
    End If
    If Tlb_Action.Buttons("shqs").Enabled = True And Tlb_Action.Buttons("shsh").Enabled = False Then
        Tlb_Action.Buttons("exec").Enabled = True
        Tlb_Action.Buttons("close").Enabled = True
        
    ElseIf Tlb_Action.Buttons("shqs").Enabled = False And Tlb_Action.Buttons("shsh").Enabled = True Then
        
        Tlb_Action.Buttons("exec").Value = tbrUnpressed
        Tlb_Action.Buttons("exec").Caption = "下达"
        Tlb_Action.Buttons("exec").Image = "xd"
        
        Tlb_Action.Buttons("close").Caption = "关闭"
        Tlb_Action.Buttons("close").Image = "gb"
        Tlb_Action.Buttons("close").Value = tbrUnpressed
        Tlb_Action.Buttons("exec").Enabled = False
        Tlb_Action.Buttons("close").Enabled = False
    End If
    If Tlb_Action.Buttons("close").Value = tbrPressed Then
        Tlb_Action.Buttons("shqs").Enabled = False   '弃审
        Tlb_Action.Buttons("shsh").Enabled = False   '审核
        Tlb_Action.Buttons("exec").Enabled = False   '下达
        
    End If
    If Trim(LrText(11).Text) <> "" Then
        Tlb_Action.Buttons("shqs").Enabled = False   '弃审
        Tlb_Action.Buttons("shsh").Enabled = False   '审核
    End If
    
End Sub

Private Sub Wbkcl()                                                 '文本框录入之前处理(根据实际情况)
    
    Dim xswbrr As String
    With WglrGrid
        Zdlrqnr = Trim(.Text)
        xswbrr = Trim(.Text)
        If GridBoolean(.Col, 3) Then   '列表框录入
            '填充列表框程序
            Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
        Else
            Wbkbhlock = True
       
            '====以下为用户自定义
            Ydtext.Text = xswbrr
            '====以上为用户自定义
         
            Wbkbhlock = False
            Ydtext.SelStart = Len(Ydtext.Text)
        End If
    End With

End Sub

Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long) As Boolean       '录入数据字段有效性判断,同时进行字段录入事后处理
 
    '函数参数:Dqpdwgh, Dqpdwgl 当前要判断网格单元所处行列值

    Dim Str_JudgeText As String                 '临时有效性判断字段内容
    Dim Coljsq As Long                          '临时列计数器
    Dim RecTemp As New ADODB.Recordset          '临时使用动态集
    Dim Sqlstr As String                        '临时使用查询字符串

    With WglrGrid
        '非录入状态或非数据行则其有效性为合法
        If Yxxpdlock Or .Row < .FixedRows Then
            sjzdyxxpd = True
            Exit Function
        End If
        
        '取得当前要判断字段内容
        Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
      
        '根据不同字段进行相应的处理(依据其逻辑编号)
        Select Case GridStr(Dqpdwgl, 1)
            '[>>以下为自定义部分
            Case "001"                   '物料编码
                If Not Trim(Str_JudgeText) = "" Then
                    '1.放置字段有效性判断
                    Sqlstr = "SELECT MNumber,MName,Model,PurUnitName From Gy_Material Where (MNumber='" & Str_JudgeText & "' Or MName='" & Str_JudgeText & "') and IsPurchase=1 "
                    Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
                    If RecTemp.EOF Then
                        Tsxx = "此物料编码不存在或不具备采购属性!"
                        GoTo Lrcwcl
                    End If
                    '2.放置字段事后处理程序
                    .TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)) = Trim(RecTemp.Fields("MNumber") & "")      '显示物料编码
                    .TextMatrix(Dqpdwgh, Sydz("002", GridStr(), Szzls)) = Trim(RecTemp.Fields("MName") & "")        '显示物料名称
                    .TextMatrix(Dqpdwgh, Sydz("003", GridStr(), Szzls)) = Trim(RecTemp.Fields("Model") & "")        '显示物料规格型号
                    .TextMatrix(Dqpdwgh, Sydz("004", GridStr(), Szzls)) = RecTemp.Fields("PurUnitName") & ""        '计量单位
                Else
                    .TextMatrix(Dqpdwgh, Sydz("002", GridStr(), Szzls)) = ""
                    .TextMatrix(Dqpdwgh, Sydz("003", GridStr(), Szzls)) = ""
                    .TextMatrix(Dqpdwgh, Sydz("004", GridStr(), Szzls)) = ""
                End If
                   
               
            
            Case "005"          '数量

                
                '1.放置字段有效性判断
                If Trim(.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls))) = "" Then
                    Exit Function
                End If
                If (Not IsNumeric(Trim(.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls))))) Then
                    Tsxx = "请输入数字!"
                    GoTo Lrcwcl
                Else
                    .TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls)) = S2N(Trim(.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls))))
                    If S2N(Trim(.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls)))) < 0 Then
                        Tsxx = "计划数量不能小于零!"
                        GoTo Lrcwcl
                    
                    End If
         
                End If
                
            
            Case "006"          '数量
                '1.放置字段有效性判断
                If Not Trim(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls))) = "" Then
                    If IsDate(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls))) Then
                        .TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)) = Format(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)), "yyyy-mm-dd")
                        If S2N(Left(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)), 4)) < 1753 Then
                            .TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)) = "1900-01-01"
                        End If
                        If Trim(Me.LrText(3).Text) <> "" Then
                            If .TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)) < Me.LrText(3).Text Then
                                Tsxx = "计划到货日期不能小于计划日期!"
                                GoTo Lrcwcl
                            End If
                        End If
                    Else
                        Tsxx = "非法公历日期!(格式:" + Format(Date, "y

⌨️ 快捷键说明

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