You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

895 lines
38 KiB
C#

2 months ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Xml.Linq;
using NetLibrary;
namespace TradeManage
{
public class SFClass
{
public string url{get;set;}
/// <summary>
/// 接入码
/// </summary>
public string UserCode { get; set; }
/// <summary>
/// 校验码
/// </summary>
public string CheckCode { get; set; }
/// <summary>
/// 语言
/// </summary>
public string Lang { get; set; }
public SFClass()
{
// url = "http://bsp-oisp.sf-express.com/bsp-oisp/ws/expressService?wsdl";
url = "http://ibu-ibse.sit.sf-express.com:1091/CBTA/ws/sfexpressService?wsdl";
Lang = "en";
}
#region 读取运单号
public sf_OrderResult GetOrderResult2(sf_Order2 model, out string ErrorMessage)
{
if (string.IsNullOrEmpty(UserCode) == true)
{
ErrorMessage = "接入码不能为空";
return null;
}
if (string.IsNullOrEmpty(CheckCode) == true)
{
ErrorMessage = "校验码不能为空";
return null;
}
//if (string.IsNullOrEmpty(url) == false)
// obj.Url = this.url;
ErrorMessage = "";
StringBuilder sb = new StringBuilder();
// sb.Append("<?xml version='1.0' encoding='utf-8' ?>");
sb.Append("<Request service=\"OrderService\" lang=\"zh-CN\">");
sb.Append("<Head>" + this.UserCode + "</Head>");
sb.Append("<Body>" + model.ToXml() + "</Body>");
sb.Append("</Request>");
string xml = sb.ToString();
string XmlContent = "";
try
{
string check_word = CheckCode;
string verifyCode = MD5Base64(xml + check_word); //example format: ODA4RUExMzFDRDRFM0ZFOThFOTUwQjAyNDgyOERGNjQ=
sfservice.SfexpressServiceClient service = new sfservice.SfexpressServiceClient();
//string name = "sfexpressService";
//WebServiceProxy wsd;
//try
//{
// wsd = new WebServiceProxy(url, name);
//}
//catch (Exception ex)
//{
// throw new Exception("创建代理对象异常", ex);
//}
XmlContent = service.sfexpressService(xml, verifyCode);
XmlContent = XmlContent.ToLower();
XElement doc = XElement.Parse(XmlContent);
string head = CustomIO.GetXmlElement(doc, "head");
if (head == "err")
{
XElement doc3 = doc.Element("error");
string code = CustomIO.GetXmlAttribute(doc3, "code");
ErrorMessage = "错误代码:" + code + "," + CustomIO.GetXmlElement(doc, "error");
return null;
}
doc = doc.Element("body").Element("orderresponse");
sf_OrderResult model2 = new sf_OrderResult();
model2.orderid = CustomIO.GetXmlAttribute(doc, "orderid");
model2.mailno = CustomIO.GetXmlAttribute(doc, "mailno");
// model2.return_tracking_no = CustomIO.GetXmlAttribute(doc, "return_tracking_no");
model2.agent_mailno = CustomIO.GetXmlAttribute(doc, "agent_mailno");
model2.skybill_code = CustomIO.GetXmlAttribute(doc, "skybill_code");
//model2.destcode = CustomIO.GetXmlAttribute(doc, "destcode");
//model2.filter_result = CustomIO.GetXmlAttribute(doc, "filter_result");
//model2.remark = CustomIO.GetXmlAttribute(doc, "remark");
return model2;
//return response;
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
return null;
// return ex.Message;
}
return null;
}
#endregion
public static string MD5Base64(string input)
{
string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(input, "MD5");
byte[] by = System.Text.Encoding.UTF8.GetBytes(pwd);
return Convert.ToBase64String(by);
}
}
#region 订单
public class sf_Order
{
/// <summary>
/// 客户订单号
/// </summary>
public string orderid { get; set; }
/// <summary>
/// 快件产品类别1 标准快递2 顺丰特惠9 顺E宝平邮10 顺E宝挂号此处传产品代码
/// 目前支持如下
///E1顺丰国际小包平邮
///E2: 顺丰国际小包挂号
///E3: 顺丰国际电商专递
/// </summary>
public string express_type { get; set; }
/// <summary>
/// 寄件方公司名称
/// </summary>
public string j_company { get; set; }
/// <summary>
/// 寄件方联系人
/// </summary>
public string j_contact { get; set; }
/// <summary>
/// 寄件方电话
/// </summary>
public string j_tel { get; set; }
/// <summary>
/// 寄件方手机
/// </summary>
public string j_mobile { get; set; }
/// <summary>
/// 寄件方详细地址
/// </summary>
public string j_address { get; set; }
/// <summary>
/// 到件方公司名称,没有的话就传联系人名称
/// </summary>
public string d_company { get; set; }
/// <summary>
/// 到件方联系人
/// </summary>
public string d_contact { get; set; }
/// <summary>
/// 到件方联系电话
/// </summary>
public string d_tel { get; set; }
/// <summary>
/// 到件方手机
/// </summary>
public string d_mobile { get; set; }
/// <summary>
/// 到件方详细地址
/// </summary>
public string d_address { get; set; }
/// <summary>
/// 包裹数
/// </summary>
public int? parcel_quantity { get; set; }
/// <summary>
/// 付款方式1:寄方付 2:收方付 3:第三方付
/// </summary>
public int? pay_method { get; set; }
/// <summary>
/// 寄件方所在省份
/// </summary>
public string j_province { get; set; }
/// <summary>
/// 寄件方所属城市名称
/// </summary>
public string j_city { get; set; }
/// <summary>
/// 到件方所在省份
/// </summary>
public string d_province { get; set; }
/// <summary>
/// 到件方所属城市名称
/// </summary>
public string d_city { get; set; }
/// <summary>
/// 托寄物声明价值
/// </summary>
public decimal? declared_value { get; set; }
/// <summary>
/// 托寄物声明价值币别CNY: 人民币HKD: 港币USD: 美元NTD: 新台币RUB: 卢布EUR: 欧元MOP: 澳门元SGD: 新元JPY: 日元KRW: 韩元MYR: 马币VND: 越南盾THB: 泰铢AUD: 澳大利亚元MNT: 图格里克
/// </summary>
public string declared_value_currency { get; set; }
/// <summary>
/// 月结卡号
/// </summary>
public string custid { get; set; }
/// <summary>
/// 模板选择
/// </summary>
public string template { get; set; }
/// <summary>
/// 寄方国家
/// </summary>
public string j_country { get; set; }
/// <summary>
/// 寄件人所在县/区
/// </summary>
public string j_county { get; set; }
/// <summary>
/// 寄件方代码
/// </summary>
public string j_shippercode { get; set; }
/// <summary>
/// 寄方邮编
/// </summary>
public string j_post_code { get; set; }
/// <summary>
/// 到方国家
/// </summary>
public string d_country { get; set; }
/// <summary>
/// 到件人所在县/区
/// </summary>
public string d_county { get; set; }
/// <summary>
/// 到件方代码
/// </summary>
public string d_deliverycode { get; set; }
/// <summary>
/// 到方邮编
/// </summary>
public string d_post_code { get; set; }
/// <summary>
/// 订单货物总重量
/// </summary>
public decimal? cargo_total_weight { get; set; }
/// <summary>
/// 要求上门取件开始时间格式YYYY-MM-DD HH24:MM:SS示例2012-7-30 09:30:00默认为系统收到订单的系统时间
/// </summary>
public DateTime? sendstarttime { get; set; }
/// <summary>
/// 运单号
/// </summary>
public string mailno { get; set; }
/// <summary>
/// 签回单单号
/// </summary>
public string return_tracking { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
/// <summary>
/// 是否需要签回单号1需要
/// </summary>
public string need_return_tracking_no { get; set; }
/// <summary>
/// 是否下call 1-下call,其他否SYSTEM表示如果不提供将从系统配置获取
/// </summary>
public string is_docall { get; set; }
/// <summary>
/// 是否申请运单号 1-申请运单号其他否SYSTEM表示如果不提供将从系统配置获取
/// </summary>
public int? is_gen_bill_no { get; set; }
/// <summary>
/// 是否生成电子运单图片 1-生成其他否SYSTEM表示如果不提供将从系统配置获取
/// </summary>
public int? is_gen_eletric_pic { get; set; }
/// <summary>
/// 图片格式如果需要顺丰系统推送图片则要传这个值。1A42A5
/// </summary>
public int? waybill_size { get; set; }
/// <summary>
/// 长
/// </summary>
public decimal? cargo_length { get; set; }
/// <summary>
/// 宽
/// </summary>
public decimal? cargo_width { get; set; }
/// <summary>
/// 高
/// </summary>
public decimal? cargo_height { get; set; }
/// <summary>
/// 物品信息
/// </summary>
public List<sf_Goods> ListGoods { get; set; }
/// <summary>
/// 增值服务
/// </summary>
public List<sf_Service> ListService { get; set; }
public sf_Order()
{
ListGoods = new List<sf_Goods>();
ListService = new List<sf_Service>();
}
#region 转成XML
public string ToXml()
{
StringBuilder sb = new StringBuilder();
sb.Append("<Order");
sb.Append(" orderid=\"" + this.orderid + "\"");
if (string.IsNullOrEmpty(this.express_type) == false) sb.Append(" express_type=\"" + this.express_type + "\"");
if (string.IsNullOrEmpty(this.j_company) == false) sb.Append(" j_company=\"" + this.j_company + "\"");
if (string.IsNullOrEmpty(this.j_contact) == false) sb.Append(" j_contact=\"" + this.j_contact + "\"");
if (string.IsNullOrEmpty(this.j_tel) == false) sb.Append(" j_tel=\"" + this.j_tel + "\"");
if (string.IsNullOrEmpty(this.j_mobile) == false)
sb.Append(" j_mobile=\"" + this.j_mobile.ToString() + "\"");
else
sb.Append(" j_mobile=\"\"");
sb.Append(" operate_flag=\"1\"");
if (string.IsNullOrEmpty(this.j_address) == false) sb.Append(" j_address=\"" + this.j_address + "\"");
sb.Append(" d_company=\"" + this.d_company + "\"");
sb.Append(" d_contact=\"" + this.d_contact + "\"");
sb.Append(" d_tel=\"" + this.d_tel + "\"");
if (string.IsNullOrEmpty(this.d_mobile) == false)
sb.Append(" d_mobile=\"" + this.d_mobile.ToString() + "\"");
else
sb.Append(" d_mobile=\"\"");
sb.Append(" d_address=\"" + this.d_address + "\"");
if (this.parcel_quantity != null) sb.Append(" parcel_quantity=\"" + this.parcel_quantity + "\"");
if (this.pay_method != null) sb.Append(" pay_method=\"" + this.pay_method + "\"");
if (string.IsNullOrEmpty(this.j_province) == false) sb.Append(" j_province=\"" + this.j_province + "\"");
if (string.IsNullOrEmpty(this.j_city) == false)
sb.Append(" j_city=\"" + this.j_city.ToString() + "\"");
else
sb.Append(" j_city=\"\"");
if (this.declared_value != null) sb.Append(" declared_value=\"" + this.declared_value.Value.ToString("0.###") + "\"");
if (string.IsNullOrEmpty(this.declared_value_currency) == false) sb.Append(" declared_value_currency=\"" + this.declared_value_currency + "\"");
if (string.IsNullOrEmpty(this.custid) == false) sb.Append(" custid=\"" + this.custid + "\"");
if (string.IsNullOrEmpty(this.j_country) == false) sb.Append(" j_country=\"" + this.j_country + "\"");
if (string.IsNullOrEmpty(this.j_county) == false) sb.Append(" j_county=\"" + this.j_county + "\"");
if (string.IsNullOrEmpty(this.j_post_code) == false) sb.Append(" j_post_code=\"" + this.j_post_code + "\"");
if (string.IsNullOrEmpty(this.d_country) == false) sb.Append(" d_country=\"" + this.d_country + "\"");
if (string.IsNullOrEmpty(this.d_province) == false) sb.Append(" d_province=\"" + this.d_province + "\"");
if (string.IsNullOrEmpty(this.d_city) == false)
sb.Append(" d_city=\"" + this.d_city.ToString() + "\"");
else sb.Append(" d_city=\"\"");
if (string.IsNullOrEmpty(this.d_county) == false)
sb.Append(" d_county=\"" + this.d_county.ToString() + "\"");
else
sb.Append(" d_county=\"\"");
if (string.IsNullOrEmpty(this.d_deliverycode) == false) sb.Append(" d_deliverycode=\"" + this.d_deliverycode + "\"");
if (string.IsNullOrEmpty(this.d_post_code) == false) sb.Append(" d_post_code=\"" + this.d_post_code + "\"");
if (this.cargo_total_weight != null) sb.Append(" cargo_total_weight=\"" + this.cargo_total_weight.Value.ToString("0.###") + "\"");
//if (string.IsNullOrEmpty(this.mailno) == false) sb.Append(" mailno=\"" + this.mailno + "\"");
//if (string.IsNullOrEmpty(this.return_tracking) == false) sb.Append(" return_tracking=\"" + this.return_tracking + "\"");
//if (string.IsNullOrEmpty(this.remark) == false) sb.Append(" remark=\"" + this.remark + "\"");
//if (string.IsNullOrEmpty(this.need_return_tracking_no) == false) sb.Append(" need_return_tracking_no=\"" + this.need_return_tracking_no + "\"");
//if (this.is_docall != null) sb.Append(" is_docall=\"" + this.is_docall + "\"");
//if (this.is_gen_bill_no != null) sb.Append(" is_gen_bill_no=\"" + this.is_gen_bill_no + "\"");
//if (this.is_gen_eletric_pic != null) sb.Append(" is_gen_eletric_pic=\"" + this.is_gen_eletric_pic + "\"");
//if (this.waybill_size != null) sb.Append(" waybill_size=\"" + this.waybill_size + "\"");
//if (this.cargo_length != null) sb.Append(" cargo_length=\"" + this.cargo_length.Value.ToString("0.###") + "\"");
//if (this.cargo_width != null) sb.Append(" cargo_width=\"" + this.cargo_width.Value.ToString("0.###") + "\"");
//if (this.cargo_height != null) sb.Append(" cargo_height=\"" + this.cargo_height.Value.ToString("0.###") + "\"");
sb.Append(">");
foreach (var item in this.ListGoods)
{
sb.Append("<Cargo");
sb.Append(" name=\"" + item.name + "\"");
if (item.count != null) sb.Append(" count=\"" + item.count + "\"");
sb.Append(" unit=\"piece\"");
if (item.weight != null) sb.Append(" weight=\"" + item.weight.Value.ToString("0.###") + "\"");
if (item.amount != null) sb.Append(" amount=\"" + item.amount.Value.ToString("0.##########") + "\"");
if (string.IsNullOrEmpty(item.currency) == false) sb.Append(" currency=\"" + item.currency + "\"");
sb.Append(" source_area=\"china\"");
sb.Append(">");
sb.Append("</Cargo>");
}
//foreach (var item in this.ListService)
//{
// sb.Append("<AddedService");
// sb.Append(" name=\"" + item.name + "\"");
// if (string.IsNullOrEmpty(item.value) == false) sb.Append(" value=\"" + item.value + "\"");
// if (string.IsNullOrEmpty(item.value1) == false) sb.Append(" value1=\"" + item.value1 + "\"");
// if (string.IsNullOrEmpty(item.value2) == false) sb.Append(" value2=\"" + item.value2 + "\"");
// if (string.IsNullOrEmpty(item.value3) == false) sb.Append(" value3=\"" + item.value3 + "\"");
// if (string.IsNullOrEmpty(item.value4) == false) sb.Append(" value4=\"" + item.value4 + "\"");
// sb.Append(">");
// sb.Append("</AddedService>");
//}
sb.Append("</Order>");
return sb.ToString();
}
#endregion
#region 欧美转成XML
public string ToOUXml()
{
StringBuilder sb = new StringBuilder();
sb.Append("<Order");
sb.Append(" orderid=\"" + this.orderid + "\"");
if (string.IsNullOrEmpty(this.express_type) == false) sb.Append(" express_type=\"" + this.express_type + "\"");
if (string.IsNullOrEmpty(this.j_company) == false) sb.Append(" j_company=\"" + this.j_company + "\"");
if (string.IsNullOrEmpty(this.j_contact) == false) sb.Append(" j_contact=\"" + this.j_contact + "\"");
if (string.IsNullOrEmpty(this.j_tel) == false) sb.Append(" j_tel=\"" + this.j_tel + "\"");
if (string.IsNullOrEmpty(this.j_mobile) == false)
sb.Append(" j_mobile=\"" + this.j_mobile.ToString() + "\"");
else
sb.Append(" j_mobile=\"\"");
sb.Append(" operate_flag=\"1\"");
if (string.IsNullOrEmpty(this.j_address) == false) sb.Append(" j_address=\"" + this.j_address + "\"");
sb.Append(" d_company=\"" + this.d_company + "\"");
sb.Append(" d_contact=\"" + this.d_contact + "\"");
sb.Append(" d_tel=\"" + this.d_tel + "\"");
if (string.IsNullOrEmpty(this.d_mobile) == false)
sb.Append(" d_mobile=\"" + this.d_mobile.ToString() + "\"");
else
sb.Append(" d_mobile=\"\"");
sb.Append(" d_address=\"" + this.d_address + "\"");
if (this.parcel_quantity != null) sb.Append(" parcel_quantity=\"" + this.parcel_quantity + "\"");
if (string.IsNullOrEmpty(this.j_province) == false) sb.Append(" j_province=\"" + this.j_province + "\"");
if (string.IsNullOrEmpty(this.j_city) == false)
sb.Append(" j_city=\"" + this.j_city.ToString() + "\"");
else
sb.Append(" j_city=\"\"");
if (string.IsNullOrEmpty(this.j_country) == false) sb.Append(" j_country=\"" + this.j_country + "\"");
if (string.IsNullOrEmpty(this.j_county) == false) sb.Append(" j_county=\"" + this.j_county + "\"");
if (string.IsNullOrEmpty(this.j_post_code) == false) sb.Append(" j_post_code=\"" + this.j_post_code + "\"");
if (string.IsNullOrEmpty(this.d_country) == false) sb.Append(" d_country=\"" + this.d_country + "\"");
if (string.IsNullOrEmpty(this.d_province) == false) sb.Append(" d_province=\"" + this.d_province + "\"");
if (string.IsNullOrEmpty(this.d_city) == false)
sb.Append(" d_city=\"" + this.d_city.ToString() + "\"");
else sb.Append(" d_city=\"\"");
if (string.IsNullOrEmpty(this.d_county) == false)
sb.Append(" d_county=\"" + this.d_county.ToString() + "\"");
else
sb.Append(" d_county=\"\"");
if (string.IsNullOrEmpty(this.d_post_code) == false) sb.Append(" d_post_code=\"" + this.d_post_code + "\"");
if (this.cargo_total_weight != null) sb.Append(" cargo_total_weight=\"" + this.cargo_total_weight.Value.ToString("0.###") + "\"");
sb.Append(">");
foreach (var item in this.ListGoods)
{
sb.Append("<Cargo");
sb.Append(" name=\"" + item.name + "\"");
if (item.count != null) sb.Append(" count=\"" + item.count + "\"");
if (string.IsNullOrEmpty(item.unit) == false) sb.Append(" unit=\"PCE\"");
if (item.weight != null) sb.Append(" weight=\"" + item.weight.Value.ToString("0.###") + "\"");
if (item.amount != null) sb.Append(" amount=\"" + item.amount.Value.ToString("0.##########") + "\"");
if (string.IsNullOrEmpty(item.currency) == false) sb.Append(" ename=\"" + item.ename + "\"");
sb.Append(">");
sb.Append("</Cargo>");
}
sb.Append("</Order>");
return sb.ToString();
}
#endregion
}
#endregion
#region 订单
public class sf_Order2
{
/// <summary>
/// 客户订单号
/// </summary>
public string orderid { get; set; }
/// <summary>
/// 快件产品类别1 标准快递2 顺丰特惠9 顺E宝平邮10 顺E宝挂号此处传产品代码
/// 目前支持如下
///E1顺丰国际小包平邮
///E2: 顺丰国际小包挂号
///E3: 顺丰国际电商专递
/// </summary>
public string express_type { get; set; }
/// <summary>
/// 寄件方公司名称
/// </summary>
public string j_company { get; set; }
/// <summary>
/// 寄件方联系人
/// </summary>
public string j_contact { get; set; }
/// <summary>
/// 寄件方电话
/// </summary>
public string j_tel { get; set; }
/// <summary>
/// 寄件方手机
/// </summary>
public string j_mobile { get; set; }
/// <summary>
/// 寄件方详细地址
/// </summary>
public string j_address { get; set; }
/// <summary>
/// 到件方公司名称,没有的话就传联系人名称
/// </summary>
public string d_company { get; set; }
/// <summary>
/// 到件方联系人
/// </summary>
public string d_contact { get; set; }
/// <summary>
/// 到件方联系电话
/// </summary>
public string d_tel { get; set; }
/// <summary>
/// 到件方手机
/// </summary>
public string d_mobile { get; set; }
/// <summary>
/// 到件方手机
/// </summary>
public string d_email { get; set; }
/// <summary>
/// 操作表示(0.新增1.新增并确认订单)
/// </summary>
public string operate_flag { get; set; }
/// <summary>
/// 到件方详细地址
/// </summary>
public string d_address { get; set; }
/// <summary>
/// 包裹数
/// </summary>
public int? parcel_quantity { get; set; }
///// <summary>
///// 付款方式1:寄方付 2:收方付 3:第三方付
///// </summary>
//public int? pay_method { get; set; }
/// <summary>
/// 寄件方所在省份
/// </summary>
public string j_province { get; set; }
/// <summary>
/// 寄件方所属城市名称
/// </summary>
public string j_city { get; set; }
/// <summary>
/// 到件方所在省份
/// </summary>
public string d_province { get; set; }
/// <summary>
/// 到件方所属城市名称
/// </summary>
public string d_city { get; set; }
/// <summary>
/// 寄方国家
/// </summary>
public string j_country { get; set; }
/// <summary>
/// 寄方国家
/// </summary>
public string j_post_code { get; set; }
/// <summary>
/// 到方国家
/// </summary>
public string d_country { get; set; }
/// <summary>
/// 到方邮编
/// </summary>
public string d_post_code { get; set; }
/// <summary>
/// 订单货物总重量单位KG
/// </summary>
public decimal? cargo_total_weight { get; set; }
/// <summary>
/// 客户ERP的标识码
/// </summary>
public string returnsign { get; set; }
/// <summary>
/// 月结卡号
/// </summary>
public string pit_code { get; set; }
/// <summary>
/// 模板选择
/// </summary>
public string length { get; set; }
/// <summary>
/// 模板选择
/// </summary>
public string width { get; set; }
/// <summary>
/// 模板选择
/// </summary>
public string height { get; set; }
/// <summary>
/// 寄件方代码
/// </summary>
public string d_identify_code { get; set; }
/// <summary>
/// VAT税号
/// </summary>
public string vat_code { get; set; }
/// <summary>
/// 是否有电,默认为空有点则填写Y不带电填写N(俄罗斯专递必填、其它选填)
/// </summary>
public string is_battery { get; set; }
/// <summary>
/// 保价服务
/// </summary>
public string is_insurance { get; set; }
/// <summary>
/// 物品信息
/// </summary>
public List<sf_Goods2> ListGoods { get; set; }
/// <summary>
/// 增值服务
/// </summary>
// public List<sf_Service> ListService { get; set; }
public sf_Order2()
{
ListGoods = new List<sf_Goods2>();
// ListService = new List<sf_Service>();
}
#region 转成XML
public string ToXml()
{
StringBuilder sb = new StringBuilder();
sb.Append("<Order");
sb.Append(" orderid=\"" + this.orderid + "\"");
if (string.IsNullOrEmpty(this.express_type) == false) sb.Append(" express_type=\"" + this.express_type + "\"");
if (string.IsNullOrEmpty(this.j_company) == false) sb.Append(" j_company=\"" + this.j_company + "\"");
if (string.IsNullOrEmpty(this.j_contact) == false) sb.Append(" j_contact=\"" + this.j_contact + "\"");
if (string.IsNullOrEmpty(this.j_tel) == false) sb.Append(" j_tel=\"" + this.j_tel + "\"");
if (string.IsNullOrEmpty(this.j_mobile) == false)
sb.Append(" j_mobile=\"" + this.j_mobile.ToString() + "\"");
else
sb.Append(" j_mobile=\"\"");
if (string.IsNullOrEmpty(this.pit_code) == false)
sb.Append(" pit_code=\"" + this.pit_code.ToString() + "\"");
else
sb.Append(" pit_code=\"\"");
sb.Append(" operate_flag=\"1\"");
if (string.IsNullOrEmpty(this.j_address) == false) sb.Append(" j_address=\"" + this.j_address + "\"");
sb.Append(" d_company=\"" + this.d_company + "\"");
sb.Append(" d_contact=\"" + this.d_contact + "\"");
sb.Append(" d_tel=\"" + this.d_tel + "\"");
if (string.IsNullOrEmpty(this.d_mobile) == false)
sb.Append(" d_mobile=\"" + this.d_mobile.ToString() + "\"");
else
sb.Append(" d_mobile=\"\"");
sb.Append(" d_address=\"" + this.d_address + "\"");
if (this.parcel_quantity != null) sb.Append(" parcel_quantity=\"" + this.parcel_quantity + "\"");
// if (this.pay_method != null) sb.Append(" pay_method=\"" + this.pay_method + "\"");
if (string.IsNullOrEmpty(this.j_province) == false) sb.Append(" j_province=\"" + this.j_province + "\"");
if (string.IsNullOrEmpty(this.j_city) == false)
sb.Append(" j_city=\"" + this.j_city.ToString() + "\"");
else
sb.Append(" j_city=\"\"");
//if (this.declared_value != null) sb.Append(" declared_value=\"" + this.declared_value.Value.ToString("0.###") + "\"");
// if (string.IsNullOrEmpty(this.declared_value_currency) == false) sb.Append(" declared_value_currency=\"" + this.declared_value_currency + "\"");
// if (string.IsNullOrEmpty(this.custid) == false) sb.Append(" custid=\"" + this.custid + "\"");
if (string.IsNullOrEmpty(this.j_country) == false) sb.Append(" j_country=\"" + this.j_country + "\"");
// if (string.IsNullOrEmpty(this.j_county) == false) sb.Append(" j_county=\"" + this.j_county + "\"");
if (string.IsNullOrEmpty(this.j_post_code) == false) sb.Append(" j_post_code=\"" + this.j_post_code + "\"");
if (string.IsNullOrEmpty(this.d_country) == false) sb.Append(" d_country=\"" + this.d_country + "\"");
if (string.IsNullOrEmpty(this.d_province) == false) sb.Append(" d_province=\"" + this.d_province + "\"");
if (string.IsNullOrEmpty(this.d_city) == false)
sb.Append(" d_city=\"" + this.d_city.ToString() + "\"");
else sb.Append(" d_city=\"\"");
// if (string.IsNullOrEmpty(this.d_county) == false)
// sb.Append(" d_county=\"" + this.d_county.ToString() + "\"");
// else
// sb.Append(" d_county=\"\"");
// if (string.IsNullOrEmpty(this.d_deliverycode) == false) sb.Append(" d_deliverycode=\"" + this.d_deliverycode + "\"");
if (string.IsNullOrEmpty(this.d_post_code) == false) sb.Append(" d_post_code=\"" + this.d_post_code + "\"");
if (this.cargo_total_weight != null) sb.Append(" cargo_total_weight=\"" + this.cargo_total_weight.Value.ToString("0.###") + "\"");
//if (string.IsNullOrEmpty(this.mailno) == false) sb.Append(" mailno=\"" + this.mailno + "\"");
//if (string.IsNullOrEmpty(this.return_tracking) == false) sb.Append(" return_tracking=\"" + this.return_tracking + "\"");
//if (string.IsNullOrEmpty(this.remark) == false) sb.Append(" remark=\"" + this.remark + "\"");
//if (string.IsNullOrEmpty(this.need_return_tracking_no) == false) sb.Append(" need_return_tracking_no=\"" + this.need_return_tracking_no + "\"");
//if (this.is_docall != null) sb.Append(" is_docall=\"" + this.is_docall + "\"");
//if (this.is_gen_bill_no != null) sb.Append(" is_gen_bill_no=\"" + this.is_gen_bill_no + "\"");
//if (this.is_gen_eletric_pic != null) sb.Append(" is_gen_eletric_pic=\"" + this.is_gen_eletric_pic + "\"");
//if (this.waybill_size != null) sb.Append(" waybill_size=\"" + this.waybill_size + "\"");
//if (this.cargo_length != null) sb.Append(" cargo_length=\"" + this.cargo_length.Value.ToString("0.###") + "\"");
//if (this.cargo_width != null) sb.Append(" cargo_width=\"" + this.cargo_width.Value.ToString("0.###") + "\"");
//if (this.cargo_height != null) sb.Append(" cargo_height=\"" + this.cargo_height.Value.ToString("0.###") + "\"");
sb.Append(">");
foreach (var item in this.ListGoods)
{
sb.Append("<Cargo");
sb.Append(" name=\"" + item.name + "\"");
sb.Append(" ename=\"" + item.ename + "\"");
if (item.count != null) sb.Append(" count=\"" + item.count + "\"");
sb.Append(" unit=\"PCE\"");
if (item.weight != null) sb.Append(" weight=\"" + item.weight.Value.ToString("0.###") + "\"");
if (item.amount != null) sb.Append(" amount=\"" + item.amount.Value.ToString("0.##########") + "\"");
// if (string.IsNullOrEmpty(item.currency) == false) sb.Append(" currency=\"" + item.currency + "\"");
// sb.Append(" source_area=\"china\"");
sb.Append(">");
sb.Append("</Cargo>");
}
//foreach (var item in this.ListService)
//{
// sb.Append("<AddedService");
// sb.Append(" name=\"" + item.name + "\"");
// if (string.IsNullOrEmpty(item.value) == false) sb.Append(" value=\"" + item.value + "\"");
// if (string.IsNullOrEmpty(item.value1) == false) sb.Append(" value1=\"" + item.value1 + "\"");
// if (string.IsNullOrEmpty(item.value2) == false) sb.Append(" value2=\"" + item.value2 + "\"");
// if (string.IsNullOrEmpty(item.value3) == false) sb.Append(" value3=\"" + item.value3 + "\"");
// if (string.IsNullOrEmpty(item.value4) == false) sb.Append(" value4=\"" + item.value4 + "\"");
// sb.Append(">");
// sb.Append("</AddedService>");
//}
sb.Append("</Order>");
return sb.ToString();
}
#endregion
}
#endregion
#region 物品信息
public class sf_Goods
{
/// <summary>
/// 货物名称
/// </summary>
public string name { get; set; }
//货物英文名
public string ename { get; set; }
/// <summary>
/// 货物数量
/// </summary>
public int? count { get; set; }
/// <summary>
/// 货物单位
/// </summary>
public string unit { get; set; }
/// <summary>
/// 货物单位重量
/// </summary>
public decimal? weight { get; set; }
/// <summary>
/// 货物单价
/// </summary>
public decimal? amount { get; set; }
/// <summary>
/// 货物单价的币别
/// </summary>
public string currency { get; set; }
/// <summary>
/// 原产地国别
/// </summary>
public string source_area { get; set; }
}
public class sf_Goods2
{
/// <summary>
/// 货物中文品名,用于海关申报
/// </summary>
public string name { get; set; }
/// <summary>
/// 货物英文申报品名,用于海关申报
/// </summary>
public string ename { get; set; }
/// <summary>
/// 海关编码,用于海关申报(顺丰国际电商专递欧洲流向必填、其它选填)
/// </summary>
public string hscode { get; set; }
/// <summary>
/// 货物数量
/// </summary>
public Int32? count { get; set; }
/// <summary>
/// 货物单位默认为PCE
/// </summary>
public string unit { get; set; }
/// <summary>
/// 货物单位重量
/// </summary>
public decimal? weight { get; set; }
/// <summary>
/// 货物单价默认为美元
/// </summary>
public decimal? amount { get; set; }
/// <summary>
/// 配货备注
/// </summary>
public string diNote { get; set; }
/// <summary>
///配货名称
/// </summary>
public decimal? diPickName { get; set; }
}
#endregion
#region 服务名
public class sf_Service
{
/// <summary>
/// 增值服务名
/// </summary>
public string name { get; set; }
/// <summary>
/// 增值服务值1
/// </summary>
public string value { get; set; }
/// <summary>
/// 增值服务值2
/// </summary>
public string value1 { get; set; }
/// <summary>
/// 增值服务名3
/// </summary>
public string value2 { get; set; }
/// <summary>
/// 增值服务名4
/// </summary>
public string value3 { get; set; }
/// <summary>
/// 增值服务名5
/// </summary>
public string value4 { get; set; }
}
#endregion
#region 运单号分配
public class sf_OrderResult
{
/// <summary>
/// 订单号
/// </summary>
public string orderid { get; set; }
/// <summary>
/// 运单号,可多个单号,如子母件,以逗号分隔
/// </summary>
public string mailno { get; set; }
/// <summary>
/// 签单返还运单号
/// </summary>
public string return_tracking_no { get; set; }
/// <summary>
/// 代理运单号,可多个单号,如子母件,以逗号分隔
/// </summary>
public string agent_mailno { get; set; }
/// <summary>
/// 原寄地代码
/// </summary>
public string origincode { get; set; }
/// <summary>
/// 目的地代码
/// </summary>
public string destcode { get; set; }
/// <summary>
/// 筛单结果1-人工确认2-可收派 3-不可以收派
/// </summary>
public string filter_result { get; set; }
/// <summary>
/// 1-收方超范围2-派方超范围3-其他原因
/// </summary>
public string remark { get; set; }
public string skybill_code { get; set; }
}
#endregion
}