......
If Filter > "" Then Filter = " and " & Filter
DataTables("生产进度汇总表").StopRedraw
DataTables("生产进度汇总表").DataRows.Clear
Dim Arys As List(Of String())
Arys = DataTables("冲压车间工资表").GetValues("产品名称|生产工序|订单号", "产品名称 is not null" & Filter )
For Each Ary As String() In Arys
Dim dr As DataRow = DataTables("生产进度汇总表").AddNew()
dr("产品名称") = Ary(0)
dr("生产工序") = Ary(1)
dr("订单号") = Ary(2)
dr("实际生产数") = DataTables("冲压车间工资表").Compute("sum(数量)","[产品名称] = '" & Ary(0) & "' and 生产工序='" & Ary(1) & "' and 订单号 " & IIF(Ary(2) > ""," ='" & Ary(2) & "'" , " Is Null") )
Next
Dim dt As DataTable
Dim g As New GroupTableBuilder("统计表1", DataTables("半成品完工进仓表"))
g.Groups.AddDef("产品名称")
g.Groups.AddDef("订单号")
g.Totals.AddDef("数量")
dt = g.Build(False)
For Each dr As DataRow In dt.DataRows
DataTables("生产进度汇总表").ReplaceFor("半成品进仓数",dr("数量"),"[产品名称] = '" & dr("产品名称") & "' and 订单号 " & IIF(dr.IsNull("订单号")," Is Null"," ='" & dr("订单号") & "'"))
Next
Dim g2 As New GroupTableBuilder("统计表2", DataTables("生产计划表"))
g2.Groups.AddDef("产品名称")
g2.Groups.AddDef("订单号")
g2.Totals.AddDef("数量")
dt = g2.Build(False)
For Each dr As DataRow In dt.DataRows
DataTables("生产进度汇总表").ReplaceFor("生产计划数",dr("数量"),"[产品名称] = '" & dr("产品名称") & "' And 订单号 " & IIF(dr.IsNull("订单号")," Is Null"," ='" & dr("订单号") & "'"))
Next
DataTables("生产进度汇总表").ResumeRedraw