wanggang 1 year ago
parent
commit
72a7f4bf9f
  1. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  2. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiType.cs
  3. 9
      code/src/Shared/Win.Sfs.Shared/SharedExtensions.cs

6
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

@ -21,7 +21,6 @@ using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Extensions;
using RestSharp.Extensions; using RestSharp.Extensions;
using SettleAccount.Job.SignalR; using SettleAccount.Job.SignalR;
using SqlSugar; using SqlSugar;
@ -37,6 +36,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.Shared.Filter; using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
using Win.Sfs.Shared;
namespace Win.Sfs.SettleAccount.Entities.BQ; namespace Win.Sfs.SettleAccount.Entities.BQ;
@ -295,7 +295,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
[HttpPost] [HttpPost]
public async Task<string> LogExport(RequestDto input) public async Task<string> 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 fileName = $"库存事务_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.xlsx";
var content = this.GetContent(entities, "库存事务_"); var content = this.GetContent(entities, "库存事务_");
await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false); await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false);
@ -514,7 +514,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
} }
else if (propertyType.IsEnum) 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)) else if (propertyType == typeof(DateTime))
{ {

8
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiType.cs

@ -7,14 +7,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// </summary> /// </summary>
public enum VmiType public enum VmiType
{ {
/// <summary> [Display(Name = "入库")]
/// 入库
/// </summary>
In, In,
/// <summary> [Display(Name = "出库")]
/// 出库
/// </summary>
Out Out
} }

9
code/src/Shared/Win.Sfs.Shared/SharedExtensions.cs

@ -1,4 +1,6 @@
using System; using System;
using System.ComponentModel.DataAnnotations;
using System.Reflection;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
@ -11,5 +13,12 @@ namespace Win.Sfs.Shared
var hash = MD5.HashData(Encoding.UTF8.GetBytes(input)); var hash = MD5.HashData(Encoding.UTF8.GetBytes(input));
return new Guid(hash); return new Guid(hash);
} }
public static string GetDisplayName(this Enum enumValue)
{
var type = enumValue.GetType();
var field = type.GetField(enumValue.ToString());
return field.GetCustomAttribute<DisplayAttribute>()?.Name ?? field.Name;
}
} }
} }

Loading…
Cancel
Save