以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  条件添加  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=112916)

--  作者:有点蓝
--  发布时间:2018/1/5 11:52:00
--  
这个意思?

For Each dr3 As DataRow In dt2.Select("成品编码 = \'" & dr1("成品编码")& "\' and 生产批次 = \'" & dr1("生产批次")& "\'")

--  作者:有点甜
--  发布时间:2018/1/5 13:17:00
--  
Dim t1 As DataTable = e.Form.Controls("毛坯工序").Table.DataTable
Dim dt1 As DataTable = DataTables("毛坯工序维护_条码维护")
Dim dt2 As DataTable = DataTables("生产排产表")
Dim Cols1() As String = {"成品编码","毛坯编码","生产批次","批次序号","毛坯产地","投产日期"}
Dim Cols2() As String = {"成品编码","毛坯编码","生产批次","批次序号","毛坯产地","投产日期"}
Dim Cols3() As String = {"加工工序","加工内容","成品描述"}
Dim Cols4() As String = {"加工工序","加工内容","成品描述"}
For Each dr1 As DataRow In dt1.Select("")
    For Each dr3 As DataRow In dt2.Select("成品编码 = \'" & dr1("成品编码")& "\' and 生产批次 = \'" & dr1("生产批次")& "\'")
        Dim dr2 As DataRow = t1.find("成品编码 = \'" & dr1("成品编码")& "\' and 生产批次 = \'" & dr1("生产批次")& "\'")
        If dr2 Is Nothing Then
            dr2 = t1.addnew
            For i As Integer = 0 To Cols1.Length -1
                dr2(Cols2(i)) = dr1(Cols1(i))
            Next
            For i As Integer = 0 To Cols3.Length -1
                dr2(Cols4(i)) = dr3(Cols3(i))
            Next
        end if
    Next
Next

--  作者:有点甜
--  发布时间:2018/1/5 14:19:00
--  
Dim t1 As DataTable = e.Form.Controls("毛坯工序").Table.DataTable
Dim dt1 As DataTable = DataTables("毛坯工序维护_条码维护")
Dim dt2 As DataTable = DataTables("生产排产表")
Dim Cols1() As String = {"成品编码","毛坯编码","生产批次","批次序号","毛坯产地","投产日期"}
Dim Cols2() As String = {"成品编码","毛坯编码","生产批次","批次序号","毛坯产地","投产日期"}
Dim Cols3() As String = {"加工工序","加工内容","成品描述"}
Dim Cols4() As String = {"加工工序","加工内容","成品描述"}
For Each dr1 As DataRow In dt1.Select("")
    For Each dr3 As DataRow In dt2.Select("成品编码 = \'" & dr1("成品编码")& "\' and 生产批次 = \'" & dr1("生产批次")& "\' and 加工工序 = \'" & dr1("加工工序") & "\'")
        Dim dr2 As DataRow = t1.find("成品编码 = \'" & dr1("成品编码")& "\' and 生产批次 = \'" & dr1("生产批次")& "\' and 加工工序 = \'" & dr1("加工工序") & "\'")
        If dr2 Is Nothing Then
            dr2 = t1.addnew
            For i As Integer = 0 To Cols1.Length -1
                dr2(Cols2(i)) = dr1(Cols1(i))
            Next
            For i As Integer = 0 To Cols3.Length -1
                dr2(Cols4(i)) = dr3(Cols3(i))
            Next
        end if
    Next
Next

--  作者:有点甜
--  发布时间:2018/1/5 17:11:00
--  
Dim t1 As DataTable = e.Form.Controls("毛坯工序").Table.DataTable
Dim dt1 As DataTable = DataTables("毛坯工序维护_条码维护")
Dim dt2 As DataTable = DataTables("生产排产表")
Dim Cols1() As String = {"成品编码","毛坯编码","生产批次","批次序号","毛坯产地","投产日期"}
Dim Cols2() As String = {"成品编码","毛坯编码","生产批次","批次序号","毛坯产地","投产日期"}
Dim Cols3() As String = {"加工工序","加工内容","成品描述"}
Dim Cols4() As String = {"加工工序","加工内容","成品描述"}
For Each dr1 As DataRow In dt1.Select("")
    For Each dr3 As DataRow In dt2.Select("成品编码 = \'" & dr1("成品编码")& "\' and 生产批次 = \'" & dr1("生产批次")& "\'")
        Dim dr2 As DataRow = t1.find("成品编码 = \'" & dr3("成品编码")& "\' and 生产批次 = \'" & dr3("生产批次")& "\' and 加工工序 = \'" & dr3("加工工序") & "\'")
        If dr2 Is Nothing Then
            dr2 = t1.addnew
            For i As Integer = 0 To Cols1.Length -1
                dr2(Cols2(i)) = dr1(Cols1(i))
            Next
            For i As Integer = 0 To Cols3.Length -1
                dr2(Cols4(i)) = dr3(Cols3(i))
            Next
        end if
    Next
Next

--  作者:有点蓝
--  发布时间:2018/1/5 22:51:00
--  
Dim t1 As DataTable = e.Form.Controls("毛坯工序").Table.DataTable
Dim dt1 As DataTable = DataTables("毛坯工序维护_条码维护")
Dim dt2 As DataTable = DataTables("生产排产表")
Dim Cols1() As String = {"成品编码","毛坯编码","生产批次","批次序号","毛坯产地","投产日期"}
Dim Cols2() As String = {"成品编码","毛坯编码","生产批次","批次序号","毛坯产地","投产日期"}
Dim Cols3() As String = {"加工工序","加工内容","成品描述"}
Dim Cols4() As String = {"加工工序","加工内容","成品描述"}
For Each dr1 As DataRow In dt1.Select("")
    For Each arr As String() In dt2.GetValues("成品编码|生产批次|加工工序","成品编码 = \'" & dr1("成品编码")& "\' and 生产批次 = \'" & dr1("生产批次")& "\'")
        Dim dr3 As DataRow = dt2.find("成品编码 = \'" & arr(0) & "\' and 生产批次 = \'" & arr(1) & "\' and 加工工序 = \'" & arr(2) & "\'")
        Dim dr2 As DataRow = t1.AddNew()
        For i As Integer = 0 To Cols1.Length -1
            dr2(Cols2(i)) = dr1(Cols1(i))
        Next
        For i As Integer = 0 To Cols3.Length -1
            dr2(Cols4(i)) = dr3(Cols3(i))
        Next
    Next
Next