Dim aa(50) As Object
Dim dtp1 As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
Dim dt1 As Date = dtp1.value
Dim dtp2 As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker2")
Dim dt2 As Date = dtp2.value
Dim dtp3 As WinForm.combobox = e.Form.Controls("combobox1")
Dim khm As String = dtp3.value
DataTables("实时工序计算表").LoadFilter = ""
DataTables("实时工序计算表").Load()
'按客户与日期加载数据表
DataTables("实时工序计算表").LoadFilter = "客户= '" & khm & "' and 发货日期>= #" & dt1 & " # and 发货日期<= #" & dt2 & "# and 清单条码编码 is not null"
DataTables("实时工序计算表").Load()
Dim tname As String = "按发货日期和客户计算工作量表"
aa(3) = tname
''5、创建查询表
Dim dtb1 As New DataTableBuilder(tname)
aa(4) = dtb1
dtb1.AddDef("日期", GetType(Date))
dtb1.AddDef("项目号", GetType(String), 60)
dtb1.AddDef("客户", GetType(String), 12)
dtb1.AddDef("清单条码编码", GetType(String), 30)
dtb1.AddDef("变压器型号", GetType(String), 60)
dtb1.AddDef("所属装配", GetType(String), 60)
dtb1.AddDef("产品图号", GetType(String), 70)
dtb1.AddDef("订单类别", GetType(String), 36)
dtb1.AddDef("产品类型", GetType(String), 40)
dtb1.AddDef("产品名称", GetType(String), 40)
dtb1.AddDef("台数", GetType(Short))
dtb1.AddDef("件每台", GetType(Short))
dtb1.AddDef("重量", GetType(Double))
dtb1.AddDef("重量耗时h", GetType(Double))
dtb1.AddDef("数量", GetType(Double))
dtb1.AddDef("数量耗时h", GetType(Double))
dtb1.AddDef("总耗时h", GetType(Double))
Dim gxs As New List(Of String)
aa(4) = gxs
For Each gx As String In DataTables("实时工序计算表").GetValues("工序名称", "", "顺序号")
gxs.Add(gx)
Dim gxx1 As String = gx & "_重量"
Dim gxx2 As String = gx & "_耗时h"
dtb1.AddDef(gxx1, GetType(Double))
dtb1.AddDef(gxx2, GetType(Double))
Next
dtb1.Build()
'计算数据
Functions.Execute("计算合计工作量", aa)
Functions.Execute("工序计算", aa)
MessageBox.Show("计算完毕!", "提示!")
e.form.close
mainTable = Tables(tname)
函数代码:
Dim gxs As New List(Of String) = args(4)
'For Each gx As String In gxs
' Dim gxzl As Double = DataTables("实时工序计算表").Compute("Sum(重量)", "[清单条码编码]='" & qdm & "' and 工序名称='" & gx & "'")
' Dim gxhs As Double = DataTables("实时工序计算表").Compute("Sum(实际耗时)", "[清单条码编码]='" & qdm & "' and 工序名称='" & gx & "'")
' gxhs = gxhs / 60
' Dim gxx1 As String = gx & "_重量"
' Dim gxx2 As String = gx & "_耗时h"
' If gxhs <> 0 Then
' dr3(gxx1) = round2(gxzl, 2)
' dr3(gxx2) = round2(gxhs, 2)
' Else
' dr3(gxx1) = Nothing
' dr3(gxx2) = Nothing
' End If
' Tables(tname).Cols(gxx1).GrandTotal = True
' Tables(tname).Cols(gxx2).GrandTotal = True
'Next
错误信息:
此主题相关图片如下:微信图片_20230512153710.jpg