Example #1
0
        /// <summary>
        /// 提交顺E宝成功
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool SubmitSuccess(SfOrderResponse model)
        {
            Log.Info("运单号{0},提交顺E宝成功".FormatWith(model.OrderId));
            if (model == null)
            {
                return(false);
            }
            if (model.OrderId.IsNullOrWhiteSpace())
            {
                return(false);
            }
            DbUtility dbUtility = new SqlDbUtility(_lmsCon);
            var       obj       = dbUtility.ExecuteScalar("exec P_CreateLithuaniaSuccessWayBill {0},{1},{2},{3},{4},{5},{6},{7},{8},{9}",
                                                          model.OrderId, _LithuaniaVenderCode, model.MailNo, model.OriginCode ?? "", model.DestCode ?? "",
                                                          model.AgentMailNo ?? "", model.Remark ?? "", 2, model.FilterResult ?? "", model.TrackNumber ?? "");

            return(obj.ToString() == "1");
        }
Example #2
0
        /// <summary>
        /// 查询顺丰
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="authorization"></param>
        /// <returns></returns>
        public static SfOrderResponse SearchOrderInfo(string orderId, string authorization)
        {
            var         model          = new SfOrderResponse();
            string      strXml         = @"<Request service='OrderSearchService' lang='en'>
                                <Head>" + authorization + @"</Head>
                                <Body>
                                <OrderSearch orderid='" + orderId + @"' />
                                </Body>
                                </Request>
                                ";
            string      responseResult = SfCommonService(strXml);
            XmlDocument xdoc           = new XmlDocument();

            xdoc.LoadXml(responseResult);
            XmlNode root = xdoc.SelectSingleNode("/Response/Head");

            if (root != null && root.InnerText == "OK")
            {
                XmlNode o = xdoc.SelectSingleNode("/Response/Body/OrderSearchResponse");
                if (o != null && o.Attributes != null)
                {
                    if (o.Attributes["mailno"] != null)
                    {
                        model.MailNo = o.Attributes["mailno"].Value.Trim();
                    }
                    if (o.Attributes["remark"] != null)
                    {
                        model.Remark = o.Attributes["remark"].Value.Trim();
                    }
                    if (o.Attributes["origincode"] != null)
                    {
                        model.OriginCode = o.Attributes["origincode"].Value;
                    }
                    if (o.Attributes["destcode"] != null)
                    {
                        model.DestCode = o.Attributes["destcode"].Value;
                    }
                    if (o.Attributes["agent_mailno"] != null)
                    {
                        model.AgentMailNo = o.Attributes["agent_mailno"].Value.Trim();
                    }
                    if (o.Attributes["orderid"] != null)
                    {
                        model.OrderId = o.Attributes["orderid"].Value.Trim();
                    }
                    if (o.Attributes["filter_result"] != null)
                    {
                        model.FilterResult = o.Attributes["filter_result"].Value.Trim();
                    }
                    if (o.Attributes["return_tracking_no"] != null)
                    {
                        model.TrackNumber = o.Attributes["return_tracking_no"].Value.Trim();
                    }
                }
            }
            else if (root != null && root.InnerText == "ERR")
            {
                XmlNode err = xdoc.SelectSingleNode("/Response/ERROR");
                if (err != null && err.Attributes != null && err.Attributes["code"] != null)
                {
                    Log.Error("运单号为:{2}订单查询俄罗斯顺丰API错误代码为:{0},错误信息:{1}".FormatWith(err.Attributes["code"].Value, ErrorCode.ResourceManager
                                                                                  .GetString(err.Attributes["code"].Value).IsNullOrWhiteSpace() ? "[{0}]数据格式验证失败".FormatWith(err.Attributes["code"].Value) : "[{0}]{1}".FormatWith(err.Attributes["code"].Value, ErrorCode.ResourceManager
                                                                                                                                                                                                                                   .GetString(err.Attributes["code"].Value)),
                                                                                  orderId));
                }
            }
            return(model);
        }