public async Task <object> Post(string dataSign, string requestType, string requestData) { LogisticViewModel model = JsonConvert.DeserializeObject <LogisticViewModel>(requestData); foreach (RequestData data in model.Data) { LogisticDto dto = new LogisticDto() { ShipperCode = data.ShipperCode, EstimatedDeliveryTime = data.EstimatedDeliveryTime, LogisticCode = data.LogisticCode, PickerInfo = data.PickerInfo, SenderInfo = data.SenderInfo, State = data.State.ToInt32() }; foreach (Traces traces in data.Traces) { dto.AcceptStation = traces.AcceptStation; dto.AcceptTime = traces.AcceptTime.ToDateTime(); dto.Remark = traces.Remark; await _logisticService.AddAsync(dto); } } IDictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("EBusinessID", KdGoldConfig.EBusinessId); dic.Add("UpdateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); dic.Add("Success", true); dic.Add("Reason", ""); return(dic); }
/// <summary> /// 添加物流信息 /// </summary> /// <param name="dto"></param> public async Task AddAsync(LogisticDto dto) { bool b = await this.LogisticRepository.ExistAsync(l => l.LogisticCode == dto.LogisticCode && l.AcceptStation == dto.AcceptStation && l.State == dto.State); if (!b) { var model = new Logistic() { AcceptStation = dto.AcceptStation, AcceptTime = dto.AcceptTime, AddTime = DateTime.Now, EstimatedDeliveryTime = dto.EstimatedDeliveryTime, LogisticCode = dto.LogisticCode, PickerInfo = dto.PickerInfo, Remark = dto.Remark, SenderInfo = dto.SenderInfo, ShipperCode = dto.ShipperCode, State = dto.State, Status = 1 }; model = await this.LogisticRepository.AddAsync(model); } }