If e.DataCol.name = "入库数量" OrElse e.DataCol.name = "出库数量" Then If e.DataRow("批号") Is Nothing OrElse e.DataRow("物料编号") Is Nothing Then Else Dim dr As DataRow = DataTables("批号表").find("批号 = '" & e.DataRow("批号") & "' And 物料编号 = '" & e.DataRow("物料编号") & "'") If dr Is Nothing Then dr = DataTables("批号表").AddNew() dr("批号") = e.DataRow("批号") dr("物料编号") = e.DataRow("物料编号") dr("库存数量") = e.DataRow("入库数量") + e.DataRow("出库数量") End If Dim filter As String = "批号 = '" & e.DataRow("批号") & "' And 物料编号 = '" & e.DataRow("物料编号") & "'" dr("库存数量") = e.DataTable.compute("sum(入库数量)", filter) + e.DataTable.compute("sum(出库数量)", filter) End If End If
|