以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]BOM用量計算問題 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=151689) |
-- 作者:kenmen -- 发布时间:2020/7/1 9:43:00 -- [求助]BOM用量計算問題 老師好,我做了一個利用三個暫存表計算BOM用量的程式,可是由於不確定BOM的階層,不曉得應該要讓程式運行多少次才能確定所有成品、半成品階都換算成材料,請老師幫我看看怎麼修改,謝謝! For i As Integer = 1 To 8 If i Mod 2 = 1 Then Dim drs As List (of DataRow) = DataTables("BOM用量計算暫存二").Select("","主件路徑") If drs IsNot Nothing Then For Each dr As DataRow In drs For Each BOM As DataRow In DataTables("BOMUsage").Select("[主件品號] = \'" & dr("品號") & "\' And [元件狀態] = \'有效\'") Dim Item_Code As String = BOM("元件品號") If Item_Code.StartsWith("B") Or Item_Code.StartsWith("C") Then Dim radd As Row = Tables("BOM用量計算暫存一").AddNew radd("品號") = BOM("元件品號") radd("數量") = BOM("單位用量") * dr("數量") radd("主件路徑") = dr("主件路徑") & "." & BOM("主件品號") Else Dim radd As Row = Tables("BOM材料暫存明細").AddNew radd("品號") = BOM("元件品號") radd("數量") = BOM("單位用量") * dr("數量") radd("主件路徑") = dr("主件路徑") End If Next Next DataTables("BOM用量計算暫存二").DataRows.Clear End If End If If i Mod 2 = 0 Then Dim drs As List (of DataRow) = DataTables("BOM用量計算暫存一").Select("","主件路徑") If drs IsNot Nothing Then For Each dr As DataRow In drs For Each BOM As DataRow In DataTables("BOMUsage").Select("[主件品號] = \'" & dr("品號") & "\' And [元件狀態] = \'有效\'") Dim Item_Code As String = BOM("元件品號") If Item_Code.StartsWith("B") Or Item_Code.StartsWith("C") Then Dim radd As Row = Tables("BOM用量計算暫存二").AddNew radd("品號") = BOM("元件品號") radd("數量") = BOM("單位用量") * dr("數量") radd("主件路徑") = dr("主件路徑") & "." & BOM("主件品號") Else Dim radd As Row = Tables("BOM材料暫存明細").AddNew radd("品號") = BOM("元件品號") radd("數量") = BOM("單位用量") * dr("數量") radd("主件路徑") = dr("主件路徑") End If Next Next DataTables("BOM用量計算暫存一").DataRows.Clear End If End If Next [此贴子已经被作者于2020/7/1 9:44:12编辑过]
|
-- 作者:有点蓝 -- 发布时间:2020/7/1 9:51:00 -- 业务的东西我不懂。请上传实例,并使用文字详细说明计算规则。 或者您到群里咨询一下有这方面开发经验的用户,qq群:123865097
|