diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs index c6a143df..d9c87ab0 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs @@ -7,15 +7,15 @@ public class GetPageTrackOrderInput : PageInfoInput /// public int SubSystemId { get; set; } - ///// - ///// 单号 - ///// - //public List? OrderNos { get; set; } - /// /// 单号 /// - public string? OrderNos { get; set; } + public List? OrderNos { get; set; } + + ///// + ///// 单号 + ///// + //public string? OrderNos { get; set; } /// /// tab标签类型 0 全部, 1 异常 2 预警 @@ -136,7 +136,7 @@ public class TrackOrderDto /// /// 子系统 /// - public string SubSystem { get; set; } + public string? SubSystem { get; set; } /// /// 子系统id @@ -153,13 +153,13 @@ public class TrackOrderDto /// public string? QuestionTypeName { get; set; } - /// - /// 问题描述(主数据枚举TrackProblemDescription) - /// - public int ProblemDescription { get; set; } + ///// + ///// 问题描述(主数据枚举TrackProblemDescription) + ///// + //public int ProblemDescription { get; set; } - /// - /// 问题描述名称 - /// - public string? ProblemDescriptionName { get; set; } + ///// + ///// 问题描述名称 + ///// + //public string? ProblemDescriptionName { get; set; } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs index 25cb3b57..da077adf 100644 --- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs +++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs @@ -1,8 +1,13 @@ using AutoMapper; +using Google.Protobuf.WellKnownTypes; +using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Dtos.Order; +using SJZY.Track.Domain.Enums; +using System.ComponentModel; +using System.Reflection; using Volo.Abp.AutoMapper; namespace SJZY.Track.Application.AutoMapper; @@ -20,7 +25,10 @@ public class OrderAutoMapperProfile : Profile CreateMap(MemberList.None); CreateMap(MemberList.None); - CreateMap(MemberList.None); + CreateMap(MemberList.None) + .ForMember(dest => dest.OrderTypeName, opt => opt.MapFrom(source => GetEnumDescription(2, source.OrderType))) + .ForMember(dest => dest.QuestionTypeName, opt => opt.MapFrom(source => GetEnumDescription(1, source.QuestionType))); + CreateMap, UnifyPageResultDto>(MemberList.None); CreateMap(MemberList.None).Ignore(dest => dest.TrackTimeZone) .ForMember(dest => dest.Id, opt => opt.Ignore()) @@ -29,4 +37,34 @@ public class OrderAutoMapperProfile : Profile .ForMember(dest => dest.EnContent, opt => opt.MapFrom(m => m.TrackEnContent)) .ForMember(dest => dest.TrackTimeZoneValue, opt => opt.MapFrom(m => m.TrackTimeZone)); } + + /// + /// 通过类型int获取枚举描述 + /// + /// 1 问题类型枚举 2 订单枚举 + /// + /// + public static string GetEnumDescription(int type, int value) + { + string enumDescription = string.Empty; + if (type == 1) + { + TrackProblemType trackProblem = (TrackProblemType)value; // 将int值转换为枚举 + if (trackProblem.GetDescription().IsNullOrWhiteSpace()) + enumDescription = ""; + else + enumDescription = trackProblem.GetDescription(); // 获取描述标记 + } + else + { + OrderType orderType = (OrderType)value; // 将int值转换为枚举 + if (orderType.GetDescription().IsNullOrWhiteSpace()) + enumDescription = ""; + else + enumDescription = orderType.GetDescription(); // 获取描述标记 + + } + + return enumDescription; + } } \ No newline at end of file diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj index 62282f44..e3162402 100644 --- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj +++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj @@ -8,7 +8,11 @@ - + + + + + diff --git a/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs index 029d5523..4ca4b245 100644 --- a/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs +++ b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs @@ -58,7 +58,6 @@ public class TrackOrderService : ApplicationService list.ForEach(a => { a.Id = id++; - var trackContentsOfTemplates = trackContents.Where(b => b.SubSystemId == input.SubSystemId && b.TrackCode == a.Code && input.TrackTemplateIds.Contains( diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs index 06cfe9e9..5f164841 100644 --- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs +++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs @@ -8,7 +8,7 @@ public int SubSystemId { get; set; } /// - /// 当tab选中 0 默认不传 1 直接写死传值 [1,4] 2 传 [2,4] + /// 当tab选中 0 全部 1 异常 2 警告 /// public int TabType { get; set; } @@ -22,10 +22,15 @@ /// public int? CustomerId { get; set; } + ///// + ///// 单号 + ///// + //public string? OrderNos { get; set; } + /// /// 单号 /// - public string? OrderNos { get; set; } + public List? OrderNos { get; set; } /// /// 创建时间开始 @@ -121,7 +126,7 @@ /// /// 子系统 /// - public string SubSystem { get; set; } + public string? SubSystem { get; set; } /// /// 子系统id @@ -132,5 +137,15 @@ /// 轨迹模板Id数组 /// public List? TrackTemplateIds { get; set; } + + /// + /// 问题类型(主数据枚举TrackQuestionType) + /// + public int QuestionType { get; set; } + + /// + /// 问题类型名称 + /// + public string? QuestionTypeName { get; set; } } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Enums/OrderType.cs b/src/SJZY.Track.Domain/Enums/OrderType.cs index 072aba6b..79a97c52 100644 --- a/src/SJZY.Track.Domain/Enums/OrderType.cs +++ b/src/SJZY.Track.Domain/Enums/OrderType.cs @@ -1,6 +1,18 @@ -namespace SJZY.Track.Domain.Enums; +using System.ComponentModel; + +namespace SJZY.Track.Domain.Enums; public enum OrderType { - 干线提单 = 1 + [Description("干线提单")] + 干线提单 = 1, + + [Description("小包运单")] + 小包运单 = 2, + + [Description("箱/袋单")] + 箱袋单 = 3, + + [Description("FBA订单")] + FBA订单 = 4, } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/Enums/TrackProblemType.cs b/src/SJZY.Track.Domain/Enums/TrackProblemType.cs index 10087ba0..92369b84 100644 --- a/src/SJZY.Track.Domain/Enums/TrackProblemType.cs +++ b/src/SJZY.Track.Domain/Enums/TrackProblemType.cs @@ -1,4 +1,6 @@ -namespace SJZY.Track.Domain.Enums; +using System.ComponentModel; + +namespace SJZY.Track.Domain.Enums; [Flags] public enum TrackProblemType @@ -6,15 +8,18 @@ public enum TrackProblemType /// /// 没问题 /// + [Description("无")] None = 0, /// /// 异常 /// + [Description("异常")] Error = 1, /// /// 预警 /// + [Description("预警")] Warn = 2, } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/Queries/TrackOrderQueries.cs b/src/SJZY.Track.Repository/Queries/TrackOrderQueries.cs index 2542a33e..6a3314eb 100644 --- a/src/SJZY.Track.Repository/Queries/TrackOrderQueries.cs +++ b/src/SJZY.Track.Repository/Queries/TrackOrderQueries.cs @@ -24,30 +24,11 @@ public class TrackOrderQueries : ISugarRepository, ITrackOrderQueries, /// public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input) { - List orderNoList = new List(); - List questionTypeIds = new List(); - int ques = 0; - if (!input.OrderNos.IsNullOrWhiteSpace()) - { - orderNoList = input.OrderNos!.Split(',', ',', ':', ':').ToList(); - } - - if (input.TabType == 1) - { - questionTypeIds = new List { 1, 4 }; - ques = questionTypeIds.Sum(); - } - else if (input.TabType == 2) - { - questionTypeIds = new List { 2, 4 }; - ques = questionTypeIds.Sum(); - } - var pageList = await Context.Queryable() .LeftJoin((a, b) => a.CustomId == b.Id && b.IsDeleted == false) .LeftJoin((a, b, c) => a.SubSystemId == c.Id && c.IsDeleted == false) .WhereIF(input.SubSystemId > 0, (a, b, c) => a.SubSystemId == input.SubSystemId) - .WhereIF(!orderNoList.IsNullOrEmpty(), (a, b, c) => orderNoList.Contains(a.OrderNo)) + .WhereIF(!input.OrderNos.IsNullOrEmpty(), (a, b, c) => input.OrderNos!.Contains(a.OrderNo)) .WhereIF(input.CreateTimeStart.HasValue && input.CreateTimeEnd.HasValue, (a, b, c) => a.CreateTime >= input.CreateTimeStart && a.CreateTime <= input.CreateTimeEnd) .WhereIF(input.CreateTimeStart.HasValue && (!input.CreateTimeEnd.HasValue), @@ -56,7 +37,7 @@ public class TrackOrderQueries : ISugarRepository, ITrackOrderQueries, (a, b, c) => a.CreateTime <= input.CreateTimeEnd) .WhereIF(input.CustomerId > 0, (a, b, c) => a.CustomId == input.CustomerId) .WhereIF(input.TrackOrderType > 0, (a, b, c) => a.OrderType == input.TrackOrderType) - .WhereIF(input.TabType > 0 && !questionTypeIds.IsNullOrEmpty(), (a, b, c) => (a.QuestionType & ques) > 0) + .WhereIF(input.TabType > 0, (a, b, c) => a.QuestionType == input.TabType) .OrderByDescending((a, b, c) => a.CreateTime) .Select((a, b, c) => new TrackOrderVO { diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index 7609c5a6..360f2a88 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -83,7 +83,7 @@ public class TrackContentRepository : BasicRepository, ITrac CreateUser = e.Name, UpdateTime = a.UpdateTime, UpdateUser = f.Name, - IsFinish= a.IsCompleted + IsFinish = a.IsCompleted }) .ToPagedListAsync(input.PageIndex, input.PageSize); @@ -97,21 +97,21 @@ public class TrackContentRepository : BasicRepository, ITrac public async Task> GetTrackContentAttributeValue(GetTemplateContentAttributeValueInputVO input) { var list = await Context.Queryable() - .LeftJoin((a, b) => a.Id==b.TrackContentId&& b.TrackTemplateId>0 && b.IsDeleted==false) - .LeftJoin((a, b, c) => b.TrackTemplateId==c.Id&& c.IsDeleted==false) - .WhereIF(!input.TrackCodes.IsNullOrEmpty(), (a, b, c) => input.TrackCodes.Contains(a.Code)) - .WhereIF(input.SubSystemId>0, (a, b, c) => a.SubSystemId==input.SubSystemId) - .WhereIF(!input.TrackTemplateIds.IsNullOrEmpty(), (a, b, c) => input.TrackTemplateIds.Contains(c.Id)) - .Where((a, b, c) => c.Id>0) + .LeftJoin((a, b) => a.Id == b.TrackContentId && b.TrackTemplateId > 0 && b.IsDeleted == false) + .LeftJoin((a, b, c) => b.TrackTemplateId == c.Id && c.IsDeleted == false) + .WhereIF(!input.TrackCodes.IsNullOrEmpty(), (a, b, c) => input.TrackCodes!.Contains(a.Code)) + .WhereIF(input.SubSystemId > 0, (a, b, c) => a.SubSystemId == input.SubSystemId) + .WhereIF(!input.TrackTemplateIds.IsNullOrEmpty(), (a, b, c) => input.TrackTemplateIds!.Contains(c.Id)) + .Where((a, b, c) => c.Id > 0) //.OrderByIF(!input.TrackTemplateIds.IsNullOrEmpty(), (a, b, c) => SqlFunc.IIF(input.TrackTemplateIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), c.CreateTime), OrderByType.Desc) .Select((a, b, c) => new GetTemplateContentAttributeValueVO { - IsCanDelete=b.IsCanDelete, - IsExternal=b.IsExternal, - SubSystemId= a.SubSystemId, - TrackCode= a.Code, - TrackContenId= a.Id, - TrackTemplateId=c.Id + IsCanDelete = b.IsCanDelete, + IsExternal = b.IsExternal, + SubSystemId = a.SubSystemId, + TrackCode = a.Code, + TrackContenId = a.Id, + TrackTemplateId = c.Id }).ToListAsync(); return list; @@ -125,9 +125,9 @@ public class TrackContentRepository : BasicRepository, ITrac public async Task GetTemplateIsExist(int trackContentId) { //var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id); - var trackContentEntities = await Context.Queryable().LeftJoin((a, b) => a.Id==b.TrackContentId && b.IsDeleted==false) - .LeftJoin((a, b, c) => b.TrackTemplateId==c.Id&& c.IsDeleted==false) - .Where((a, b, c) => a.Id==trackContentId) + var trackContentEntities = await Context.Queryable().LeftJoin((a, b) => a.Id == b.TrackContentId && b.IsDeleted == false) + .LeftJoin((a, b, c) => b.TrackTemplateId == c.Id && c.IsDeleted == false) + .Where((a, b, c) => a.Id == trackContentId) .Select((a, b, c) => new { TrackContentId = a.Id, @@ -135,7 +135,7 @@ public class TrackContentRepository : BasicRepository, ITrac }) .ToListAsync(); - if (trackContentEntities.Any(a => a.TemplateId>0)) + if (trackContentEntities.Any(a => a.TemplateId > 0)) { return true; }