新增品名分类、合约号增、删、改查

optimize
jianghaiqing 2 years ago
parent 43b1e47b7d
commit f05685fec2

@ -9760,21 +9760,25 @@
<summary> <summary>
主键 主键
</summary> </summary>
<example>358942162968645</example>
</member> </member>
<member name="P:Myshipping.Application.ParaContractNoDto.ContractNo"> <member name="P:Myshipping.Application.ParaContractNoDto.ContractNo">
<summary> <summary>
合约号编号 合约号编号
</summary> </summary>
<example>TAO21A00759</example>
</member> </member>
<member name="P:Myshipping.Application.ParaContractNoDto.ContractName"> <member name="P:Myshipping.Application.ParaContractNoDto.ContractName">
<summary> <summary>
合约号名称 合约号名称
</summary> </summary>
<example>测试1</example>
</member> </member>
<member name="P:Myshipping.Application.ParaContractNoDto.ContractNote"> <member name="P:Myshipping.Application.ParaContractNoDto.ContractNote">
<summary> <summary>
合约号备注 合约号备注
</summary> </summary>
<example>测试1</example>
</member> </member>
<member name="P:Myshipping.Application.ParaContractNoDto.CreateTime"> <member name="P:Myshipping.Application.ParaContractNoDto.CreateTime">
<summary> <summary>
@ -9923,6 +9927,163 @@
修改者名称 修改者名称
</summary> </summary>
</member> </member>
<member name="T:Myshipping.Application.QueryParaContractNoDto">
<summary>
约号台账查询
</summary>
</member>
<member name="P:Myshipping.Application.QueryParaContractNoDto.ContractNo">
<summary>
合约号编号
</summary>
</member>
<member name="P:Myshipping.Application.QueryParaContractNoDto.ContractName">
<summary>
合约号名称
</summary>
</member>
<member name="P:Myshipping.Application.QueryParaContractNoDto.ContractNote">
<summary>
合约号备注
</summary>
</member>
<member name="P:Myshipping.Application.QueryParaContractNoDto.CreateUserName">
<summary>
创建者名称
</summary>
<example></example>
</member>
<member name="P:Myshipping.Application.QueryParaContractNoDto.UpdateUserName">
<summary>
修改者名称
</summary>
<example></example>
</member>
<member name="P:Myshipping.Application.QueryParaContractNoDto.CreateTimeBegin">
<summary>
创建时间开始
</summary>
<example>2022-01-01</example>
</member>
<member name="P:Myshipping.Application.QueryParaContractNoDto.CreateTimeEnd">
<summary>
创建时间结束
</summary>
<example>2023-07-01</example>
</member>
<member name="P:Myshipping.Application.QueryParaContractNoDto.UpdateTimeBegin">
<summary>
更新时间开始
</summary>
<example></example>
</member>
<member name="P:Myshipping.Application.QueryParaContractNoDto.UpdateTimeEnd">
<summary>
更新时间结束
</summary>
<example></example>
</member>
<member name="P:Myshipping.Application.QueryParaContractNoDto.PageNo">
<summary>
当前页码
</summary>
<example>1</example>
</member>
<member name="P:Myshipping.Application.QueryParaContractNoDto.PageSize">
<summary>
页码容量
</summary>
<example>20</example>
</member>
<member name="P:Myshipping.Application.QueryParaContractNoDto.SortField">
<summary>
排序字段
</summary>
<example>ContractNo</example>
</member>
<member name="P:Myshipping.Application.QueryParaContractNoDto.descSort">
<summary>
排序方法,默认降序
</summary>
<example>true</example>
</member>
<member name="T:Myshipping.Application.QueryParaGoodsCategoryDto">
<summary>
品名分类参数台账查询
</summary>
</member>
<member name="P:Myshipping.Application.QueryParaGoodsCategoryDto.GoodsCategory">
<summary>
品名分类
</summary>
<example>02</example>
</member>
<member name="P:Myshipping.Application.QueryParaGoodsCategoryDto.GoodsCategoryName">
<summary>
品名分类名称
</summary>
<example></example>
</member>
<member name="P:Myshipping.Application.QueryParaGoodsCategoryDto.CreateUserName">
<summary>
创建者名称
</summary>
<example></example>
</member>
<member name="P:Myshipping.Application.QueryParaGoodsCategoryDto.UpdateUserName">
<summary>
修改者名称
</summary>
<example></example>
</member>
<member name="P:Myshipping.Application.QueryParaGoodsCategoryDto.CreateTimeBegin">
<summary>
创建时间开始
</summary>
<example>2022-01-01</example>
</member>
<member name="P:Myshipping.Application.QueryParaGoodsCategoryDto.CreateTimeEnd">
<summary>
创建时间结束
</summary>
<example>2023-07-01</example>
</member>
<member name="P:Myshipping.Application.QueryParaGoodsCategoryDto.UpdateTimeBegin">
<summary>
更新时间开始
</summary>
<example></example>
</member>
<member name="P:Myshipping.Application.QueryParaGoodsCategoryDto.UpdateTimeEnd">
<summary>
更新时间结束
</summary>
<example></example>
</member>
<member name="P:Myshipping.Application.QueryParaGoodsCategoryDto.PageNo">
<summary>
当前页码
</summary>
<example>1</example>
</member>
<member name="P:Myshipping.Application.QueryParaGoodsCategoryDto.PageSize">
<summary>
页码容量
</summary>
<example>20</example>
</member>
<member name="P:Myshipping.Application.QueryParaGoodsCategoryDto.SortField">
<summary>
排序字段
</summary>
<example>GoodsCategory</example>
</member>
<member name="P:Myshipping.Application.QueryParaGoodsCategoryDto.descSort">
<summary>
排序方法,默认降序
</summary>
<example>true</example>
</member>
<member name="T:Myshipping.Application.QueryParaGoodsDto"> <member name="T:Myshipping.Application.QueryParaGoodsDto">
<summary> <summary>
品名参数台账查询 品名参数台账查询
@ -10044,6 +10205,7 @@
检索品名参数 检索品名参数
</summary> </summary>
<param name="queryItem">检索值</param> <param name="queryItem">检索值</param>
<param name="top">默认最大行数</param>
<returns>返回回执</returns> <returns>返回回执</returns>
</member> </member>
<member name="M:Myshipping.Application.IParaService.GetParaGoodsPageAsync(Myshipping.Application.QueryParaGoodsDto)"> <member name="M:Myshipping.Application.IParaService.GetParaGoodsPageAsync(Myshipping.Application.QueryParaGoodsDto)">
@ -10053,6 +10215,78 @@
<param name="QuerySearch">品名参数台账查询请求</param> <param name="QuerySearch">品名参数台账查询请求</param>
<returns>返回结果</returns> <returns>返回结果</returns>
</member> </member>
<member name="M:Myshipping.Application.IParaService.SaveParaGoodsCategoryInfo(Myshipping.Application.ParaGoodsCategoryDto)">
<summary>
保存品名分类参数
</summary>
<param name="model">品名分类参数</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.IParaService.GetParaGoodsCategoryInfo(System.Int64)">
<summary>
主键获取品名分类参数
</summary>
<param name="Id">品名分类主键</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.IParaService.QueryParaGoodsCategoryInfo(System.String,System.Int32)">
<summary>
检索品名分类参数
</summary>
<param name="queryItem">检索值</param>
<param name="top">默认最大行数</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.IParaService.DeleteParaGoodsCategoryInfo(System.Int64[])">
<summary>
作废品名分类参数
</summary>
<param name="Ids">品名分类参数主键数组</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.IParaService.GetParaGoodsCategoryPageAsync(Myshipping.Application.QueryParaGoodsCategoryDto)">
<summary>
品名分类参数台账查询
</summary>
<param name="QuerySearch">品名分类参数台账查询请求</param>
<returns>返回结果</returns>
</member>
<member name="M:Myshipping.Application.IParaService.SaveParaContractNoInfo(Myshipping.Application.ParaContractNoDto)">
<summary>
保存约号参数
</summary>
<param name="model">约号参数</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.IParaService.GetParaContractNoInfo(System.Int64)">
<summary>
主键获取约号参数
</summary>
<param name="Id">约号主键</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.IParaService.QuerytParaContractNoInfo(System.String,System.Int32)">
<summary>
检索约号参数
</summary>
<param name="queryItem">检索值</param>
<param name="top">默认最大行数</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.IParaService.DeleteParaContractNoInfo(System.Int64[])">
<summary>
作废约号参数
</summary>
<param name="Ids">约号参数主键数组</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.IParaService.GetParaContractNoPageAsync(Myshipping.Application.QueryParaContractNoDto)">
<summary>
约号参数台账查询
</summary>
<param name="QuerySearch">约号参数台账查询请求</param>
<returns>返回结果</returns>
</member>
<member name="T:Myshipping.Application.ParaService"> <member name="T:Myshipping.Application.ParaService">
<summary> <summary>
订舱业务参数 订舱业务参数
@ -10094,6 +10328,78 @@
<param name="QuerySearch">品名参数台账查询请求</param> <param name="QuerySearch">品名参数台账查询请求</param>
<returns>返回结果</returns> <returns>返回结果</returns>
</member> </member>
<member name="M:Myshipping.Application.ParaService.SaveParaGoodsCategoryInfo(Myshipping.Application.ParaGoodsCategoryDto)">
<summary>
保存品名分类参数
</summary>
<param name="model">品名分类参数</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.ParaService.GetParaGoodsCategoryInfo(System.Int64)">
<summary>
主键获取品名分类参数
</summary>
<param name="Id">品名分类主键</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.ParaService.QueryParaGoodsCategoryInfo(System.String,System.Int32)">
<summary>
检索品名分类参数
</summary>
<param name="queryItem">检索值</param>
<param name="top">默认最大行数</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.ParaService.DeleteParaGoodsCategoryInfo(System.Int64[])">
<summary>
作废品名分类参数
</summary>
<param name="Ids">品名分类参数主键数组</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.ParaService.GetParaGoodsCategoryPageAsync(Myshipping.Application.QueryParaGoodsCategoryDto)">
<summary>
品名分类参数台账查询
</summary>
<param name="QuerySearch">品名分类参数台账查询请求</param>
<returns>返回结果</returns>
</member>
<member name="M:Myshipping.Application.ParaService.SaveParaContractNoInfo(Myshipping.Application.ParaContractNoDto)">
<summary>
保存约号参数
</summary>
<param name="model">约号参数</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.ParaService.GetParaContractNoInfo(System.Int64)">
<summary>
主键获取约号参数
</summary>
<param name="Id">约号主键</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.ParaService.QuerytParaContractNoInfo(System.String,System.Int32)">
<summary>
检索约号参数
</summary>
<param name="queryItem">检索值</param>
<param name="top">默认最大行数</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.ParaService.DeleteParaContractNoInfo(System.Int64[])">
<summary>
作废约号参数
</summary>
<param name="Ids">约号参数主键数组</param>
<returns>返回回执</returns>
</member>
<member name="M:Myshipping.Application.ParaService.GetParaContractNoPageAsync(Myshipping.Application.QueryParaContractNoDto)">
<summary>
约号参数台账查询
</summary>
<param name="QuerySearch">约号参数台账查询请求</param>
<returns>返回结果</returns>
</member>
<member name="P:Myshipping.Application.RulesEngineOrderBookingContaCargoInfo.PKGs"> <member name="P:Myshipping.Application.RulesEngineOrderBookingContaCargoInfo.PKGs">
<summary> <summary>
件数 件数

@ -11,21 +11,25 @@ namespace Myshipping.Application
/// <summary> /// <summary>
/// 主键 /// 主键
/// </summary> /// </summary>
/// <example>358942162968645</example>
public string Id{ get; set; } public string Id{ get; set; }
/// <summary> /// <summary>
/// 合约号编号 /// 合约号编号
/// </summary> /// </summary>
/// <example>TAO21A00759</example>
public string ContractNo { get; set; } public string ContractNo { get; set; }
/// <summary> /// <summary>
/// 合约号名称 /// 合约号名称
/// </summary> /// </summary>
/// <example>测试1</example>
public string ContractName { get; set; } public string ContractName { get; set; }
/// <summary> /// <summary>
/// 合约号备注 /// 合约号备注
/// </summary> /// </summary>
/// <example>测试1</example>
public string ContractNote { get; set; } public string ContractNote { get; set; }
/// <summary> /// <summary>

@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 约号台账查询
/// </summary>
public class QueryParaContractNoDto
{
/// <summary>
/// 合约号编号
/// </summary>
public string ContractNo { get; set; }
/// <summary>
/// 合约号名称
/// </summary>
public string ContractName { get; set; }
/// <summary>
/// 合约号备注
/// </summary>
public string ContractNote { get; set; }
/// <summary>
/// 创建者名称
/// </summary>
/// <example></example>
public string CreateUserName { get; set; }
/// <summary>
/// 修改者名称
/// </summary>
/// <example></example>
public string UpdateUserName { get; set; }
/// <summary>
/// 创建时间开始
/// </summary>
/// <example>2022-01-01</example>
public string CreateTimeBegin { get; set; }
/// <summary>
/// 创建时间结束
/// </summary>
/// <example>2023-07-01</example>
public string CreateTimeEnd { get; set; }
/// <summary>
/// 更新时间开始
/// </summary>
/// <example></example>
public string UpdateTimeBegin { get; set; }
/// <summary>
/// 更新时间结束
/// </summary>
/// <example></example>
public string UpdateTimeEnd { get; set; }
/// <summary>
/// 当前页码
/// </summary>
/// <example>1</example>
public int PageNo { get; set; } = 1;
/// <summary>
/// 页码容量
/// </summary>
/// <example>20</example>
public int PageSize { get; set; } = 20;
/// <summary>
/// 排序字段
/// </summary>
/// <example>ContractNo</example>
public string SortField { get; set; }
/// <summary>
/// 排序方法,默认降序
/// </summary>
/// <example>true</example>
public bool descSort { get; set; } = true;
}
}

@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 品名分类参数台账查询
/// </summary>
public class QueryParaGoodsCategoryDto
{
/// <summary>
/// 品名分类
/// </summary>
/// <example>02</example>
public string GoodsCategory { get; set; }
/// <summary>
/// 品名分类名称
/// </summary>
/// <example></example>
public string GoodsCategoryName { get; set; }
/// <summary>
/// 创建者名称
/// </summary>
/// <example></example>
public string CreateUserName { get; set; }
/// <summary>
/// 修改者名称
/// </summary>
/// <example></example>
public string UpdateUserName { get; set; }
/// <summary>
/// 创建时间开始
/// </summary>
/// <example>2022-01-01</example>
public string CreateTimeBegin { get; set; }
/// <summary>
/// 创建时间结束
/// </summary>
/// <example>2023-07-01</example>
public string CreateTimeEnd { get; set; }
/// <summary>
/// 更新时间开始
/// </summary>
/// <example></example>
public string UpdateTimeBegin { get; set; }
/// <summary>
/// 更新时间结束
/// </summary>
/// <example></example>
public string UpdateTimeEnd { get; set; }
/// <summary>
/// 当前页码
/// </summary>
/// <example>1</example>
public int PageNo { get; set; } = 1;
/// <summary>
/// 页码容量
/// </summary>
/// <example>20</example>
public int PageSize { get; set; } = 20;
/// <summary>
/// 排序字段
/// </summary>
/// <example>GoodsCategory</example>
public string SortField { get; set; }
/// <summary>
/// 排序方法,默认降序
/// </summary>
/// <example>true</example>
public bool descSort { get; set; } = true;
}
}

@ -33,6 +33,7 @@ namespace Myshipping.Application
/// 检索品名参数 /// 检索品名参数
/// </summary> /// </summary>
/// <param name="queryItem">检索值</param> /// <param name="queryItem">检索值</param>
/// <param name="top">默认最大行数</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<List<ParaGoodsDto>> QueryParaGoodsInfo(string queryItem, int top = 10); Task<List<ParaGoodsDto>> QueryParaGoodsInfo(string queryItem, int top = 10);
@ -43,47 +44,77 @@ namespace Myshipping.Application
/// <returns>返回结果</returns> /// <returns>返回结果</returns>
Task<dynamic> GetParaGoodsPageAsync(QueryParaGoodsDto QuerySearch); Task<dynamic> GetParaGoodsPageAsync(QueryParaGoodsDto QuerySearch);
///// <summary> /// <summary>
///// 保存品名分类参数 /// 保存品名分类参数
///// </summary> /// </summary>
///// <param name="model">品名分类参数</param> /// <param name="model">品名分类参数</param>
///// <returns>返回回执</returns> /// <returns>返回回执</returns>
//Task<CommonWebApiResult> SaveParaGoodsCategoryInfo(ParaGoodsCategoryDto model); Task<long> SaveParaGoodsCategoryInfo(ParaGoodsCategoryDto model);
///// <summary> /// <summary>
///// 主键获取品名分类参数 /// 主键获取品名分类参数
///// </summary> /// </summary>
///// <param name="Id">品名分类主键</param> /// <param name="Id">品名分类主键</param>
///// <returns>返回回执</returns> /// <returns>返回回执</returns>
//Task<CommonWebApiResult> GetParaGoodsCategoryInfo(long Id); Task<ParaGoodsCategoryDto> GetParaGoodsCategoryInfo(long Id);
///// <summary> /// <summary>
///// 检索品名分类参数 /// 检索品名分类参数
///// </summary> /// </summary>
///// <param name="queryItem">检索值</param> /// <param name="queryItem">检索值</param>
///// <returns>返回回执</returns> /// <param name="top">默认最大行数</param>
//Task<CommonWebApiResult> QueryParaGoodsCategoryInfo(string queryItem); /// <returns>返回回执</returns>
Task<List<ParaGoodsCategoryDto>> QueryParaGoodsCategoryInfo(string queryItem, int top = 10);
///// <summary> /// <summary>
///// 保存约号参数 /// 作废品名分类参数
///// </summary> /// </summary>
///// <param name="model">约号参数</param> /// <param name="Ids">品名分类参数主键数组</param>
///// <returns>返回回执</returns> /// <returns>返回回执</returns>
//Task<CommonWebApiResult> SaveParaContractNoInfo(ParaGoodsCategoryDto model); Task<string> DeleteParaGoodsCategoryInfo(long[] Ids);
///// <summary> /// <summary>
///// 主键获取约号参数 /// 品名分类参数台账查询
///// </summary> /// </summary>
///// <param name="Id">约号主键</param> /// <param name="QuerySearch">品名分类参数台账查询请求</param>
///// <returns>返回回执</returns> /// <returns>返回结果</returns>
//Task<CommonWebApiResult> GetParaContractNoInfo(long Id); Task<dynamic> GetParaGoodsCategoryPageAsync(QueryParaGoodsCategoryDto QuerySearch);
///// <summary>
///// 检索约号参数 /// <summary>
///// </summary> /// 保存约号参数
///// <param name="queryItem">检索值</param> /// </summary>
///// <returns>返回回执</returns> /// <param name="model">约号参数</param>
//Task<CommonWebApiResult> QuerytParaContractNoInfo(string queryItem); /// <returns>返回回执</returns>
Task<long> SaveParaContractNoInfo(ParaContractNoDto model);
/// <summary>
/// 主键获取约号参数
/// </summary>
/// <param name="Id">约号主键</param>
/// <returns>返回回执</returns>
Task<ParaContractNoDto> GetParaContractNoInfo(long Id);
/// <summary>
/// 检索约号参数
/// </summary>
/// <param name="queryItem">检索值</param>
/// <param name="top">默认最大行数</param>
/// <returns>返回回执</returns>
Task<List<ParaContractNoDto>> QuerytParaContractNoInfo(string queryItem, int top = 10);
/// <summary>
/// 作废约号参数
/// </summary>
/// <param name="Ids">约号参数主键数组</param>
/// <returns>返回回执</returns>
Task<string> DeleteParaContractNoInfo(long[] Ids);
/// <summary>
/// 约号参数台账查询
/// </summary>
/// <param name="QuerySearch">约号参数台账查询请求</param>
/// <returns>返回结果</returns>
Task<dynamic> GetParaContractNoPageAsync(QueryParaContractNoDto QuerySearch);
} }
} }

@ -7,8 +7,11 @@ using Microsoft.Extensions.Logging;
using Myshipping.Application.Entity; using Myshipping.Application.Entity;
using Myshipping.Application.Helper; using Myshipping.Application.Helper;
using Myshipping.Core; using Myshipping.Core;
using Myshipping.Core.Entity;
using NPOI.OpenXmlFormats.Wordprocessing; using NPOI.OpenXmlFormats.Wordprocessing;
using NPOI.SS.Formula.Functions; using NPOI.SS.Formula.Functions;
using NPOI.XWPF.UserModel;
using Org.BouncyCastle.Crypto;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -60,6 +63,17 @@ namespace Myshipping.Application
if(sameList.Count > 0 && !string.IsNullOrWhiteSpace(model.Id) && sameList.Any(t=>t.Id != long.Parse(model.Id))) if(sameList.Count > 0 && !string.IsNullOrWhiteSpace(model.Id) && sameList.Any(t=>t.Id != long.Parse(model.Id)))
throw Oops.Oh($"商品编码【{model.GoodsCode}】已存在不能重复保存"); throw Oops.Oh($"商品编码【{model.GoodsCode}】已存在不能重复保存");
//如果填写了品名分配需要确认根据库中数据一致
if (!string.IsNullOrWhiteSpace(model.GoodsCategory))
{
var categoryInfo = _paraGoodsCategoryInfoRepository.AsQueryable().First(t => t.GOODS_CATEGORY.Equals(model.GoodsCategory.Trim()));
if (categoryInfo == null)
throw Oops.Oh($"品名分类代码【{model.GoodsCategory}】不存在,请确认品名分类");
if (!string.IsNullOrWhiteSpace(model.GoodsCategoryName) && !categoryInfo.GOODS_CATEGORY_NAME.Equals(model.GoodsCategoryName.Trim()))
throw Oops.Oh($"品名分类名称【{model.GoodsCategoryName}】错误code={model.GoodsCategory}请确认品名分类");
}
if (!string.IsNullOrWhiteSpace(model.Id)) if (!string.IsNullOrWhiteSpace(model.Id))
{ {
@ -281,8 +295,8 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.GoodsDesp), t => t.GOODS_DESP.Contains(QuerySearch.GoodsDesp.Trim(), StringComparison.OrdinalIgnoreCase)) .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.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.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.CreateUserName), t => t.CreatedUserName.Contains(QuerySearch.CreateUserName.Trim(), StringComparison.OrdinalIgnoreCase))
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.UpdateUserName), t => t.GOODS_NAME_EN.Contains(QuerySearch.UpdateUserName.Trim(), StringComparison.OrdinalIgnoreCase)) .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.UpdateUserName), t => t.UpdatedUserName.Contains(QuerySearch.UpdateUserName.Trim(), StringComparison.OrdinalIgnoreCase))
.OrderBy(entityOrderCol + (QuerySearch.descSort ? " asc " : " desc ")) .OrderBy(entityOrderCol + (QuerySearch.descSort ? " asc " : " desc "))
.ToPagedListAsync(QuerySearch.PageNo, QuerySearch.PageSize); .ToPagedListAsync(QuerySearch.PageNo, QuerySearch.PageSize);
return new return new
@ -295,77 +309,519 @@ namespace Myshipping.Application
}; };
} }
///// <summary> /// <summary>
///// 保存品名分类参数 /// 保存品名分类参数
///// </summary> /// </summary>
///// <param name="model">品名分类参数</param> /// <param name="model">品名分类参数</param>
///// <returns>返回回执</returns> /// <returns>返回回执</returns>
//public async Task<CommonWebApiResult> SaveParaGoodsCategoryInfo(ParaGoodsCategoryDto model) public async Task<long> SaveParaGoodsCategoryInfo(ParaGoodsCategoryDto model)
//{ {
// CommonWebApiResult result = new CommonWebApiResult(); ParaGoodsCategoryInfo info = null;
// return result; try
//} {
//判断代码不能重复
///// <summary> var sameList = _paraGoodsCategoryInfoRepository.AsQueryable()
///// 主键获取品名分类参数 .Where(t => t.GOODS_CATEGORY.Equals(model.GoodsCategory, StringComparison.OrdinalIgnoreCase)).ToList();
///// </summary>
///// <param name="Id">品名分类主键</param> if (sameList.Count > 0 && !string.IsNullOrWhiteSpace(model.Id) && sameList.Any(t => t.Id != long.Parse(model.Id)))
///// <returns>返回回执</returns> throw Oops.Oh($"商品分类代码【{model.GoodsCategory}】已存在不能重复保存");
//public async Task<CommonWebApiResult> GetParaGoodsCategoryInfo(long Id)
//{ if (!string.IsNullOrWhiteSpace(model.Id))
// CommonWebApiResult result = new CommonWebApiResult(); {
info = await _paraGoodsCategoryInfoRepository.AsQueryable().FirstAsync(t => t.Id == long.Parse(model.Id));
// return result;
//} //如果填写了品名分配需要确认根据库中数据一致
if (!info.GOODS_CATEGORY.Equals(model.GoodsCategory, StringComparison.OrdinalIgnoreCase))
///// <summary> {
///// 检索品名分类参数 var existsList = _paraGoodsCategoryInfoRepository.AsQueryable()
///// </summary> .LeftJoin(_paraGoodsInfoRepository.AsQueryable(), (cate, goods) => cate.GOODS_CATEGORY == goods.GOODS_CATEGORY)
///// <param name="queryItem">检索值</param> .Where(cate => cate.Id == info.Id)
///// <returns>返回回执</returns> .Select((cate, goods) => new { Cate = cate, Goods = goods }).ToList();
//public async Task<CommonWebApiResult> QueryParaGoodsCategoryInfo(string queryItem)
//{ if (existsList.Any(t => t.Goods != null))
// CommonWebApiResult result = new CommonWebApiResult(); throw Oops.Oh($"原分类代码{info.GOODS_CATEGORY}已有对应品名参数,不能修改");
// return result; }
//}
info.GOODS_CATEGORY = model.GoodsCategory;
info.GOODS_CATEGORY_NAME = model.GoodsCategoryName;
///// <summary>
///// 保存约号参数 await _paraGoodsCategoryInfoRepository.AsUpdateable(info).IgnoreColumns(it => new
///// </summary> {
///// <param name="model">约号参数</param> it.Id,
///// <returns>返回回执</returns> it.TenantId,
//public async Task<CommonWebApiResult> SaveParaContractNoInfo(ParaGoodsCategoryDto model) it.CreatedTime,
//{ it.CreatedUserId,
// CommonWebApiResult result = new CommonWebApiResult(); it.CreatedUserName
}).ExecuteCommandAsync();
// return result; }
//} else
{
///// <summary> info = model.Adapt<ParaGoodsCategoryInfo>();
///// 主键获取约号参数
///// </summary> await _paraGoodsCategoryInfoRepository.InsertAsync(info);
///// <param name="Id">约号主键</param> }
///// <returns>返回回执</returns> }
//public async Task<CommonWebApiResult> GetParaContractNoInfo(long Id) catch (Exception ex)
//{ {
// CommonWebApiResult result = new CommonWebApiResult(); throw Oops.Bah($"保存品名分类参数异常,{ex.Message}");
}
// return result;
//} return info.Id;
}
///// <summary>
///// 检索约号参数 /// <summary>
///// </summary> /// 主键获取品名分类参数
///// <param name="queryItem">检索值</param> /// </summary>
///// <returns>返回回执</returns> /// <param name="Id">品名分类主键</param>
//public async Task<CommonWebApiResult> QuerytParaContractNoInfo(string queryItem) /// <returns>返回回执</returns>
//{ public async Task<ParaGoodsCategoryDto> GetParaGoodsCategoryInfo(long Id)
// CommonWebApiResult result = new CommonWebApiResult(); {
ParaGoodsCategoryDto model = null;
// return result;
//} try
{
ParaGoodsCategoryInfo info = _paraGoodsCategoryInfoRepository.AsQueryable().First(t => t.Id == Id);
if (info == null)
throw Oops.Oh($"获取品名分类参数失败");
model = info.Adapt<ParaGoodsCategoryDto>();
}
catch (Exception ex)
{
throw Oops.Bah($"获取品名分类参数异常,{ex.Message}");
}
return model;
}
/// <summary>
/// 检索品名分类参数
/// </summary>
/// <param name="queryItem">检索值</param>
/// <param name="top">默认最大行数</param>
/// <returns>返回回执</returns>
[HttpGet("/Para/QueryParaGoodsCategoryInfo")]
public async Task<List<ParaGoodsCategoryDto>> QueryParaGoodsCategoryInfo([FromQuery] string queryItem, [FromQuery] int top = 10)
{
List<ParaGoodsCategoryDto> list = new List<ParaGoodsCategoryDto>();
try
{
var query = _paraGoodsCategoryInfoRepository.AsQueryable();
if (!string.IsNullOrWhiteSpace(queryItem))
{
query = query.Where(t =>
t.GOODS_CATEGORY.Contains(queryItem.Trim(), StringComparison.OrdinalIgnoreCase) ||
t.GOODS_CATEGORY_NAME.Contains(queryItem.Trim(), StringComparison.OrdinalIgnoreCase)
);
}
query = query.OrderBy("GOODS_CATEGORY asc");
var currList = await query.Take(top).ToListAsync();
if (currList.Count > 0)
list = currList.Select(t => t.Adapt<ParaGoodsCategoryDto>()).ToList();
}
catch (Exception ex)
{
throw Oops.Bah($"保存品名参数异常,{ex.Message}");
}
return list;
}
/// <summary>
/// 作废品名分类参数
/// </summary>
/// <param name="Ids">品名分类参数主键数组</param>
/// <returns>返回回执</returns>
[HttpPost("/Para/DeleteParaGoodsCategoryInfo")]
public async Task<string> DeleteParaGoodsCategoryInfo(long[] Ids)
{
try
{
//如果没有给主键直接抛异常
if (Ids.Length == 0)
throw Oops.Oh("没有提供需要作废的主键信息");
var list = _paraGoodsCategoryInfoRepository.AsQueryable().Where(t => Ids.Contains(t.Id)).ToList();
if (list.Count != Ids.Length)
{
var noRecord = string.Join(",", Ids.GroupJoin(list, l => l, r => r.Id, (l, r) => {
var currList = r.ToList();
if (r.Count() > 0)
return string.Empty;
return l.ToString();
}).Where(t => !string.IsNullOrWhiteSpace(t)).ToArray());
throw Oops.Oh($"以下主键信息 {noRecord} 检索失败或者已作废过");
}
//这里需要判断当前的品名分类是否已经对应到品名上,如果已有对应则不能直接作废
var existsList = _paraGoodsCategoryInfoRepository.AsQueryable()
.LeftJoin(_paraGoodsInfoRepository.AsQueryable(),(cate, goods) => cate.GOODS_CATEGORY == goods.GOODS_CATEGORY)
.Where(cate => Ids.Contains(cate.Id))
.Select((cate, goods) => new { Cate = cate, Goods = goods }).ToList();
if(existsList.Any(t=>t.Goods != null))
throw Oops.Oh($"以下分类代码已指定品名参数不能直接删除,{string.Join(",",existsList.Select(t=>t.Cate.GOODS_CATEGORY).Distinct().ToArray())}");
list.ForEach(async entity =>
{
entity.IsDeleted = true;
entity.UpdatedTime = DateTime.Now;
entity.UpdatedUserId = UserManager.UserId;
entity.UpdatedUserName = UserManager.Name;
await _paraGoodsCategoryInfoRepository.AsUpdateable(entity).IgnoreColumns(it => new
{
it.Id,
it.TenantId,
it.CreatedTime,
it.CreatedUserId,
it.CreatedUserName
}).ExecuteCommandAsync();
});
}
catch (Exception ex)
{
throw Oops.Bah($"作废品名参数异常,{ex.Message}");
}
return "作废成功";
}
#region 品名分类参数台账查询
/// <summary>
/// 品名分类参数台账查询
/// </summary>
/// <param name="QuerySearch">品名分类参数台账查询请求</param>
/// <returns>返回结果</returns>
public async Task<dynamic> GetParaGoodsCategoryPageAsync(QueryParaGoodsCategoryDto 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<ParaGoodsCategoryDto, ParaGoodsCategoryInfo>(QuerySearch.SortField);
var entities = await _paraGoodsCategoryInfoRepository.AsQueryable().Filter(null, true)
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.GoodsCategory), t => t.GOODS_CATEGORY.Contains(QuerySearch.GoodsCategory.Trim(), StringComparison.OrdinalIgnoreCase))
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.GoodsCategoryName), t => t.GOODS_CATEGORY_NAME.Contains(QuerySearch.GoodsCategoryName.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.CreateUserName), t => t.CreatedUserName.Contains(QuerySearch.CreateUserName.Trim(), StringComparison.OrdinalIgnoreCase))
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.UpdateUserName), t => t.UpdatedUserName.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<ParaGoodsCategoryDto>()).ToList()
};
}
#endregion
#region 保存约号参数
/// <summary>
/// 保存约号参数
/// </summary>
/// <param name="model">约号参数</param>
/// <returns>返回回执</returns>
public async Task<long> SaveParaContractNoInfo(ParaContractNoDto model)
{
ParaContractNoInfo info = null;
try
{
//判断代码不能重复
var sameList = _paraContractNoInfoRepository.AsQueryable()
.Where(t => t.CONTRACT_NO.Equals(model.ContractNo, StringComparison.OrdinalIgnoreCase)).ToList();
if (sameList.Count > 0 && !string.IsNullOrWhiteSpace(model.Id) && sameList.Any(t => t.Id != long.Parse(model.Id)))
throw Oops.Oh($"合约号编号【{model.ContractNo}】已存在不能重复保存");
if (!string.IsNullOrWhiteSpace(model.Id))
{
info = await _paraContractNoInfoRepository.AsQueryable().FirstAsync(t => t.Id == long.Parse(model.Id));
info.CONTRACT_NO = model.ContractNo;
info.CONTRACT_NAME = model.ContractName;
info.CONTRACT_NAME = model.ContractName;
await _paraContractNoInfoRepository.AsUpdateable(info).IgnoreColumns(it => new
{
it.Id,
it.TenantId,
it.CreatedTime,
it.CreatedUserId,
it.CreatedUserName
}).ExecuteCommandAsync();
}
else
{
info = model.Adapt<ParaContractNoInfo>();
await _paraContractNoInfoRepository.InsertAsync(info);
}
}
catch (Exception ex)
{
throw Oops.Bah($"保存约号参数异常,{ex.Message}");
}
return info.Id;
}
#endregion
#region 主键获取约号参数
/// <summary>
/// 主键获取约号参数
/// </summary>
/// <param name="Id">约号主键</param>
/// <returns>返回回执</returns>
public async Task<ParaContractNoDto> GetParaContractNoInfo(long Id)
{
ParaContractNoDto model = null;
try
{
ParaContractNoInfo info = _paraContractNoInfoRepository.AsQueryable().First(t => t.Id == Id);
if (info == null)
throw Oops.Oh($"获取约号参数失败");
model = info.Adapt<ParaContractNoDto>();
}
catch (Exception ex)
{
throw Oops.Bah($"获取约号参数异常,{ex.Message}");
}
return model;
}
#endregion
#region 检索约号参数
/// <summary>
/// 检索约号参数
/// </summary>
/// <param name="queryItem">检索值</param>
/// <param name="top">默认最大行数</param>
/// <returns>返回回执</returns>
public async Task<List<ParaContractNoDto>> QuerytParaContractNoInfo([FromQuery] string queryItem, [FromQuery] int top = 10)
{
List<ParaContractNoDto> list = new List<ParaContractNoDto>();
try
{
var query = _paraContractNoInfoRepository.AsQueryable();
if (!string.IsNullOrWhiteSpace(queryItem))
{
query = query.Where(t =>
t.CONTRACT_NO.Contains(queryItem.Trim(), StringComparison.OrdinalIgnoreCase) ||
t.CONTRACT_NAME.Contains(queryItem.Trim(), StringComparison.OrdinalIgnoreCase) ||
t.CONTRACT_NOTE.Contains(queryItem.Trim(), StringComparison.OrdinalIgnoreCase)
);
}
query = query.OrderBy("CONTRACT_NO asc");
var currList = await query.Take(top).ToListAsync();
if (currList.Count > 0)
list = currList.Select(t => t.Adapt<ParaContractNoDto>()).ToList();
}
catch (Exception ex)
{
throw Oops.Bah($"检索约号参数异常,{ex.Message}");
}
return list;
}
#endregion
#region 作废约号参数
/// <summary>
/// 作废约号参数
/// </summary>
/// <param name="Ids">约号参数主键数组</param>
/// <returns>返回回执</returns>
public async Task<string> DeleteParaContractNoInfo(long[] Ids)
{
try
{
//如果没有给主键直接抛异常
if (Ids.Length == 0)
throw Oops.Oh("没有提供需要作废的主键信息");
var list = _paraContractNoInfoRepository.AsQueryable().Where(t => Ids.Contains(t.Id)).ToList();
if (list.Count != Ids.Length)
{
var noRecord = string.Join(",", Ids.GroupJoin(list, l => l, r => r.Id, (l, r) => {
var currList = r.ToList();
if (r.Count() > 0)
return string.Empty;
return l.ToString();
}).Where(t => !string.IsNullOrWhiteSpace(t)).ToArray());
throw Oops.Oh($"以下主键信息 {noRecord} 检索失败或者已作废过");
}
list.ForEach(async entity =>
{
entity.IsDeleted = true;
entity.UpdatedTime = DateTime.Now;
entity.UpdatedUserId = UserManager.UserId;
entity.UpdatedUserName = UserManager.Name;
await _paraContractNoInfoRepository.AsUpdateable(entity).IgnoreColumns(it => new
{
it.Id,
it.TenantId,
it.CreatedTime,
it.CreatedUserId,
it.CreatedUserName
}).ExecuteCommandAsync();
});
}
catch (Exception ex)
{
throw Oops.Bah($"作废约号参数异常,{ex.Message}");
}
return "作废成功";
}
#endregion
#region 约号参数台账查询
/// <summary>
/// 约号参数台账查询
/// </summary>
/// <param name="QuerySearch">约号参数台账查询请求</param>
/// <returns>返回结果</returns>
public async Task<dynamic> GetParaContractNoPageAsync(QueryParaContractNoDto 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<ParaContractNoDto, ParaContractNoInfo>(QuerySearch.SortField);
var entities = await _paraContractNoInfoRepository.AsQueryable().Filter(null, true)
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.ContractNo), t => t.CONTRACT_NO.Contains(QuerySearch.ContractNo.Trim(), StringComparison.OrdinalIgnoreCase))
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.ContractName), t => t.CONTRACT_NAME.Contains(QuerySearch.ContractName.Trim(), StringComparison.OrdinalIgnoreCase))
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.ContractNote), t => t.CONTRACT_NOTE.Contains(QuerySearch.ContractNote.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.CreateUserName), t => t.CreatedUserName.Contains(QuerySearch.CreateUserName.Trim(), StringComparison.OrdinalIgnoreCase))
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.UpdateUserName), t => t.UpdatedUserName.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<ParaContractNoDto>()).ToList()
};
}
#endregion
} }
} }

Loading…
Cancel
Save