Foxtable(狐表)用户栏目专家坐堂 → StartIndex 不能小于 0。


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

主题:StartIndex 不能小于 0。

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/1/2 16:09:00 [显示全部帖子]

我这样测试没问题,请测试弹出的值分别是什么。

 

Dim _username, _lxs
msgbox(ClipBoard.GetText)
Dim rs As String()=ClipBoard.GetText.Replace(chr(10),"").split(chr(13))
If  rs(0).Contains("******************") = False Then  '先简单判断一下格式是否正确
    msgbox("不可识别的格式!")
    Return Nothing
End If

Dim xg As Integer = rs(3).LastIndexOf("/")    '找出/的位置
Dim gngj As String = ""   '定义gngj来记录国内国际
msgbox(xg)
If xg >= 0 Then
    If rs(3).SubString(xg-1,1) = "1" Then
        gngj = "国际"
    Else
        If    rs(3).SubString(xg-1,1) = "2" Then
            gngj = "国内"
        End If
    End If
End If

Dim starts,Ends As new List(of Integer)   '定义集合 来记录有效数据的开始行和结束行
For i As Integer = 0 To rs.Length -1
    If rs(i).Contains("TKT-NUMBER") Then
        starts.Add(i+2)     '已经是真实行值了
    End If
    If rs(i).Contains("TOTAL TICKETS") Then
        ends.Add(i-2)    '已经是真实行值了
    End If
Next
msgbox(starts.count)
msgbox(Ends.count)
For x As Integer = 0 To Ends.Count - 1   '遍历每一大组有效数据
    For ii As Integer = starts(x) To Ends(x)
        Dim datas() As String = rs(ii).trim().Replace("    "," ").Replace("   "," ").Replace("  "," ").Split(" ")  '这已经是提取到了每一个具体行了,并做好了分割
        Dim ddr As DataRow =  DataTables("机piao").SQLFind("piao号 = '" & datas(0).Replace("-","") & "'")
        If ddr Is Nothing Then   '若 没有piao号重复值
           
            If rs(ii).Contains("VOID") = True Then    '若包含了viod 要特殊处理
                Dim dr As  DataRow = DataTables("机piao").AddNew   '先新增一行
               
                dr("出piao人") = _username
                dr("旅行社") = _lxs
                dr("添加日期") = Date.Today
                dr("十位piao号") = datas(0).SubString(4)
                dr("piao号") = datas(0).Replace("-","")
                dr("航班号") = "VOID"
                dr("国内国际") = gngj
                dr("数据来源") = "BSP"
            Else
                If rs(ii).Contains("REFUND") = True Then    '若包含了ET-REFUND 要特殊处理
                    Dim dr As  DataRow = DataTables("机piao").AddNew   '先新增一行
                    dr("添加日期") = Date.Today
                   
                    dr("出piao人") = _username
                    dr("旅行社") = _lxs
                    dr("十位piao号") = datas(0).SubString(4)
                    dr("piao号") = datas(0).Replace("-","")
                    dr("航班号") = "REFUND"
                    dr("国内国际") = gngj
                    dr("数据来源") = "BSP"
                Else
                    Dim dr As  DataRow = DataTables("机piao").AddNew   '先新增一行
                    dr("添加日期") = Date.Today
                   
                    dr("出piao人") = _username
                    dr("旅行社") = _lxs
                    dr("十位piao号") = datas(0).SubString(4)
                    dr("piao号") = datas(0).Replace("-","")
                    dr("行程") = datas(1) & datas(2)
                    dr("piao款") = datas(3)
                    dr("导入税款") = datas(4)
                    dr("PNR") = datas(6)
                    dr("出piao人") = datas(7)
                    dr("国内国际") = gngj
                    dr("数据来源") = "BSP"
                   
                End If
            End If
        End If
       
    Next
Next

 


 回到顶部