diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml index 4932674f..e8a8ca98 100644 --- a/Myshipping.Application/Myshipping.Application.xml +++ b/Myshipping.Application/Myshipping.Application.xml @@ -9923,6 +9923,101 @@ 修改者名称 + + + 品名参数台账查询 + + + + + 品名编码 + + + + + + 品名中文 + + + + + + 品名英文 + + + + + + 品名描述 + + + + + + 品名分类 + + 02 + + + + 创建者名称 + + + + + + 修改者名称 + + + + + + 创建时间开始 + + 2022-01-01 + + + + 创建时间结束 + + 2023-07-01 + + + + 更新时间开始 + + + + + + 更新时间结束 + + + + + + 当前页码 + + 1 + + + + 页码容量 + + 20 + + + + 排序字段 + + GoodsCode + + + + 排序方法,默认降序 + + true + 保存品名参数 @@ -9951,9 +10046,16 @@ 检索值 返回回执 + + + 品名参数台账查询 + + 品名参数台账查询请求 + 返回结果 + - + 订舱业务参数 @@ -9985,6 +10087,13 @@ 默认最大行数 返回回执 + + + 品名参数台账查询 + + 品名参数台账查询请求 + 返回结果 + 件数 diff --git a/Myshipping.Application/Service/Para/Dto/QueryParaGoodsDto.cs b/Myshipping.Application/Service/Para/Dto/QueryParaGoodsDto.cs new file mode 100644 index 00000000..442567e4 --- /dev/null +++ b/Myshipping.Application/Service/Para/Dto/QueryParaGoodsDto.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 品名参数台账查询 + /// + public class QueryParaGoodsDto + { + /// + /// 品名编码 + /// + /// + public string GoodsCode { get; set; } + + /// + /// 品名中文 + /// + /// + public string GoodsNameCN { get; set; } + + /// + /// 品名英文 + /// + /// + public string GoodsNameEN { get; set; } + + /// + /// 品名描述 + /// + /// + public string GoodsDesp { get; set; } + + /// + /// 品名分类 + /// + /// 02 + public string GoodsCategory { get; set; } + + /// + /// 创建者名称 + /// + /// + public string CreateUserName { get; set; } + + /// + /// 修改者名称 + /// + /// + public string UpdateUserName { get; set; } + + /// + /// 创建时间开始 + /// + /// 2022-01-01 + public string CreateTimeBegin { get; set; } + + /// + /// 创建时间结束 + /// + /// 2023-07-01 + public string CreateTimeEnd { get; set; } + + /// + /// 更新时间开始 + /// + /// + public string UpdateTimeBegin { get; set; } + + /// + /// 更新时间结束 + /// + /// + public string UpdateTimeEnd { get; set; } + + /// + /// 当前页码 + /// + /// 1 + public int PageNo { get; set; } = 1; + + /// + /// 页码容量 + /// + /// 20 + public int PageSize { get; set; } = 20; + + /// + /// 排序字段 + /// + /// GoodsCode + public string SortField { get; set; } + + /// + /// 排序方法,默认降序 + /// + /// true + public bool descSort { get; set; } = true; + } +} diff --git a/Myshipping.Application/Service/Para/Interface/IParaService.cs b/Myshipping.Application/Service/Para/Interface/IParaService.cs index 41f548d9..7b4b9076 100644 --- a/Myshipping.Application/Service/Para/Interface/IParaService.cs +++ b/Myshipping.Application/Service/Para/Interface/IParaService.cs @@ -36,6 +36,13 @@ namespace Myshipping.Application /// 返回回执 Task> QueryParaGoodsInfo(string queryItem, int top = 10); + /// + /// 品名参数台账查询 + /// + /// 品名参数台账查询请求 + /// 返回结果 + Task GetParaGoodsPageAsync(QueryParaGoodsDto QuerySearch); + ///// ///// 保存品名分类参数 ///// diff --git a/Myshipping.Application/Service/Para/ParaService.cs b/Myshipping.Application/Service/Para/ParaService.cs index dffdc66d..c0b47131 100644 --- a/Myshipping.Application/Service/Para/ParaService.cs +++ b/Myshipping.Application/Service/Para/ParaService.cs @@ -5,6 +5,7 @@ using Mapster; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Myshipping.Application.Entity; +using Myshipping.Application.Helper; using Myshipping.Core; using NPOI.OpenXmlFormats.Wordprocessing; using NPOI.SS.Formula.Functions; @@ -17,7 +18,7 @@ using System.Threading.Tasks; namespace Myshipping.Application { /// - /// + /// 订舱业务参数 /// [ApiDescriptionSettings("Application", Name = "Para", Order = 10)] public class ParaService : IParaService, IDynamicApiController @@ -222,6 +223,78 @@ namespace Myshipping.Application return list; } + /// + /// 品名参数台账查询 + /// + /// 品名参数台账查询请求 + /// 返回结果 + [HttpPost("/Para/GetParaGoodsPage")] + public async Task GetParaGoodsPageAsync(QueryParaGoodsDto QuerySearch) + { + DateTime createBegin = DateTime.MinValue; + DateTime createEnd = DateTime.MinValue; + + DateTime updateBegin = DateTime.MinValue; + DateTime updateEnd = DateTime.MinValue; + + if (!string.IsNullOrWhiteSpace(QuerySearch.CreateTimeBegin)) + { + if (!DateTime.TryParse(QuerySearch.CreateTimeBegin, out createBegin)) + throw Oops.Oh($"创建开始日期格式错误,{QuerySearch.CreateTimeBegin}"); + } + + if (!string.IsNullOrWhiteSpace(QuerySearch.CreateTimeEnd)) + { + if (!DateTime.TryParse(QuerySearch.CreateTimeEnd, out createEnd)) + throw Oops.Oh($"创建结束日期格式错误,{QuerySearch.CreateTimeEnd}"); + + createEnd = createEnd.AddDays(1); + } + + if (!string.IsNullOrWhiteSpace(QuerySearch.UpdateTimeBegin)) + { + if (!DateTime.TryParse(QuerySearch.UpdateTimeBegin, out updateBegin)) + throw Oops.Oh($"更新起始日期格式错误,{QuerySearch.UpdateTimeBegin}"); + } + + if (!string.IsNullOrWhiteSpace(QuerySearch.UpdateTimeEnd)) + { + if (!DateTime.TryParse(QuerySearch.UpdateTimeEnd, out updateEnd)) + throw Oops.Oh($"更新结束日期格式错误,{QuerySearch.UpdateTimeEnd}"); + + updateEnd = updateEnd.AddDays(1); + } + + string entityOrderCol = "CreatedTime"; + + //这里因为返回给前端的台账数据是DTO,所以这里排序时候需要转换成Entity对应的字段 + if (!string.IsNullOrWhiteSpace(QuerySearch.SortField)) + entityOrderCol = MapsterExtHelper.GetAdaptProperty(QuerySearch.SortField); + + var entities = await _paraGoodsInfoRepository.AsQueryable().Filter(null, true) + .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.GoodsCode), t => t.GOODS_CODE.Contains(QuerySearch.GoodsCode.Trim(), StringComparison.OrdinalIgnoreCase)) + .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.GoodsNameCN), t => t.GOODS_NAME_CN.Contains(QuerySearch.GoodsNameCN.Trim(), StringComparison.OrdinalIgnoreCase)) + .WhereIF(createBegin != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value >= createBegin) + .WhereIF(createEnd != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value < createEnd) + .WhereIF(updateBegin != DateTime.MinValue, t => t.UpdatedTime.HasValue && t.UpdatedTime.Value >= updateBegin) + .WhereIF(updateEnd != DateTime.MinValue, t => t.UpdatedTime.HasValue && t.UpdatedTime.Value < updateEnd) + .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.GoodsDesp), t => t.GOODS_DESP.Contains(QuerySearch.GoodsDesp.Trim(), StringComparison.OrdinalIgnoreCase)) + .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.GoodsNameEN), t => t.GOODS_NAME_EN.Contains(QuerySearch.GoodsNameEN.Trim(), StringComparison.OrdinalIgnoreCase)) + .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.GoodsCategory), t => t.GOODS_CATEGORY.Equals(QuerySearch.GoodsCategory.Trim(), StringComparison.OrdinalIgnoreCase)) + .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.CreateUserName), t => t.GOODS_NAME_EN.Contains(QuerySearch.CreateUserName.Trim(), StringComparison.OrdinalIgnoreCase)) + .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.UpdateUserName), t => t.GOODS_NAME_EN.Contains(QuerySearch.UpdateUserName.Trim(), StringComparison.OrdinalIgnoreCase)) + .OrderBy(entityOrderCol + (QuerySearch.descSort ? " asc " : " desc ")) + .ToPagedListAsync(QuerySearch.PageNo, QuerySearch.PageSize); + return new + { + PageNo = entities.PageIndex, + PageSize = entities.PageSize, + TotalPage = entities.TotalPages, + TotalRows = entities.TotalCount, + Rows = entities.Items.Select(t => t.Adapt()).ToList() + }; + } + ///// ///// 保存品名分类参数 /////