子表的datacolchanged事件有重置列,子表的datacolchanged代码是这样的,
If (e.DataCol.Name = "PO单价" AndAlso Not(e.DataRow.IsNull("PO数量"))) OrElse (e.DataCol.Name = "PO数量" AndAlso Not(e.DataRow.IsNull("PO单价"))) Then
DataTables("orderlist").DataCols("需求总金额").RaiseDataColChanged("PO = '" & e.DataRow("PO") & "'")
End If
If e.DataCol.Name = "PO总价" Then
Dim dr2 As DataRow = e.DataRow
If Not(dr2.IsNull("PO总价")) Then
Dim amount,xj,xc As Double
amount = Math.Round(dr2("PO单价") * dr2("PO数量"),3)
xj = Math.Abs(amount-dr2("PO总价"))
xc = xj / dr2("PO总价")
If xj < 0.1 OrElse xc <0.001 Then
dr2("价格核对") = "核对正常"
Else
dr2("价格核对") = "核对异常"
End If
End If
End If
If e.DataCol.Name = "生产单号" AndAlso Not(e.DataRow.IsNull("生产单号")) Then
e.DataRow("生产安排时间") = Date.Now()
End If