Dim t As Table = Tables("电解电容") Dim cr As Row = t.Current Dim cs1() As String = {"供应商","日期","暂收单号","采购单号","材料代号"} Dim cs2() As String = {"外形尺寸_本体直径","外形尺寸_本体高","电容量测试值","损耗角正切测试值","漏电流测试值"} If cr.DataRow.GetChildRows("电解电容检验记录录入").count = 0 Then Dim drs = DataTables("电解电容检验记录数据库").Select("材料代号 = '" & cr("材料代号") & "'") If drs.count = 0 Then msgbox("没找到数据库") Else For j As Integer = 1 To cr("零缺陷数量") Dim ndr As DataRow = DataTables("电解电容检验记录录入").AddNew For i As Integer = 0 To cs1.length-1 ndr(cs1(i)) = cr(cs1(i)) Next Dim fdr = drs(Rand.Next(drs.count)) For i As Integer = 0 To cs2.length-1 ndr(cs2(i)) = fdr(cs2(i)) Next Next End If End If
|