Ejemplo n.º 1
0
        /// <summary>
        /// 修改快递单号
        /// </summary>
        /// <param name="epId"></param>
        /// <param name="logistic">快递单号</param>
        /// <returns></returns>
        public bool UpdateLogistic(int epId, string logistic)
        {
            var model = this.ExchangePersonRepository.Find(ep => ep.Id == epId);

            model.LogisticCode = logistic;
            //提交到快递鸟
            KdGoldCore.OrderTracesSubByJson(logistic);

            return(this.ExchangePersonRepository.Update(model));
        }
Ejemplo n.º 2
0
        public async Task <object> Get(string code)
        {
            MessageBase2        result      = new MessageBase2();
            string              json        = KdGoldCore.GetOrderTraces(code);
            var                 jo          = JObject.Parse(json);
            LogisticResultModel resultModel = new LogisticResultModel()
            {
                LogisticCode = code,
                ShipperCode  = jo["data"]["company"]["fullname"].ToString(),
                State        = await _sysParaService.GetTextAsync("logisticState", jo["data"]["info"]["state"].ToString())
            };

            resultModel.Accept = new List <KeyValuePair <string, string> >();
            foreach (JToken jt in jo["data"]["info"]["context"])
            {
                resultModel.Accept.Add(new KeyValuePair <string, string>(DateTimeHelper.ConvertDateTime(jt["time"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"), jt["desc"].ToString()));
            }

            resultModel.LogisticPhone = "1234567891";
            result.Data = resultModel;

            //var dtoList = _logisticService.FindList(code);
            //if (dtoList.Count>0)
            //{
            //    LogisticResultModel resultModel = new LogisticResultModel()
            //    {
            //        LogisticCode = dtoList[0].LogisticCode,
            //        ShipperCode = dtoList[0].ShipperCode,
            //        State = dtoList[0].StateText
            //    };
            //    resultModel.Accept = new List<KeyValuePair<string, string>>();
            //    foreach (LogisticDto dto in dtoList)
            //    {
            //        resultModel.Accept.Add(new KeyValuePair<string, string>(dto.AcceptTime.ToString("yyyy-MM-dd HH:mm:ss"), dto.AcceptStation));
            //    }
            //    resultModel.LogisticPhone = "1234567891";
            //    result.Data = resultModel;
            //}



            return(result);
        }