以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  自动增加行问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=119759)

--  作者:13775189031
--  发布时间:2018/5/31 14:19:00
--  自动增加行问题
请教

Select Case e.DataCol.name
    Case "领料情况_分机组"
        If e.newvalue = True AndAlso e.DataRow("物资说明") = "外购件" Then
            For i As Integer = 1 To 2
                Dim ndr As DataRow = DataTables("领料清单").AddNew
                ndr("编号") = e.DataRow("编号")
                ndr("预算编号") = e.DataRow("预算编号")
                ndr("物资说明") = e.DataRow("物资说明")
                ndr("名称") = e.DataRow("物资名称")
                ndr("规格") = e.DataRow("规格")
                ndr("材质") = e.DataRow("材质")
                ndr("单位") = e.DataRow("单位")
                ndr("领料数量") = e.DataRow("到货数量") / 2
            Next
        End If
        If e.newvalue = True AndAlso e.DataRow("物资说明") = "电气" Then
            For i As Integer = 1 To 2
                Dim ndr As DataRow = DataTables("领料清单").AddNew
                ndr("编号") = e.DataRow("编号")
                ndr("预算编号") = e.DataRow("预算编号")
                ndr("物资说明") = e.DataRow("物资说明")
                ndr("名称") = e.DataRow("物资名称")
                ndr("规格") = e.DataRow("规格")
                ndr("材质") = e.DataRow("材质")
                ndr("单位") = e.DataRow("单位")
                ndr("领料数量") = e.DataRow("到货数量") / 2
            Next
        End If
        If e.newvalue = True AndAlso e.DataRow("物资说明") = "焊材" Then
            For i As Integer = 1 To 2
                Dim ndr As DataRow = DataTables("领料清单").AddNew
                ndr("编号") = e.DataRow("编号")
                ndr("预算编号") = e.DataRow("预算编号")
                ndr("物资说明") = e.DataRow("物资说明")
                ndr("名称") = e.DataRow("物资名称")
                ndr("规格") = e.DataRow("规格")
                ndr("材质") = e.DataRow("材质")
                ndr("单位") = e.DataRow("单位")
                ndr("领料数量") = e.DataRow("到货数量") / 2
            Next
        End If
    Case "领料情况_不分机组"
       If e.newvalue = True AndAlso e.DataRow("物资说明") = "外购件" Then
            Dim ndr1 As DataRow = DataTables("领料清单").AddNew
            ndr1("编号") = e.DataRow("编号")
            ndr1("预算编号") = e.DataRow("预算编号")
            ndr1("生产令号") = e.DataRow("生产令号")
            ndr1("项目名称") = e.DataRow("项目名称")
            ndr1("物资说明") = e.DataRow("物资说明")
            ndr1("名称") = e.DataRow("物资名称")
            ndr1("规格") = e.DataRow("规格")
            ndr1("材质") = e.DataRow("材质")
            ndr1("单位") = e.DataRow("单位")
            ndr1("领料数量") = e.DataRow("数量")
        Else
            DataTables("领料清单").DeleteFor("编号=\'" & e.DataRow("编号") & "\'")
        End If
       If e.newvalue = True AndAlso e.DataRow("物资说明") = "电气" Then
            Dim ndr1 As DataRow = DataTables("领料清单").AddNew
            ndr1("编号") = e.DataRow("编号")
            ndr1("预算编号") = e.DataRow("预算编号")
            ndr1("生产令号") = e.DataRow("生产令号")
            ndr1("项目名称") = e.DataRow("项目名称")
            ndr1("物资说明") = e.DataRow("物资说明")
            ndr1("名称") = e.DataRow("物资名称")
            ndr1("规格") = e.DataRow("规格")
            ndr1("材质") = e.DataRow("材质")
            ndr1("单位") = e.DataRow("单位")
            ndr1("领料数量") = e.DataRow("数量")
        Else
            DataTables("领料清单").DeleteFor("编号=\'" & e.DataRow("编号") & "\'")
        End If
        If e.newvalue = True AndAlso e.DataRow("物资说明") = "焊材" Then
            Dim ndr1 As DataRow = DataTables("领料清单").AddNew
            ndr1("编号") = e.DataRow("编号")
            ndr1("预算编号") = e.DataRow("预算编号")
            ndr1("生产令号") = e.DataRow("生产令号")
            ndr1("项目名称") = e.DataRow("项目名称")
            ndr1("物资说明") = e.DataRow("物资说明")
            ndr1("名称") = e.DataRow("物资名称")
            ndr1("规格") = e.DataRow("规格")
            ndr1("材质") = e.DataRow("材质")
            ndr1("单位") = e.DataRow("单位")
            ndr1("领料数量") = e.DataRow("数量")
        Else
            DataTables("领料清单").DeleteFor("编号=\'" & e.DataRow("编号") & "\'")
        End If
End Select

问题一:Case "领料情况_分机组"下,勾选取消后,领料清单中也自动删除,怎么编?
问题二:Case "领料情况_不分机组",("物资说明") = "焊材"时可实现,但=“外购件”和“电气”时,就没反应,是什么问题?

--  作者:有点甜
--  发布时间:2018/5/31 14:42:00
--  

Select Case e.DataCol.name
    Case "领料情况_分机组"
        If e.newvalue = False Then
            DataTables("领料清单").DeleteFor("编号=\'" & e.DataRow("编号") & "\'")
        Else
            If e.DataRow("物资说明") = "外购件" Then
                For i As Integer = 1 To 2
                    Dim ndr As DataRow = DataTables("领料清单").AddNew
                    ndr("编号") = e.DataRow("编号")
                    ndr("预算编号") = e.DataRow("预算编号")
                    ndr("物资说明") = e.DataRow("物资说明")
                    ndr("名称") = e.DataRow("物资名称")
                    ndr("规格") = e.DataRow("规格")
                    ndr("材质") = e.DataRow("材质")
                    ndr("单位") = e.DataRow("单位")
                    ndr("领料数量") = e.DataRow("到货数量") / 2
                Next
            End If
            If e.DataRow("物资说明") = "电气" Then
                For i As Integer = 1 To 2
                    Dim ndr As DataRow = DataTables("领料清单").AddNew
                    ndr("编号") = e.DataRow("编号")
                    ndr("预算编号") = e.DataRow("预算编号")
                    ndr("物资说明") = e.DataRow("物资说明")
                    ndr("名称") = e.DataRow("物资名称")
                    ndr("规格") = e.DataRow("规格")
                    ndr("材质") = e.DataRow("材质")
                    ndr("单位") = e.DataRow("单位")
                    ndr("领料数量") = e.DataRow("到货数量") / 2
                Next
            End If
            If e.DataRow("物资说明") = "焊材" Then
                For i As Integer = 1 To 2
                    Dim ndr As DataRow = DataTables("领料清单").AddNew
                    ndr("编号") = e.DataRow("编号")
                    ndr("预算编号") = e.DataRow("预算编号")
                    ndr("物资说明") = e.DataRow("物资说明")
                    ndr("名称") = e.DataRow("物资名称")
                    ndr("规格") = e.DataRow("规格")
                    ndr("材质") = e.DataRow("材质")
                    ndr("单位") = e.DataRow("单位")
                    ndr("领料数量") = e.DataRow("到货数量") / 2
                Next
            End If
        end if
    Case "领料情况_不分机组"
        if e.newvalue = false then
            DataTables("领料清单").DeleteFor("编号=\'" & e.DataRow("编号") & "\'")
        else
            If e.DataRow("物资说明") = "外购件" Then
                Dim ndr1 As DataRow = DataTables("领料清单").AddNew
                ndr1("编号") = e.DataRow("编号")
                ndr1("预算编号") = e.DataRow("预算编号")
                ndr1("生产令号") = e.DataRow("生产令号")
                ndr1("项目名称") = e.DataRow("项目名称")
                ndr1("物资说明") = e.DataRow("物资说明")
                ndr1("名称") = e.DataRow("物资名称")
                ndr1("规格") = e.DataRow("规格")
                ndr1("材质") = e.DataRow("材质")
                ndr1("单位") = e.DataRow("单位")
                ndr1("领料数量") = e.DataRow("数量")
            End If
            If e.DataRow("物资说明") = "电气" Then
                Dim ndr1 As DataRow = DataTables("领料清单").AddNew
                ndr1("编号") = e.DataRow("编号")
                ndr1("预算编号") = e.DataRow("预算编号")
                ndr1("生产令号") = e.DataRow("生产令号")
                ndr1("项目名称") = e.DataRow("项目名称")
                ndr1("物资说明") = e.DataRow("物资说明")
                ndr1("名称") = e.DataRow("物资名称")
                ndr1("规格") = e.DataRow("规格")
                ndr1("材质") = e.DataRow("材质")
                ndr1("单位") = e.DataRow("单位")
                ndr1("领料数量") = e.DataRow("数量")
            End If
            If e.DataRow("物资说明") = "焊材" Then
                Dim ndr1 As DataRow = DataTables("领料清单").AddNew
                ndr1("编号") = e.DataRow("编号")
                ndr1("预算编号") = e.DataRow("预算编号")
                ndr1("生产令号") = e.DataRow("生产令号")
                ndr1("项目名称") = e.DataRow("项目名称")
                ndr1("物资说明") = e.DataRow("物资说明")
                ndr1("名称") = e.DataRow("物资名称")
                ndr1("规格") = e.DataRow("规格")
                ndr1("材质") = e.DataRow("材质")
                ndr1("单位") = e.DataRow("单位")
                ndr1("领料数量") = e.DataRow("数量")
            end if
        End If
End Select

--  作者:13775189031
--  发布时间:2018/5/31 17:11:00
--  
谢谢!