老师您好! 我有这么一个问题,我把表中的(bs,开工时间)两个字段取不重复值,同时放到一个数组中,然后分别取出数值,在数据表中作为条件计算,可是,在运用中“开工时间”的数组,取出后秒数全部为”零“,我的目的“原样取出。怎么解决这个问题?请指教,谢谢!我的代码:
Dim drs As List(Of DataRow)
Dim Nas As New List(Of String) 'bs长度18
Dim Nbs As New List(Of String) 'bs长度6
Dim Ncs As New List(Of String) 'bs长度12
Dim l As Integer
Dim Arys As List(Of String())
Arys = DataTables("实时工序计算表").GetValues("bs|开工时间")
For Each Ary As String() In Arys
Dim time As Date = CCDate(ary(1))
Dim zzl As Double = DataTables("实时工序计算表").Compute("sum(重量)", "bs='" & Ary(0) & "'and 开工时间=#" & Ary(1) & "#")
MessageBox.Show(Ary(0) & "/" & Ary(1) & "/" & ZZL)
drs = DataTables("实时工序计算表").Select("[bs]='" & Ary(0) & "'and 开工时间=#" & Ary(1) & "#")
For Each dr As DataRow In drs
If dr IsNot Nothing Then
Dim gxhs As Double = dr("工序耗时")
Dim dzl As Double = dr("重量")
Dim sjhs As Double = Round2((dzl * gxhs / zzl), 2)
'MessageBox.Show(dzl & "/" & sjhs & "/" & dr("bs"))
If sjhs <> 0 Then
dr("实际耗时") = Round2((dzl * gxhs / zzl), 2)
Else
MessageBox.Show(ary(0))
end if
End if
Next
' MessageBox.Show(Ary(0) & "|" & Ary(1))
Next
比如数据表里“开工时间是:2023-04-22 08:59:22,而MessageBox.Show(Ary(1) 的数据为:2023-04-22 08:59:00,所以,我的上述代码有的数据没有计算。我感觉上述“绿色”标记语句,有问题吧。