| | |
| | | private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; |
| | | private readonly ICoreCmsPlanOrderServices _planOrderServices; |
| | | |
| | | |
| | | private IUnitOfWork _unitOfWork; |
| | | |
| | | public CoreCmsOrderServices(ICoreCmsOrderRepository dal |
| | |
| | | order.shipAddress = userShipInfo.street + " " + userShipInfo.address; |
| | | order.shipName = userShipInfo.name; |
| | | order.shipMobile = userShipInfo.mobile; |
| | | order.shipCoordinate = userShipInfo.latitude + "," + userShipInfo.longitude; |
| | | |
| | | var ship = await _shipServices.GetShip(userShipInfo.areaId); |
| | | if (ship != null) |
| | |
| | | order.aftersalesItem = await _billAftersalesServices.QueryListByClauseAsync(p => p.orderId == order.orderId); |
| | | //发货单 |
| | | order.delivery = await _billDeliveryServices.QueryListByClauseAsync(p => p.orderId == order.orderId); |
| | | |
| | | if (order.delivery != null && order.delivery.Any()) |
| | | { |
| | | foreach (var item in order.delivery) |
| | | { |
| | | if (item.logiCode == "Distributor") |
| | | { |
| | | //是供应商送货 |
| | | var ds= await _unitOfWork.GetDbClient().Queryable<CoreCmsDistribution>().Where(x => x.id == item.sendDistributionID).FirstAsync(); |
| | | if(ds==null) |
| | | { |
| | | item.logiName = "经销商配送,但是经销商已经退出或者不存在"; |
| | | } |
| | | else |
| | | { |
| | | item.logiName = $"经销商配送({ds.schoolName}--{ds.name})"; |
| | | } |
| | | item.distributionAcceptStr = item.sendDistributionAccept?.GetDescription() ?? "经销商未确认接受配送"; |
| | | |
| | | } |
| | | else |
| | | { |
| | | var outFirstAsync = await _logisticsServices.QueryByClauseAsync(p => p.logiCode == item.logiCode); |
| | | item.logiName = outFirstAsync != null ? outFirstAsync.logiName : item.logiCode; |
| | | } |
| | | } |
| | | } |
| | | //获取提货门店 |
| | |
| | | shipMobile = orderInfo[0].shipMobile, |
| | | logisticsId = orderInfo[0].logisticsId, |
| | | logisticsName = orderInfo[0].logisticsName, |
| | | Coordinate= orderInfo[0].shipCoordinate, |
| | | items = new List<CoreCmsOrderItem>(), |
| | | orders = orderInfo //把订单信息冗余上去 |
| | | }; |
| | |
| | | //是否有警告 |
| | | if (string.IsNullOrEmpty(jm.msg)) |
| | | { |
| | | jm.msg = "请注意!合并发货订单中存在:" + jm.msg + "。确定发货吗?"; |
| | | //多地址多用户禁止 合并发货 20240605 |
| | | |
| | | jm.msg = jm.msg + "。不可合并发货"; |
| | | jm.status = false; |
| | | return jm; |
| | | // jm.msg = "请注意!合并发货订单中存在:" + jm.msg + "。确定发货吗?"; |
| | | } |
| | | jm.status = true; |
| | | jm.data = newOrder; |
| | |
| | | /// <param name="deliveryCompanyId">第三方对接物流编码</param> |
| | | /// <returns></returns> |
| | | public async Task<WebApiCallBack> BatchShip(string[] ids, string logiCode, string logiNo, |
| | | Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo, int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "") |
| | | Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo, int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "", int? sendDistributionID = null) |
| | | { |
| | | |
| | | var result = await _billDeliveryServices.BatchShip(ids, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo, deliveryCompanyId); |
| | | var result = await _billDeliveryServices.BatchShip(ids, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo, deliveryCompanyId,sendDistributionID); |
| | | return result; |
| | | |
| | | } |
| | |
| | | /// <param name="deliveryCompanyId">第三方对接物流编码</param> |
| | | /// <returns></returns> |
| | | public async Task<WebApiCallBack> Ship(string orderId, string logiCode, string logiNo, |
| | | Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo, int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "") |
| | | Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo, int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "", int? sendDistributionID = null) |
| | | { |
| | | var result = await _billDeliveryServices.Ship(orderId, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo, deliveryCompanyId); |
| | | var result = await _billDeliveryServices.Ship(orderId, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo, deliveryCompanyId,sendDistributionID); |
| | | return result; |
| | | |
| | | } |