Foxtable(狐表)用户栏目专家坐堂 → [求助]BOM展开增加上阶料号和层级


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

主题:[求助]BOM展开增加上阶料号和层级

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/26 15:54:00 [显示全部帖子]

Dim dt As DataTable = DataTables("物料清单")
DataTables("表c").DataRows.Clear
Dim txt1 = e.Form.Controls("textbox1").text
Dim txt2 = val(e.Form.Controls("textbox2").text)
Dim filter As String
If txt1 > "" Then
    filter = "主物料 = '" & txt1 & "'"
Else
    filter = "主物料 is null"
End If
Dim drs As List(of DataRow) =dt.SQLSelect(filter)
Dim lst As new List(of String)
Dim idx = 0
Do While drs.Count > 0
    lst.Clear
    For Each dr As DataRow In drs
        Dim bh As String = dr("子物料")
        Dim ndr As DataRow = DataTables("表c").AddNew
        ndr("物料编码") = bh
        lst.Add(bh)
        Dim fdr As DataRow = DataTables("产品表").Find("物料编码 = '" & bh & "'")
        If fdr IsNot Nothing Then
            ndr("物料名称") = fdr("物料名称")
        End If
        ndr("上级编码") = dr("主物料")
        ndr("层级") = idx

        ndr("用量") = dr("用量")
        ndr("需求量") = dr("用量") * txt2
        'Functions.Execute("sum",dr, txt2)
    Next
    idx += 1
    drs = dt.SQLSelect("主物料 in ('" & String.Join("','",lst.ToArray) & "')")
Loop

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/26 16:30:00 [显示全部帖子]

Dim dt As DataTable = DataTables("物料清单")
DataTables("表c").DataRows.Clear
Dim txt1 = e.Form.Controls("textbox1").text
Dim txt2 = val(e.Form.Controls("textbox2").text)
Dim filter As String
If txt1 > "" Then
    filter = "主物料 = '" & txt1 & "'"
Else
    filter = "主物料 is null"
End If
Dim drs As List(of DataRow) =dt.SQLSelect(filter)
Dim lst As new List(of String)
Dim idx = 0
Do While drs.Count > 0
    lst.Clear
    For Each dr As DataRow In drs
        Dim bh As String = dr("子物料")
        Dim ndr As DataRow = DataTables("表c").AddNew
        ndr("物料编码") = bh
        lst.Add(bh)
        Dim fdr As DataRow = DataTables("产品表").Find("物料编码 = '" & bh & "'")
        If fdr IsNot Nothing Then
            ndr("物料名称") = fdr("物料名称")
        End If
        fdr = DataTables("表c").Find("物料编码 = '" & dr("主物料") & "'")
        If fdr Is Nothing Then
            ndr("需求量") = dr("用量") * txt2
        Else
            ndr("需求量") = dr("用量") * fdr("需求量")
           
        End If
        ndr("上级编码") = dr("主物料")
        ndr("层级") = idx
        ndr("用量") = dr("用量")
        'Functions.Execute("sum",dr, txt2)
    Next
    idx += 1
    drs = dt.SQLSelect("主物料 in ('" & String.Join("','",lst.ToArray) & "')")
Loop

 回到顶部