diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs index d7691e36..788027af 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs @@ -16,42 +16,51 @@ public class PriceListDto : EntityDto /// [Display(Name = "零件号")] public string LU { get; set; } - /// /// 价格 /// [Display(Name = "价格")] public Decimal Price { set; get; } - /// /// 开始时间 /// [Display(Name = "开始时间")] public DateTime BeginTime { set; get; } - /// /// 结束时间 /// [Display(Name = "结束时间")] public DateTime EndTime { set; get; } - /// /// 客户编码 /// [Display(Name = "客户编码")] public string ClientCode { get; set; } - + /// + /// 业务类别 + /// + [Display(Name = "业务类别")] + public EnumBusinessType BusinessType { get; set; } + /// + /// 版本 + /// + [Display(Name = "版本")] + public string Version { set; get; } /// /// 合同签订时间 /// [Display(Name = "合同签订时间")] - public DateTime Date { get; set; } - + public string Date { get; set; } /// /// 合同号 /// [Display(Name = "合同号")] public string ContractNo { get; set; } + /// + /// 是否作废 + /// + [Display(Name = "是否作废")] + public bool IsCancel { get; set; } } /// @@ -182,6 +191,18 @@ public class PriceListRequestDto : PagedAndSortedResultRequestDto public virtual List Filters { get; set; } = new List(); } +/// +/// UpdateDto +/// +public class PriceListUpdateDto : EntityDto +{ + /// + /// 是否作废 + /// + [Display(Name = "是否作废")] + public bool IsCancel { get; set; } +} + #region 备件价格 /// /// 备件价格 @@ -229,6 +250,11 @@ public class PriceListBJDto : AuditedEntityDto /// [Display(Name = "合同号")] public string ContractNo { get; set; } + /// + /// 是否作废 + /// + [Display(Name = "是否作废")] + public bool IsCancel { get; set; } } /// @@ -364,125 +390,18 @@ public class PriceListBJRequestDto : RequestInputBase public string Version { set; get; } public virtual List Filters { get; set; } = new List(); -} -#endregion - -/// -/// 列表 -/// -public class TB_PRICE_LISTDto : AuditedEntityDto -{ - /// - /// 零件号 - /// - [Display(Name = "零件号")] - public string LU { get; set; } - - /// - /// 价格 - /// - [Display(Name = "价格")] - public Decimal Price { set; get; } - - /// - /// 开始时间 - /// - [Display(Name = "开始时间")] - public DateTime BeginTime { set; get; } - - /// - /// 结束时间 - /// - [Display(Name = "结束时间")] - public DateTime EndTime { set; get; } - - /// - /// 客户编码 - /// - [Display(Name = "客户编码")] - public string ClientCode { get; set; } - - /// - /// 业务类别 - /// - [Display(Name = "业务类别")] - public EnumBusinessType BusinessType { get; set; } - - /// - /// 版本 - /// - [Display(Name = "版本")] - public string Version { set; get; } - - /// - /// 合同签订时间 - /// - [Display(Name = "合同签订时间")] - public string Date { get; set; } - - /// - /// 合同号 - /// - [Display(Name = "合同号")] - public string ContractNo { get; set; } } /// -/// 列表请求 +/// UpdateDto /// -public class TB_PRICE_LIST_RequestDto : PagedAndSortedResultRequestDto +public class PriceListBJUpdateDto : EntityDto { /// - /// 零件号 - /// - [Display(Name = "零件号")] - public string LU { get; set; } - - /// - /// 价格 + /// 是否作废 /// - [Display(Name = "价格")] - public Decimal Price { set; get; } - - /// - /// 开始时间 - /// - [Display(Name = "开始时间")] - public DateTime BeginTime { set; get; } - - /// - /// 结束时间 - /// - [Display(Name = "结束时间")] - public DateTime EndTime { set; get; } - - /// - /// 客户编码 - /// - [Display(Name = "客户编码")] - public string ClientCode { get; set; } - - /// - /// 业务类别 - /// - [Display(Name = "业务类别")] - public EnumBusinessType BusinessType { get; set; } - - /// - /// 版本 - /// - [Display(Name = "版本")] - public string Version { set; get; } - - /// - /// 高级检索 - /// - [Display(Name = "高级检索")] - public virtual List Filters { get; set; } = new List(); - - /// - /// 导出文件类型 - /// - public int FileType { set; get; } + [Display(Name = "是否作废")] + public bool IsCancel { get; set; } } +#endregion diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs index f4206951..2289a758 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using EFCore.BulkExtensions; +using LinqToDB; using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Excel; using Microsoft.AspNetCore.Authorization; @@ -16,6 +17,7 @@ using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; +using Win.Sfs.SettleAccount.Entities.Factories; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.Shared.RepositoryBase; @@ -217,12 +219,12 @@ public class PriceListAppService : SettleAccountApplicationBase /// 获取列表 /// [HttpPost] - public async Task> GetListAsync(RequestDto input) + public async Task> GetListAsync(RequestDto input) { 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 dtos = ObjectMapper.Map, List>(entities); - return new PagedResultDto(totalCount, dtos); + var dtos = ObjectMapper.Map, List>(entities); + return new PagedResultDto(totalCount, dtos); } /// @@ -242,6 +244,19 @@ public class PriceListAppService : SettleAccountApplicationBase { return await _priceListRepository.DeleteListAsync(ids).ConfigureAwait(false); } + + /// + /// 修改实体 + /// + [HttpPost] + public async Task UpdateAsync(PriceListUpdateDto input) + { + var entity = await _settleAccountDbContext.Set().FindAsync(input.Id).ConfigureAwait(false); + entity.IsCancel = input.IsCancel; + _settleAccountDbContext.Set().Update(entity); + var dto = ObjectMapper.Map(entity); + return dto; + } #endregion } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs index 44b57d66..63bed1c3 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs @@ -202,6 +202,19 @@ public class PriceListAppServiceBJ : SettleAccountApplicationBase var dtos = ObjectMapper.Map, List>(entities); return new PagedResultDto(totalCount, dtos); } + + /// + /// 修改实体 + /// + [HttpPost] + public async Task UpdateAsync(PriceListBJUpdateDto input) + { + var entity = await _settleAccountDbContext.Set().FindAsync(input.Id).ConfigureAwait(false); + entity.IsCancel = input.IsCancel; + _settleAccountDbContext.Set().Update(entity); + var dto = ObjectMapper.Map(entity); + return dto; + } #endregion } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs index 3b24f6a3..3ccaa219 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs @@ -556,7 +556,7 @@ namespace Win.Sfs.SettleAccount /// private void CreateMapPriceList() { - CreateMap() + CreateMap() .ForMember(x => x.Date, y => y.MapFrom(d => d.Date.ToString("yyyy-MM-dd"))); CreateMap() .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.Date, y => y.MapFrom(y => DateTime.ParseExact(y.Date, "dd.MM.yyyy", System.Globalization.CultureInfo.CurrentCulture))); CreateMap(); - - CreateMap().ReverseMap(); - CreateMap().ReverseMap(); - } ///