窗体AfterClose事件代码【运行时导致系统一直在写数据,程序出现假死,怎么解决呢?】
Tables("镜片物料").Filter = ""
Tables("镜片物料").DataTable.Save
Functions.Execute("遍历增加镜片到物料表")
Functions.Execute("遍历增加")
For Each r As Row In Tables("镜片物料").rows
If r.Locked=False Then
r.Locked=True
End If
Next
Functions.Execute("遍历增加镜片到物料表")内部函数事件代码如下:
Dim dr1 As Table = Tables("物料表")
Dim dr As DataRow
Dim Products As List(Of String)
Products = DataTables("镜片物料").GetValues("uuid")
For Each Product As String In Products
output.Show("库存uuid:"& Product)
dr = DataTables("物料表").Find("uuid = '" & Product & "'")
If dr IsNot Nothing Then '如果找到的话
output.Show("镜架uuid:"& Product)
Else
output.Show("不存在的镜架uuid:"& Product)
dr1.AddNew
dr1.Current("uuid")= Product
dr1.Current("类别")= "镜片"
dr1.DataTable.Save
End If
Next
DataTables("物料表").DataCols("uuid").RaiseDataColChanged()
遍历追加内部 函数代码如下:
Dim dr As DataRow
Dim dr1 As Table
Dim Products As List(Of String())
Products = DataTables("镜片物料").GetValues("uuid|产品名|初始库存")
For Each Product As String() In Products
dr = DataTables("库存表").Find("uuid = '"&Product(0)&"'and 类别='镜片'")
If dr IsNot Nothing Then '如果找到的话
dr("入库")=Product(2)
Else
dr1 = Tables("库存表")
dr1.AddNew
dr1.Current("产品名")=Product(1)
dr1.Current("入库")=Product(2)
dr1.Current("日期")=now.today
dr1.Current("类别")="镜片"
dr1.Current("uuid")=Product(0)
dr1.Save
End If
Next