If e.Form.Controls("ComboBox1").Value = Nothing Then
MessageBox.Show("请选择供应商")
Return
End If
For Each r As Row In Tables("临时材料表").rows
For Each c As Col In Tables("临时材料表").cols
If r.IsNull(c.name) Then
MessageBox.Show(r.index+1 & "行 " & c.name & " 列为空")
Return
End If
Next
Next
Dim Cols1() As String = {"产品名称","型号规格","单位","单价"}
Dim Cols2() As String = {"产品名称","型号规格","单位","单价"}
Dim idxs As String = "-1,"
For Each dr1 As DataRow In DataTables("临时材料表").Select("")
Dim dr2 As DataRow = DataTables("材料表").find("供应商 = '" & e.Form.Controls("ComboBox1").text & "' and 产品名称 = '" & dr1("产品名称") & "' and 型号规格 = '" & dr1("型号规格") & "'")
If dr2 Is Nothing Then
dr2 = DataTables("材料表").AddNew()
dr2("供应商")=e.Form.Controls("ComboBox1").text
For i As Integer = 0 To Cols1.Length-1
dr2(Cols2(i))=dr1(Cols1(i))
Next
idxs &= dr1("_Identify") & ","
End If
Next
DataTables("临时材料表").DeleteFor("_Identify in (" & idxs.trim(",") & ")")