Foxtable(狐表)用户栏目专家坐堂 → 如何建构多级BOM树目录?高手请进!


  共有9677人关注过本帖树形打印复制链接

主题:如何建构多级BOM树目录?高手请进!

帅哥哟,离线,有人找我吗?
476240618
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:121 积分:1122 威望:0 精华:1 注册:2011/9/16 14:49:00
  发帖心情 Post By:2013/1/12 12:51:00 [显示全部帖子]

 For Each dr As DataRow In dt.datarows
        If dr("所属母件") = dbtx Then
            nd = tr.Nodes.Add(dr("物料编码"),dr("物料名称"))
            Dim r As Row = Tables("产品").AddNew()
            r("物料编码") = dr("物料编码")
            r("物料名称") = dr("物料名称")
            Functions.Execute("AddChildren",nd,dt)
           
        End If
    Next
内部函数

Dim nd As WinForm.TreeNode = args(0)
Dim dt As DataTable = args(1)
Dim drs As  List(of DataRow)
drs = dt.Select("[所属母件] = '" & nd.name & "'")
For Each dr As DataRow In drs
    Dim cd As Winform.TreeNode = nd.Nodes.Add(dr("物料编码"),dr("物料名称"))
  Dim s As String = dr("物料编码")
                 Dim cr As DataRow = DataTables("产品").Find("物料编码 = '" & s & "'")
            If cr IsNot Nothing Then
         cr("用量") = cr("用量") + dr("用量")
            Else
                Dim r As Row = Tables("产品").AddNew()
                r("物料编码") = dr("物料编码")
                r("物料名称") = dr("物料名称")
                r("用量") =  dr("用量")
            End If
    Functions.Execute("AddChildren",cd,dt)
Next


 回到顶部