Select Case e.DataCol.Name Case "车间名称","工序明细","产品图号" If e.DataRow.IsNull("车间名称") Then e.DataRow("工时明细") = Nothing Else Dim filter As String = "产品图号 = '" & e.DataRow("产品图号") & "'" Dim fdr As DataRow = DataTables("工时统计表").Find(filter) Dim sum As Double = 0 Dim str As String = "" If fdr IsNot Nothing Then For Each dc As DataCol In DataTables("工时统计表").DataCols If dc.Name.StartsWith("工序_") AndAlso fdr(dc.name) > 0 Then Dim dr As DataRow = DataTables("工序明细").Find("车间 = '" & e.DataRow("车间名称") & "' and 工序列名称 = '" & dc.Name & "'") If dr IsNot Nothing Then str &= dr("工序名称") & "," End If sum += fdr(dc.name) End If Next End If e.DataRow("工序明细") = str.trim(",") e.DataRow("工时明细") = sum End If End Select
|