【多个逻辑列】每一个逻辑列被选中后,就写入一条数据到库存表,但是多个逻辑列为什么就只有第一行可以写库存,而其他的就不能写呢?
此主题相关图片如下:1.png
订货明细表列变化事件代码如下:【需要优化,烦请各位老师指导优化下,谢谢!】If e.DataCol.Name = "收货入库" Then
If e.DataRow("收货入库")=True Then
Tables("订货记录_Table1").AllowEdit =True
Dim t1 As Table = e.Form.controls("table1").Table
If t1.Current IsNot Nothing Then
Dim cnt As Integer
cnt = DataTables("订货记录_Table2").Compute("Count([订货编号])", "订货编号 = '" & t1.Current("订货编号") & "'")
Dim cnt1 As Integer
cnt1 = DataTables("订货记录_Table2").Compute("Count([订货编号])", "订货编号 = '" & t1.Current("订货编号") & "'and 收货入库=true")
If cnt1=cnt Then
t1.Current("收货入库") =True
Tables("订货记录_Table1").AllowEdit =False
Dim pr1 As DataRow
pr1 = DataTables("订货记录_Table3").sqlFind("货名 = '" & e.DataRow("货名") & "' And 入库编号 = '" & e.DataRow("订货编号") & "'")
If pr1 IsNot Nothing Then
pr1("入库数量")= pr1("入库数量") + e.NewValue - e.OldValue
Else
Dim nr As Row = Tables("订货记录_Table3").AddNew()
nr("货名")= e.DataRow("货名")
nr("入库数量")= e.DataRow("数量")
nr("入库日期")= e.DataRow("订货日期")
nr("入库编号")= e.DataRow("订货编号")
End If
For Each dt As DataTable In DataTables
dt.Save()
Next
Else
t1.Current("收货入库") =False
Tables("订货记录_Table1").AllowEdit =False
End If
End If
For Each dt As DataTable In DataTables
dt.Save()
Next
Else
Tables("订货记录_Table1").AllowEdit =True
Dim t11 As Table = e.Form.controls("table1").Table
Dim t4 As Table = e.Form.controls("table2").Table
If t11.Current IsNot Nothing Then
t11.Filter = "订货编号 = '" & t4.Current("订货编号") & "'"
t11.Current("收货入库")=False
End If
End If
End If
[此贴子已经被作者于2017/6/26 9:35:20编辑过]