-- 作者:xusuyang
-- 发布时间:2017/6/3 21:55:00
-- 老师请教有关编码
If e.DataCol.Name = "产品信息_产品名称" OrElse e.DataCol.name = "产品信息_产品批号" Then If e.DataRow.isnull("产品信息_产品名称") OrElse e.DataRow.isnull("产品信息_产品批号")Then e.DataRow("产品信息_产品编码") = Nothing Else e.DataRow("产品信息_产品编码") = GetPy(e.DataRow("产品信息_产品名称"), 1) & e.DataRow("产品信息_产品批号").replace("*", "") End If End If Select Case e.DataCol.Name Case "产品信息_产品编码","出入库信息_入库数量","出入库信息_出库数量" Dim drs As List(of DataRow) Dim Filter As String Filter = "[_SortKey] >= " & e.DataRow("_SortKey") & " And [产品信息_产品编码] = \'" & e.DataRow("产品信息_产品编码") & "\'" drs = e.DataTable.Select(Filter) For Each dr As DataRow In drs Filter = "[_SortKey] <= " & dr("_SortKey") & " And [产品信息_产品编码] = \'" & dr("产品信息_产品编码") & "\'" Dim Val1 As Double = e.DataTable.Compute("Sum(出入库信息_入库数量)",Filter) Dim Val2 As Double = e.DataTable.Compute("Sum(出入库信息_出库数量)",Filter) Dim Val3 As Double = e.DataTable.Compute("Sum(库存结余)",Filter & " And 出入库信息_入库数量 Is null And 出入库信息_出库数量 Is null") dr("库存结余") = Val1 - Val2 + val3 Next If e.DataCol.Name = "产品信息_产品编码" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then Filter = "[_SortKey] > " & e.DataRow("_SortKey") & " And [产品信息_产品编码] = \'" & e.OldValue & "\'" drs = e.DataTable.Select(Filter) For Each dr As DataRow In drs Filter = "[_SortKey] <= " & dr("_SortKey") & " And [产品信息_产品编码] = \'" & dr("产品信息_产品编码") & "\'" Dim Val1 As Double = e.DataTable.Compute("Sum(出入库信息_入库数量)",Filter) Dim Val2 As Double = e.DataTable.Compute("Sum(出入库信息_出库数量)",Filter) Dim Val3 As Double = e.DataTable.Compute("Sum(库存结余)",Filter & " And 出入信息_入库数量 Is null And 出入信息_出库数量 Is null") dr("库存结余") = Val1 - Val2 + val3 Next End If End Select
老师:您好!上述代码如何实现“产品编码”由"产品信息_产品名称+产品信息_产品批号+产品信息_规格”组成,如:”产品信息_产品名称”麻醉包,”产品信息_产品批号”20170602,”产品信息_规格”"15*10”或"15/10",“产品编码”为:20170603MZB-1510.谢谢
|
-- 作者:有点色
-- 发布时间:2017/6/4 10:18:00
--
If e.DataCol.Name = "产品信息_产品名称" OrElse e.DataCol.name = "产品信息_产品批号" OrElse e.DataCol.Name = "产品信息_规格" Then If e.DataRow.isnull("产品信息_产品名称") OrElse e.DataRow.isnull("产品信息_产品批号") OrElse e.DataRow.Isnull("产品信息_规格") Then e.DataRow("产品信息_产品编码") = Nothing Else e.DataRow("产品信息_产品编码") = e.DataRow("产品信息_产品批号") & GetPinYin(e.DataRow("产品信息_产品名称"), 1).ToUpper & "-" & e.DataRow("产品信息_规格").replace("*", "").Replace("/", "") End If End If
|