以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  2个字符串的比较。  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=88233)

--  作者:huhu
--  发布时间:2016/7/29 14:42:00
--  2个字符串的比较。
Dim yphsl As WinForm.Button = e.Form.Controls("Button5")
Dim bfhfh As WinForm.Button = e.Form.Controls("Button6")
Dim phwc As  WinForm.Button = e.Form.Controls("配货完成")
Select Case e.DataCol.name
    Case "SN"
        If Not e.DataRow.IsNull("SN")  Then
            Dim dr As Row = Tables("销售出库单列表").current
            Dim drs As List(Of DataRow) = DataTables("库存明细表").SQLSelect("订单号 = \'" & dr("销售订单号") & "\' and 物料编码 = \'" & dr("存货编码") & "\' and 状态 = \'入库完成\'","","在库生命周期 DESC")
            If dr IsNot Nothing Then
                Dim count As Integer = e.DataTable.Compute("count(sn)","订单号=\'" & dr("销售订单号") & "\' and 物料编码=\'" & dr("存货编码") & "\' and 状态 = \'配货完成\' and SN is not null")
                If count >= dr("数量") Then
                    dr("配货状态") = True
                    dr.save
                    Tables("配货整理_table1").Filter = "发货单号 = \'" & Vars("u8fhdh") & "\' and 存货编码 = \'" & Vars("chbm") & "\'"
                    Return
                End If
                For Each fdr As DataRow In drs
                    msgbox(fdr("SN") & vbcrlf & e.DataRow("SN") & vbcrlf & (fdr("SN") = e.DataRow("SN")))
                    
                    If  fdr("SN") = e.DataRow("SN") Then
                        Dim mr As DataRow = DataTables("配货扫描").find("SN = \'" & e.DataRow("SN") & "\' And  _Identify <> \'" & e.DataRow("_Identify") & "\'")
                        If mr IsNot Nothing Then
                            e.DataRow("状态") = "配货重复扫描"
                            e.DataRow("数量") = 0
                            e.DataRow.save
                        Else
                            fdr("状态") = "配货完成"
                            fdr("配货完成时间") = Date.now
                            fdr("U8发货单号") = Vars("u8fhdh")
                            fdr("业务员") = dr("业务员")
                            fdr("货运单号") = dr("货运单号")
                            fdr("发货地址") = dr("发货地址")
                            fdr("数量") = 0
                            fdr.Save
                            Dim nms() As String = {"生产订单号码","工单行号","物料编码","物料名称","类别说明","产品批次","订单号","订单行号","客户","备注","软件版本","MAC","HW","入库单号","库位类别","库位编码","入库完成时间","入库方式","在库生命周期"}
                            For Each nm As String In nms
                                e.DataRow(nm) = fdr(nm)
                            Next
                            e.DataRow("数量") = 1
                            e.DataRow("状态") = "配货完成"
                            e.DataRow("配货完成时间") = Date.now
                            e.DataRow("U8发货单号") = Vars("u8fhdh")
                            e.DataRow.save
                            Dim sum2 As Integer
                            sum2 = DataTables("配货扫描").SQLCompute("Sum(数量)","订单号=\'" & dr("销售订单号") & "\' and 物料编码=\'" & dr("存货编码") & "\' and 状态 = \'配货完成\'")
                            yphsl.text = "订单号:" & dr("销售订单号") & "+"  & "物料编码:" & dr("存货编码") & "已完成配货数量" & "=" & sum2
                        End If
                    End If
                Next
                Dim count1 As Integer = e.DataTable.Compute("count(sn)","订单号=\'" & dr("销售订单号") & "\' and 物料编码=\'" & dr("存货编码") & "\' and 状态 = \'配货完成\' and SN is not null")
                msgbox(count1)
                msgbox(dr("数量"))
                If count1 > dr("数量") Then
                    e.DataRow("数量") = 0
                    e.DataRow("物料编码") = dr("存货编码")
                    e.DataRow("订单号") = dr("销售订单号")
                    e.DataRow("状态") = "不符合出库条件"
                    e.DataRow.save
                    Dim count2 As Integer = e.DataTable.Compute("count(sn)","订单号=\'" & dr("销售订单号") & "\' and 物料编码=\'" & dr("存货编码") & "\' and 状态 = \'不符合出库条件\' and SN is not null")
                    bfhfh.text = "不符合出库SN有" & count2
                    Tables("配货整理_table4").Filter = "订单号=\'" & dr("销售订单号") & "\' and 物料编码=\'" & dr("存货编码") & "\' and 状态 = \'不符合出库条件\'"
                    Return
                End If
            End If
        End If
End Select
Dim r As Row = Tables("销售出库单列表").Current
If r("配货状态") = False Then
    phwc.Enabled = False
Else
    phwc.Enabled = True
End If


msgbox(fdr("SN") & vbcrlf & e.DataRow("SN") & vbcrlf & (fdr("SN") = e.DataRow("SN")))---弹出如附件图。
fdr("SN") = 00315072808
e.datarow("SN") = 00315072808
那么fdr("SN") = e.datarow("SN") 结果为false?


图片点击可在新窗口打开查看此主题相关图片如下:false.png
图片点击可在新窗口打开查看


--  作者:Hyphen
--  发布时间:2016/7/29 15:00:00
--  
msgbox(fdr("SN").Length)
msgbox(e.datarow("SN").Length)
看看长度是否一致

--  作者:huhu
--  发布时间:2016/7/29 16:35:00
--  
确实是length不一样,结尾增加了一个空格。

请帮我看一下,红色代码有问题吗?怎么不执行蓝色的代码?
If  fdr("SN") = e.DataRow("SN") Then
                        Dim mr As DataRow = DataTables("配货扫描").find("SN = \'" & e.DataRow("SN") & "\' And  _Identify <> \'" & e.DataRow("_Identify") & "\'")
                        If mr IsNot Nothing Then
                            e.DataRow("状态") = "配货重复扫描"
                            e.DataRow("数量") = 0
                            e.DataRow.save
                        Else

--  作者:狐狸爸爸
--  发布时间:2016/7/29 16:38:00
--  
不执行,说明条件不符合,说明mr不是nothing,说明表存在符合条件的行。