Foxtable(狐表)用户栏目专家坐堂 → 关于高效流水帐表达式问题


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

主题:关于高效流水帐表达式问题

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107725 积分:547958 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/5/26 10:14:00 [显示全部帖子]

        If dr Is Nothing Then
            mr("Kuc") = mr("入库数量") - mr("实发数量")
            dr = mr
        End If
          drs = e.DataTable.Select("[_SortKey] < " & dr("_SortKey") & " And [物料编码] = '" & dr("物料编码") & "' And [批号] = '" & dr("批号") & "'","[_SortKey] ")
        For i As Integer = 1 To drs.Count - 1
            drs(i)("Kuc") = drs(i-1)("Kuc") + drs(i)("入库数量") - drs(i)("实发数量")
        Next
        If e.DataCol.Name = "物料编码" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
            dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [物料编码]  = '" & e.OldValue & "' and [批号]='" & mr("批号") & "'", "[_SortKey] Desc")
              If dr Is Nothing Then
               dr = e.DataTable.Find("[物料编码] = '" & e.OldValue & "'and [批号]='" & mr("批号") & "'", "[_SortKey]")
                If dr IsNot Nothing Then
                    dr("Kuc") = dr("入库数量") - dr("实发数量")
                End If
            End If
            If dr IsNot Nothing Then
              drs = e.DataTable.Select("[_SortKey] < " & dr("_SortKey") & " And [物料编码] = '" & dr("物料编码") & "' And [批号] = '" & dr("批号") & "' ","[_SortKey] ")
                For i As Integer = 1 To drs.Count - 1
                    drs(i)("Kuc") = drs(i-1)("Kuc") + drs(i)("入库数量") - drs(i)("实发数量")
                Next
            End If
        End If
        If e.DataCol.Name = "批号" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
            dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [物料编码]  = '" & mr("物料编码") & "' and [批号]='" & e.OldValue & "'", "[_SortKey] Desc")
              If dr Is Nothing Then
               dr = e.DataTable.Find("[物料编码]  = '" & mr("物料编码") & "' and [批号]='" & e.OldValue & "'", "[_SortKey]")
                If dr IsNot Nothing Then
                    dr("Kuc") = dr("入库数量") - dr("实发数量")
                End If
            End If
            If dr IsNot Nothing Then
              drs = e.DataTable.Select("[_SortKey] < " & dr("_SortKey") & " And [物料编码] = '" & dr("物料编码") & "' And [批号] = '" & dr("批号") & "' ","[_SortKey] ")
                For i As Integer = 1 To drs.Count - 1
                    drs(i)("Kuc") = drs(i-1)("Kuc") + drs(i)("入库数量") - drs(i)("实发数量")
                Next
            End If
        End If

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107725 积分:547958 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/5/26 10:34:00 [显示全部帖子]

 If e.DataCol.Name = "物料编码" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
            dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [物料编码]  = '" & e.OldValue & "' and [批号]='" & mr("批号") & "'", "[_SortKey] Desc")

……

If e.DataCol.Name = "批号" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
            dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [物料编码]  = '" & mr("物料编码") & "' and [批号]='" & e.OldValue & "'", "[_SortKey] Desc")

 回到顶部
帅哥,在线噢!
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107725 积分:547958 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/5/26 11:03:00 [显示全部帖子]

"物料编码"和"批号"有录入数据吗

 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107725 积分:547958 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/5/26 11:20:00 [显示全部帖子]

请正确上传图片:http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=78

 回到顶部
帅哥,在线噢!
有点蓝
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107725 积分:547958 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/5/26 11:30:00 [显示全部帖子]

请上传实例说明

 回到顶部
帅哥,在线噢!
有点蓝
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107725 积分:547958 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/5/26 11:50:00 [显示全部帖子]

改"物料编码"才会计算,改批号不会计算的。要像上面2楼一样使用2段代码,分别处理

 回到顶部