//修改运单出仓运输方式,修改出仓信息 // Add By zhengosng //Time:2014-09-11 public ResponseResult UpdateOutStorageInfo(string outStorageId, int outshippingMethodId, string outshippingMethodName, string venderCode, string remark) { var result = new ResponseResult(); result.Result = false; try { var wayBillList = _wayBillInfoRepository.GetList(p => p.OutStorageID == outStorageId); var vender = _freightService.GetVender(venderCode); //判断是否配置了相应的出仓渠道 if (vender != null) { int inShippingMethodId = wayBillList[0].InShippingMethodID ?? 0; var deliveryChannelConfiguration = _deliveryChannelConfigurationRepository.GetList(p => p.InShippingMethodId == inShippingMethodId && p.VenderId == vender.VenderId && p.OutShippingMethodId == outshippingMethodId).FirstOrDefault(); if (deliveryChannelConfiguration == null) { result.Result = false; result.Message = wayBillList[0].InShippingMethodName + "未配置相应的发货运输渠道!"; return(result); } } else { result.Result = false; result.Message = "服务商出差!"; return(result); } //修改运单出仓运输方式 wayBillList.ForEach(p => { p.OutShippingMethodID = outshippingMethodId; p.OutShippingMethodName = outshippingMethodName; p.VenderCode = venderCode; _wayBillInfoRepository.Modify(p); }); //修改出仓信息 var outStorageInfo = _outStorageInfoRepository.Get(outStorageId); if (outStorageInfo != null && vender != null) { outStorageInfo.LastUpdatedBy = _workContext.User.UserUame; outStorageInfo.LastUpdatedOn = DateTime.Now; outStorageInfo.VenderCode = vender.Code; outStorageInfo.VenderName = vender.Name; outStorageInfo.VenderName = remark; _outStorageInfoRepository.Modify(outStorageInfo); } _wayBillInfoRepository.UnitOfWork.Commit(); _outStorageInfoRepository.UnitOfWork.Commit(); result.Result = true; } catch (Exception ex) { Log.Exception(ex); result.Result = false; } return(result); }