From 29d65444407c05caa534b9fd2e1b4c9ecf6cd2fc Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Tue, 11 Apr 2023 14:39:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?EOS=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ArriveDbContextModelCreatingExtensions.cs | 2 +- .../PlanDbContextModelCreatingExtensions.cs | 3 +- .../ReturnDbContextModelCreatingExtensions.cs | 2 +- .../ShipDbContextModelCreatingExtensions.cs | 2 +- .../EosAgentModule.cs | 18 +++++--- .../Incoming/EosIncomingBackgroundWorker.cs | 28 ++++++------ .../Incoming/PlanReader.cs | 13 ++++-- ...fs.Wms.DataExchange.Fawtyg.EosAgent.csproj | 7 +++ .../appsettings.json | 14 +++--- .../Incoming/TyrpIncomingBackgroundWorker.cs | 44 +++++++++---------- .../IncomingToWmsExtensions.cs | 11 +---- 11 files changed, 78 insertions(+), 66 deletions(-) diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Arrives/ArriveDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Arrives/ArriveDbContextModelCreatingExtensions.cs index 8d9fcc468..3d0ad6793 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Arrives/ArriveDbContextModelCreatingExtensions.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Arrives/ArriveDbContextModelCreatingExtensions.cs @@ -16,7 +16,7 @@ public static class ArriveDbContextModelCreatingExtensions b.ConfigureByConvention(); //Properties - b.Property(q => q.Id).UseIdentityColumn(); + b.Property(q => q.Id); b.Property(q => q.PlanBillNo).HasMaxLength(255); b.Property(q => q.ShipBillNo).HasMaxLength(255); b.Property(q => q.DocNo).HasMaxLength(255); diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Plans/PlanDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Plans/PlanDbContextModelCreatingExtensions.cs index 64611eba3..8b45a8e80 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Plans/PlanDbContextModelCreatingExtensions.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Plans/PlanDbContextModelCreatingExtensions.cs @@ -1,4 +1,5 @@ using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Entities; using Volo.Abp.EntityFrameworkCore.Modeling; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.EOS; @@ -16,7 +17,7 @@ public static class PlanDbContextModelCreatingExtensions b.ConfigureByConvention(); //Properties - b.Property(q => q.Id).UseIdentityColumn(); + b.Property(q => q.Id).IsRequired().HasColumnType("numeric(18,0)");//.HasPrecision(18, 0); b.Property(q => q.PlanBillNo).HasMaxLength(255); b.Property(q => q.ERP).HasMaxLength(255); b.Property(q => q.Qty).HasPrecision(18, 5); diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Returns/ReturnDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Returns/ReturnDbContextModelCreatingExtensions.cs index 1ab605ae4..b6855dde1 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Returns/ReturnDbContextModelCreatingExtensions.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Returns/ReturnDbContextModelCreatingExtensions.cs @@ -16,7 +16,7 @@ public static class ReturnDbContextModelCreatingExtensions b.ConfigureByConvention(); //Properties - b.Property(q => q.Id).UseIdentityColumn(); + b.Property(q => q.Id); b.Property(q => q.PlanBillNo).HasMaxLength(255); b.Property(q => q.ShipBillNo).HasMaxLength(255); b.Property(q => q.DocNo).HasMaxLength(255); diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Ships/ShipDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Ships/ShipDbContextModelCreatingExtensions.cs index 3994efa4f..6eff6d28d 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Ships/ShipDbContextModelCreatingExtensions.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Ships/ShipDbContextModelCreatingExtensions.cs @@ -16,7 +16,7 @@ public static class ShipDbContextModelCreatingExtensions b.ConfigureByConvention(); //Properties - b.Property(q => q.Id).UseIdentityColumn(); + b.Property(q => q.Id); b.Property(q => q.PlanBillNo).HasMaxLength(255); b.Property(q => q.ShipBillNo).HasMaxLength(255); b.Property(q => q.DetailMatNo).HasMaxLength(255); diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/EosAgentModule.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/EosAgentModule.cs index abe36c06a..ee6b2a09f 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/EosAgentModule.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/EosAgentModule.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Polly; using Volo.Abp; +using Volo.Abp.Account; using Volo.Abp.Autofac; using Volo.Abp.AutoMapper; using Volo.Abp.BackgroundJobs; @@ -39,7 +40,8 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent; typeof(DataExchangeDomainModule), typeof(DataExchangeEntityFrameworkCoreModule), typeof(DataExchangeDomainFawtygEosModule), - typeof(DataExchangeEntityFrameworkCoreFawtygModule) + typeof(DataExchangeEntityFrameworkCoreFawtygModule), + typeof(AbpAccountApplicationContractsModule) )] public class EosAgentModule : AbpModule { @@ -144,6 +146,10 @@ public class EosAgentModule : AbpModule typeof(BasedataApplicationContractsModule).Assembly, "BaseData" ); + context.Services.AddHttpClientProxies( + typeof(AbpAccountApplicationContractsModule).Assembly, + "Auth" + ); context.Services.AddHttpClientProxies( typeof(StoreApplicationContractsModule).Assembly, "Store" @@ -154,11 +160,13 @@ public class EosAgentModule : AbpModule ); } - public override async Task OnApplicationInitializationAsync( - ApplicationInitializationContext context) + + public override void OnApplicationInitialization( + ApplicationInitializationContext context) { - await context.AddBackgroundWorkerAsync().ConfigureAwait(false); - await context.AddBackgroundWorkerAsync().ConfigureAwait(false); + + context.AddBackgroundWorkerAsync(); + // context.AddBackgroundWorker(); } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/EosIncomingBackgroundWorker.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/EosIncomingBackgroundWorker.cs index acb6851bf..a02ce68b4 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/EosIncomingBackgroundWorker.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/EosIncomingBackgroundWorker.cs @@ -43,21 +43,21 @@ public class EosIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase //转换Plan await planConverter.ConvertAsync(plansFromExternalList).ConfigureAwait(false); - Logger.LogInformation($"Read Ship"); - var shipHandleService = workerContext.ServiceProvider.GetRequiredService(); - var shipConverter = workerContext.ServiceProvider.GetRequiredService(); - //读取并保持Ship - var shipsFromExternalList = await shipHandleService.ReadAsync().ConfigureAwait(false); - //转换Ship - await shipConverter.ConvertAsync(shipsFromExternalList).ConfigureAwait(false); + //Logger.LogInformation($"Read Ship"); + //var shipHandleService = workerContext.ServiceProvider.GetRequiredService(); + //var shipConverter = workerContext.ServiceProvider.GetRequiredService(); + ////读取并保持Ship + //var shipsFromExternalList = await shipHandleService.ReadAsync().ConfigureAwait(false); + ////转换Ship + //await shipConverter.ConvertAsync(shipsFromExternalList).ConfigureAwait(false); - Logger.LogInformation($"Read Product"); - var productHandleService = workerContext.ServiceProvider.GetRequiredService(); - var productConverter = workerContext.ServiceProvider.GetRequiredService(); - //读取并保持Product - var productsFromExternalList = await productHandleService.ReadAsync().ConfigureAwait(false); - //转换Product - await productConverter.ConvertAsync(productsFromExternalList).ConfigureAwait(false); + //Logger.LogInformation($"Read Product"); + //var productHandleService = workerContext.ServiceProvider.GetRequiredService(); + //var productConverter = workerContext.ServiceProvider.GetRequiredService(); + ////读取并保持Product + //var productsFromExternalList = await productHandleService.ReadAsync().ConfigureAwait(false); + ////转换Product + //await productConverter.ConvertAsync(productsFromExternalList).ConfigureAwait(false); Logger.LogInformation($"Completed: Handling {Incoming}"); } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/PlanReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/PlanReader.cs index f321717ac..917e143f0 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/PlanReader.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/PlanReader.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text.Json; using System.Threading.Tasks; using Microsoft.Extensions.Logging; +using Volo.Abp.Guids; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.DataExchange.Domain; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.EOS; @@ -18,22 +19,26 @@ public class PlanReader : IReader private readonly IPlanManager _planManager; private readonly IIncomingFromExternalManager _incomingFromExternalManager; private readonly ILogger _logger; - + private readonly IGuidGenerator _guidGenerator; public PlanReader( IPlanManager planManager , IIncomingFromExternalManager incomingFromExternalManager , ILogger logger + , IGuidGenerator guidGenerator ) { _planManager = planManager; _incomingFromExternalManager = incomingFromExternalManager; _logger = logger; + _guidGenerator = guidGenerator; + } public virtual async Task> ReadAsync() { //从EOS读取待处理Plan - var toBeProcessedPlans = await _planManager.GetToBeProcessedListAsync().ConfigureAwait(false); + var aa = await _planManager.GetToBeProcessedListAsync().ConfigureAwait(false); + var toBeProcessedPlans = aa.Take(100).ToList(); if (!toBeProcessedPlans.Any()) { _logger.LogInformation("no plans"); @@ -41,7 +46,7 @@ public class PlanReader : IReader } //Plan逐一转换为PurchaseOrder var incomingDataList = BuildIncomingFromExternalFromPlanAsync(toBeProcessedPlans); - await _incomingFromExternalManager.CreateManyAsync(incomingDataList).ConfigureAwait(false); + await _incomingFromExternalManager.CreateBulkAsync(incomingDataList).ConfigureAwait(false); //更新EOS数据状态 await _planManager.UpdateProcessedListAsync(toBeProcessedPlans).ConfigureAwait(false); return incomingDataList; @@ -55,7 +60,7 @@ public class PlanReader : IReader var incomingData = BuildIncomingFromExternal(plan); incomingData.SetEffectiveDate(plan.EosDate); - + incomingData.SetId(_guidGenerator.Create()); try { var po = BuildPurchaseOrderExchangeDto(plan); diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent.csproj b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent.csproj index 7804b5368..effdaa13f 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent.csproj +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent.csproj @@ -15,6 +15,13 @@ + + + + + + + diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/appsettings.json b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/appsettings.json index 27882d40c..83cadac0a 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/appsettings.json +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/appsettings.json @@ -1,12 +1,12 @@ { "ConnectionStrings": { - "Default": "Server=dev.ccwin-in.com,13319;Database=DyWmsAuth;uid=ccwin-in;pwd=Microsoft@2022;", - "DataExchange": "Server=dev.ccwin-in.com,21195;Database=DataExchange_Main;uid=sa;pwd=aA123456!;", - "EOS": "Server=dev.ccwin-in.com,13319;Database=EOS;Uid=ccwin-in;Pwd=Microsoft@2022;" + "Default": "Server=dev.ccwin-in.com,21195;Database=DataExchange_Main;uid=sa;pwd=aA123456!;TrustServerCertificate=True", + "DataExchange": "Server=dev.ccwin-in.com,21195;Database=DataExchange_Main;uid=sa;pwd=aA123456!;TrustServerCertificate=True", + "EOS": "Server=61.139.155.47;Database=EOSCC;Uid=wms;Pwd=1;TrustServerCertificate=True" }, "AuthServer": { - "Authority": "http://dev.ccwin-in.com:59093/", + "Authority": "http://dev.ccwin-in.com:21293/", "RequireHttpsMetadata": "false", "SwaggerClientId": "admin", "SwaggerClientSecret": "1q2w3E*", @@ -25,13 +25,13 @@ "RemoteServices": { "BaseData": { - "BaseUrl": "http://dev.ccwin-in.com:59094/" + "BaseUrl": "http://dev.ccwin-in.com:21294/" }, "Store": { - "BaseUrl": "http://dev.ccwin-in.com:59095/" + "BaseUrl": "http://dev.ccwin-in.com:21295/" }, "Label": { - "BaseUrl": "http://dev.ccwin-in.com:59092/" + "BaseUrl": "http://dev.ccwin-in.com:21292/" } }, "EosOptions": { diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/TyrpIncomingBackgroundWorker.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/TyrpIncomingBackgroundWorker.cs index e7227cd49..d439e1103 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/TyrpIncomingBackgroundWorker.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/TyrpIncomingBackgroundWorker.cs @@ -59,13 +59,13 @@ public class TyrpIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase common.updatedt = DateTime.Now; common.isupdate = false; - //Logger.LogInformation($"Read ItemBasic");//零件 - //var itemBasicReader = workerContext.ServiceProvider.GetRequiredService(); - //var itemBasicConverter = workerContext.ServiceProvider.GetRequiredService(); - ////读取并保存itemBasic - //var itemBasicOutsFromExternalList = await itemBasicReader.ReadAsync().ConfigureAwait(false); - ////转换itemBasic - //await itemBasicConverter.ConvertAsync(itemBasicOutsFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"Read ItemBasic");//零件 + var itemBasicReader = workerContext.ServiceProvider.GetRequiredService(); + var itemBasicConverter = workerContext.ServiceProvider.GetRequiredService(); + //读取并保存itemBasic + var itemBasicOutsFromExternalList = await itemBasicReader.ReadAsync().ConfigureAwait(false); + //转换itemBasic + await itemBasicConverter.ConvertAsync(itemBasicOutsFromExternalList).ConfigureAwait(false); //Logger.LogInformation($"Read User");//用户和部门 //var userReader = workerContext.ServiceProvider.GetRequiredService(); @@ -80,21 +80,21 @@ public class TyrpIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase ////转换department //await departmentConverter.ConvertAsync(departmentOutsFromExternalList).ConfigureAwait(false); - //Logger.LogInformation($"Read InterfaceCalendar");//账期 - //var interfaceCalendarReader = workerContext.ServiceProvider.GetRequiredService(); - //var interfaceCalendarConverter = workerContext.ServiceProvider.GetRequiredService(); - ////读取并保存InterfaceCalendar - //var interfaceCalendarOutsFromExternalList = await interfaceCalendarReader.ReadAsync(); - ////转换InterfaceCalendar - //await interfaceCalendarConverter.ConvertAsync(interfaceCalendarOutsFromExternalList); - - Logger.LogInformation($"Read Dict");//系统代码 - var dictReader = workerContext.ServiceProvider.GetRequiredService(); - var dictConverter = workerContext.ServiceProvider.GetRequiredService(); - //读取并保存Dict - var dictOutsFromExternalList = await dictReader.ReadAsync().ConfigureAwait(false); - //转换Dict - await dictConverter.ConvertAsync(dictOutsFromExternalList).ConfigureAwait(false); + Logger.LogInformation($"Read InterfaceCalendar");//账期 + var interfaceCalendarReader = workerContext.ServiceProvider.GetRequiredService(); + var interfaceCalendarConverter = workerContext.ServiceProvider.GetRequiredService(); + //读取并保存InterfaceCalendar + var interfaceCalendarOutsFromExternalList = await interfaceCalendarReader.ReadAsync().ConfigureAwait(false); + //转换InterfaceCalendar + await interfaceCalendarConverter.ConvertAsync(interfaceCalendarOutsFromExternalList).ConfigureAwait(false); + + //Logger.LogInformation($"Read Dict");//系统代码 + //var dictReader = workerContext.ServiceProvider.GetRequiredService(); + //var dictConverter = workerContext.ServiceProvider.GetRequiredService(); + ////读取并保存Dict + //var dictOutsFromExternalList = await dictReader.ReadAsync().ConfigureAwait(false); + ////转换Dict + //await dictConverter.ConvertAsync(dictOutsFromExternalList).ConfigureAwait(false); //Logger.LogInformation($"Read Bom"); //var BomReader = workerContext.ServiceProvider.GetRequiredService(); diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs index 0c7813de4..bc9666215 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs @@ -33,16 +33,7 @@ public static class IncomingToWmsExtensions { var Dict = JsonSerializer.Deserialize(incomingConverted.DataContent); var DictBasicAppService = workerContext.ServiceProvider.GetRequiredService(); - try - { - await DictBasicAppService.UpdateAsync(Dict).ConfigureAwait(false); - } - catch (System.Exception ex) - { - - throw; - } - + await DictBasicAppService.UpdateAsync(Dict).ConfigureAwait(false); } public static async Task HandleUsersAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext) { From 0833eacd58ccaa46ac3ac38ceae274565144f07a Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Tue, 11 Apr 2023 15:02:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoreHttpApiHostModule.cs | 7 +++ .../Inventories/BalanceController.cs | 10 ++--- .../ItemPacks/ItemPackAutoMapperProfile.cs | 1 + .../Filters/FilterExtensions.cs | 43 ++++++++++--------- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/StoreHttpApiHostModule.cs b/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/StoreHttpApiHostModule.cs index cb6ae48c9..84e46d947 100644 --- a/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/StoreHttpApiHostModule.cs +++ b/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/StoreHttpApiHostModule.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Text.Json.Serialization; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -83,6 +84,12 @@ public class StoreHttpApiHostModule : ModuleBase { base.ConfigureServices(context); ConfigureVirtualFileSystem(); + + //将枚举返回时都变为字符串 + //context.Services.AddControllers().AddJsonOptions(options => + //{ + // options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); + //}); //ConfigureSwaggerServices(context, context.Services.GetConfiguration()); } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs index b4a4ed2a3..9adb5c110 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs @@ -280,11 +280,11 @@ public class BalanceController : AbpController } } - if (listInput.inventoryStatuses != null && listInput.inventoryStatuses.Any()) - { - input.Condition.Filters.Add( - new Filter("Status", JsonSerializer.Serialize(listInput.inventoryStatuses), "In")); - } + //if (listInput.inventoryStatuses != null && listInput.inventoryStatuses.Any()) + //{ + // input.Condition.Filters.Add( + // new Filter("Status", JsonSerializer.Serialize(listInput.inventoryStatuses), "In")); + //} var balanceDTOs = await _balanceAppService.GetPagedListByFilterAsync(input, false).ConfigureAwait(false); diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAutoMapperProfile.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAutoMapperProfile.cs index 3b5b405af..8de7a1e0d 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAutoMapperProfile.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAutoMapperProfile.cs @@ -22,6 +22,7 @@ public partial class BasedataApplicationAutoMapperProfile : Profile CreateMap() .IgnoreAuditedObjectProperties() .Ignore(x => x.TenantId) + .Ignore(x=>x.Id) .Ignore(x => x.ExtraProperties) .Ignore(x => x.ConcurrencyStamp) ; diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Filters/FilterExtensions.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Filters/FilterExtensions.cs index 3fc0120be..5fadcdde4 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Filters/FilterExtensions.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Filters/FilterExtensions.cs @@ -206,27 +206,28 @@ public static class FilterExtensions var parameterExpression = Expression.Parameter(typeof(T), "p"); Type lstType = typeof(List<>).MakeGenericType(propertyType); - if (propertyType.IsEnum) - { - var valueArrayStrings = JsonSerializer.Deserialize>(filter.Value); - List newValues = new List(); - - var enumValues = propertyType.GetEnumValues(); - - foreach (var valueArray in valueArrayStrings) - { - foreach (var enumValue in enumValues) - { - if (enumValue.ToString() == valueArray) - { - newValues.Add(enumValue); - break; - } - } - } - var newValue = JsonSerializer.Serialize(newValues); - filter.Value = newValue; - } + //转换枚举 + //if (propertyType.IsEnum) + //{ + // var valueArrayStrings = JsonSerializer.Deserialize>(filter.Value); + // List newValues = new List(); + + // var enumValues = propertyType.GetEnumValues(); + + // foreach (var valueArray in valueArrayStrings) + // { + // foreach (var enumValue in enumValues) + // { + // if (enumValue.ToString() == valueArray) + // { + // newValues.Add(enumValue); + // break; + // } + // } + // } + // var newValue = JsonSerializer.Serialize(newValues); + // filter.Value = newValue; + //} object propertyValue = JsonSerializer.Deserialize(filter.Value, lstType); if (propertyValue != null)