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