Select Case e.DataCol.name Case "供应商","暂收单号","材料代号" If e.DataRow.IsNull("材料代号") = False AndAlso e.DataRow.IsNull("供应商") = False AndAlso e.DataRow.IsNull("暂收单号") = False Then Dim nms() As String = {"外形尺寸_本体直径","外形尺寸_本体高","电容量测试值","损耗角正切测试值","漏电流测试值","材料代号"} Dim drs As List(of DataRow) = DataTables("电解电容检验记录数据库").Select("材料代号 = '" & e.DataRow("材料代号") & "'") systemready = False If drs.count <= 10 Then For Each dr As DataRow In drs Dim dr2 As DataRow = e.DataTable.Addnew For Each nm As String In nms dr2(nm) =dr(nm) Next dr2("供应商") = e.DataRow("供应商") drs("暂收单号") = e.DataRow("暂收单号") Next Else Dim i As Integer = 1 Do Dim Id As Integer = rand.Next(0,drs.count) Dim dr5 As DataRow = drs(id) Dim dr3 As DataRow = e.DataTable.Addnew For Each nm As String In nms dr3(nm) =dr5(nm) Next dr3("供应商") = e.DataRow("供应商") dr3("暂收单号") = e.DataRow("暂收单号") i += 1 Loop While i <= 10 End If e.DataRow.Delete systemready = True End If End Select
|