以下是引用青丘狐在2023/3/16 10:10:00的发言:
入库明细DataColChanged
If e.DataCol.Name = "入库重量" Then
Dim dr As DataRow = DataTables("采购计划明细表").Find("采购ID = '" & e.DataRow("采购ID") & "' and 物资编号 = '" & e.DataRow("物资编号") & "'")
If dr IsNot Nothing Then
dr("已交重量") = dr("已交重量") + e.NewValue - e.OldValue
End If
End If
采购计划明细表DataColChanged
If e.DataCol.Name = "物资编号" Then
Dim Filter As String = "[物资编号] = '" & e.NewValue & "'"
e.DataRow("已交重量") = DataTables("入库明细").Compute("Sum(入库重量)", Filter)
End If
入库明细datarowdeleteing事件
e.DataRow("入库重量") = nothing
Dim pr As DataRow
pr = DataTables("采购计划明细表").Find(采购ID = '" & e.DataRow("采购ID") & "' and 物资编号 = '" & e.DataRow("物资编号") & "'")
If pr IsNot Nothing Then
DataTables("采购计划明细表").DataCols("物资编号").RaiseDataColChanged(pr)
End If