Dim dic As new Dictionary(of String,Integer)
DataTables("切削液勾兑_BOM分析表").DataRows.Clear()
Dim v2 As Integer = val(e.form.controls("水的比例1").Text)
For Each dr1 As DataRow In DataTables("切削液勾兑_生产在制").DataRows
For Each dr2 As DataRow In DataTables("BOM基础数据").SQLSelect("[成品编码] = '" & dr1("成品编码") & "' and 材料类型 = '油类'")
Dim nm As String = dr1("添加批次") & "|" & dr2("材料编码") & "|" & dr2("材料描述") & "|" & dr2("供应商编码") & "|" & dr2("库位")
Dim vl As Integer
If dr2("用量") = 0 Then
vl = dr1("需求数量") * v2/(1+v2)
Else
vl = dr1("需求数量") * dr2("用量")/(1+v2)
End If
If dic.ContainsKey(nm) = False
dic.Add(nm,vl)
Else
dic(nm) = dic(nm)+ vl
End If
Next
Next