If e.DataCol.name = "入库单号" Then
If e.DataRow.GetChildRows("预入库单").Count = 0 Then
Dim ddr As DataRow = DataTables("预入库单").Find ("预入库单号 = '" & e.DataRow("入库单号") & "' and 行号 = '" & e.DataRow("行号") & "'")
If ddr IsNot Nothing Then
If ddr("预入库单号") = e.DataRow("入库单号")
Dim sum As Integer
sum = DataTables("工单明细").Compute("sum(预入库数量)","入库单号 = '" & ddr("预入库单号") & "' and 行号 = '" & e.DataRow("行号") & "'")
ddr("总数量") = sum
End If
Else
Dim dr As DataRow = DataTables("预入库单").AddNew()
dr("预入库单号") = e.DataRow("入库单号")
dr("总数量") = e.DataRow("预入库数量")
dr("行号") = e.DataRow("行号")
End If
End If
End If
请问这段代码哪里有错?怎么在预入库单统计的总数量与工单明细的预入库数量不相等呢?