欢迎来到苏州瑞信防伪科技有限公司官方网站!
最新资讯
热门资讯

提货功能开发-瑞信在线提货系统源代码分析

提货功能开发瑞信在线提货系统(自助提货系统)对接顺丰快递电子面单的技术研究及源代码分析,瑞信在线提货系统,又称大闸蟹自助提货系统,主用用于各种礼卡礼券的在线及自助提货。

商家采用该系统益处:

1:消费者可以任意时刻预约提货,无需通过电话、短信等繁琐的方式。

2:预约提货的时间段不再受时间限制(24小时均可提货)。

3:消费者提货后,商家可以实时看到新的订单信息。

4:假设消费者预约的发货日期是:2017-10-12,瑞信在线提货系统会在当天打印该顺丰电子面单。

5:商家通过在线提货系统打印的顺丰电子面单,来安排发货(打印出来的面单上会打印出产品的具体型号)。

 

顺丰电子面单系统采用WebService对外开放的技术接口,瑞信在线提货系统完美对接顺丰电子面单系统,而且已经稳定运行多年,截止2017年,通过瑞信在线提货系统对接的顺丰电子面单系统累计发货量过500万笔。

 

下面我们来从瑞信在线提货系统源代码的角度分析告诉大家,为什么我们的系统为什么如此稳定且安全!在对接之前,我们首先要向当地的顺丰工作人员提出申请,申请周期一般是7天左右,申请通过后,顺丰会给我们分配对应的账号,密码,校验码。我们的提货系统获得这些信息后,便可以自动和其对接。

提货功能开发-瑞信在线提货系统源代码分析

 

public void OpNormalOrderByJxs()

{

try

{

string sf_request = “”;

string sf_monthcode;

string sf_monthpwd;

string sf_orderid;

string orderid;

string j_province;

string j_city;

string j_company;

string j_contact;

string j_tel;

string j_address;

string d_province;

string d_city;

string d_company;

string d_contact;

string d_tel;

string d_address;

string custid;

string cargo_weight = “”;

string sendstarttime;

string sales_remark;

int parcel_quantity = 0;

List<string> CanPrintJxsList = getCanPrintJxsList();

sfwb.CommonServiceService sf_webservice = new sfwb.CommonServiceService();

for (int i = 0; i < CanPrintJxsList.Count; ++i)

{

string PrintJxs = CanPrintJxsList[i];//查找指定经销商的订单记录

string sqlCmd = string.Format(“select * from sales  where  sales_is_add_express=0 and sales_is_add_jxs=1 and sales_which_jxs_send=sales_which_jxs_send and sales_express_company='{1}’ and sales_pre_express_date<#{2}# order by sales_orderinfo_ewm”, PrintJxs, ForSetting.sf_express_name, GetTomorrow());

DataSet set = ForDbHelper.getDataSet(sqlCmd);

if (set != null && (set.Tables[0].Rows.Count > 0))

{///查找指定经销商的订单记录

GetJxsInfoByID(PrintJxs);

for (int j = 0; j < set.Tables[0].Rows.Count; ++j)

{

j_province = ForSetting.companyinfo_j_province;// info_of_jxs.j_province;// bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_j_province"].ToString();

j_city = ForSetting.companyinfo_j_city;// info_of_jxs.j_city;// bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_j_city"].ToString();

j_company = info_of_jxs.j_company;// bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_name"].ToString();

j_contact = info_of_jxs.j_contact;// bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_contact"].ToString();

j_tel = info_of_jxs.j_tel;// bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_phone"].ToString();

j_address = info_of_jxs.j_address;// bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_address"].ToString();

 

////老版本的

sf_monthcode = ForSetting.companyinfo_sf_monthcode;// bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_sf_monthcode"].ToString();

sf_monthpwd = ForSetting.companyinfo_sf_monthpwd;// bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_sf_monthpwd"].ToString();

/////

//j_province = bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_j_province"].ToString();

//j_city = bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_j_city"].ToString();

//j_company = bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_name"].ToString();

//j_contact = bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_contact"].ToString();

//j_tel = bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_phone"].ToString();

//j_address = bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_address"].ToString();

//custid = bigsfdzxfh.companyinfo_ds.Tables[0].Rows[0]["companyinfo_sf_custid"].ToString();

custid = ForSetting.companyinfo_sf_custid;

sf_orderid = set.Tables[0].Rows[j]["sales_guid"].ToString() + “_” + System.DateTime.Now.ToString(“yyyyMMddHHmmss”);

orderid = set.Tables[0].Rows[j]["sales_guid"].ToString();

d_province = set.Tables[0].Rows[j]["sales_d_province"].ToString();

d_city = set.Tables[0].Rows[j]["sales_d_city"].ToString();

d_company = set.Tables[0].Rows[j]["sales_oderinfo_user"].ToString();

d_contact = set.Tables[0].Rows[j]["sales_oderinfo_user"].ToString();

d_tel = set.Tables[0].Rows[j]["sales_orderinfo_phone"].ToString();

d_address = set.Tables[0].Rows[j]["sales_orderinfo_address"].ToString();

sales_remark = set.Tables[0].Rows[j]["sales_remark"].ToString();

sendstarttime = System.DateTime.Now.ToString(ForSetting.datetimefmt);

parcel_quantity = 1;

cargo_weight = “”;// set.Tables[0].Rows[j]["quan_product_weight"].ToString();

if (cargo_weight == “”)

cargo_weight = “2”;

txtResult.Text = string.Format(“一共有{0}笔订单,需要同步顺丰电子运单号!\r\n”, total_sf_amount) + string.Format(“正在同步第{0}笔订单!,卡号:{1}”, ++CurSyncIndex, set.Tables[0].Rows[j]["sales_orderinfo_ewm"].ToString());

 

List<string> tmp = getProvinceByJxs(PrintJxs);

if (tmp != null)

{

for (int count = 0; count < tmp.Count; ++count)

{

if (tmp[count].Contains(d_province))

{

sf_request = string.Format(“<Request service=\”OrderService\” lang=\”zh-CN\”>\n<Head>{0},{1}</Head>\n<Body>\n<Order orderid=\”{2}\” express_type=\”1\”  j_company=\”{3}\”  j_contact=\”{4}\” j_tel=\”{5}\”  j_address=\”{6}\” d_company=\”{7}\” d_contact=\”{8}\” d_tel=\”{9}\” d_address=\”{10}\”  parcel_quantity=\”{11}\”  pay_method=\”1\” custid=\”{12}\”  cargo_total_weight=\”{13}\”  sendstarttime=\”{14}\”  remark=\”备注\” j_province=\”{15}\”  j_city=\”{16}\” d_province=\”{17}\” d_city=\”{18}\”>\n<Cargo name=\”大闸蟹\” unit=\”个\”></Cargo>\n</Order>\n</Body>\n</Request>”, sf_monthcode, sf_monthpwd, sf_orderid, j_company, j_contact, j_tel, j_address, d_company, d_contact, d_tel, d_address, parcel_quantity, custid, cargo_weight, sendstarttime, j_province, j_city, d_province, d_city);

break;

}

else

{//这边会冗余多执行几次 没有关系

sf_request = string.Format(“<Request service=\”OrderService\” lang=\”zh-CN\”>\n<Head>{0},{1}</Head>\n<Body>\n<Order orderid=\”{2}\” express_type=\”1\”  j_company=\”{3}\”  j_contact=\”{4}\” j_tel=\”{5}\”  j_address=\”{6}\” d_company=\”{7}\” d_contact=\”{8}\” d_tel=\”{9}\” d_address=\”{10}\”  parcel_quantity=\”{11}\”  pay_method=\”1\” custid=\”{12}\”  cargo_total_weight=\”{13}\”  sendstarttime=\”{14}\”  remark=\”备注\” j_province=\”{15}\”  j_city=\”{16}\” d_province=\”{17}\” d_city=\”{18}\”>\n<Cargo name=\”大闸蟹\” unit=\”个\”></Cargo>\n</Order>\n</Body>\n</Request>”, sf_monthcode, sf_monthpwd, sf_orderid, j_company, j_contact, j_tel, j_address, d_company, d_contact, d_tel, d_address, parcel_quantity, custid, cargo_weight, sendstarttime, j_province, j_city, d_province, d_city);

}

}

}

else

{

sf_request = string.Format(“<Request service=\”OrderService\” lang=\”zh-CN\”>\n<Head>{0},{1}</Head>\n<Body>\n<Order orderid=\”{2}\” express_type=\”1\”  j_company=\”{3}\”  j_contact=\”{4}\” j_tel=\”{5}\”  j_address=\”{6}\” d_company=\”{7}\” d_contact=\”{8}\” d_tel=\”{9}\” d_address=\”{10}\”  parcel_quantity=\”{11}\”  pay_method=\”1\” custid=\”{12}\”  cargo_total_weight=\”{13}\”  sendstarttime=\”{14}\”  remark=\”备注\” j_province=\”{15}\”  j_city=\”{16}\” d_province=\”{17}\” d_city=\”{18}\”>\n<Cargo name=\”大闸蟹\” unit=\”个\”></Cargo>\n</Order>\n</Body>\n</Request>”, sf_monthcode, sf_monthpwd, sf_orderid, j_company, j_contact, j_tel, j_address, d_company, d_contact, d_tel, d_address, parcel_quantity, custid, cargo_weight, sendstarttime, j_province, j_city, d_province, d_city);

}

 

string result = sf_webservice.sfexpressService(sf_request);

 

StreamWriter sw = new StreamWriter(“data.txt”,true);

sw.WriteLine(sf_request);

sw.WriteLine(result);

sw.Close();

 

 

XmlDocument domChild = new XmlDocument();

XmlDocument dom = new XmlDocument();

dom.LoadXml(result);

int IsOk = 0;

string descode = “”;

string mailno = “”;

string origincode = “”;

string retError = “”;

string filter_result=””;

foreach (XmlNode xn in dom.DocumentElement.ChildNodes)

{

if (xn.Name == “Head”)

{

if (xn.InnerText == “OK”)

{//下单成功

IsOk = 1;

}

else

{

IsOk = 0;

}

}

if (xn.Name == “Body”)

{

domChild.LoadXml(xn.InnerXml);

if (IsOk == 1)

{

foreach (XmlAttribute att in domChild.DocumentElement.Attributes)

{

if (att.Name == “destcode”)

descode = att.Value;

if (att.Name == “mailno”)

mailno = att.Value;

if (att.Name == “origincode”)

origincode = att.Value;

if (att.Name == “filter_result”)

filter_result = att.Value;

}

if (filter_result == “1”)

{

sqlCmd = string.Format(“update sales set sales_is_add_express=1,sales_add_express_date='{0}’,sales_express_number='{1}’,sf_mdd_code='{2}’,sales_is_getexpress_from_sf=1,sales_yjd_code='{3}’, sales_weight='{4}’ where sales_guid='{5}'”, System.DateTime.Now.ToString(ForSetting.datetimefmt), “人工确认”, descode, origincode, cargo_weight, orderid);

}

else if (filter_result == “2”)

{

sqlCmd = string.Format(“update sales set sales_is_add_express=1,sales_add_express_date='{0}’,sales_express_number='{1}’,sf_mdd_code='{2}’,sales_is_getexpress_from_sf=1,sales_yjd_code='{3}’, sales_weight='{4}’ where sales_guid='{5}'”, System.DateTime.Now.ToString(ForSetting.datetimefmt), mailno, descode, origincode, cargo_weight, orderid);

}

else if (filter_result == “3”)

{

sqlCmd = string.Format(“update sales set sales_is_add_express=1,sales_add_express_date='{0}’,sales_express_number='{1}’,sf_mdd_code='{2}’,sales_is_getexpress_from_sf=1,sales_yjd_code='{3}’, sales_weight='{4}’ where sales_guid='{5}'”, System.DateTime.Now.ToString(ForSetting.datetimefmt), “不可以派送”, descode, origincode, cargo_weight, orderid);

 

}

if (!ForDbHelper.ExecSqlCmd(sqlCmd))

{

MessageBox.Show(“错误信息,请截屏发给瑞信:” + ForDbHelper.DB_ERROR);

return;

}

 

}

}

if (xn.Name == “ERROR”)

{

mailno = xn.InnerText;

sqlCmd = string.Format(“update sales set sales_is_add_express=1,sales_add_express_date='{0}’,sales_express_number='{1}’,sales_is_getexpress_from_sf=2 where sales_guid='{2}'”, System.DateTime.Now.ToString(ForSetting.datetimefmt), mailno, orderid);

if (!ForDbHelper.ExecSqlCmd(sqlCmd))

{

MessageBox.Show(“错误信息,请截屏发给瑞信:” + retError);

return;

}

 

 

}

}

}

}

}

}

catch (Exception ex)

{

MessageBox.Show(“错误发生(0x6201609),您可以将该错误截屏发给瑞信(QQ:251665710)” + ex.Message);

}

}

联系我们

苏州瑞信防伪科技有限公司

联系人:郭先生

联系方式:137-7603-6517

联系地址:泰山路2号博济科技产业园C幢一楼

主营项目:产品防伪、防窜货(防串货)、溯源、微信二维码防伪防串货,卡券信息化管理领域

服务项目

苏州瑞信防伪科技有限公司