Dim cp, kh As String
Dim tname As String = Args(3)
Dim tzl, tsl, jts, dwzl, dwsl As Double
Dim name As String() = Args(12)
dim jr as DataRow
Dim dr1 As DataRow = DataTables("实时工序计算表").find("员工姓名='" & name(0) & "' and 清单条码编码='" & name(1) & "'")
If dr1 IsNot Nothing Then
Dim ur As DataRow = DataTables("ddqdb").find("清单条码编码='" & name(1) & "'")
If ur IsNot Nothing Then
cp = ur("产品类型")
kh = ur("客户")
tzl = ur("重量")
tsl = ur("件每台") * ur("台数")
jts = ur("件每台")
jr = DataTables(tname).AddNew()
jr("项目号") = ur("项目号")
jr("员工姓名") = name(0)
jr("清单条码编码") = name(1)
jr("客户") = kh
jr("产品类型") = cp
jr("台数") = ur("台数")
If jts <> 0 Then
jr("件每台") = jts
Else
jr("件每台") = Nothing
End If
jr("日期") = dr1("发货日期")
jr("变压器型号") = ur("变压器型号")
jr("所属装配") = ur("所属装配")
jr("产品名称") = ur("产品名称")
jr("产品图号") = ur("产品图号")
jr("订单类别") = ur("订单类别")
jr("重量") = tzl
jr("数量") = tsl
End If
Dim tzlhs As Double = DataTables("实时工序计算表").Compute("Sum(实际耗时)", "员工姓名='" & name(0) & "' and 清单条码编码='" & name(1) & "'and 结算单位='重量'")
Dim tslhs As Double = DataTables("实时工序计算表").Compute("Sum(实际耗时)", "员工姓名='" & name(0) & "' and 清单条码编码='" & name(1) & "'and 结算单位='数量'")
tzlhs = tzlhs / 60
tslhs = tslhs / 60
If tzlhs <> 0 Then
jr("重量耗时h") = round2(tzlhs , 2)
dwzl = round2(tzl / tzlhs, 2)
jr("kg/小时") = dwzl
Else
jr("重量耗时h") = Nothing
jr("kg/小时") = Nothing
End If
If tzlhs <> 0 Then
jr("数量耗时h") = round2(tzlhs , 2)
dwsl = round2(tsl / tslhs, 2)
jr("数量/小时") = dwzl
Else
jr("数量耗时h") = Nothing
jr("数量/小时") = Nothing
End If
jr("总耗时h") = round2((tzlhs + tslhs), 2)
End If
Dim gxs As List(Of String) = Args(5)
For Each gx As String In DataTables("实时工序计算表").GetValues("工序名称", "", "顺序号")
gxs.Add(gx)
Dim gxzl As Double = DataTables("实时工序计算表").Compute("Sum(重量)", "员工姓名='" & name(0) & "' and [清单条码编码]='" & name(1) & "' and 工序名称='" & gx & "' and 结算单位='重量 '")
Dim gxzlhs As Double = DataTables("实时工序计算表").Compute("Sum(实际耗时)", "员工姓名='" & name(0) & "' and [清单条码编码]='" & name(1) & "' and 工序名称='" & gx & "' and 结算单位='重量 '")
Dim gxsl As Double = DataTables("实时工序计算表").Compute("Sum(件数)", "员工姓名='" & name(0) & "' and [清单条码编码]='" & name(1) & "' and 工序名称='" & gx & "' and 结算单位='数量 '")
Dim gxslhs As Double = DataTables("实时工序计算表").Compute("Sum(实际耗时)", "员工姓名='" & name(0) & "' and [清单条码编码]='" & name(1) & "' and 工序名称='" & gx & "' and 结算单位='数量 '")
gxzlhs = gxzlhs / 60
gxslhs = gxslhs / 60
Dim gxx1 As String = gx & "_重量"
Dim gxx2 As String = gx & "_重量耗时h"
Dim gxx3 As String = gx & "_数量"
Dim gxx4 As String = gx & "_数量耗时h"
If gxzlhs <> 0 Then
jr(gxx1) = round2(gxzl, 2)
jr(gxx2) = round2(gxzlhs, 2)
Else
jr(gxx1) = Nothing
jr(gxx2) = Nothing
End If
If gxslhs <> 0 Then
jr(gxx3) = round2(gxsl, 2)
jr(gxx4) = round2(gxslhs, 2)
Else
jr(gxx3) = Nothing
jr(gxx4) = Nothing
End If
Tables(tname).Cols(gxx1).GrandTotal = True
Tables(tname).Cols(gxx2).GrandTotal = True
Tables(tname).Cols(gxx3).GrandTotal = True
Tables(tname).Cols(gxx4).GrandTotal = True
Next