If e.DataCol.Name = "收货入库" Then Dim t1 As Table = e.Form.controls("table1").Table If e.DataRow("收货入库")=True Then t1.AllowEdit =True Dim cnt As Integer cnt = e.DataTable.Compute("Count([订货编号])", "订货编号 = '" & e.DataRow("订货编号") & "'") Dim cnt1 As Integer cnt1 = e.DataTable.Compute("Count([订货编号])", "订货编号 = '" & e.DataRow("订货编号") & "'and 收货入库=true") If cnt1=cnt Then t1.Current("收货入库") =True t1.AllowEdit =False Else t1.Current("收货入库") =False t1.AllowEdit =False End If 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 DataTables.Save Else t1.AllowEdit =True If t1.Current IsNot Nothing Then t1.Current("收货入库")=False End If End If End If