Foxtable(狐表)用户栏目专家坐堂 → 2个字符串的比较。


  共有2227人关注过本帖树形打印复制链接

主题:2个字符串的比较。

帅哥哟,离线,有人找我吗?
huhu
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1165 积分:8129 威望:0 精华:0 注册:2015/3/30 10:44:00
2个字符串的比较。  发帖心情 Post By:2016/7/29 14:42:00 [只看该作者]

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
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/7/29 15:00:00 [只看该作者]

msgbox(fdr("SN").Length)
msgbox(e.datarow("SN").Length)
看看长度是否一致

 回到顶部
帅哥哟,离线,有人找我吗?
huhu
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1165 积分:8129 威望:0 精华:0 注册:2015/3/30 10:44:00
  发帖心情 Post By: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

 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251060 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2016/7/29 16:38:00 [只看该作者]

不执行,说明条件不符合,说明mr不是nothing,说明表存在符合条件的行。

 回到顶部