Dim dwdm As String = e.Form.Controls("单位代码").Value
Dim ckdm As String = e.Form.Controls("仓库代码").Value
If dwdm IsNot Nothing AndAlso ckdm IsNot Nothing Then
For Each r As Row In Tables("0604仓库物料导入_Table1").Rows
Dim Filter As String = "物料类别 = \'" & r("物料类别") & "\' And 物料名称 = \'" & r("物料名称") & "\' And 单位 = \'" & r("单位") & "\'"
If r("品牌") = Nothing Then
Filter & = " And 品牌 Is Null"
Else
Filter & = " And 品牌 = \'" & r("品牌") & "\'"
End If
If r("规格") = Nothing Then
Filter & = " And 规格 Is Null"
Else
Filter & = " And 规格 = \'" & r("规格") & "\'"
End If
If r("等级") = Nothing Then
Filter & = " And 等级 Is Null"
Else
Filter & = " And 等级 = \'" & r("等级") & "\'"
End If
Dim dr As DataRow = DataTables("C_Material").SQLFind(Filter)
If dr IsNot Nothing Then
r("物料编号") = dr("物料编号")
Dim fr As DataRow = DataTables("C_Roomm").SQLFind("单位代码 = \'" & dwdm & "\' And 仓库代码 = \'" & ckdm & "\' And 物料编号 = \'" & r("物料编号") & "\'")
If fr Is Nothing Then
r("校对通过") = True
r("备注") = Nothing
Else
r("备注") = "仓库已有"
End If
Else
Dim sl As Integer
sl = DataTables("C_Material").SQLCompute("Count(物料编号)","物料名称 Like \'%"& r("物料名称") &"%\'")
r("类似数量") = sl
r("备注") = "未有物料"
End If
Next
Else
MessageBox.Show("请检查是否输入部门或仓库信息后再进行操作,谢谢!","温馨提示")
End If