If e.DataCol.name = "SN" Then
Dim nms() As String = {"生产订单号码","工单行号","物料编码","物料名称","类别说明","产品批次","订单号","订单行号","客户","备注","软件版本","状态"}
If e.NewValue Is Nothing Then
For Each nm As String In nms
e.DataRow(nm) = Nothing
Next
Else
Dim dr1 As DataRow = DataTables("assemblyProduct").SQLFind("deviceCode = '" & e.DataRow("SN") & "' or productno = '" & e.DataRow("SN") & "'")
If dr1 IsNot Nothing Then
Dim dr2 As DataRow = DataTables("assemblySubWorkOrder").SQLFind("SID = '" & dr1("subWorkOrder") & "'")
If dr2 IsNot Nothing Then
e.DataRow("工单行号") = dr2("LineFlag")
Dim dr3 As DataRow = DataTables("assemblyWorkOrder").SQLFind("Id = '" & dr2("workOrder") & "'")
If dr3 IsNot Nothing Then
e.DataRow("生产订单号码") = dr3("WorkOrderNo")
Dim dr4 As DataRow = DataTables("计划表").SQLFind("生产订单号码 = '" & e.DataRow("生产订单号码") & "' and 工单行号 = '" & e.DataRow("工单行号") & "'")
If dr4 IsNot Nothing Then
e.DataRow("物料编码") = dr4("物料编码")
e.DataRow("物料名称") = dr4("物料名称")
e.DataRow("类别说明") = dr4("类别说明")
e.DataRow("产品批次") = dr4("产品批次")
e.DataRow("订单号") = dr4("订单号")
e.DataRow("订单行号") = dr4("订单行号")
e.DataRow("客户") = dr4("客户")
e.DataRow("备注") = dr4("备注")
e.DataRow("软件版本") = dr4("软件版本")
Dim shry As WinForm.TextBox = forms("非插卡收货扫描").Controls("TextBox2")
e.DataRow("入库收货人员") = shry.text
msgbox(8)
e.DataRow.Save
Dim dr As DataRow = DataTables("U8物料编码入库单收货统计").SQLFind("入库单号 = '" & Vars("fckrkdh") & "' And 物料编码 = '" & e.DataRow("物料编码") & "'")
If dr IsNot Nothing Then
msgbox(10)
Dim fdr As DataRow = DataTables("非插卡收货扫描").SQLFind("SN = '" & e.DataRow("SN") & "' And _Identify <> '" & e.DataRow("_Identify") & "'")
msgbox(dr("实扫到数量"))
msgbox(dr("总数量"))
If fdr IsNot Nothing Then
If fdr("状态") = "收货重复扫描" Or fdr("状态") = "收货完成" Then
e.DataRow("数量") = 0
e.DataRow("状态") = "收货重复扫描"
e.DataRow.Save
e.DataRow.locked = True
msgbox(0)
End If
ElseIf fdr Is Nothing Then
msgbox(11)
msgbox(dr("实扫到数量"))
msgbox(dr("总数量"))
If (dr("实扫到数量") - dr("总数量") < 0) Then
msgbox(1)
e.DataRow("库位类别") = dr("库位类别")
e.DataRow("入库单号") = Vars("fckrkdh")
e.DataRow("数量") = 1
dr("实扫到数量") = dr("实扫到数量") + 1
dr("比较结果") = dr("实扫到数量") - dr("总数量")
dr.save
Forms("非插卡收货扫描").StopRedraw() '停止绘制窗口
DataTables("U8物料编码入库单收货统计").StopRedraw()
DataTables("U8物料编码入库单收货统计").RemoveFor("入库单号 = '" & Vars("fckrkdh") & "' And 物料编码 = '" & e.DataRow("物料编码") & "'")
DataTables("U8物料编码入库单收货统计").AppendLoad("入库单号 = '" & Vars("fckrkdh") & "' And 物料编码 = '" & e.DataRow("物料编码") & "'")
DataTables("U8物料编码入库单收货统计").ResumeRedraw()
Forms("非插卡收货扫描").ResumeRedraw() '停止绘制窗口
e.DataRow("状态") = "收货完成"
e.DataRow("收货完成时间") = Date.now
e.DataRow.Save
e.DataRow.locked = True
ElseIf (dr("实扫到数量") - dr("总数量") = 0) Then
e.DataRow("数量") = 0
e.DataRow("状态") = "收货已满"
e.DataRow.Save
e.DataRow.locked = True
End If
End If
Else
e.DataRow("数量") = 0
e.DataRow("状态") = "非本入库单物料"
e.DataRow.Save
e.DataRow.locked = True
End If
msgbox(9)
End If
End If
End If
Else
e.DataRow("状态") = "序列号不存在"
e.DataRow.Save
e.DataRow.locked = True
End If
End If
End If
重复扫描的都对,就是有些SN,并没有执行红色的msgbox。怎么会不去执行呢?而其他的SN都是正常执行,结果也对。