| | |
| | | using CoreCms.Net.Configuration; |
| | | using CoreCms.Net.Filter; |
| | | using CoreCms.Net.IServices; |
| | | using CoreCms.Net.IServices.baifenbingfa; |
| | | using CoreCms.Net.Loging; |
| | | using CoreCms.Net.Model.Entities; |
| | | using CoreCms.Net.Model.Entities.Expression; |
| | | using CoreCms.Net.Model.FromBody; |
| | | using CoreCms.Net.Model.ViewModels.DTO; |
| | | using CoreCms.Net.Model.ViewModels.Excel; |
| | | using CoreCms.Net.Model.ViewModels.UI; |
| | | using CoreCms.Net.Utility.Extensions; |
| | |
| | | |
| | | |
| | | private readonly ICoreCmsOrderItemServices _orderItemServices; |
| | | |
| | | private readonly IBfbfComAPIService _bfbfServices; |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | , ICoreCmsLogisticsServices logisticsServices |
| | | , ICoreCmsBillPaymentsServices billPaymentsServices |
| | | , ICoreCmsPaymentsServices paymentsServices |
| | | , ICoreCmsSettingServices settingServices, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, IRedisOperationRepository redisOperationRepository, ICoreCmsBillDeliveryServices billDeliveryServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsOrderItemServices orderItemServices, IWeChatShippingDeliveryServices weChatShippingDeliveryServices) |
| | | , ICoreCmsSettingServices settingServices |
| | | , ICoreCmsUserWeChatInfoServices userWeChatInfoServices |
| | | , IRedisOperationRepository redisOperationRepository |
| | | , ICoreCmsBillDeliveryServices billDeliveryServices |
| | | , IWeChatApiHttpClientFactory weChatApiHttpClientFactory |
| | | , ICoreCmsOrderItemServices orderItemServices |
| | | , IWeChatShippingDeliveryServices weChatShippingDeliveryServices |
| | | , IBfbfComAPIService bfbfComAPIService) |
| | | { |
| | | _webHostEnvironment = webHostEnvironment; |
| | | _coreCmsOrderServices = coreCmsOrderServices; |
| | |
| | | _weChatApiHttpClientFactory = weChatApiHttpClientFactory; |
| | | _orderItemServices = orderItemServices; |
| | | _weChatShippingDeliveryServices = weChatShippingDeliveryServices; |
| | | _bfbfServices = bfbfComAPIService; |
| | | } |
| | | |
| | | #region 获取列表============================================================ |
| | |
| | | var storeList = await _storeServices.QueryAsync(); |
| | | |
| | | var logistics = await _logisticsServices.QueryListByClauseAsync(p => p.isDelete == false); |
| | | logistics.Add(new CoreCmsLogistics |
| | | { |
| | | id = int.MaxValue, |
| | | logiCode = "Distributor", |
| | | logiName = "校园代理配送", |
| | | sort = -1, |
| | | |
| | | }); |
| | | |
| | | logistics = logistics.OrderBy(x => x.sort).ToList(); |
| | | var deliveryCompany = await _weChatShippingDeliveryServices.GetCaChe(); |
| | | var result = await _coreCmsOrderServices.GetOrderShipInfo(entity.id); |
| | | if (!result.status) |
| | |
| | | jm.msg = result.msg; |
| | | return jm; |
| | | } |
| | | string lat = ""; |
| | | try |
| | | { |
| | | lat = (result.data as AdminOrderShipResult).Coordinate; |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | lat = ""; |
| | | } |
| | | List<DistributorSort> Distributors = new List<DistributorSort>(); |
| | | if (!string.IsNullOrEmpty(lat)) |
| | | //走校园代理 |
| | | { |
| | | string[] latlist= lat.Split(','); |
| | | if (latlist.Length == 2) |
| | | { |
| | | try |
| | | { |
| | | var ProductsIds = await _bfbfServices.GetOderProductsIDs(entity.id); |
| | | Distributors = await _bfbfServices.GetDistributorsList(ProductsIds); |
| | | //Distributors = _bfbfServices.orderedDistributors(Distributors, latlist[0], latlist[1]); |
| | | |
| | | } |
| | | catch (Exception) |
| | | { |
| | | Distributors = new List<DistributorSort>(); |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | if (storeList.Any()) |
| | | { |
| | | foreach (var store in storeList) |
| | |
| | | deliveryCompany, |
| | | storeList, |
| | | logistics, |
| | | Distributors |
| | | }; |
| | | |
| | | return jm; |
| | |
| | | public async Task<AdminUiCallBack> DoShip([FromBody] AdminOrderShipPost entity) |
| | | { |
| | | var jm = new AdminUiCallBack(); |
| | | if (entity.logiCode== "Distributor") |
| | | //如果选择了校园代理发货 |
| | | { |
| | | if (entity.SendDistributionID == null && entity.SendDistributionID == 0) |
| | | { |
| | | jm.code= 1; |
| | | jm.msg = "必须选择一个校园代理配送"; |
| | | return jm; |
| | | } |
| | | } |
| | | |
| | | |
| | | WebApiCallBack result; |
| | | if (entity.orderId.Contains(",")) |
| | | { |
| | | var ids = entity.orderId.Split(","); |
| | | result = await _coreCmsOrderServices.BatchShip(ids, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId); |
| | | result = await _coreCmsOrderServices.BatchShip(ids, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId,entity.SendDistributionID); |
| | | |
| | | if (result.status) |
| | | { |
| | |
| | | //依次推入队列. |
| | | foreach (var item in orderPaymentIds) |
| | | { |
| | | //经销商发货不处理发货信息 是应该作为同城处理?还是不处理,需要运行时研究 |
| | | if(entity.logiCode != "Distributor") |
| | | await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, item.paymentId); |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | result = await _coreCmsOrderServices.Ship(entity.orderId, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId); |
| | | result = await _coreCmsOrderServices.Ship(entity.orderId, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId,entity.SendDistributionID); |
| | | |
| | | //微信发货信息管理API发货 |
| | | if (result.status && await _billPaymentsServices.QueryByClauseAsync(p => p.sourceId == entity.orderId && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed) is { } paymentInfo) |
| | | { |
| | | await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, paymentInfo.paymentId); |
| | | //经销商发货不处理发货信息 |
| | | if (entity.logiCode != "Distributor") |
| | | await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, paymentInfo.paymentId); |
| | | } |
| | | |
| | | } |
| | |
| | | return jm; |
| | | } |
| | | jm.code = result.status ? 0 : 1; |
| | | var CmsOrder = result.data as CoreCmsOrder; |
| | | if(CmsOrder == null) |
| | | { |
| | | jm.msg = "不存在此信息"; |
| | | return jm; |
| | | } |
| | | //剔除经销商取消的物流信息 |
| | | CmsOrder.delivery = CmsOrder.delivery.Where(x => x.logiCode != "Distributor" || (x.logiCode == "Distributor" && x.sendDistributionAccept == sendDistributionAcceptType.Accepted)).ToList(); |
| | | |
| | | |
| | | var allConfigs = await _settingServices.GetConfigDictionaries(); |
| | | var allConfigs = await _settingServices.GetConfigDictionaries(); |
| | | |
| | | var shopName = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShopName); |
| | | var shopMobile = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShopMobile); |