逻辑是:查询总进销存每列数据是否存在于门店进销存,不存在就新增并赋值。但是这个写法,效率太慢了。不知道如何解决
Dim mdjxc As DataRow
Dim dr As DataRow
Dim dic As New Dictionary(Of DataRow,Row)
If mx.Checked Then
For Each r As Row In Tables("门店进销存_总数据").Rows
mdjxc = DataTables("门店进销存_门店进销存").Find("款号='" & r("款号") & "'And 花色='" & r("花色") & "'and 尺码='" & r("尺码") & "'and 仓库='" & r("仓库") & "'")
If mdjxc Is Nothing Then
dr = DataTables("门店进销存_门店进销存").AddNew
dic.Add(dr,r)
End If
Next
Else
For Each r As Row In Tables("门店进销存_总数据").Rows
mdjxc = DataTables("门店进销存_门店进销存").Find("款号='" & r("款号") & "'And 仓库='" & r("仓库") & "'")
If mdjxc Is Nothing Then
dr = DataTables("门店进销存_门店进销存").AddNew
dic.Add(dr,r)
End If
Next
End If
If mx.Checked Then
For Each drs As DataRow In dic.Keys
drs("款号") = dic(drs)("款号")
drs("花色") = dic(drs)("花色")
drs("尺码") = dic(drs)("尺码")
drs("品类") = dic(drs)("品类")
drs("品名") = dic(drs)("品名")
drs("仓库") = dic(drs)("仓库")
drs("吊牌价") = dic(drs)("吊牌价")
drs("实入数量") = "0"
drs("销售数量") = "0"
drs("剩余") = "0"
Next
Else
For Each drs As DataRow In dic.Keys
drs("款号") = dic(drs)("款号")
drs("品类") = dic(drs)("品类")
drs("品名") = dic(drs)("品名")
drs("吊牌价") = dic(drs)("吊牌价")
drs("仓库") = dic(drs)("仓库")
drs("实入数量") = "0"
drs("销售数量") = "0"
drs("剩余") = "0"
Next
End If
[此贴子已经被作者于2022/5/11 22:15:23编辑过]