DataTables("工序跟踪表").save()
If e.DataCol.Name = "成品编码" OrElse e.DataCol.Name = "生产批次" OrElse e.DataCol.Name = "加工工序" OrElse e.DataCol.Name = "加工次数" OrElse e.DataCol.Name = "使用设备" OrElse e.DataCol.Name = "加工工序" OrElse e.DataCol.Name = "配刀单号" OrElse e.DataCol.Name = "实际领刀日期" Then
Dim Filter As String = "[成品编码] = '" & e.DataRow("成品编码") & "' and [生产批次] = '" & e.DataRow("生产批次") & "' and [加工工序] = '" & e.DataRow("加工工序") & "' and [加工次数] = '" & e.DataRow("加工次数") & "' and [使用设备] = '" & e.DataRow("使用设备")& "' and [配刀单号] = '" & e.DataRow("配刀单号")& "'and [扫描日期] < ='" & e.DataRow("还刀日期")& "'and [扫描日期] >= '" & e.DataRow("实际领刀日期") & "'"
e.DataRow("加工数量") = DataTables("工序跟踪表").SQLCompute("Sum(合格品)", Filter)
e.datarow.save()
End If
事件表代码2
Select Case e.DataCol.Name
Case "生产批次","使用设备","加工次数","加工工序","配刀单号","还刀日期"
Dim dr As DataRow = e.DataRow
Dim pr As DataRow
If dr.IsNull("生产批次") OrElse dr.IsNull("使用设备") OrElse dr.IsNull("加工次数") OrElse dr.IsNull("加工工序") OrElse dr.IsNull("配刀单号") OrElse dr.IsNull("还刀日期") Then
Dim filter As String
filter = "生产批次 = '" & dr("生产批次") & "' And 使用设备 = '" & dr("使用设备") & "' and 加工工序 = '" & dr("加工工序") & "' and 加工次数 = '" & dr("加工次数") & "' and 配刀单号 = '" & dr("配刀单号") & "' and 扫描日期 = '" & dr("还刀日期")& "'"
pr = DataTables("工序跟踪表").SQLFind(filter)
If pr IsNot Nothing Then
dr("还刀人员") = pr("姓名")
dr.save()
End If
End If
End Select
您的问题就是该保存的没保存就在后台查找数据,此时您看到的符合的条件值在后台并不一定符合!