请老师指点一下:ReplaceFor有时替换不成功,tabel1新增行的编号列设置的是自动编号,订单编号、状态、扫描状态和派工员工都赋值成功了,就是table4的编号初始值是空,没有替换成功成新的值,什么原因?
Button的Click事件代码如下:
'生成派工单
Dim cr As DataRow
Dim g As New GroupTableBuilder("自动分配统计", DataTables(eF orm.Name & "_Table4"))
g.Groups.AddDef("派工员工")
g.Groups.AddDef("订单编号")
Dim dt As DataTable = g.Build(True)
For Each dr As DataRow In dt.DataRows
cr = DataTables(eF orm.Name & "_Table1").AddNew
cr.save
DataTables(eF orm.Name & "_Table4").ReplaceFor("编号", cr("编号"), "派工员工='" & dr("派工员工") & "' and 订单编号='" & dr("订单编号") & "'")
cr("订单编号") = dr("订单编号")
cr("状态") = "未完成"
cr("扫描_状态") = "未扫描"
cr("派工员工") = dr("派工员工")
Next
DataTables(eF orm.Name & "_Table4").save
DataTables(eF orm.Name & "_Table1").save
DataTables(eF orm.Name & "_Table4").RemoveFor("编号 Is Not Null") '移除已派工订单