예제 #1
0
 /// <summary>
 /// 按快递单号获取快递路由信息。
 /// </summary>
 /// <returns></returns>
 public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <Jinher.AMP.BTP.Deploy.CustomDTO.OrderExpressRouteExtendDTO> GetExpressRouteByExpNo(Jinher.AMP.BTP.Deploy.OrderExpressRouteDTO express)
 {
     base.Do();
     return(this.Command.GetExpressRouteByExpNo(express));
 }
예제 #2
0
 /// <summary>
 /// 修改快递信息
 /// </summary>
 /// <returns></returns>
 public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO UpdateExpressRoute(Jinher.AMP.BTP.Deploy.OrderExpressRouteDTO model)
 {
     base.Do();
     return(this.Command.UpdateExpressRoute(model));
 }
예제 #3
0
        /// <summary>
        /// 按快递单号获取快递路由信息。
        /// </summary>
        /// <returns></returns>
        public ResultDTO <OrderExpressRouteExtendDTO> GetExpressRouteByExpNoExt(Jinher.AMP.BTP.Deploy.OrderExpressRouteDTO express)
        {
            ResultDTO <OrderExpressRouteExtendDTO> result = new ResultDTO <OrderExpressRouteExtendDTO>();

            try
            {
                if (express == null)
                {
                    result.ResultCode = 1;
                    result.Message    = "参数错误,参数不能为空!";
                    return(result);
                }
                else if (string.IsNullOrWhiteSpace(express.ShipExpCo))
                {
                    result.ResultCode = 2;
                    result.Message    = "参数错误,物流公司名称不能为空!";
                    return(result);
                }
                else if (string.IsNullOrWhiteSpace(express.ExpOrderNo))
                {
                    result.ResultCode = 3;
                    result.Message    = "参数错误,运单号不能为空!";
                    return(result);
                }

                var cname  = express.ShipExpCo.Replace("快递", "").Replace("速递", "").Replace("物流", "").Replace("配送", "").Replace("货运", "").Replace("快运", "").Replace("速运", "").ToUpper();
                var ocInfo = ExpressCode.AllExpCodes.Where(ec => ec.ExpCompanyName.ToUpper().Contains(cname));
                if (!ocInfo.Any())
                {
                    result.ResultCode = 4;
                    result.Message    = "暂不支持该物流公司的快递单号查询!";
                    return(result);
                }
                express.ShipperCode = ocInfo.First().ExpCode;

                var oerQuery = (from oer in OrderExpressRoute.ObjectSet()
                                where oer.ShipperCode == express.ShipperCode && oer.ExpOrderNo == express.ExpOrderNo
                                select oer).FirstOrDefault();
                if (oerQuery == null)
                {
                    return(result);
                }
                OrderExpressRouteExtendDTO oerDto = new OrderExpressRouteExtendDTO();
                oerDto.FillWith(oerQuery);
                var etQuery = (from et in ExpressTrace.ObjectSet()
                               where et.ExpRouteId == oerQuery.Id
                               orderby et.AcceptTime descending
                               select et).ToList();
                if (etQuery.Any())
                {
                    List <ExpressTraceDTO> oerList = etQuery.ConvertAll <ExpressTraceDTO>(exp => exp.ToEntityData());
                    oerDto.Traces = oerList;
                }
                result.Data = oerDto;
            }
            catch (Exception ex)
            {
                result.ResultCode = -1;
                result.Message    = string.Format("按快递单号获取快递路由信息异常,异常信息:{0}", ex);
                return(result);
            }
            return(result);
        }