1. If e.DataCol.name = "产品去向" Then 条件判断永远为假,因为前面已经Case "执行合同编号","日期"
2. e.DataRow.IsNull 只能判断事件所在的表,也就是制品统计表的值,不能去判断其它表的值
不明白楼上统计的条件是什么,可以这样试试
Select Case e.DataCol.Name
Case "执行合同编号","日期"
Dim dc As DataRow = e.DataRow
Dim filter1 As String
filter1 = "执行合同编号 = '" & dc("执行合同编号") & "' And 日期 = '" & dc("日期") & "' and 工位 like '下料' and 产品去向 = '锻造'"
Dim s1 = DataTables("生产安排表").Compute("SUM(实际完成数量)",filter1 )
filter1 = "执行合同编号 = '" & dc("执行合同编号") & "' And 日期 = '" & dc("日期") & "' and 工位 like '杆体探伤' and 产品去向 = '锻造'""
Dim s2 = DataTables("生产安排表").Compute("SUM(实际完成数量)",filter1 )
filter1 = "执行合同编号 = '" & dc("执行合同编号") & "' And 日期 = '" & dc("日期") & "' and 工位 like '双曲线矫直机' and 产品去向 = '锻造'""
Dim s3 = DataTables("生产安排表").Compute("SUM(实际完成数量)",filter1 )
dc("下料矫直转出_锻造转入_根") = s1+s2+s3
End Select