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

📄

📁 VB开发的ERP系统
💻
📖 第 1 页 / 共 5 页
字号:
        
                '设置文本框录入状态
                Call Sub_LrtextStatus(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       '退出
                
                '设置文本框录入状态
                Call Sub_LrtextStatus(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)
        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(12).Text) <> "" And Trim(LrText(11).Text) = "" Then
        Tlb_Action.Buttons("shsh").Enabled = True      '审核
    Else
        Tlb_Action.Buttons("shsh").Enabled = False   '审核
    End If
    If Trim(LrText(12).Text) <> "" And Trim(LrText(11).Text) <> "" Then
        Tlb_Action.Buttons("shqs").Enabled = True      '弃审
    Else
        Tlb_Action.Buttons("shqs").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,PrimaryUnit,PrimaryUnitName,Ispcgl,Isbzqgl,planprice From Gy_Material Where stopflag=0 and MNumber='" & Trim(Str_JudgeText) & "' Or MName='" & Trim(Str_JudgeText) & "'"
                    Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
                    If RecTemp.EOF Then
                        Tsxx = "此物料编码不存在!"
                        GoTo Lrcwcl
                    Else
                        '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)) = Trim(RecTemp.Fields("PrimaryUnitName") & "")
                        .TextMatrix(Dqpdwgh, 2) = RecTemp.Fields("Ispcgl")
                        .TextMatrix(Dqpdwgh, 3) = RecTemp.Fields("Isbzqgl")
                        
                        If PriceMode = "计划价法" And Val(RecTemp.Fields("PlanPrice")) <> 0 Then
                            .TextMatrix(Dqpdwgh, Sydz("009", GridStr(), Szzls)) = Val(RecTemp.Fields("PlanPrice"))
                        End If
                    End If
                    '根据公式计算结果
                        Call Sub_JoinCount(Dqpdwgh, Sydz("008", GridStr(), Szzls))
                        Call Sub_JoinCount(Dqpdwgh, Sydz("010", GridStr(), Szzls))
                        Call Sub_JoinCount(Dqpdwgh, Sydz("012", GridStr(), Szzls))
                Else
                    '3.清空相关字段
                    .TextMatrix(Dqpdwgh, Sydz("002", GridStr(), Szzls)) = ""                                             '物料名称
                    .TextMatrix(Dqpdwgh, Sydz("003", GridStr(), Szzls)) = ""                                             '物料规格型号
                    .TextMatrix(Dqpdwgh, Sydz("004", GridStr(), Szzls)) = ""
                End If
    
            Case "005"
                '1.放置字段有效性判断
                '2.放置字段事后处理程序
                If Not Trim(Str_JudgeText) = "" Then
                  Sqlstr = "SELECT MArea,MAreaName From KF_Marea Where (MArea='" & Trim(Str_JudgeText) & "' Or MAreaName='" & Trim(Str_JudgeText) & "') and whcode='" & Trim(LrText(4).Tag) & "' and endflag=1"
                    Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
                        If RecTemp.EOF Then
                            Tsxx = "此货区不存在或不属于本仓库或不是末级货区!"
                            GoTo Lrcwcl
                        End If
                        .TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls)) = Trim(RecTemp.Fields("MAreaName") & "")
                        .TextMatrix(Dqpdwgh, 1) = Trim(RecTemp.Fields("MArea") & "")

                End If
            Case "006"
                '1.放置字段有效性判断
                '2.放置字段事后处理程序
                If Not Trim(Str_JudgeText) = "" Then
                  Sqlstr = "SELECT MArea,MAreaName From KF_Marea Where (MArea='" & Trim(Str_JudgeText) & "' Or MAreaName='" & Trim(Str_JudgeText) & "') and whcode='" & Trim(LrText(5).Tag) & "' and endflag=1"
                    Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
                        If RecTemp.EOF Then
                            Tsxx = "此货区不存在或不属于本仓库或不是末级货区!"
                            GoTo Lrcwcl
                        End If
                        .TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)) = Trim(RecTemp.Fields("MAreaName") & "")
                        .TextMatrix(Dqpdwgh, 4) = Trim(RecTemp.Fields("MArea") & "")

                End If
                
            Case "007"
                If .TextMatrix(Dqpdwgh, 0) = "*" Then
                    If Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))) = "" Then
                        Tsxx = "请先输入物料!"
                        Dqpdwgl = Sydz("001", GridStr(), Szzls)
                        GoTo Lrcwcl
                    End If
                    '先输入批次和货区
                    If conArea = 1 Then
                        If Not .ColHidden(Sydz("005", GridStr(), Szzls)) Then
                            If Trim(.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls))) = "" Then
                                Tsxx = "请先输入转出货区!"
                                Dqpdwgl = Sydz("005", GridStr(), Szzls)
                                GoTo Lrcwcl
                            End If
                        End If
                    End If
                    
                    If conArea = 1 Then
                        If Not .ColHidden(Sydz("006", GridStr(), Szzls)) Then
                            If Trim(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls))) = "" Then
                                Tsxx = "请先输入转入货区!"
                                Dqpdwgl = Sydz("006", GridStr(), Szzls)
                                GoTo Lrcwcl
                            End If
                        End If
                    End If
                    
                    '如果对应物料不使用批此管理,则设为空值
                    If conBatch = 1 Then
                        If Trim(.TextMatrix(Dqpdwgh, 2)) <> "" Then
                            If CBool(.TextMatrix(Dqpdwgh, 2)) = False Then
                                .TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)) = ""
                            Else
                                '如果为批次管理的物料则显示判断此批号是否存在
                                If Trim(Str_JudgeText) <> "" Then
                                If BatchJudge(Trim(LrText(4).Tag), .TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)), .TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)), intCount, intFatherID(), intChildID(), IsQc(), False) = 1 Then
                                    Tsxx = "此批号不存在!"
                                    Dqpdwgl = Sydz("007", GridStr(), Szzls)
                                    GoTo Lrcwcl
                                End If
                                End If
                            End If
                        End If
                    End If
                End If
            Case "008"          '数量
                '1.放置字段有效性判断
                 If Trim(.TextMatrix(Dqpdwgh, 0)) = "*" Then
                     If Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))) = "" Then
                        Tsxx = "请先输入物料!"
                        Dqpdwgl = Sydz("001", GridStr(), Szzls)
                        GoTo Lrcwcl
                     End If
                     
                    '先输入批次和货区
                    If conArea = 1 Then
                        If Not .ColHidden(Sydz("005", GridStr(), Szzls)) Then
                            If Trim(.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls))) = "" Then
                                Tsxx = "请先输入转出货区!"
                                Dqpdwgl = Sydz("005", GridStr(), Szzls)
                                GoTo Lrcwcl
                            End If
                        End If
                        If Not .ColHidden(Sydz("006", GridStr(), Szzls)) Then
                            If Trim(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls))) = "" Then
                                Tsxx = "请先输入转入货区!"
                                Dqpdwgl = Sydz("006", GridStr(), Szzls)
                                GoTo Lrcwcl
                            End If
                        End If
                     End If
                     If conBatch = 1 Then
                        If CBool(.TextMatrix(Dqpdwgh, 2)) = True Then
                            If Trim(.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls))) = "" Then
                                Tsxx = "请先输入批号!"
                                Dqpdwgl = Sydz("007", GridStr(), Szzls)
                                GoTo Lrcwcl
                            End If
                        End If
                     End If
                    If Val(Str_JudgeText) = 0 Then
                        Tsxx = "数量不能为0!"
                        Dqpdwgl = Sydz("008", GridStr(), Szzls)
                        GoTo Lrcwcl
                    End If
                    If Val(.TextMatrix(Dqpdwgh, Sydz("012", GridStr(), Szzls))) < 0 Then
                        If Val(Str_JudgeText) > 0 Then
                            Tsxx = "金额为负值,数量不允许为正值!"
                            Dqpdwgl = Sydz("008", GridStr(), Szzls)
                            GoTo Lrcwcl
     

⌨️ 快捷键说明

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