根据帮助,已完成了入仓明细表中流水账的一部分功能。即修改(含增行、删行)了今单入仓数列的数量,被修改行的材料累计入仓数量会随之变化。具体的代码如下:
Select Case e.DataCol.Name
Case "存货编码","数量"
Dim drs As List(of DataRow)
Dim Filter As String
drs = e.DataTable.Select(Filter)
For Each dr As DataRow In drs
Filter = "[_SortKey] <= " & dr("_SortKey") & " And [存货编码] = '" & dr("存货编码") & "'and & parent.项目名称 = '" & Tables("入仓主表").current("项目名称") & "'"
Dim Val1 As Double = e.DataTable.Compute("Sum(数量)",Filter)
dr("累计入仓数量") = Val1
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)
dr("累计入仓数量") = Val1
Next
End If
End Select
请帮助:如何增加动态表达式条件(本人试图修改'and & parent.项目名称 = '" & Tables("入仓主表").current("项目名称") & ",但不成功),实现如下功能:当在入仓明细表中修改(含增行、删行)任意行,仅修改该行对应入仓主表的项目名称同一材料的材料累计入仓数量,不是该项目名称的同一材料的累计入仓数量不变。