以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 关于高效流水帐表达式问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=168888) |
-- 作者:foxpa -- 发布时间:2021/5/26 10:08:00 -- 关于高效流水帐表达式问题 老师好 按物料编码+批号设置的流水帐,计算结果没有把批号区分出来,不知道表达式哪里错误了,麻烦老师帮助一下 Select Case e.DataCol.Name Case "物料编码","入库数量","实发数量","批号" Dim dr As DataRow Dim mr As DataRow = e.DataRow Dim drs As List(of DataRow) dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [物料编码] = \'" & mr("物料编码") & "\' And [批号] = \'" & mr("批号") & "\'", "[_SortKey] Desc") 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 [物料编码] and [批号] = \'" & e.OldValue & "\'", "[_SortKey] Desc") If dr Is Nothing Then dr = e.DataTable.Find("[物料编码] 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 End Select
|
-- 作者:有点蓝 -- 发布时间: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 |
-- 作者:foxpa -- 发布时间:2021/5/26 10:33:00 -- 我看出来哪里错误,请老师指出一下,谢谢 |
-- 作者:有点蓝 -- 发布时间: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") |
-- 作者:foxpa -- 发布时间:2021/5/26 10:43:00 -- 加批号区分可以,但是增加一行作出入库数量是,库存数量不计算,请问有是哪里错误,谢谢 |
-- 作者:有点蓝 -- 发布时间:2021/5/26 11:03:00 -- "物料编码"和"批号"有录入数据吗 |
-- 作者:foxpa -- 发布时间:2021/5/26 11:18:00 -- |
-- 作者:有点蓝 -- 发布时间:2021/5/26 11:20:00 -- 请正确上传图片:http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=78 |
-- 作者:foxpa -- 发布时间:2021/5/26 11:25:00 -- "物料编码"和"批号"都有录入数据哦 |
-- 作者:有点蓝 -- 发布时间:2021/5/26 11:30:00 -- 请上传实例说明 |