Foxtable(狐表)用户栏目专家坐堂 → [求助]用丰桥开放平台的快递API接入方案怎么搞


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

主题:[求助]用丰桥开放平台的快递API接入方案怎么搞

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


加好友 发短信
等级:一尾狐 帖子:431 积分:5156 威望:0 精华:0 注册:2016/1/28 2:59:00
  发帖心情 Post By:2019/5/27 15:02:00 [只看该作者]

附件为C# 转换 vb.net 后,在狐表中怎么使用呢?

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:转换net后.txt


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


加好友 发短信
等级:一尾狐 帖子:431 积分:5156 威望:0 精华:0 注册:2016/1/28 2:59:00
  发帖心情 Post By:2019/5/27 16:02:00 [只看该作者]

版主,求助吖图片点击可在新窗口打开查看


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/5/27 16:37:00 [只看该作者]

全局代码,编写代码

 

Class TestCallWaybillPrinter

public Shared Sub WayBillPrinterTools()
Dim url7 As String = "http://localhost:4040/sf/waybill/print?type=V2.0.FM_poster_100mm150mm&output=noAlertPrint"
Dim url8 As String = "http://localhost:4040/sf/waybill/print?type=V2.0.FM_poster_100mm150mm&output=print"
Dim url9 As String = "http://localhost:4040/sf/waybill/print?type=V2.0.FM_poster_100mm150mm&output=image"
Dim url10 As String = "http://localhost:4040/sf/waybill/print?type=V3.0.FM_poster_100mm210mm&output=noAlertPrint"
Dim url11 As String = "http://localhost:4040/sf/waybill/print?type=V3.0.FM_poster_100mm210mm&output=print"
Dim url12 As String = "http://localhost:4040/sf/waybill/print?type=V3.0.FM_poster_100mm210mm&output=image"
Dim reqURL As String = url12
Dim jsonParam As String = AssemblyParameters(True)
Console.WriteLine("param :" & jsonParam)
Console.ReadKey(True)
Dim notTopLogo As Boolean = True

If reqURL.Contains("V2.0") AndAlso notTopLogo Then
    reqURL = reqURL.Replace("V2.0", "V2.1")
End If

If reqURL.Contains("V3.0") AndAlso notTopLogo Then
    reqURL = reqURL.Replace("V3.0", "V3.1")
End If

Dim result As String = postJson(reqURL, jsonParam)
Console.WriteLine("最终msg:" & result)
Console.ReadKey(True)

If result.Contains(""",""") Then
    Dim arr As String() = result.Split(""",""")
   
    For i As Integer = 0 To arr.Length - 1
        generateImage(arr(i).ToString(), "D:\qiaoWaybill201811102-" & i & ".jpg")
    Next
Else
    generateImage(result, "D:\qiaoWaybill201811102-1.jpg")
End If

Console.WriteLine("结束")
Console.ReadKey(True)
End Sub

Private Shared Function AssemblyParameters(ByVal isFengMi As Boolean) As String
Dim waybillDtoList As IList(Of WaybillDto) = New List(Of WaybillDto)()
Dim dto As WaybillDto = New WaybillDto()
dto.appId = "SLKJ2019"
dto.appKey = "FBIqMkZjzxbsZgo7jTpeq7PD8CVzLT4Q"
dto.mailNo = "755123457777"
dto.consignerProvince = "广东省"
dto.consignerCity = "深圳市"
dto.consignerCounty = "南山区"
dto.consignerAddress = "学府路软件产业基地2B12楼5200708号"
dto.consignerCompany = "神一样的科技"
dto.consignerMobile = "15893799999"
dto.consignerName = "风一样的旭哥"
dto.consignerShipperCode = "518052"
dto.consignerTel = "0755-33123456"
dto.deliverProvince = "浙江省"
dto.deliverCity = "杭州市"
dto.deliverCounty = "拱墅区"
dto.deliverCompany = "神罗科技集团有限公司"
dto.deliverAddress = "舟山东路708号古墩路北(玉泉花园旁)百花苑西区7-2-201室"
dto.deliverName = "艾丽斯"
dto.deliverMobile = "15881234567"
dto.deliverShipperCode = "310000"
dto.deliverTel = "0571-26508888"
dto.destCode = "755"
dto.zipCode = "571"
dto.expressType = 1
dto.codValue = "999.9"
dto.insureValue = "501"
dto.monthAccount = "7550385912"
dto.orderNo = ""
dto.payMethod = 1
dto.childRemark = "子单号备注"
dto.mainRemark = "这是主运单的备注"
dto.returnTrackingRemark = "迁回单备注"
dto.encryptCustName = True
dto.encryptMobile = True
Dim rlsInfoDtoList As System.Collections.ArrayList = New System.Collections.ArrayList
Dim rlsMain As RlsInfoDto = New RlsInfoDto()
rlsMain.abFlag = "A"
rlsMain.codingMapping = "F33"
rlsMain.codingMappingOut = "1A"
rlsMain.destRouteLabel = "755WE-571A3"
rlsMain.destTeamCode = "012345678"
rlsMain.printIcon = "11110000"
rlsMain.proCode = "T4"
rlsMain.qrcode = "MMM={'k1':'755WE','k2':'021WT','k3':'','k4':'T4','k5':'755123456789','k6':''}"
rlsMain.sourceTransferCode = "021WTF"
rlsMain.waybillNo = "755123456789"
rlsMain.xbFlag = "XB"
rlsInfoDtoList.Add(rlsMain)

If dto.returnTrackingNo IsNot Nothing Then
    Dim rlsBack As RlsInfoDto = New RlsInfoDto()
    rlsBack.waybillNo = dto.returnTrackingNo
    rlsBack.destRouteLabel = "021WTF"
    rlsBack.printIcon = "11110000"
    rlsBack.proCode = "T4"
    rlsBack.abFlag = "A"
    rlsBack.xbFlag = "XB"
    rlsBack.codingMapping = "1A"
    rlsBack.codingMappingOut = "F33"
    rlsBack.destTeamCode = "87654321"
    rlsBack.sourceTransferCode = "755WE-571A3"
    rlsBack.qrcode = "MMM={'k1':'21WT','k2':'755WE','k3':'','k4':'T4','k5':'443123456789','k6':''}"
    rlsInfoDtoList.Add(rlsBack)
End If

Dim cargo As CargoInfoDto = New CargoInfoDto()
cargo.cargo = "苹果7S"
cargo.cargoCount = 2
cargo.cargoUnit = "件"
cargo.sku = "00015645"
cargo.remark = "手机贵重物品 小心轻放"
Dim cargo2 As CargoInfoDto = New CargoInfoDto()
cargo2.cargo = "苹果macbook pro"
cargo2.cargoCount = 10
cargo2.cargoUnit = "件"
cargo2.sku = "00015646"
cargo2.remark = "笔记本贵重物品 小心轻放"
Dim cargoInfoList As System.Collections.ArrayList = New System.Collections.ArrayList
cargoInfoList.Add(cargo2)
cargoInfoList.Add(cargo)
dto.cargoInfoDtoList = cargoInfoList
dto.rlsInfoDtoList = rlsInfoDtoList

If isFengMi Then
    dto.rlsInfoDtoList = rlsInfoDtoList
End If

waybillDtoList.Add(dto)
Return Newtonsoft.Json.JsonConvert.SerializeObject(waybillDtoList)
End Function

Private Shared Function postJson(ByVal reqURL As String, ByVal jsonParm As String) As String
Dim httpResult As String = ""

Try
    Dim req As System.Net.HttpWebRequest = CType(System.Net.WebRequest.Create(reqURL), System.Net.HttpWebRequest)
    req.ContentType = "application/json;charset=utf-8"
    req.Method = "POST"
    req.Timeout = 20000
    Dim bs As Byte() = System.Text.Encoding.UTF8.GetBytes(jsonParm)
   
    Using reqStream As io.Stream = req.GetRequestStream()
    reqStream.Write(bs, 0, bs.Length)
End Using

Using response As System.Net.HttpWebResponse = CType(req.GetResponse(), System.Net.HttpWebResponse)

Using sr As io.StreamReader = New io.StreamReader(response.GetResponseStream(), Encoding.[Default])
httpResult = sr.ReadToEnd().ToString()
End Using
End Using

If httpResult.Contains("[") Then
    httpResult = httpResult.Substring(httpResult.IndexOf("[") + 1, httpResult.IndexOf("]") - httpResult.IndexOf("[") - 1)
End If

If httpResult.StartsWith("""") Then
    httpResult = httpResult.Substring(1, httpResult.Length - 1)
End If

If httpResult.EndsWith("""") Then
    httpResult = httpResult.Substring(0, httpResult.Length - 1)
End If

httpResult = httpResult.Replace("\n", "")
Catch ex As Exception
    Return ex.Message
End Try

Return httpResult
End Function

Public Shared Function generateImage(ByVal imgStr As String, ByVal imgFilePath As String) As Boolean
If imgStr Is Nothing Then Return False

Try
    Dim bytes As Byte() = Convert.FromBase64String(imgStr)
    Dim x As Integer = 256
    Dim a As Byte = CByte(x)
   
    For i As Integer = 0 To bytes.Length - 1
       
        If bytes(i) < 0 Then
            bytes(i) += a
        End If
    Next
   
    Using fs As io.FileStream = New io.FileStream(imgFilePath, io.FileMode.OpenOrCreate, io.FileAccess.Write)
    fs.Write(bytes, 0, bytes.Length)
    fs.Close()
End Using

Catch e As Exception
    Return False
End Try

Return True
End Function
End Class

Class CargoInfoDto
Public cargo As String
Public parcelQuantity As Integer
Public cargoCount As Integer
Public cargoUnit As String
Public cargoWeight As Double
Public cargoAmount As Double
Public cargoTotalWeight As Double
Public remark As String
Public sku As String
End Class

Class RlsInfoDto
Public abFlag As String
Public codingMapping As String
Public codingMappingOut As String
Public destRouteLabel As String
Public destTeamCode As String
Public printIcon As String
Public proCode As String
Public qrcode As String
Public sourceTransferCode As String
Public waybillNo As String
Public xbFlag As String
End Class

Class WaybillDto
Public mailNo As String
Public expressType As Integer
Public payMethod As Integer
Public returnTrackingNo As String
Public monthAccount As String
Public orderNo As String
Public zipCode As String
Public destCode As String
Public payArea As String
Public deliverCompany As String
Public deliverName As String
Public deliverMobile As String
Public deliverTel As String
Public deliverProvince As String
Public deliverCity As String
Public deliverCounty As String
Public deliverAddress As String
Public deliverShipperCode As String
Public consignerCompany As String
Public consignerName As String
Public consignerMobile As String
Public consignerTel As String
Public consignerProvince As String
Public consignerCity As String
Public consignerCounty As String
Public consignerAddress As String
Public consignerShipperCode As String
Public logo As String
Public sftelLogo As String
Public topLogo As String
Public topsftelLogo As String
Public appId As String
Public appKey As String
Public electric As String
Public cargoInfoDtoList As System.Collections.ArrayList
Public rlsInfoDtoList As System.Collections.ArrayList
Public insureValue As String
Public codValue As String
Public codMonthAccount As String
Public mainRemark As String
Public returnTrackingRemark As String
Public childRemark As String
Public custLogo As String
Public insureFee As String
Public encryptCustName As Boolean
Public encryptMobile As Boolean
End Class

 

调用代码

 

TestCallWaybillPrinter.WayBillPrinterTools

[此贴子已经被作者于2019/5/27 16:41:16编辑过]

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


加好友 发短信
等级:一尾狐 帖子:431 积分:5156 威望:0 精华:0 注册:2016/1/28 2:59:00
  发帖心情 Post By:2019/5/27 17:24:00 [只看该作者]

甜版,提示下图错误

 


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

 

 

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.foxdb

 


以下内容是专门发给有点甜;有点蓝浏览


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/5/27 17:39:00 [只看该作者]

 

Console.WriteLine("param :" & jsonParam)
Console.ReadKey(True)

 

改成

 

msgbox(jsonParam)

 

-----------其余的,类似 Console 的,都改成msgbox

 

 


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


加好友 发短信
等级:一尾狐 帖子:431 积分:5156 威望:0 精华:0 注册:2016/1/28 2:59:00
  发帖心情 Post By:2019/5/27 17:52:00 [只看该作者]

甜版,现在改了后,仅是弹窗显示,但是输出打印呢?

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/5/27 18:18:00 [只看该作者]

以下是引用km007在2019/5/27 17:52:00的发言:
甜版,现在改了后,仅是弹窗显示,但是输出打印呢?

 

不是生成对应的文件了吗?认认真真看懂代码。看懂帮助文件。

 


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


加好友 发短信
等级:一尾狐 帖子:431 积分:5156 威望:0 精华:0 注册:2016/1/28 2:59:00
  发帖心情 Post By:2019/5/27 18:37:00 [只看该作者]

generateImage(result, "D:\qiaoWaybill201811102-1.jpg")

 

这里输出这个图片,但是,我在D盘找不到这个图片


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


加好友 发短信
等级:一尾狐 帖子:431 积分:5156 威望:0 精华:0 注册:2016/1/28 2:59:00
  发帖心情 Post By:2019/5/27 18:44:00 [只看该作者]

搞掂了,谢谢甜版,爱你呦


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


加好友 发短信
等级:超级版主 帖子:106209 积分:540168 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/5/27 19:35:00 [只看该作者]

Console.xxx这种代码全部去掉

 回到顶部
总数 27 上一页 1 2 3 下一页