以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]计算BOM (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=153123) |
-- 作者:liumiao123 -- 发布时间:2020/7/31 16:19:00 -- [求助]计算BOM 这个怎么算出来的都是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) |
-- 作者:有点蓝 -- 发布时间:2020/7/31 16:30:00 -- 代码没有问题。可能有其它事件代码影响了 |