zoukankan      html  css  js  c++  java
  • VB.NET Jobject 解析 JSON

     1     ''' <summary>
     2     ''' 提交快递数据参数,返回 快递跟踪
     3     ''' </summary>
     4     ''' <param name="OrderCode">物流运单号</param>
     5     ''' <param name="LogisticCode">物流运单号</param>
     6     ''' <param name="ShipperCode">快递公司编码</param>
     7     ''' <returns>Traces:(快递跟踪) eg. 2016-12-07 16:01:23: 顺丰速运 已收取快件</returns>
     8     ''' <remarks></remarks>
     9 
    10     Public Function GetKDinfo(ByVal OrderCode As String, ByVal LogisticCode As String, ByVal ShipperCode As String) As String
    11 
    12         Dim st As String
    13         st = getOrderTracesByJson(OrderCode, ShipperCode, LogisticCode)
    14 
    15         Dim jo As JObject
    16         jo = JsonConvert.DeserializeObject(st)
    17 
    18         Dim KDinfo As String
    19         KDinfo = ""
    20 
    21         Dim ss As String
    22         ss = jo("Traces").ToString()
    23         Dim jff As JArray
    24         jff = JsonConvert.DeserializeObject(ss)
    25 
    26         For i = 0 To jff.Count - 1
    27             KDinfo = KDinfo + jff(i)("AcceptTime").ToString() + ": " + jff(i)("AcceptStation").ToString() + "
    "
    28         Next
    29         Return KDinfo
    30     End Function
    31 
    32     ''' <summary>
    33     ''' 查询 快递状态
    34     ''' </summary>
    35     ''' <param name="OrderCode">订单号</param>
    36     ''' <param name="LogisticCode">物流运单号</param>
    37     ''' <param name="ShipperCode">快递公司编号</param>
    38     ''' <returns>返回快递状态状态 State:(物流状态) 0-无轨迹;1-已揽收;2-在途中;201-到达派件城市;3-签收;4-问题件 </returns>
    39     ''' <remarks>参数都是string类型的,饭后文本状态信息。</remarks>
    40     Public Function GetKDstate(ByVal OrderCode As String, ByVal LogisticCode As String, ByVal ShipperCode As String) As String
    41 
    42         Dim st As String
    43         Dim KDinfostr(2) As String
    44         st = getOrderTracesByJson("", ShipperCode, LogisticCode)
    45 
    46         Dim jo As JObject
    47         jo = JsonConvert.DeserializeObject(st)
    48 
    49         Dim endstr As String
    50         endstr = ""
    51         Dim stateInt As Int16
    52 
    53         'MsgBox(jo("State").Type)
    54 
    55         stateInt = CInt(IIf(IsDBNull(jo("State")), "0", jo("State")))
    56 
    57         Select Case stateInt
    58             Case 0
    59                 endstr = "无轨迹"
    60             Case 1
    61                 endstr = "已揽收"
    62             Case 2
    63                 endstr = "在途中"
    64             Case 3
    65                 endstr = "签收"
    66             Case 4
    67                 endstr = "问题件"
    68         End Select
    69         Return endstr
    70     End Function
  • 相关阅读:
    读书笔记之理想设计的特征
    一些javascript 变量声明的 疑惑
    LINQ 使用方法
    Google MySQL tool releases
    读书笔记之设计的层次
    EF之数据库连接问题The specified named connection is either not found in the configuration, not intended to be used with the Ent
    转载 什么是闭包
    javascript面向对象起步
    Tips
    数据结构在游戏中的应用
  • 原文地址:https://www.cnblogs.com/wx881208/p/6410107.html
Copyright © 2011-2022 走看看