If e.DataCol.Name.StartsWith("工序") Then
Dim filter As String = "产品名称 = \'" & e.DataRow("产品名称") & "\'"
Dim fdr As DataRow = DataTables("产品信息").Find(filter)
If fdr IsNot Nothing Then
Dim names() As String = e.newValue.split(",")
For Each name As String In names
Dim sum As Double = e.DataTable.Compute("sum(数量)", filter & " and 单号 = \'" & e.DataRow("单号") & "\' and " & e.DataCol.Name & " = \'" & name & "\'")
sum = sum * fdr(name)
Dim fdr2 As DataRow = DataTables("工时统计").Find(filter & " and 单号 = \'" & e.DataRow("单号") & "\'")
If fdr2 Is Nothing Then
fdr2 = DataTables("工时统计").AddNew
fdr2("产品名称") = e.DataRow("产品名称")
fdr2("日期") = e.DataRow("日期")
fdr2("单号") = e.DataRow("单号")
End If
If DataTables("工时统计").DataCols.Contains(name) Then
fdr2(name) = sum
End If
If e.OldValue IsNot Nothing AndAlso DataTables("工时统计").DataCols.Contains(e.OldValue) Then
fdr2(e.OldValue) = fdr(e.DataCol.Name) * e.DataTable.Compute("sum(数量)", filter & " and 单号 = \'" & e.DataRow("单号") & "\' and " & e.DataCol.Name & " = \'" & e.OldValue & "\'")
End If
Next
Else
msgbox("没有找到【产品信息】对应的数据!")
End If
End If