Browse Source

其他领物料添加前置过滤条件

master
mahao 2 years ago
parent
commit
9a874ee47e
  1. 5
      host/WmsWebApi.HttpApi.Host/appsettings.json
  2. 19
      src/WmsWebApi.Application/OtherZll/OtherZllService.cs
  3. 2
      src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs
  4. 13
      src/WmsWebApi.Domain/Options/CustomConfigOptions.cs
  5. 15
      src/WmsWebApi.Domain/Options/OtherZllConfigOptions.cs
  6. 17
      src/WmsWebApi.Domain/WmsWebApiDomainModule.cs

5
host/WmsWebApi.HttpApi.Host/appsettings.json

@ -25,5 +25,10 @@
"RequireHttpsMetadata": "false",
"SwaggerClientId": "WmsWebApi_Swagger",
"SwaggerClientSecret": "1q2w3e*"
},
"CustomConfig": {
"OtherZllConfig": {
"ErnamFilters": [ "1023", "1024" ]
}
}
}

19
src/WmsWebApi.Application/OtherZll/OtherZllService.cs

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Polly;
using Polly.Retry;
@ -14,6 +15,7 @@ using WmsWebApi.BackgroundJobs;
using WmsWebApi.EntityFrameworkCore;
using WmsWebApi.Enums;
using WmsWebApi.Jsons;
using WmsWebApi.Options;
using WmsWebApi.Wms;
namespace WmsWebApi.OtherZll;
@ -36,6 +38,7 @@ public class OtherZllService : ApplicationService, IOtherZllService
private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry;
private readonly IOtherZllJsonRepository _otherZllJsonRepository;
private readonly AsyncRetryPolicy _asyncRetryPolicy;
private readonly OtherZllConfigOptions _otherZllConfigOptions;
/// <summary>
/// 是否是请求重试
@ -52,7 +55,9 @@ public class OtherZllService : ApplicationService, IOtherZllService
TmPgWmsUpdate tmPgWmsUpdate,
Volo.Abp.Uow.IUnitOfWorkManager unitOfWorkManager,
IBackgroundJobRequestRetry backgroundJobRequestRetry,
IOtherZllJsonRepository otherZllJsonRepository)
IOtherZllJsonRepository otherZllJsonRepository,
IOptionsMonitor<CustomConfigOptions> customConfigOptions,
IOptionsMonitor<OtherZllConfigOptions> otherZllConfigOptions)
{
_tsStockDetailRepository = tsStockDetailRepository;
_tbProductReceiveRepository = tbProductReceiveRepository;
@ -75,6 +80,7 @@ public class OtherZllService : ApplicationService, IOtherZllService
{
Logger.LogInformation($"执行失败,第 {retryCount} 次重试");
});
_otherZllConfigOptions = otherZllConfigOptions.CurrentValue;
}
[HttpPost("add")]
@ -93,6 +99,17 @@ public class OtherZllService : ApplicationService, IOtherZllService
result.MESSAGE = "Json格式不正确,详细信息:" + ex.Message;
return result;
}
if (_dtoList != null && _dtoList.Count() > 0)
{
//根据配置文件过滤ERNAM
var ernamFilters = _otherZllConfigOptions.ErnamFilters;
if (ernamFilters != null && ernamFilters.Count > 0)
{
_dtoList = _dtoList.FindAll(e => !ernamFilters.Contains(e.ERNAM));
}
}
if (_dtoList == null || _dtoList.Count() <= 0)
{
bErr = true;

2
src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs

@ -114,7 +114,7 @@ public class ZlldcjLogAppService : ApplicationService, IZlldcjLogAppService
result.MESSAGE = "Json格式不正确,详细信息:" + ex.GetBaseException().Message;
return result;
}
if (dtos == null || dtos.Count == 0)
if (dtos == null || dtos.Count <= 0)
{
bErr = true;
result.MESSAGE = "err:没有1000工厂数据";

13
src/WmsWebApi.Domain/Options/CustomConfigOptions.cs

@ -0,0 +1,13 @@
namespace WmsWebApi.Options
{
/// <summary>
/// 自定义配置选项
/// </summary>
public class CustomConfigOptions
{
/// <summary>
/// 其他领物料配置
/// </summary>
public OtherZllConfigOptions OtherZllConfig { get; set; }
}
}

15
src/WmsWebApi.Domain/Options/OtherZllConfigOptions.cs

@ -0,0 +1,15 @@
using System.Collections.Generic;
namespace WmsWebApi.Options
{
/// <summary>
/// 其他领物料配置选项
/// </summary>
public class OtherZllConfigOptions
{
/// <summary>
/// 创建对象的人员名称过滤
/// </summary>
public List<string> ErnamFilters { get; set; }
}
}

17
src/WmsWebApi.Domain/WmsWebApiDomainModule.cs

@ -1,5 +1,8 @@
using Volo.Abp.Domain;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Domain;
using Volo.Abp.Modularity;
using WmsWebApi.Options;
namespace WmsWebApi
{
@ -9,6 +12,18 @@ namespace WmsWebApi
)]
public class WmsWebApiDomainModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
base.ConfigureServices(context);
IConfiguration configuration = context.Services.GetConfiguration();
#region Options
context.Services.AddOptions();
Configure<CustomConfigOptions>(configuration.GetSection("CustomConfig"));
Configure<OtherZllConfigOptions>(configuration.GetSection("CustomConfig:OtherZllConfig"));
#endregion
}
}
}

Loading…
Cancel
Save