分组统计的临时表,如何按插卡时间进行分类自动编号,(需要的效果:按插卡时间排序,地址码的 005 和 001 对换位置),请各位老师指教,谢谢!
Tables("统计表").Sort = "日期,班组ID,批次ID,工位ID,插卡时间"
Dim idx As Integer = 0
For Each dr As DataRow In DataTables("统计表").DataRows
Dim max As String = Tables("统计表").Compute("max(地址码)", "日期 = '" & dr("日期") & "' and 班组ID = '" & dr("班组ID") & "' and 批次ID = '" & dr("批次ID") & "' and 工位ID = '" & dr("工位ID") & "'")
If max > "" Then
idx = Cint(max) + 1
Else
idx = 1
End If
dr("地址码") = Format(idx,"000")
dr("加工费") = dr("单价") * dr("产量")
Next
此主题相关图片如下:捕获2.png
[此贴子已经被作者于2016/3/29 15:32:38编辑过]