Dim count As Integer = DataTables("工序合并表").SQLCompute("count(牌号)","牌号 not in (se lect 牌号 from {密度表})") 'se lect的空格去掉
If count > 0 Then
msgbox("密度表的牌号不完整")
End If
Dim d1 As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
Dim d2 As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker2")
Dim m As Integer
If d1.Value IsNot Nothing AndAlso d2.Value IsNot Nothing Then
m = (d2.Value - d1.Value).TotalMinutes
End If
Dim t As Table = e.Form.Controls("Table1").Table
Dim b As New SQLGroupTableBuilder("统计表1","工序合并表")
b.AddTable("工序合并表","牌号","密度表","牌号") '添加统计表
b.Groups.AddDef("工序") '根据订单表产品ID分组
b.Totals.AddExp("长度","iif(作业分钟=0,0,重量 / 厚度 / 宽度 / 密度 * 1000)")
b.Totals.AddDef("作业分钟","实际作业分钟")
t.datasource = b.BuildDataSource
t.DataTable.DataCols.Add("应作业分钟",Gettype(Integer))
t.DataTable.ReplaceFor("应作业分钟",m)
t.DataTable.DataCols.Add("作业率",Gettype(Double),"实际作业分钟/应作业分钟")
t.DataTable.DataCols("作业率").SetFormat("00%")