diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs index 74ff0ede..46f5b293 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs @@ -21,7 +21,6 @@ using Microsoft.AspNetCore.SignalR; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.OpenApi.Extensions; using RestSharp.Extensions; using SettleAccount.Job.SignalR; using SqlSugar; @@ -37,6 +36,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.Shared.Filter; using Win.Sfs.Shared.RepositoryBase; +using Win.Sfs.Shared; namespace Win.Sfs.SettleAccount.Entities.BQ; @@ -295,7 +295,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran [HttpPost] public async Task LogExport(RequestDto input) { - var entities = await _logRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount).ConfigureAwait(false); + var entities = await _logRepository.GetListByFilterAsync(input.Filters, input.Sorting).ConfigureAwait(false); var fileName = $"库存事务_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.xlsx"; var content = this.GetContent(entities, "库存事务_"); await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false); @@ -514,7 +514,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran } else if (propertyType.IsEnum) { - cell.Value = (Enum.Parse(propertyType, value) as Enum)?.GetDisplayName(); + cell.Value = (Enum.Parse(propertyType, value) as Enum)?.GetDisplayName(); } else if (propertyType == typeof(DateTime)) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiType.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiType.cs index 9c5412eb..f6376eb2 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiType.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiType.cs @@ -7,14 +7,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; /// public enum VmiType { - /// - /// 入库 - /// + [Display(Name = "入库")] In, - /// - /// 出库 - /// + [Display(Name = "出库")] Out } diff --git a/code/src/Shared/Win.Sfs.Shared/SharedExtensions.cs b/code/src/Shared/Win.Sfs.Shared/SharedExtensions.cs index 1805962e..1d5d1f91 100644 --- a/code/src/Shared/Win.Sfs.Shared/SharedExtensions.cs +++ b/code/src/Shared/Win.Sfs.Shared/SharedExtensions.cs @@ -1,4 +1,6 @@ using System; +using System.ComponentModel.DataAnnotations; +using System.Reflection; using System.Security.Cryptography; using System.Text; @@ -11,5 +13,12 @@ namespace Win.Sfs.Shared var hash = MD5.HashData(Encoding.UTF8.GetBytes(input)); return new Guid(hash); } + + public static string GetDisplayName(this Enum enumValue) + { + var type = enumValue.GetType(); + var field = type.GetField(enumValue.ToString()); + return field.GetCustomAttribute()?.Name ?? field.Name; + } } }