|
|
@ -5,6 +5,7 @@ using Mapster;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Myshipping.Application.Entity;
|
|
|
|
using Myshipping.Application.Entity;
|
|
|
|
|
|
|
|
using Myshipping.Application.Helper;
|
|
|
|
using Myshipping.Core;
|
|
|
|
using Myshipping.Core;
|
|
|
|
using NPOI.OpenXmlFormats.Wordprocessing;
|
|
|
|
using NPOI.OpenXmlFormats.Wordprocessing;
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
@ -17,7 +18,7 @@ using System.Threading.Tasks;
|
|
|
|
namespace Myshipping.Application
|
|
|
|
namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// 订舱业务参数
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
[ApiDescriptionSettings("Application", Name = "Para", Order = 10)]
|
|
|
|
[ApiDescriptionSettings("Application", Name = "Para", Order = 10)]
|
|
|
|
public class ParaService : IParaService, IDynamicApiController
|
|
|
|
public class ParaService : IParaService, IDynamicApiController
|
|
|
@ -222,6 +223,78 @@ namespace Myshipping.Application
|
|
|
|
return list;
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 品名参数台账查询
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="QuerySearch">品名参数台账查询请求</param>
|
|
|
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
|
|
|
[HttpPost("/Para/GetParaGoodsPage")]
|
|
|
|
|
|
|
|
public async Task<dynamic> 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<ParaGoodsDto, ParaGoodsInfo>(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<ParaGoodsDto>()).ToList()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///// <summary>
|
|
|
|
///// <summary>
|
|
|
|
///// 保存品名分类参数
|
|
|
|
///// 保存品名分类参数
|
|
|
|
///// </summary>
|
|
|
|
///// </summary>
|
|
|
|