| | |
| | | /// </summary> |
| | | public const string DistributionAchievementOder = "DistributionAchievementOder"; |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 增加经销商分配记录表 |
| | | /// </summary> |
| | | public const string AddDistributionSendOderMQ = "AddDistributionSendOderMQ"; |
| | | |
| | | /// <summary> |
| | | /// 修改经销商分配记录表分配记录 |
| | | /// </summary> |
| | | public const string ActiveDistributionSendOderMQ = "ActiveDistributionSendOderMQ"; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | new CommonKeyValues() {sDescription = "本地同城配送", sValue = "无", sKey = "benditongcheng"}, |
| | | new CommonKeyValues() {sDescription = "本地上门自提", sValue = "无", sKey = "shangmenziti"}, |
| | | new CommonKeyValues() {sDescription = "供应商送货", sValue = "无", sKey = "Distributor"}, |
| | | }; |
| | | return list; |
| | | } |
New file |
| | |
| | | using CoreCms.Net.Model.Entities; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace CoreCms.Net.DTO |
| | | { |
| | | /// <summary> |
| | | /// ActiveDistributionSendOder mq模型 |
| | | /// </summary> |
| | | public class ActiveDistributionSendOderMQ |
| | | { |
| | | /// <summary> |
| | | /// 订单状态 |
| | | /// </summary> |
| | | public sendDistributionAcceptType? SendOderActive { get; set; } |
| | | /// <summary> |
| | | /// 描述 |
| | | /// </summary> |
| | | public string? Dec { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 发送单ID |
| | | /// </summary> |
| | | public string deliveryID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 所属用户ID |
| | | /// </summary> |
| | | public int userID { get; set; } |
| | | |
| | | } |
| | | } |
| | |
| | | <Nullable>enable</Nullable> |
| | | </PropertyGroup> |
| | | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\CoreCms.Net.Model\CoreCms.Net.Model.csproj" /> |
| | | </ItemGroup> |
| | | |
| | | </Project> |
| | |
| | | /// <returns></returns> |
| | | Task<WebApiCallBack> BatchShip(string[] orderId, string logiCode, string logiNo, Dictionary<int, int> items, |
| | | int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "", |
| | | string memo = "", string deliveryCompanyId = ""); |
| | | string memo = "", string deliveryCompanyId = "", int? sendDistributionID = null); |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | Task<WebApiCallBack> Ship(string orderId, string logiCode, string logiNo, Dictionary<int, int> items, |
| | | int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "", |
| | | string memo = "", string deliveryCompanyId = ""); |
| | | string memo = "", string deliveryCompanyId = "", int? sendDistributionID = null); |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="storeId">店铺收货地址</param> |
| | | /// <param name="shipAreaId">省市区id</param> |
| | | /// <param name="deliveryCompanyId">第三方对接物流编码</param> |
| | | /// <param name="deliveryCompanyId">送货经销商ID</param> |
| | | /// <returns></returns> |
| | | 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 = ""); |
| | | int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "",int? sendDistributionID=null); |
| | | |
| | | /// <summary> |
| | | /// 订单发货 |
| | |
| | | /// <param name="storeId">店铺收货地址</param> |
| | | /// <param name="shipAreaId">省市区id</param> |
| | | /// <param name="deliveryCompanyId">第三方对接物流编码</param> |
| | | /// <param name="sendDistributionID">送货经销商ID</param> |
| | | /// <returns></returns> |
| | | Task<WebApiCallBack> Ship(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 = ""); |
| | | int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "", int? sendDistributionID = null); |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="count"></param> |
| | | /// <returns></returns> |
| | | public decimal CommandCustomizable(int count); |
| | | decimal CommandCustomizable(int count); |
| | | |
| | | /// <summary> |
| | | /// 根据经纬度对列表进行远近距离排序 |
| | | /// </summary> |
| | | /// <param name="DataList"></param> |
| | | /// <param name="longitude"></param> |
| | | /// <param name="latitude"></param> |
| | | /// <returns></returns> |
| | | List<DistributorSort> orderedDistributors(List<DistributorSort> DataList,string longitude,string latitude); |
| | | |
| | | /// <summary> |
| | | /// 获取校园代理列表 根据货品ID获取已经铺货的校园代理列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | Task<List<DistributorSort>> GetDistributorsList(List<int > PIds); |
| | | /// <summary> |
| | | /// 获取订单的所有货品ID |
| | | /// </summary> |
| | | /// <param name="OderIds"></param> |
| | | /// <returns></returns> |
| | | public Task<List<int>> GetOderProductsIDs(string[] OderIds); |
| | | |
| | | } |
| | | |
| | | public class DistributorSort |
| | | { |
| | | public int id { get; set; } |
| | | public string name { get; set; } |
| | | public string longitude { get; set; } |
| | | public string latitude { get; set; } |
| | | } |
| | | |
| | | |
New file |
| | |
| | | using CoreCms.Net.Model.Entities; |
| | | using CoreCms.Net.Model.ViewModels.Basics; |
| | | using CoreCms.Net.Model.ViewModels.UI; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using static CoreCms.Net.Configuration.GlobalEnumVars; |
| | | |
| | | namespace CoreCms.Net.IServices.baifenbingfa |
| | | { |
| | | /// <summary> |
| | | /// 经销商发货相关服务 |
| | | /// </summary> |
| | | public interface IDistributorDeliveryServices |
| | | { |
| | | /// <summary> |
| | | /// 获取经销商发货未处理订单 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | Task< int> GetNoAcceptedDeliveryCount(); |
| | | |
| | | /// <summary> |
| | | /// 是否显示经销商菜单项 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | Task<bool> GetShowDelivery(); |
| | | |
| | | /// <summary> |
| | | /// 获取所有详单 |
| | | /// </summary> |
| | | /// <param name="Param"></param> |
| | | /// <returns> |
| | | /// </returns> |
| | | Task<(List<CoreCmsBillDelivery>, int)> GetDeliveryList(GetDeliveryListPost Param); |
| | | /// <summary> |
| | | /// 设置订单状态 |
| | | /// </summary> |
| | | /// <param name="acceptType"> 同意类型</param> |
| | | /// <param name="DeliveryID">配送单ID</param> |
| | | /// <param name="CancelledDec">取消原因</param> |
| | | /// <returns></returns> |
| | | Task<WebApiCallBack> SetDeliveryAccepted(sendDistributionAcceptType acceptType,string DeliveryID,string CancelledDec= null); |
| | | } |
| | | |
| | | |
| | | public class GetDeliveryListPost |
| | | { |
| | | /// <summary> |
| | | /// 每页数量 |
| | | /// </summary> |
| | | public int limit { get; set; } = 5; |
| | | |
| | | /// <summary> |
| | | /// 页码 |
| | | /// </summary> |
| | | public int page { get; set; } = 1; |
| | | |
| | | /// <summary> |
| | | /// 经销商确认状态 |
| | | /// </summary> |
| | | public sendDistributionAcceptType? distributionAcceptStatus { get; set; } |
| | | /// <summary> |
| | | /// 订单状态 |
| | | /// </summary> |
| | | public BillDeliveryStatus? Status { get; set; } |
| | | } |
| | | } |
| | |
| | | * Description: 暂无 |
| | | ***********************************************************************/ |
| | | |
| | | using Chuanyin.Attribute; |
| | | using SqlSugar; |
| | | using System.ComponentModel; |
| | | using System.ComponentModel.DataAnnotations; |
| | |
| | | { |
| | | /// <summary> |
| | | /// 发货单表 |
| | | /// </summary> |
| | | /// </summary> |
| | | public partial class CoreCmsBillDelivery |
| | | { |
| | | /// <summary> |
| | |
| | | |
| | | |
| | | public System.DateTime? updateTime { get; set; } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// SendDistributionID 发货经销商ID |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "发货经销商ID")] |
| | | public int? sendDistributionID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 送货代理商用户ID |
| | | /// </summary> |
| | | public int? sendDistributionUserID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// sendDistributionAccept 经销商发货确认状态 |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "经销商发货确认状态")] |
| | | public sendDistributionAcceptType? sendDistributionAccept { get; set; } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 供应商送货确认状态 |
| | | /// </summary> |
| | | public enum sendDistributionAcceptType |
| | | { |
| | | |
| | | /// <summary> |
| | | /// 订单已被创建,等待处理。 |
| | | /// </summary> |
| | | [Description("接受")] |
| | | Accepted, |
| | | |
| | | /// <summary> |
| | | /// 订单商品已打包,准备或已经发出。 |
| | | /// </summary> |
| | | [Description("发货")] |
| | | Shipped, |
| | | |
| | | /// <summary> |
| | | /// 订单商品已成功送达客户手中。 |
| | | /// </summary> |
| | | [Description("送达")] |
| | | Delivered, |
| | | |
| | | /// <summary> |
| | | /// 订单被用户或系统取消。 |
| | | /// </summary> |
| | | [Description("取消")] |
| | | Cancelled, |
| | | |
| | | /// <summary> |
| | | /// 订单处理超过了预定的时间限制,自动取消。 |
| | | /// </summary> |
| | | [Description("超时")] |
| | | TimedOut, |
| | | |
| | | /// <summary> |
| | | /// 等待确认接受 |
| | | /// </summary> |
| | | [Description("等待确认接受")] |
| | | NoAccted, |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | [SugarColumn(IsIgnore = true)] |
| | | public System.String shipAreaIdName { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 商品列表 |
| | | /// </summary> |
| | | [Navigate(NavigateType.OneToOne,nameof(orderId))] |
| | | public CoreCmsOrder? order { get; set; } |
| | | /// <summary> |
| | | /// sendDistributionAccept 经销商发货确认状态字符串描述 |
| | | /// </summary> |
| | | [SugarColumn(IsIgnore =true)] |
| | | public string distributionAcceptStr { get; set; } |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// 购物车表 |
| | | /// </summary> |
| | | [SqlCodeFirst] |
| | | |
| | | public class CoreCmsCart |
| | | { |
| | | /// <summary> |
| | |
| | | /// 经销商表 |
| | | /// </summary> |
| | | [SugarTable("CoreCmsDistribution",TableDescription = "经销商表")] |
| | | [SqlCodeFirst] |
| | | |
| | | public partial class CoreCmsDistribution |
| | | { |
| | | /// <summary> |
| | |
| | | [SugarColumn(ColumnDescription = "所属行业")] |
| | | public string profession { get; set; } |
| | | /// <summary> |
| | | /// 店铺做标牌 |
| | | /// 店铺定位 |
| | | /// </summary> |
| | | [Display(Name = "店铺定位")] |
| | | [SugarColumn(ColumnDescription = "店铺定位", IsNullable =true)] |
| | |
| | | /// <summary> |
| | | /// 货品表 |
| | | /// </summary> |
| | | [SqlCodeFirst] |
| | | |
| | | public partial class CoreCmsProducts |
| | | { |
| | | /// <summary> |
| | |
| | | * Description: 暂无 |
| | | ***********************************************************************/ |
| | | |
| | | using Chuanyin.Attribute; |
| | | using SqlSugar; |
| | | using System.ComponentModel; |
| | | using System.ComponentModel.DataAnnotations; |
| | |
| | | /// <summary> |
| | | /// 订单表 |
| | | /// </summary> |
| | | |
| | | public partial class CoreCmsOrder |
| | | { |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 配送方式名称 |
| | | /// </summary> |
| | | [Display(Name = "配送方式名称")] |
| | | |
| | | [Display(Name = "配送方式名称")] |
| | | |
| | | [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] |
| | | |
| | | [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] |
| | | |
| | | public System.String logisticsName { get; set; } |
| | | |
| | |
| | | |
| | | |
| | | public System.String shipAddress { get; set; } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 收货地址定位 |
| | | /// </summary> |
| | | [Display(Name = "收货地址定位")] |
| | | [SugarColumn(ColumnDescription = "收货地址定位",IsNullable = true)] |
| | | public System.String shipCoordinate { get; set; } |
| | | /// <summary> |
| | | /// 收货人姓名 |
| | | /// </summary> |
| | |
| | | /// 更新时间 |
| | | /// </summary> |
| | | [Display(Name = "更新时间")] |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public System.DateTime? updateTime { get; set; } |
| | | |
| | | |
| | |
| | | /// 计划订单id ALTER TABLE [CoreCmsOrder] ADD [planorderId] [nvarchar](255) NULL; |
| | | /// </summary> |
| | | [Display(Name = "计划订单id")] |
| | | |
| | | |
| | | [StringLength(maximumLength: 255, ErrorMessage = "{0}不能超过{1}字")] |
| | | [SugarColumn(IsNullable = true)] |
| | |
| | | /// <summary> |
| | | /// 订单明细表 |
| | | /// </summary> |
| | | [SugarTable("CoreCmsOrderItem",TableDescription = "订单明细表")] |
| | | [SqlCodeFirst] |
| | | [SugarTable("CoreCmsOrderItem",TableDescription = "订单明细表")] |
| | | public partial class CoreCmsOrderItem |
| | | { |
| | | /// <summary> |
| | |
| | | /// 订单详情 |
| | | /// </summary> |
| | | [SugarColumn(IsIgnore = true)] |
| | | |
| | | public List<CoreCmsOrderItem> items { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 子查询 |
| | | /// </summary> |
| | | [Navigate(NavigateType.OneToMany, nameof(CoreCmsOrderItem.orderId), nameof(orderId))] |
| | | public List<CoreCmsOrderItem> Orderitems { get; set; } |
| | | /// <summary> |
| | | /// 用户信息 |
| | | /// </summary> |
New file |
| | |
| | | using Chuanyin.Attribute; |
| | | using CoreCms.Net.Model.Entities.baseModel; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace CoreCms.Net.Model.Entities.baifenbingfa.DistributionSendOder |
| | | { |
| | | /// <summary> |
| | | /// 供应商发货配发记录 |
| | | /// </summary> |
| | | [SugarTable(TableDescription = "供应商发货配发记录")] |
| | | [SqlCodeFirst] |
| | | public class DistributionSendOder: BFBaseModel |
| | | { |
| | | /// <summary> |
| | | /// ID |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主键ID")] |
| | | public int id { get; set; } |
| | | /// <summary> |
| | | /// 分配供应商用户ID |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "分配供应商用户ID", IsNullable =true)] |
| | | public int? userID { get; set; } |
| | | /// <summary> |
| | | /// 分配供应商ID |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "分配供应商ID")] |
| | | public int distributionID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 分配时间 |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "分配时间", IsNullable = true)] |
| | | public DateTime? sendTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 确认时间 |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "确认时间", IsNullable = true)] |
| | | public DateTime? activeTime { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 原因 |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "原因", IsNullable = true)] |
| | | public string description { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 分配操作员ID |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "分配操作员ID", IsNullable = true)] |
| | | public int? sendMangerID { get; set; } |
| | | /// <summary> |
| | | /// 配送单ID |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "配送单Id")] |
| | | public string deliveryID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 配送状态 |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "配送状态",IsNullable =true)] |
| | | public sendDistributionAcceptType? sendDistributionAccept { get; set; } |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// 铺货 |
| | | /// </summary> |
| | | [SqlCodeFirst] |
| | | |
| | | public class Puhuo : BFBaseModel |
| | | { |
| | | /// <summary> |
| | |
| | | /// 备注 |
| | | /// </summary> |
| | | public string memo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 校园代理SendDistributionID |
| | | /// </summary> |
| | | public int? SendDistributionID { get; set; } |
| | | } |
| | | |
| | | |
| | |
| | | public string logisticsName { get; set; } |
| | | public List<CoreCmsOrderItem> items { get; set; } |
| | | public List<CoreCmsOrder> orders { get; set; } |
| | | /// <summary> |
| | | /// 定位信息,用逗号分割 |
| | | /// liao20240605 |
| | | /// </summary> |
| | | public string? Coordinate { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\CoreCms.Net.Caching\CoreCms.Net.Caching.csproj" /> |
| | | <ProjectReference Include="..\CoreCms.Net.Configuration\CoreCms.Net.Configuration.csproj" /> |
| | | <ProjectReference Include="..\CoreCms.Net.IRepository\CoreCms.Net.IRepository.csproj" /> |
| | | <ProjectReference Include="..\CoreCms.Net.IServices\CoreCms.Net.IServices.csproj" /> |
| | | <ProjectReference Include="..\CoreCms.Net.Loging\CoreCms.Net.Loging.csproj" /> |
| | | <ProjectReference Include="..\CoreCms.Net.WeChat.Service\CoreCms.Net.WeChat.Service.csproj" /> |
New file |
| | |
| | | using CoreCms.Net.Configuration; |
| | | using CoreCms.Net.DTO; |
| | | using CoreCms.Net.IRepository.UnitOfWork; |
| | | using CoreCms.Net.IServices; |
| | | using CoreCms.Net.Loging; |
| | | using CoreCms.Net.Model.Entities.baifenbingfa.DistributionSendOder; |
| | | using InitQ.Abstractions; |
| | | using InitQ.Attributes; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace CoreCms.Net.RedisMQ |
| | | { |
| | | /// <summary> |
| | | /// 供应商配送订单分配记录 |
| | | /// </summary> |
| | | public class DistributionSendOderMQ: IRedisSubscribe |
| | | { |
| | | private readonly IUnitOfWork _unitOfWork; |
| | | public DistributionSendOderMQ(IUnitOfWork unitOfWork) |
| | | { |
| | | _unitOfWork= unitOfWork; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 增加一个记录 |
| | | /// </summary> |
| | | /// <param name="message"></param> |
| | | [Subscribe(RedisMessageQueueKey.AddDistributionSendOderMQ)] |
| | | public async void AddDistributionSendOder(string message) |
| | | { |
| | | var Param = JsonConvert.DeserializeObject<DistributionSendOder>(message); |
| | | if(Param == null) { |
| | | |
| | | NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "AddDistributionSendOder 增加一个记录 处理失败", $"转换模型失败===》 {message}"); |
| | | return; |
| | | } |
| | | Param.createTime = DateTime.Now; |
| | | Param.createBy = "系统队列"; |
| | | |
| | | await _unitOfWork.GetDbClient().Insertable(Param).ExecuteCommandAsync(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 修改状态 |
| | | /// </summary> |
| | | /// <param name="message"></param> |
| | | [Subscribe(RedisMessageQueueKey.ActiveDistributionSendOderMQ)] |
| | | public async void ActiveDistributionSendOder(string message) |
| | | { |
| | | var Param = JsonConvert.DeserializeObject<ActiveDistributionSendOderMQ>(message); |
| | | if (Param == null) |
| | | { |
| | | |
| | | NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "ActiveDistributionSendOder 修改状态 处理失败", $"转换模型失败===》 {message}"); |
| | | return; |
| | | } |
| | | |
| | | var oder=await _unitOfWork.GetDbClient().Queryable<DistributionSendOder>().Where(x => x.deliveryID == Param.deliveryID && x.userID == Param.userID).FirstAsync(); |
| | | oder.upDataTime = DateTime.Now; |
| | | oder.upDataBy = "ActiveDistributionSendOder 队列"; |
| | | oder.description = Param.Dec; |
| | | oder.sendDistributionAccept= Param.SendOderActive; |
| | | |
| | | await _unitOfWork.GetDbClient().Updateable(Param).ExecuteCommandAsync(); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Threading.Tasks; |
| | | using CoreCms.Net.Auth.HttpContextUser; |
| | | using CoreCms.Net.Caching.AutoMate.RedisCache; |
| | | using CoreCms.Net.Configuration; |
| | | using CoreCms.Net.DTO; |
| | | using CoreCms.Net.IRepository; |
| | | using CoreCms.Net.IRepository.UnitOfWork; |
| | | using CoreCms.Net.IServices; |
| | | using CoreCms.Net.Loging; |
| | | using CoreCms.Net.Model.Entities; |
| | | using CoreCms.Net.Model.Entities.baifenbingfa.DistributionSendOder; |
| | | using CoreCms.Net.Model.ViewModels.Api; |
| | | using CoreCms.Net.Model.ViewModels.DTO; |
| | | using CoreCms.Net.Model.ViewModels.UI; |
| | | using CoreCms.Net.Utility.Helper; |
| | | using Essensoft.Paylink.Alipay.Domain; |
| | | using Flurl.Http; |
| | | using Microsoft.Extensions.DependencyInjection; |
| | | using Microsoft.Extensions.Hosting; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using static SKIT.FlurlHttpClient.Wechat.Api.Models.CgibinExpressDeliveryOpenMessageGetDeliveryListResponse.Types; |
| | | |
| | | |
| | | namespace CoreCms.Net.Services |
| | |
| | | private readonly IUnitOfWork _unitOfWork; |
| | | private readonly IServiceProvider _serviceProvider; |
| | | private readonly IRedisOperationRepository _redisOperationRepository; |
| | | private readonly ICoreCmsDistributionRepository _coreCmsDistributionRepository; |
| | | |
| | | private readonly IHttpContextUser _user; |
| | | |
| | | |
| | | public CoreCmsBillDeliveryServices( |
| | |
| | | , ICoreCmsStoreServices storeServices |
| | | , ICoreCmsBillDeliveryItemServices billDeliveryItemServices |
| | | , ICoreCmsOrderLogServices orderLogServices |
| | | , ICoreCmsSettingServices settingServices, IRedisOperationRepository redisOperationRepository) |
| | | , ICoreCmsSettingServices settingServices |
| | | , IRedisOperationRepository redisOperationRepository, |
| | | ICoreCmsDistributionRepository coreCmsDistributionRepository |
| | | , IHttpContextUser user) |
| | | { |
| | | this._dal = dal; |
| | | base.BaseDal = dal; |
| | |
| | | _orderLogServices = orderLogServices; |
| | | _settingServices = settingServices; |
| | | _redisOperationRepository = redisOperationRepository; |
| | | _coreCmsDistributionRepository = coreCmsDistributionRepository; |
| | | _user = user; |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | /// <param name="shipAddress">收货地址</param> |
| | | /// <param name="memo">发货描述</param> |
| | | /// <param name="deliveryCompanyId">第三方对接物流编码</param> |
| | | /// <param name="sendDistributionID">送货供应商ID</param> |
| | | /// <returns></returns> |
| | | public async Task<WebApiCallBack> BatchShip(string[] orderId, string logiCode, string logiNo, Dictionary<int, int> items, int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "", string memo = "", string deliveryCompanyId = "") |
| | | public async Task<WebApiCallBack> BatchShip(string[] orderId, string logiCode, string logiNo, Dictionary<int, int> items, int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "", string memo = "", string deliveryCompanyId = "", int? sendDistributionID = null) |
| | | { |
| | | using var container = _serviceProvider.CreateScope(); |
| | | var jm = new WebApiCallBack(); |
| | | |
| | | if(sendDistributionID > 0) |
| | | { |
| | | jm.msg = "经销商发货不支持批量发货"; |
| | | return jm; |
| | | } |
| | | var orderService = container.ServiceProvider.GetService<ICoreCmsOrderServices>(); |
| | | var stockServices = container.ServiceProvider.GetService<ICoreCmsStockServices>(); |
| | | //获取订单详情 |
| | |
| | | } |
| | | if (tNum < 1) |
| | | { |
| | | jm.msg = "请至少发生一件商品!"; |
| | | jm.msg = "请至少发一件商品!"; |
| | | return jm; |
| | | } |
| | | //事务处理开始 |
| | |
| | | /// <param name="shipAddress">收货地址</param> |
| | | /// <param name="memo">发货描述</param> |
| | | /// <param name="deliveryCompanyId">第三方对接物流编码</param> |
| | | /// <param name="sendDistributionID">经销商送货ID</param> |
| | | /// <returns></returns> |
| | | public async Task<WebApiCallBack> Ship(string orderId, string logiCode, string logiNo, Dictionary<int, int> items, int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "", string memo = "", string deliveryCompanyId = "") |
| | | public async Task<WebApiCallBack> Ship(string orderId, string logiCode, string logiNo, Dictionary<int, int> items, int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "", string memo = "", string deliveryCompanyId = "",int? sendDistributionID=null) |
| | | { |
| | | using var container = _serviceProvider.CreateScope(); |
| | | var jm = new WebApiCallBack(); |
| | | |
| | | |
| | | var orderService = container.ServiceProvider.GetService<ICoreCmsOrderServices>(); |
| | | //获取订单详情 |
| | | var dInfoResult = await orderService.GetOrderShipInfo(orderId); |
| | |
| | | billDelivery.memo = memo; |
| | | billDelivery.createTime = DateTime.Now; |
| | | billDelivery.thirdPartylogiCode = deliveryCompanyId; |
| | | |
| | | if(sendDistributionID>0) |
| | | { |
| | | var a= _coreCmsDistributionRepository.QueryById(sendDistributionID); |
| | | if(a==null) |
| | | { |
| | | jm.msg = "经销商不存在"; |
| | | return jm; |
| | | } |
| | | billDelivery.sendDistributionUserID= a.userId; |
| | | billDelivery.sendDistributionID = sendDistributionID; |
| | | billDelivery.sendDistributionAccept = sendDistributionAcceptType.NoAccted; |
| | | var mQ = new DistributionSendOder |
| | | { |
| | | |
| | | sendDistributionAccept = sendDistributionAcceptType.NoAccted, |
| | | distributionID = (int)sendDistributionID, |
| | | sendMangerID = _user.ID, |
| | | deliveryID = billDelivery.deliveryId, |
| | | sendTime = DateTime.Now, |
| | | userID= a.userId |
| | | |
| | | |
| | | }; |
| | | //记录操作记录 |
| | | await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.AddDistributionSendOderMQ, JsonConvert.SerializeObject(mQ)); |
| | | } |
| | | //设置发货明细 |
| | | var bdRel = new List<CoreCmsBillDeliveryItem>(); |
| | | |
| | |
| | | |
| | | |
| | | //插入发货单主体表 |
| | | await _dal.InsertAsync(billDelivery); |
| | | await _dal.InsertAsync(billDelivery); |
| | | |
| | | |
| | | |
| | | |
| | | //插入发货单明细表 |
| | | await _billDeliveryItemServices.InsertAsync(bdRel); |
| | |
| | | <PackageReference Include="Flurl.Http" Version="3.2.4" /> |
| | | <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" /> |
| | | <PackageReference Include="Microsoft.Extensions.Options" Version="8.0.0" /> |
| | | <PackageReference Include="NEST" Version="7.17.5" /> |
| | | <PackageReference Include="Qiniu" Version="8.5.0" /> |
| | | <PackageReference Include="QRCoder" Version="1.4.3" /> |
| | | <PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.0" /> |
| | |
| | | private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices; |
| | | private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; |
| | | private readonly ICoreCmsPlanOrderServices _planOrderServices; |
| | | |
| | | |
| | | private IUnitOfWork _unitOfWork; |
| | | |
| | |
| | | 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) |
| | | { |
| | | var outFirstAsync = await _logisticsServices.QueryByClauseAsync(p => p.logiCode == item.logiCode); |
| | | item.logiName = outFirstAsync != null ? outFirstAsync.logiName : item.logiCode; |
| | | 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; |
| | | |
| | | } |
| | |
| | | using CoreCms.Net.IServices.baifenbingfa; |
| | | using CoreCms.Net.Model.Entities; |
| | | using CoreCms.Net.Utility.Helper; |
| | | using Nest; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | return 0; |
| | | return count * 1; |
| | | } |
| | | |
| | | public List<DistributorSort> orderedDistributors(List<DistributorSort> DataList, string latitude, string longitude) |
| | | { |
| | | |
| | | |
| | | GeoCoordinate inputLocation = new GeoCoordinate(double.Parse(longitude), double.Parse(latitude)); // 输入的经纬度 |
| | | |
| | | var sortedDistributors = DataList.OrderBy(d => CalculateDistance(inputLocation, new GeoCoordinate(double.Parse(d.longitude), double.Parse(d.latitude)))) |
| | | .ToList(); |
| | | return sortedDistributors; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 计算经纬达距离 |
| | | /// </summary> |
| | | /// <param name="location1"></param> |
| | | /// <param name="location2"></param> |
| | | /// <returns></returns> |
| | | private static double CalculateDistance(GeoCoordinate location1, GeoCoordinate location2) |
| | | { |
| | | const double earthRadiusKm = 6371; |
| | | var dLat = ToRadians(location2.Latitude - location1.Latitude); |
| | | var dLon = ToRadians(location2.Longitude - location1.Longitude); |
| | | |
| | | var a = Math.Sin(dLat / 2) * Math.Sin(dLat / 2) + |
| | | Math.Cos(ToRadians(location1.Latitude)) * Math.Cos(ToRadians(location2.Latitude)) * |
| | | Math.Sin(dLon / 2) * Math.Sin(dLon / 2); |
| | | var c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a)); |
| | | var distance = earthRadiusKm * c; |
| | | |
| | | return distance; |
| | | } |
| | | |
| | | private static double ToRadians(double degree) |
| | | { |
| | | return degree * Math.PI / 180; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取有效校园代理 |
| | | /// </summary> |
| | | /// <param name="PIds"></param> |
| | | /// <returns></returns> |
| | | public async Task< List<DistributorSort>> GetDistributorsList(List<int> PIds) |
| | | { |
| | | var blist= await _unitOfWork.GetDbClient().Queryable<CoreCmsDistribution>().Where(x=>x.profession=="校园代理"&&x.verifyStatus== (int)GlobalEnumVars.DistributionVerifyStatus.VerifyYes).ToListAsync(); |
| | | List < DistributorSort > retlist=new List<DistributorSort>(); |
| | | foreach (var item in blist) |
| | | { |
| | | if (string.IsNullOrEmpty(item.storeCoordinate) || item.storeCoordinate == ",") |
| | | //没有定位,不加入 |
| | | continue; |
| | | var ldinate= item.storeCoordinate.Split(','); |
| | | retlist.Add( new DistributorSort() |
| | | { |
| | | id = item.id, |
| | | latitude = ldinate[0], |
| | | longitude = ldinate[1], |
| | | name = item.schoolName + ":" + item.name |
| | | |
| | | |
| | | |
| | | }); |
| | | } |
| | | return retlist; |
| | | } |
| | | |
| | | |
| | | |
| | | public async Task< List< int>> GetOderProductsIDs(string[] OderIds) |
| | | { |
| | | var list= await _unitOfWork.GetDbClient().Queryable<CoreCmsOrder>().Where(x => OderIds.Contains(x.orderId)) |
| | | .Select(x => new { items = SqlFunc.Subqueryable<CoreCmsOrderItem>().Where(it => it.orderId == x.orderId).ToList() }).ToListAsync(); |
| | | var li=new List<int>(); |
| | | foreach (var item in list) |
| | | { |
| | | li.AddRange(item.items.Select(x=>x.id).ToList()); |
| | | |
| | | |
| | | } |
| | | return li; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using CoreCms.Net.Caching.AutoMate.RedisCache; |
| | | using CoreCms.Net.IRepository.UnitOfWork; |
| | | using CoreCms.Net.IRepository; |
| | | using CoreCms.Net.IServices; |
| | | using CoreCms.Net.IServices.baifenbingfa; |
| | | using CoreCms.Net.Model.Entities; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using CoreCms.Net.Auth.HttpContextUser; |
| | | using CoreCms.Net.Model.Entities.Expression; |
| | | using CoreCms.Net.Model.ViewModels.Basics; |
| | | using COSXML.Model.Tag; |
| | | using NPOI.SS.Formula.Functions; |
| | | using CoreCms.Net.Model.ViewModels.UI; |
| | | using SqlSugar; |
| | | using CoreCms.Net.Configuration; |
| | | using Newtonsoft.Json; |
| | | using CoreCms.Net.DTO; |
| | | |
| | | namespace CoreCms.Net.Services.baifenbingfa |
| | | { |
| | | /// <summary> |
| | | /// 供应商发货单处理服务 |
| | | /// </summary> |
| | | public class DistributorDeliveryServices : BaseServices<CoreCmsBillDelivery>, IDistributorDeliveryServices |
| | | { |
| | | |
| | | private readonly ICoreCmsBillDeliveryRepository _dal; |
| | | private readonly ICoreCmsStoreServices _storeServices; |
| | | private readonly ICoreCmsBillDeliveryItemServices _billDeliveryItemServices; |
| | | private readonly ICoreCmsOrderLogServices _orderLogServices; |
| | | private readonly ICoreCmsSettingServices _settingServices; |
| | | private readonly IUnitOfWork _unitOfWork; |
| | | private readonly IServiceProvider _serviceProvider; |
| | | private readonly IRedisOperationRepository _redisOperationRepository; |
| | | private readonly IHttpContextUser _user; |
| | | |
| | | public readonly ICoreCmsDistributionServices _coreCmsDistributionServices; |
| | | |
| | | public DistributorDeliveryServices( |
| | | IUnitOfWork unitOfWork, |
| | | IServiceProvider serviceProvider |
| | | , ICoreCmsBillDeliveryRepository dal |
| | | , ICoreCmsStoreServices storeServices |
| | | , ICoreCmsBillDeliveryItemServices billDeliveryItemServices |
| | | , ICoreCmsOrderLogServices orderLogServices |
| | | , ICoreCmsSettingServices settingServices |
| | | , IRedisOperationRepository redisOperationRepository |
| | | , IHttpContextUser user |
| | | ,ICoreCmsDistributionServices coreCmsDistributionServices ) |
| | | { |
| | | this._dal = dal; |
| | | base.BaseDal = dal; |
| | | _unitOfWork = unitOfWork; |
| | | _serviceProvider = serviceProvider; |
| | | _storeServices = storeServices; |
| | | _billDeliveryItemServices = billDeliveryItemServices; |
| | | _orderLogServices = orderLogServices; |
| | | _settingServices = settingServices; |
| | | _redisOperationRepository = redisOperationRepository; |
| | | _user = user; |
| | | _coreCmsDistributionServices = coreCmsDistributionServices; |
| | | } |
| | | |
| | | public async Task<(List< CoreCmsBillDelivery>,int )> GetDeliveryList(GetDeliveryListPost Param) |
| | | { |
| | | |
| | | |
| | | var where = PredicateBuilder.True<CoreCmsBillDelivery>(); |
| | | if(Param.Status != null ) |
| | | { |
| | | where= where.And(x => x.status == (int)Param.Status); |
| | | } |
| | | if (Param.distributionAcceptStatus != null) |
| | | { |
| | | where= where.And(x => x.sendDistributionAccept == Param.distributionAcceptStatus); |
| | | } |
| | | where= where.And(x => x.sendDistributionUserID == _user.ID); |
| | | //必须是出于发货状态 |
| | | //where= where.And(x => x.order.shipStatus ==(int ) GlobalEnumVars.OrderShipStatus.Yes); |
| | | //必须是有效状态 |
| | | //where= where.And(x => x.order.status == (int)GlobalEnumVars.OrderStatus.Normal); |
| | | RefAsync<int> totl = 0; |
| | | var list= await _unitOfWork.GetDbClient().Queryable<CoreCmsBillDelivery>().Includes(x => x.order, order => order.Orderitems, ite => ite.productInfo) |
| | | .Where(where).OrderByDescending(x => x.createTime) |
| | | .ToPageListAsync(Param.page, Param.limit, totl); |
| | | var listdata= new PageList<CoreCmsBillDelivery>(list, Param.page, Param.limit, totl); |
| | | |
| | | return (listdata,totl); |
| | | //return await _dal.QueryPageAsync(where, x => x.createTime, SqlSugar.OrderByType.Desc, Param.page, Param.page); |
| | | } |
| | | |
| | | public async Task<int> GetNoAcceptedDeliveryCount() |
| | | { |
| | | return await _dal.GetCountAsync(x => x.sendDistributionUserID == _user.ID && x.sendDistributionAccept == sendDistributionAcceptType.NoAccted); |
| | | } |
| | | |
| | | public async Task<bool> GetShowDelivery() |
| | | { |
| | | return (await _coreCmsDistributionServices.GetCountAsync(x => x.userId == _user.ID && x.verifyStatus == (int)GlobalEnumVars.DistributionVerifyStatus.VerifyYes&&x.profession=="校园代理", isDataCache: true, cacheTimes: 60)>0); |
| | | } |
| | | public async Task<WebApiCallBack> SetDeliveryAccepted(sendDistributionAcceptType acceptType, string DeliveryID, string CancelledDec = null) |
| | | { |
| | | WebApiCallBack ret = new WebApiCallBack(); |
| | | var data = await _dal.QueryByIdAsync(DeliveryID); |
| | | if (data == null) |
| | | { |
| | | ret.status = false; |
| | | ret.msg = " 没有找到发货单"; |
| | | return ret; |
| | | |
| | | } |
| | | if (data.sendDistributionUserID != _user.ID) |
| | | { |
| | | ret.status = false; |
| | | ret.msg = "该发货单不属于该该用户"; |
| | | return ret; |
| | | } |
| | | |
| | | var oder = await _unitOfWork.GetDbClient().Queryable<CoreCmsOrder>().Where(x=>x.status== (int)GlobalEnumVars.OrderStatus.Normal).Includes(x => x.Orderitems).Where(x => x.orderId == data.orderId).FirstAsync(); |
| | | if(oder != null) |
| | | { |
| | | ret.status = false; |
| | | ret.msg = "订单已经完结,不可操作"; |
| | | return ret; |
| | | } |
| | | |
| | | var mQ = new ActiveDistributionSendOderMQ |
| | | { |
| | | Dec = CancelledDec, |
| | | SendOderActive = acceptType, |
| | | deliveryID = DeliveryID, |
| | | userID = _user.ID |
| | | }; |
| | | //记录操作记录 |
| | | await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.ActiveDistributionSendOderMQ, JsonConvert.SerializeObject(mQ)); |
| | | //用户不同意配送 |
| | | try |
| | | { |
| | | |
| | | |
| | | _unitOfWork.BeginTran(); |
| | | if (acceptType == sendDistributionAcceptType.Cancelled) |
| | | { |
| | | //如果是取消订单,需要把订单 |
| | | //不接受 需要将原订单设置为为分配状态, |
| | | |
| | | |
| | | |
| | | if (oder.status != (int)GlobalEnumVars.OrderStatus.Complete |
| | | && oder.status != (int)GlobalEnumVars.OrderStatus.Cancel |
| | | &&oder.shipStatus== (int)GlobalEnumVars.OrderShipStatus.Yes |
| | | ) |
| | | { |
| | | var Deliveryitem = await _unitOfWork.GetDbClient().Queryable<CoreCmsBillDeliveryItem>().Where(x => x.deliveryId == data.deliveryId).ToListAsync(); |
| | | |
| | | foreach (var item in oder.Orderitems) |
| | | { |
| | | //处理已发货数据 |
| | | |
| | | item.sendNums -= Deliveryitem.Where(x => x.productId == item.productId).Select(x => x.nums).FirstOrDefault(); |
| | | if(item.sendNums<0) |
| | | item.sendNums = 0; |
| | | item.updateTime = DateTime.Now; |
| | | |
| | | |
| | | |
| | | } |
| | | oder.shipStatus =(int ) GlobalEnumVars.OrderShipStatus.No; |
| | | |
| | | oder.updateTime = DateTime.Now; |
| | | await _unitOfWork.GetDbClient().UpdateNav( oder ).Include(x=>x.Orderitems).ExecuteCommandAsync() ; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | data.sendDistributionAccept = acceptType; |
| | | data.updateTime= DateTime.Now; |
| | | ret.status = true; |
| | | var r= await _dal.UpdateAsync(data); |
| | | if(r==true) |
| | | _unitOfWork.CommitTran(); |
| | | else |
| | | { |
| | | _unitOfWork.RollbackTran(); |
| | | } |
| | | ret.status = r; |
| | | ret.msg = r ? "设置成功" : "设置失败"; |
| | | return ret; |
| | | } |
| | | catch (Exception) |
| | | { |
| | | _unitOfWork.RollbackTran(); |
| | | throw; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Text; |
| | | |
| | | namespace CoreCms.Net.Utility.Extensions |
| | |
| | | return thisValue != null && thisValue != DBNull.Value && bool.TryParse(thisValue.ToString(), out result) ? result : result; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取枚举的标注的值 |
| | | /// </summary> |
| | | /// <typeparam name="T"></typeparam> |
| | | /// <param name="value"></param> |
| | | /// <returns></returns> |
| | | public static string GetDescription(this Enum value) |
| | | { |
| | | var field = value.GetType().GetField(value.ToString()); |
| | | var attributes = (DescriptionAttribute[])field.GetCustomAttributes(typeof(DescriptionAttribute), false); |
| | | return attributes.Length > 0 ? attributes[0].Description : value.ToString(); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | 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, |
| | |
| | | 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); |
| | |
| | | <div class="layui-input-inline layui-form-mid layui-inline-3"> |
| | | {{d.params.data.model.logiName || '' }} |
| | | </div> |
| | | {{# if(d.params.data.model.logiCode!="Distributor"){}} |
| | | <label class="layui-form-label">快递单号:</label> |
| | | <div class="layui-input-inline layui-form-mid layui-inline-3"> |
| | | {{d.params.data.model.logiNo || '' }} |
| | | </div> |
| | | {{# }else {}} |
| | | <label class="layui-form-label">经销商发货确认状态:</label> |
| | | <div class="layui-input-inline layui-form-mid layui-inline-3"> |
| | | {{d.params.data.model.distributionAcceptStr || '' }} |
| | | </div> |
| | | {{#}}} |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">收货电话:</label> |
| | |
| | | {{d.params.data.model.shipAddress || '' }} |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">发货备注:</label> |
| | | <div class="layui-input-inline layui-form-mid layui-inline-100"> |
| | |
| | | <th>收货人名</th> |
| | | <th>收货电话</th> |
| | | <th>收货地址</th> |
| | | <th style="width: 60px">操作</th> |
| | | <th style="width: 60px">状态</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | |
| | | <td>{{item.shipMobile}}</td> |
| | | <td>{{item.shipAreaIdName}}-{{item.shipAddress}}</td> |
| | | <td> |
| | | |
| | | {{item.logiCode=="Distributor"? item.distributionAcceptStr??"未确认接受配送":""}} |
| | | <!-- <button type="button" class="layui-btn layui-btn-warm layui-btn-xs" data-deliveryId="{{item.deliveryId}}" lay-active="refreshDelivery" style="margin-left: 0px">同步直播订单</button> --> |
| | | </td> |
| | | </tr> |
| | |
| | | <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center"> |
| | | {{item.nums-item.sendNums-item.reshipNums+item.reshipedNums}} |
| | | </td> |
| | | <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center">¥ {{ item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums) }}</td> |
| | | <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center">¥ {{ Number(item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums)).toFixed(2) }}</td> |
| | | </tr> |
| | | {{# }); }} |
| | | </tbody> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="shipCoordinate" class="layui-form-label layui-form-required" |
| | | >坐标位置</label |
| | | > |
| | | <div class="layui-input-block"> |
| | | <input |
| | | name="shipCoordinate" |
| | | id="coordinateBox" |
| | | lay-active="showMap" |
| | | lay-verType="tips" |
| | | value="{{d.params.data.orderModel.shipCoordinate || '' }}" |
| | | lay-verify="required|verifycoordinate" |
| | | class="layui-input" |
| | | lay-reqText="请输入坐标位置" |
| | | placeholder="请输入坐标位置" |
| | | /> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">收货地址</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="shipAddress" value="{{d.params.data.orderModel.shipAddress}}" class="layui-input"> |
| | | <input type="text" name="shipAddress" id="shipAddressBox" value="{{d.params.data.orderModel.shipAddress}}" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | {{# } }} |
| | |
| | | layui.data.sendParams = function (d) { |
| | | //开启调试情况下获取接口赋值数据 |
| | | if (debug) { console.log(d.params.data); } |
| | | layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'], |
| | | layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg',"util",], |
| | | function () { |
| | | var $ = layui.$ |
| | | , form = layui.form |
| | |
| | | , laydate = layui.laydate |
| | | , upload = layui.upload |
| | | , cropperImg = layui.cropperImg |
| | | ,util = layui.util |
| | | , coreHelper = layui.coreHelper; |
| | | |
| | | coreHelper.Post("Api/Tools/GetAreaCheckedList", { id: d.params.data.orderModel.shipAreaId }, function (data) { |
| | |
| | | } |
| | | } |
| | | } |
| | | //处理属性 为 lay-active 的所有元素事件 |
| | | util.event("lay-active", { |
| | | showMap: function () { |
| | | var oldData = $("#coordinateBox").val(); |
| | | let data = { |
| | | oldData: oldData, |
| | | coordinateBoxIdName: "coordinateBox", |
| | | addressBoxIdName: "shipAddressBox", |
| | | }; |
| | | |
| | | admin.popup({ |
| | | shadeClose: false, |
| | | title: "查看详情", |
| | | area: ["1000px", "570px"], |
| | | id: "LAY-popup-common-getQQMap", |
| | | success: function (layero, index) { |
| | | layui |
| | | .view(this.id) |
| | | .render("common/getQQMap", { data }) |
| | | .done(function () { |
| | | form.render(); |
| | | }); |
| | | // 禁止弹窗出现滚动条 |
| | | $(layero) |
| | | .children(".layui-layer-content") |
| | | .css("overflow", "visible"); |
| | | }, |
| | | }); |
| | | }, |
| | | }); |
| | | |
| | | //重载form |
| | | form.render(null, 'LAY-app-CoreCmsOrder-editForm'); |
| | |
| | | area: ['1000px', '90%'], |
| | | id: 'LAY-popup-CoreCmsOrder-distribution', |
| | | success: function (layero, index) { |
| | | |
| | | if(e.data.order.delivery?.length>0) |
| | | { |
| | | e.data.order.delivery.forEach(element => { |
| | | if( element.logiCode=="Distributor") |
| | | { |
| | | e.data.order.logisticsName+=`[${element.logiName} == ${element.sendDistributionAccept}] ` |
| | | } |
| | | }); |
| | | } |
| | | |
| | | view(this.id).render('order/orders/distribution', { data: e.data }).done(function () { |
| | | form.on('submit(LAY-app-order-distributionPrint-submit)', function (data) { |
| | | LODOP = getLodop(); |
| | |
| | | id: 'LAY-popup-CoreCmsOrder-union', |
| | | success: function (layero, index) { |
| | | view(this.id).render('order/orders/union', { data: e.data }).done(function () { |
| | | |
| | | if(e.data.order.delivery?.length>0) |
| | | { |
| | | e.data.order.delivery.forEach(element => { |
| | | if( element.logiCode=="Distributor") |
| | | { |
| | | e.data.order.logisticsName+=`[${element.logiName} == ${element.sendDistributionAccept}]` |
| | | } |
| | | }); |
| | | } |
| | | |
| | | form.on('submit(LAY-app-order-unionPrint-submit)', function (data) { |
| | | LODOP = getLodop(); |
| | | LODOP.ADD_PRINT_HTM(20, "5%", "90%", "100%", document.getElementById("printDiv").innerHTML); |
| | |
| | | //监听提交 |
| | | form.on('submit(LAY-app-CoreCmsOrder-shipForm-submit)', |
| | | function (data) { |
| | | |
| | | var field = data.field; //获取提交的字段 |
| | | |
| | | var keys = Object.keys(field); |
| | |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label">物流公司</label> |
| | | <div class="layui-input-inline layui-inline-4"> |
| | | <select name="logiCode" lay-verify="required" lay-reqText="请选择物流公司" lay-search lay-filter="logiCodefilter"> |
| | | <select name="logiCode" lay-verify="required" lay-reqText="请选择物流公司" lay-search lay-filter="logiCodefilter" id="SelWUliuId"> |
| | | <option value="">搜索选择物流公司</option> |
| | | {{# layui.each(d.params.data.logistics, function(index, item){ }} |
| | | <option value="{{item.logiCode}}">{{item.logiName}}</option> |
| | |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <!-- <div class="layui-inline" > |
| | | <label class="layui-form-label">直播物流</label> |
| | | <div class="layui-input-inline layui-inline-4"> |
| | | <select name="deliveryCompanyId" lay-verify="required" lay-reqText="直播物流" lay-search> |
| | |
| | | <option value="OTHERS" selected="selected">无物流</option> |
| | | {{# layui.each(d.params.data.deliveryCompany, function(index, item){ }} |
| | | <option value="{{item.deliveryId}}">{{item.deliveryName}}</option> |
| | | {{# }); }} |
| | | </select> |
| | | </div> |
| | | </div> --> |
| | | |
| | | <div class="layui-inline" id="SelXiaoyuanDiali_" > |
| | | <label class="layui-form-label ">选择校园代理</label> |
| | | <div class="layui-input-inline layui-inline-4"> |
| | | <select name="sendDistributionID" lay-reqText="选择校园代理" lay-search id="selXiaoYuanDaiLiInputID"> |
| | | <option value="">选择校园代理</option> |
| | | {{# layui.each(d.params.data.distributors, function(index, item){ }} |
| | | <option value="{{item.id}}">{{item.name}}</option> |
| | | {{# }); }} |
| | | </select> |
| | | </div> |
| | |
| | | , coreHelper = layui.coreHelper; |
| | | |
| | | form.on('select(logiCodefilter)', function (data) { |
| | | if (data.value == 'benditongcheng' || data.value == 'shangmenziti') { |
| | | if(data.value=="Distributor") |
| | | { |
| | | $('#SelXiaoyuanDiali_').show(); |
| | | $('#selXiaoYuanDaiLiInputID').attr('lay-verify', 'required') |
| | | form.render(null, 'LAY-app-CoreCmsOrder-shipForm'); |
| | | } |
| | | else{ |
| | | $('#SelXiaoyuanDiali_').hide(); |
| | | $('#selXiaoYuanDaiLiInputID').removeAttr('lay-verify') |
| | | } |
| | | if (data.value == 'benditongcheng' || data.value == 'shangmenziti'||data.value=='Distributor') { |
| | | $('#logiNo').val('无'); |
| | | } else { |
| | | var logiNoVal = $('#logiNo').val(); |
| | |
| | | } |
| | | |
| | | //重载form |
| | | if($("#SelWUliuId").val()!="Distributor") |
| | | { |
| | | $('#SelXiaoyuanDiali_').hide(); |
| | | $('#selXiaoYuanDaiLiInputID').attr('lay-verify', '') |
| | | } |
| | | form.render(null, 'LAY-app-CoreCmsOrder-shipForm'); |
| | | }) |
| | | }; |
| | |
| | | <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center"> |
| | | {{item.nums-item.sendNums-item.reshipNums+item.reshipedNums}} |
| | | </td> |
| | | <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top;">¥ {{ item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums) }}</td> |
| | | <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top;">¥ {{ Number(item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums)).toFixed(2) }}</td> |
| | | </tr> |
| | | {{# }); }} |
| | | </tbody> |
| | |
| | | <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center"> |
| | | {{item.nums-item.sendNums-item.reshipNums+item.reshipedNums}} |
| | | </td> |
| | | <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top;">¥ {{ item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums) }}</td> |
| | | <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top;">¥ {{ Number( item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums)).toFixed(2) }}</td> |
| | | </tr> |
| | | {{# }); }} |
| | | </tbody> |
| | |
| | | <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center"> |
| | | {{item.nums-item.sendNums-item.reshipNums+item.reshipedNums}} |
| | | </td> |
| | | <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center">¥ {{ item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums) }}</td> |
| | | <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center">¥ {{ Number( item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums)).toFixed(2) }}</td> |
| | | </tr> |
| | | {{# }); }} |
| | | </tbody> |
| | |
| | | layui.data.sendParams = function (d) { |
| | | //开启调试情况下获取接口赋值数据 |
| | | if (debug) { console.log(d.params.data); } |
| | | |
| | | layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'], |
| | | function () { |
| | | var $ = layui.$ |
| | |
| | | , coreHelper = layui.coreHelper; |
| | | |
| | | //重载form |
| | | |
| | | form.render(); |
| | | }) |
| | | }; |
| | |
| | | util.event("lay-active", { |
| | | showMap: function () { |
| | | var oldData = $("#coordinateBox").val(); |
| | | |
| | | let data = { |
| | | oldData: oldData, |
| | | coordinateBoxIdName: "coordinateBox", |
| | |
| | | /// </summary> |
| | | [Route("api/[controller]/[action]")] |
| | | [ApiController] |
| | | |
| | | public class PinTuanController : ControllerBase |
| | | { |
| | | |
| | |
| | | using CoreCms.Net.Caching.AutoMate.RedisCache; |
| | | using CoreCms.Net.Configuration; |
| | | using CoreCms.Net.IServices; |
| | | using CoreCms.Net.IServices.baifenbingfa; |
| | | using CoreCms.Net.Loging; |
| | | using CoreCms.Net.Model.Entities; |
| | | using CoreCms.Net.Model.Entities.Expression; |
| | |
| | | private readonly IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; |
| | | private readonly WeChatOptions _weChatOptions; |
| | | private readonly IRedisOperationRepository _redisOperationRepository; |
| | | private readonly IDistributorDeliveryServices _distributorDeliveryServices; |
| | | |
| | | /// <summary> |
| | | /// 构造函数 |
| | |
| | | , ICoreCmsSettingServices settingServices |
| | | , ICoreCmsServicesServices servicesServices |
| | | , IOptions<WeChatOptions> weChatOptions |
| | | , ICoreCmsUserServicesOrderServices userServicesOrderServices, ICoreCmsUserServicesTicketServices userServicesTicketServices, ICoreCmsStoreServices storeServices, ICoreCmsCouponServices couponServices, ICoreCmsOrderServices orderServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, IRedisOperationRepository redisOperationRepository) |
| | | , ICoreCmsUserServicesOrderServices userServicesOrderServices |
| | | , ICoreCmsUserServicesTicketServices userServicesTicketServices |
| | | , ICoreCmsStoreServices storeServices |
| | | , ICoreCmsCouponServices couponServices |
| | | , ICoreCmsOrderServices orderServices |
| | | , IWeChatApiHttpClientFactory weChatApiHttpClientFactory |
| | | , IRedisOperationRepository redisOperationRepository |
| | | , IDistributorDeliveryServices distributorDeliveryServices) |
| | | { |
| | | _user = user; |
| | | _userWeChatInfoServices = userWeChatInfoServices; |
| | |
| | | _weChatApiHttpClientFactory = weChatApiHttpClientFactory; |
| | | _redisOperationRepository = redisOperationRepository; |
| | | _weChatOptions = weChatOptions.Value; |
| | | _distributorDeliveryServices = distributorDeliveryServices; |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | user.sex = (int)GlobalEnumVars.UserSexTypes.未知; |
| | | } |
| | | //未处理订单数量 |
| | | var DeliveryCount = await _distributorDeliveryServices.GetNoAcceptedDeliveryCount(); |
| | | |
| | | var ShowDelivery = await _distributorDeliveryServices.GetShowDelivery(); |
| | | jm.data = new |
| | | { |
| | | user.id, |
| | |
| | | orderCount, |
| | | footPrintCount, |
| | | collectionCount, |
| | | user.isplanorder |
| | | user.isplanorder, |
| | | DeliveryCount, |
| | | ShowDelivery |
| | | }; |
| | | return jm; |
| | | } |
New file |
| | |
| | | using CoreCms.Net.IRepository; |
| | | using CoreCms.Net.IServices; |
| | | using CoreCms.Net.IServices.baifenbingfa; |
| | | using CoreCms.Net.Model.Entities; |
| | | using CoreCms.Net.Model.FromBody; |
| | | using CoreCms.Net.Model.ViewModels.Basics; |
| | | using CoreCms.Net.Model.ViewModels.UI; |
| | | using CoreCms.Net.Utility.Extensions; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using SKIT.FlurlHttpClient.Wechat.Api.Models; |
| | | using Swashbuckle.AspNetCore.Annotations; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace CoreCms.Net.Web.WebApi.Controllers.baifenbingfa |
| | | { |
| | | /// <summary> |
| | | /// 经销商发货单处理 |
| | | /// </summary> |
| | | /// <summary> |
| | | /// 页面接口 |
| | | /// </summary> |
| | | [Route("api/[controller]/[action]")] |
| | | [ApiController] |
| | | [Authorize] |
| | | public class DistributorDeliveryController: ControllerBase |
| | | { |
| | | |
| | | IDistributorDeliveryServices _distributorDeliveryServices ; |
| | | |
| | | public DistributorDeliveryController(IDistributorDeliveryServices distributorDeliveryServices ) |
| | | { |
| | | _distributorDeliveryServices= distributorDeliveryServices ; |
| | | } |
| | | /// <summary> |
| | | /// 获取list |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost("GetList")] |
| | | [SwaggerResponse(200, "返回数据", typeof(WebApiCallBack))] |
| | | [SwaggerResponse(201, "Data类型", typeof(IPageList<CoreCmsBillDelivery>))] |
| | | |
| | | public async Task<WebApiCallBack> GetList(GetDeliveryListPost param) |
| | | { |
| | | var datalist = await _distributorDeliveryServices.GetDeliveryList(param); |
| | | return new WebApiCallBack |
| | | { |
| | | status = true, |
| | | data =new { datalist= datalist.Item1, |
| | | total=datalist.Item2 |
| | | } |
| | | |
| | | }; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 接受发货单 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost("Accepted")] |
| | | public async Task<WebApiCallBack> Accepted([FromBody] AccptedInParam param) |
| | | { |
| | | var datalist = await _distributorDeliveryServices.SetDeliveryAccepted( param.acceptType, param.id,param.noAcceptTypeMsg); |
| | | return new WebApiCallBack |
| | | { |
| | | status = true, |
| | | data = datalist |
| | | |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | public class AccptedInParam |
| | | { |
| | | /// <summary> |
| | | /// 状态 0 为接受 3 为拒绝/取消 |
| | | /// </summary> |
| | | public sendDistributionAcceptType acceptType { get; set; } |
| | | /// <summary> |
| | | /// 发货单ID |
| | | /// |
| | | /// </summary> |
| | | public string id { get; set; } |
| | | /// <summary> |
| | | /// 校园代理拒绝原因 |
| | | /// </summary> |
| | | public string noAcceptTypeMsg { get; set; } |
| | | } |
| | | |
| | | |
| | | } |