实现代码如下:
Dim cjxh As Integer = 5
If _cjxh >= cjxh Then
_cjxh = 0
DataTables("扎包记录").DataRows.Clear()
End If
_cjxh = _cjxh + 1
Dim f As New Filler
f.SourceTable = DataTables("工位模板") '指定数据来源
f.SourceCols = "工序编号" '指定数据来源列
f.DataTable = DataTables("扎包记录") '指定数据接收表
f.DataCols = "工序编号" '指定数据接收列
f.Fill()
For Each dr As DataRow In DataTables("扎包记录").DataRows
If dr.IsNull("采集序号") Then
Dim pr1 As DataRow = DataTables("工位模板").Find("工序编号 = '" & dr("工序编号") & "' and 重复工位 = False")
Dim pr2 As DataRow = DataTables("工位模板").Find("工序编号 = '" & dr("工序编号") & "' And 重复工位 = True")
If Right(CStr(_cjxh / 2 * 10),1) = 0 Then ’如果采集序号为偶数时
If pr2 IsNot Nothing Then
dr("采集序号") = _cjxh
dr("工位ID") = pr2("工位ID")
ElseIf pr1 IsNot Nothing Then
dr("采集序号") = _cjxh
dr("工位ID") = pr1("工位ID")
End If
ElseIf pr1 IsNot Nothing Then
dr("采集序号") = _cjxh
dr("工位ID") = pr1("工位ID")
End If
End If
Next
DataTables("扎包记录").Save()
Tables("扎包记录").AutoSizeCols()
With Tables("扎包记录")
.Position = .Rows.Count - 1
End With
[此贴子已经被作者于2016/6/20 19:07:00编辑过]