mahao 1 year ago
parent
commit
4da84bfcf2
  1. 159
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  2. 21
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  3. 13
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs
  4. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

159
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs

@ -16,42 +16,51 @@ public class PriceListDto : EntityDto<Guid>
/// </summary> /// </summary>
[Display(Name = "零件号")] [Display(Name = "零件号")]
public string LU { get; set; } public string LU { get; set; }
/// <summary> /// <summary>
/// 价格 /// 价格
/// </summary> /// </summary>
[Display(Name = "价格")] [Display(Name = "价格")]
public Decimal Price { set; get; } public Decimal Price { set; get; }
/// <summary> /// <summary>
/// 开始时间 /// 开始时间
/// </summary> /// </summary>
[Display(Name = "开始时间")] [Display(Name = "开始时间")]
public DateTime BeginTime { set; get; } public DateTime BeginTime { set; get; }
/// <summary> /// <summary>
/// 结束时间 /// 结束时间
/// </summary> /// </summary>
[Display(Name = "结束时间")] [Display(Name = "结束时间")]
public DateTime EndTime { set; get; } public DateTime EndTime { set; get; }
/// <summary> /// <summary>
/// 客户编码 /// 客户编码
/// </summary> /// </summary>
[Display(Name = "客户编码")] [Display(Name = "客户编码")]
public string ClientCode { get; set; } public string ClientCode { get; set; }
/// <summary>
/// 业务类别
/// </summary>
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
/// <summary>
/// 版本
/// </summary>
[Display(Name = "版本")]
public string Version { set; get; }
/// <summary> /// <summary>
/// 合同签订时间 /// 合同签订时间
/// </summary> /// </summary>
[Display(Name = "合同签订时间")] [Display(Name = "合同签订时间")]
public DateTime Date { get; set; } public string Date { get; set; }
/// <summary> /// <summary>
/// 合同号 /// 合同号
/// </summary> /// </summary>
[Display(Name = "合同号")] [Display(Name = "合同号")]
public string ContractNo { get; set; } public string ContractNo { get; set; }
/// <summary>
/// 是否作废
/// </summary>
[Display(Name = "是否作废")]
public bool IsCancel { get; set; }
} }
/// <summary> /// <summary>
@ -182,6 +191,18 @@ public class PriceListRequestDto : PagedAndSortedResultRequestDto
public virtual List<FilterCondition> Filters { get; set; } = new List<FilterCondition>(); public virtual List<FilterCondition> Filters { get; set; } = new List<FilterCondition>();
} }
/// <summary>
/// UpdateDto
/// </summary>
public class PriceListUpdateDto : EntityDto<Guid>
{
/// <summary>
/// 是否作废
/// </summary>
[Display(Name = "是否作废")]
public bool IsCancel { get; set; }
}
#region 备件价格 #region 备件价格
/// <summary> /// <summary>
/// 备件价格 /// 备件价格
@ -229,6 +250,11 @@ public class PriceListBJDto : AuditedEntityDto<Guid>
/// </summary> /// </summary>
[Display(Name = "合同号")] [Display(Name = "合同号")]
public string ContractNo { get; set; } public string ContractNo { get; set; }
/// <summary>
/// 是否作废
/// </summary>
[Display(Name = "是否作废")]
public bool IsCancel { get; set; }
} }
/// <summary> /// <summary>
@ -364,125 +390,18 @@ public class PriceListBJRequestDto : RequestInputBase
public string Version { set; get; } public string Version { set; get; }
public virtual List<FilterCondition> Filters { get; set; } = new List<FilterCondition>(); public virtual List<FilterCondition> Filters { get; set; } = new List<FilterCondition>();
}
#endregion
/// <summary>
/// 列表
/// </summary>
public class TB_PRICE_LISTDto : AuditedEntityDto<Guid>
{
/// <summary>
/// 零件号
/// </summary>
[Display(Name = "零件号")]
public string LU { get; set; }
/// <summary>
/// 价格
/// </summary>
[Display(Name = "价格")]
public Decimal Price { set; get; }
/// <summary>
/// 开始时间
/// </summary>
[Display(Name = "开始时间")]
public DateTime BeginTime { set; get; }
/// <summary>
/// 结束时间
/// </summary>
[Display(Name = "结束时间")]
public DateTime EndTime { set; get; }
/// <summary>
/// 客户编码
/// </summary>
[Display(Name = "客户编码")]
public string ClientCode { get; set; }
/// <summary>
/// 业务类别
/// </summary>
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
/// <summary>
/// 版本
/// </summary>
[Display(Name = "版本")]
public string Version { set; get; }
/// <summary>
/// 合同签订时间
/// </summary>
[Display(Name = "合同签订时间")]
public string Date { get; set; }
/// <summary>
/// 合同号
/// </summary>
[Display(Name = "合同号")]
public string ContractNo { get; set; }
} }
/// <summary> /// <summary>
/// 列表请求 /// UpdateDto
/// </summary> /// </summary>
public class TB_PRICE_LIST_RequestDto : PagedAndSortedResultRequestDto public class PriceListBJUpdateDto : EntityDto<Guid>
{ {
/// <summary> /// <summary>
/// 零件号 /// 是否作废
/// </summary>
[Display(Name = "零件号")]
public string LU { get; set; }
/// <summary>
/// 价格
/// </summary> /// </summary>
[Display(Name = "价格")] [Display(Name = "是否作废")]
public Decimal Price { set; get; } public bool IsCancel { get; set; }
/// <summary>
/// 开始时间
/// </summary>
[Display(Name = "开始时间")]
public DateTime BeginTime { set; get; }
/// <summary>
/// 结束时间
/// </summary>
[Display(Name = "结束时间")]
public DateTime EndTime { set; get; }
/// <summary>
/// 客户编码
/// </summary>
[Display(Name = "客户编码")]
public string ClientCode { get; set; }
/// <summary>
/// 业务类别
/// </summary>
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
/// <summary>
/// 版本
/// </summary>
[Display(Name = "版本")]
public string Version { set; get; }
/// <summary>
/// 高级检索
/// </summary>
[Display(Name = "高级检索")]
public virtual List<FilterCondition> Filters { get; set; } = new List<FilterCondition>();
/// <summary>
/// 导出文件类型
/// </summary>
public int FileType { set; get; }
} }
#endregion

21
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using LinqToDB;
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel; using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
@ -16,6 +17,7 @@ using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.Factories;
using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
@ -217,12 +219,12 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
/// 获取列表 /// 获取列表
/// </summary> /// </summary>
[HttpPost] [HttpPost]
public async Task<PagedResultDto<TB_PRICE_LISTDto>> GetListAsync(RequestDto input) public async Task<PagedResultDto<PriceListDto>> GetListAsync(RequestDto input)
{ {
var entities = await _priceListRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); var entities = await _priceListRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
var totalCount = await _priceListRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); var totalCount = await _priceListRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<PriceList>, List<TB_PRICE_LISTDto>>(entities); var dtos = ObjectMapper.Map<List<PriceList>, List<PriceListDto>>(entities);
return new PagedResultDto<TB_PRICE_LISTDto>(totalCount, dtos); return new PagedResultDto<PriceListDto>(totalCount, dtos);
} }
/// <summary> /// <summary>
@ -242,6 +244,19 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
{ {
return await _priceListRepository.DeleteListAsync(ids).ConfigureAwait(false); return await _priceListRepository.DeleteListAsync(ids).ConfigureAwait(false);
} }
/// <summary>
/// 修改实体
/// </summary>
[HttpPost]
public async Task<PriceListDto> UpdateAsync(PriceListUpdateDto input)
{
var entity = await _settleAccountDbContext.Set<PriceList>().FindAsync(input.Id).ConfigureAwait(false);
entity.IsCancel = input.IsCancel;
_settleAccountDbContext.Set<PriceList>().Update(entity);
var dto = ObjectMapper.Map<PriceList, PriceListDto>(entity);
return dto;
}
#endregion #endregion
} }

13
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

@ -202,6 +202,19 @@ public class PriceListAppServiceBJ : SettleAccountApplicationBase<PriceListBJ>
var dtos = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJDto>>(entities); var dtos = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJDto>>(entities);
return new PagedResultDto<PriceListBJDto>(totalCount, dtos); return new PagedResultDto<PriceListBJDto>(totalCount, dtos);
} }
/// <summary>
/// 修改实体
/// </summary>
[HttpPost]
public async Task<PriceListBJDto> UpdateAsync(PriceListBJUpdateDto input)
{
var entity = await _settleAccountDbContext.Set<PriceListBJ>().FindAsync(input.Id).ConfigureAwait(false);
entity.IsCancel = input.IsCancel;
_settleAccountDbContext.Set<PriceListBJ>().Update(entity);
var dto = ObjectMapper.Map<PriceListBJ, PriceListBJDto>(entity);
return dto;
}
#endregion #endregion
} }

6
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -556,7 +556,7 @@ namespace Win.Sfs.SettleAccount
/// </summary> /// </summary>
private void CreateMapPriceList() private void CreateMapPriceList()
{ {
CreateMap<PriceList, TB_PRICE_LISTDto>() CreateMap<PriceList, PriceListDto>()
.ForMember(x => x.Date, y => y.MapFrom(d => d.Date.ToString("yyyy-MM-dd"))); .ForMember(x => x.Date, y => y.MapFrom(d => d.Date.ToString("yyyy-MM-dd")));
CreateMap<PriceListImportDto, PriceList>() CreateMap<PriceListImportDto, PriceList>()
.ForMember(x => x.LU, y => y.MapFrom(y => y.PartNo)) .ForMember(x => x.LU, y => y.MapFrom(y => y.PartNo))
@ -566,10 +566,6 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.ClientCode, y => y.MapFrom(y => y.Plant)) .ForMember(x => x.ClientCode, y => y.MapFrom(y => y.Plant))
.ForMember(x => x.Date, y => y.MapFrom(y => DateTime.ParseExact(y.Date, "dd.MM.yyyy", System.Globalization.CultureInfo.CurrentCulture))); .ForMember(x => x.Date, y => y.MapFrom(y => DateTime.ParseExact(y.Date, "dd.MM.yyyy", System.Globalization.CultureInfo.CurrentCulture)));
CreateMap<PriceList, PriceListExportDto>(); CreateMap<PriceList, PriceListExportDto>();
CreateMap<PriceList, PriceListDto>().ReverseMap();
CreateMap<PriceList, PriceListRequestDto>().ReverseMap();
} }
/// <summary> /// <summary>

Loading…
Cancel
Save