这个怎么算出来的都是2倍,按照示范做的·········································
Dim dic As new Dictionary(of String,Integer)
DataTables("零件需求").DataRows.Clear()
For Each dr1 As DataRow In DataTables("订单").DataRows
For Each dr2 As DataRow In DataTables("物料清单").Select("[阀门型号] = '" & dr1("规格型号") & "'")
Dim nm As String = dr2("子图号")
Dim vl As Integer = dr1("数量") * dr2("单位用量")
If dic.ContainsKey(nm) = False
dic.Add(nm,vl)
Else
dic(nm) = dic(nm)+ vl
End If
Next
Next
For Each key As String In dic.keys
Dim dr As DataRow = DataTables("零件需求").AddNew()
dr("子图号") = key
dr("订单用量") = dic(key)
Next

此主题相关图片如下:a01.jpg
