| | |
| | | using System.Threading.Tasks; |
| | | using CoreCms.Net.Configuration; |
| | | using CoreCms.Net.Filter; |
| | | using CoreCms.Net.IRepository.UnitOfWork; |
| | | using CoreCms.Net.IServices; |
| | | using CoreCms.Net.Loging; |
| | | using CoreCms.Net.Model.Entities; |
| | |
| | | using CoreCms.Net.Model.ViewModels.UI; |
| | | using CoreCms.Net.Utility.Extensions; |
| | | using CoreCms.Net.Web.Admin.Infrastructure; |
| | | using DotLiquid.Util; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Hosting; |
| | | using Microsoft.AspNetCore.Mvc; |
| | |
| | | private readonly ICoreCmsBillDeliveryItemServices _itemServices; |
| | | private readonly ICoreCmsLogisticsServices _logisticsServices; |
| | | private readonly IWebHostEnvironment _webHostEnvironment; |
| | | private readonly IUnitOfWork _unitOfWork; |
| | | private readonly ICoreCmsDistributionOrderServices _coreCmsDistributionOrderServices; |
| | | |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | | public CoreCmsBillDeliveryController(IWebHostEnvironment webHostEnvironment, |
| | | ICoreCmsBillDeliveryServices coreCmsBillDeliveryServices, ICoreCmsAreaServices areaServices, |
| | | ICoreCmsBillDeliveryItemServices itemServices, ICoreCmsLogisticsServices logisticsServices) |
| | | ICoreCmsBillDeliveryItemServices itemServices |
| | | , ICoreCmsLogisticsServices logisticsServices |
| | | , IUnitOfWork sugarUnitOfWork, ICoreCmsDistributionOrderServices coreCmsDistributionOrderServices) |
| | | { |
| | | _webHostEnvironment = webHostEnvironment; |
| | | _coreCmsBillDeliveryServices = coreCmsBillDeliveryServices; |
| | | _areaServices = areaServices; |
| | | _itemServices = itemServices; |
| | | _logisticsServices = logisticsServices; |
| | | _unitOfWork = sugarUnitOfWork; |
| | | _coreCmsDistributionOrderServices = coreCmsDistributionOrderServices; |
| | | } |
| | | |
| | | #region 获取列表============================================================ |
| | |
| | | |
| | | if (!string.IsNullOrEmpty(item.logiCode)) |
| | | { |
| | | |
| | | if (item.logiCode == "Distributor") |
| | | { |
| | | //是供应商供货,那么需要获取供应商信息 |
| | | var dis = await _unitOfWork.GetDbClient().Queryable<CoreCmsDistribution>().Where(x => x.id == item.sendDistributionID).FirstAsync(); |
| | | if (dis != null) |
| | | item.logiName = $"分配给经销商发货({dis.name} -- {dis.schoolName})"; |
| | | } |
| | | else |
| | | { |
| | | var logiModel = logist.Find(p => p.logiCode == item.logiCode); |
| | | if (logiModel != null) item.logiName = logiModel.logiName; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (!string.IsNullOrEmpty(model.logiCode)) |
| | | { |
| | | var logiModel = await _logisticsServices.QueryByClauseAsync(p => p.logiCode == model.logiCode); |
| | | ; |
| | | if (logiModel != null) model.logiName = logiModel.logiName; |
| | | if (model.logiCode == "Distributor") |
| | | { |
| | | //是供应商供货,那么需要获取供应商信息 |
| | | var dis = await _unitOfWork.GetDbClient().Queryable<CoreCmsDistribution>().Where(x => x.id == model.sendDistributionID).FirstAsync(); |
| | | if (dis != null) |
| | | { |
| | | model.logiName = $"分配给经销商发货({dis.name} -- {dis.schoolName})"; |
| | | model.distributionAcceptStr = model.sendDistributionAccept?.GetDescription()??"未确认接受分配"; |
| | | } |
| | | |
| | | } |
| | | else |
| | | |
| | | { |
| | | var logiModel = await _logisticsServices.QueryByClauseAsync(p => p.logiCode == model.logiCode); |
| | | if (logiModel != null) model.logiName = logiModel.logiName; |
| | | } |
| | | |
| | | } |
| | | |
| | | var items = await _itemServices.QueryListByClauseAsync(p => p.deliveryId == model.deliveryId, |