入库明细表:
Select Case e.DataCol.Name
Case "物料编号","供应商","物料名称","型号规格","购进数量","判断列"
Dim filter As String = "物料编号 = '" & e.DataRow("物料编号") & "' and 供应商 = '" & e.DataRow("供应商") & "' and 物料名称 = '" & e.DataRow("物料名称") & "' and 型号规格 = '" & e.DataRow("型号规格") & "'"
If not (e.DataRow.IsNull("供应商") OrElse e.DataRow.IsNull("物料名称") OrElse e.DataRow.IsNull("型号规格") OrElse e.DataRow.IsNull("物料编号")) Then
Dim fdr As DataRow = DataTables("库存表").Find(filter)
If (fdr Is Nothing) Then
fdr = DataTables("库存表").AddNew
fdr("物料编号") = e.DataRow("物料编号")
fdr("物料名称") = e.DataRow("物料名称")
fdr("型号规格") = e.DataRow("型号规格")
fdr("供应商") = e.DataRow("供应商")
End If
End If
If e.DataCol.Name = "购进数量" Then
DataTables("库存表").DataCols("供应商").RaiseDataColChanged(filter)
Else
DataTables("库存表").DataCols("供应商").RaiseDataColChanged()
End If
End Select
库存表:
Select Case e.DataCol.Name
Case "物料编号","物料名称","型号规格","供应商"
Dim filter As String = "物料编号 = '" & e.DataRow("物料编号") & "'and 供应商 = '" & e.DataRow("供应商") & "' and 物料名称 = '" & e.DataRow("物料名称") & "' and 型号规格 = '" & e.DataRow("型号规格") & "'"
Filter = Filter & " 判断列 = True"
e.DataRow("库存数量") = DataTables("入库明细表").Compute("sum(购进数量)", filter)
End Select