以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=80337)

--  作者:huhu
--  发布时间:2016/1/20 22:05:00
--  [求助]
非插卡收货扫描增加一行,执行for 循环,比较SN是否有重复,且提示为收货完成或者是收货重复扫描,那么
新增行的数量为0,提示为收货重复扫描。
如果没有重复的,就提示收货完成。
现在我想这样的循环,SN必然有重复。请帮忙看看下面的思路是否是有问题,如何改?谢谢。
                        Dim dr As DataRow = DataTables("U8物料数量汇总表").Find("入库单号 = \'" & Vars("fckrkdh") & "\' And 物料编码 = \'" & e.DataRow("物料编码") & "\'")
                        msgbox(0)
                        If dr IsNot Nothing Then
                            msgbox(1)
                            For Each r As DataRow In DataTables("非插卡收货扫描").DataRows
                                If r("SN") = e.DataRow("SN") And (r(“提示”)= “收货完成” or r("提示") = "收货重复扫描" )Then
                                    msgbox(2)
                                    e.DataRow("数量") = 0
                                    e.DataRow("提示") = "收货重复扫描"
                                ElseIf r("SN") = e.DataRow("SN") And r("提示") = "" Then
                                    msgbox(3)
                                    If Forms("非插卡收货扫描").opened =True
                                        Dim kwlb As WinForm.ComboBox = e.Form.Controls("ComboBox1")
                                        e.DataRow("库位类别") = kwlb.text
                                    End If
                                    e.DataRow("入库单号") = Vars("fckrkdh")
                                    e.DataRow("数量") = 1
                                    e.DataRow("提示") = "收货完成"
                                    e.DataRow.locked = True
                                    dr("实扫到数量") = dr("实扫到数量") + 1
                                    msgbox(4)
                                End If
                            Next
                        Else
                            e.DataRow("数量") = 0
                            e.DataRow("提示") = "非本入库单"
                        End If

--  作者:大红袍
--  发布时间:2016/1/20 22:15:00
--  

为什么要这样循环?直接find不就行了?

 

Dim fdr As DataRow = DataTables("非插卡收货扫描").Find("SN = \'" &  e.DataRow("SN") & "\' And _Identify <> " & e.DataRow("_Identify"))

If fdr IsNot Nothing Then

 

End If

 


--  作者:huhu
--  发布时间:2016/1/20 22:21:00
--  
对啊。没想起用Identify来区分行。
多谢。