Dim dr As DataRow = DataTables("U8物料数量汇总表").Find("入库单号 = '" & Vars("fckrkdh") & "' And 物料编码 = '" & e.DataRow("物料编码") & "'")
If dr IsNot Nothing Then
Dim fdr As DataRow = DataTables("非插卡收货扫描").Find("SN = '" & e.DataRow("SN") & "' And _Identify <> " & e.DataRow("_Identify"))
If fdr IsNot Nothing Then
If fdr("提示") = "收货重复扫描" Or fdr("提示") = "收货完成" Then
e.DataRow("数量") = 0
e.DataRow("提示") = "收货重复扫描"
e.DataRow.locked = True
End If
Else
If dr("比较结果") < 0 Then
msgbox(0)
e.DataRow("库位类别") = dr("库位类别")
e.DataRow("入库单号") = Vars("fckrkdh")
e.DataRow("数量") = 1
e.DataRow("提示") = "收货完成"
e.DataRow("收货完成时间") = Date.now
e.DataRow.locked = True
dr("实扫到数量") = dr("实扫到数量") + 1
msgbox(1)
ElseIf dr("比较结果") = 0 Then
msgbox(2)
e.DataRow("数量") = 0
e.DataRow("提示") = "收货已满"
e.DataRow.locked = True
msgbox(3)
End If
End If
Else
e.DataRow("数量") = 0
e.DataRow("提示") = "非本入库单物料"
e.DataRow.locked = True
End If
End If
红色代码执行可能会遇到执行完后正好dr("比较结果")=0了,那就又把蓝色的代码也给执行了,就会本应该是红色代码的值变为了蓝色代码的值。