Browse Source

EOS接口修改

集成Redis
lvzb 2 years ago
parent
commit
29d6544440
  1. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Arrives/ArriveDbContextModelCreatingExtensions.cs
  2. 3
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Plans/PlanDbContextModelCreatingExtensions.cs
  3. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Returns/ReturnDbContextModelCreatingExtensions.cs
  4. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Eos/Ships/ShipDbContextModelCreatingExtensions.cs
  5. 18
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/EosAgentModule.cs
  6. 28
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/EosIncomingBackgroundWorker.cs
  7. 13
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/PlanReader.cs
  8. 7
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent.csproj
  9. 14
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/appsettings.json
  10. 44
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/TyrpIncomingBackgroundWorker.cs
  11. 11
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs

2
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);

3
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);

2
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);

2
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);

18
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<EosIncomingBackgroundWorker>().ConfigureAwait(false);
await context.AddBackgroundWorkerAsync<EosOutgoingBackgroundWorker>().ConfigureAwait(false);
context.AddBackgroundWorkerAsync<EosIncomingBackgroundWorker>();
// context.AddBackgroundWorker<TyrpOutgoingBackgroundWorker>();
}
}

28
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<ShipReader>();
var shipConverter = workerContext.ServiceProvider.GetRequiredService<ShipConverter>();
//读取并保持Ship
var shipsFromExternalList = await shipHandleService.ReadAsync().ConfigureAwait(false);
//转换Ship
await shipConverter.ConvertAsync(shipsFromExternalList).ConfigureAwait(false);
//Logger.LogInformation($"Read Ship");
//var shipHandleService = workerContext.ServiceProvider.GetRequiredService<ShipReader>();
//var shipConverter = workerContext.ServiceProvider.GetRequiredService<ShipConverter>();
////读取并保持Ship
//var shipsFromExternalList = await shipHandleService.ReadAsync().ConfigureAwait(false);
////转换Ship
//await shipConverter.ConvertAsync(shipsFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Read Product");
var productHandleService = workerContext.ServiceProvider.GetRequiredService<ProductReader>();
var productConverter = workerContext.ServiceProvider.GetRequiredService<ProductConverter>();
//读取并保持Product
var productsFromExternalList = await productHandleService.ReadAsync().ConfigureAwait(false);
//转换Product
await productConverter.ConvertAsync(productsFromExternalList).ConfigureAwait(false);
//Logger.LogInformation($"Read Product");
//var productHandleService = workerContext.ServiceProvider.GetRequiredService<ProductReader>();
//var productConverter = workerContext.ServiceProvider.GetRequiredService<ProductConverter>();
////读取并保持Product
//var productsFromExternalList = await productHandleService.ReadAsync().ConfigureAwait(false);
////转换Product
//await productConverter.ConvertAsync(productsFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Completed: Handling {Incoming}");
}

13
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<PlanReader> _logger;
private readonly IGuidGenerator _guidGenerator;
public PlanReader(
IPlanManager planManager
, IIncomingFromExternalManager incomingFromExternalManager
, ILogger<PlanReader> logger
, IGuidGenerator guidGenerator
)
{
_planManager = planManager;
_incomingFromExternalManager = incomingFromExternalManager;
_logger = logger;
_guidGenerator = guidGenerator;
}
public virtual async Task<List<IncomingFromExternal>> 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);

7
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent.csproj

@ -15,6 +15,13 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.12" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.*" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.12" />
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="6.3.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="6.0.2" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="5.3.5" />
<PackageReference Include="Volo.Abp.BackgroundJobs" Version="5.3.5" />
<PackageReference Include="Volo.Abp.BackgroundWorkers" Version="5.3.5" />

14
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": {

44
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<ItemBasicReader>();
//var itemBasicConverter = workerContext.ServiceProvider.GetRequiredService<ItemBasicConverter>();
////读取并保存itemBasic
//var itemBasicOutsFromExternalList = await itemBasicReader.ReadAsync().ConfigureAwait(false);
////转换itemBasic
//await itemBasicConverter.ConvertAsync(itemBasicOutsFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Read ItemBasic");//零件
var itemBasicReader = workerContext.ServiceProvider.GetRequiredService<ItemBasicReader>();
var itemBasicConverter = workerContext.ServiceProvider.GetRequiredService<ItemBasicConverter>();
//读取并保存itemBasic
var itemBasicOutsFromExternalList = await itemBasicReader.ReadAsync().ConfigureAwait(false);
//转换itemBasic
await itemBasicConverter.ConvertAsync(itemBasicOutsFromExternalList).ConfigureAwait(false);
//Logger.LogInformation($"Read User");//用户和部门
//var userReader = workerContext.ServiceProvider.GetRequiredService<UserReader>();
@ -80,21 +80,21 @@ public class TyrpIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
////转换department
//await departmentConverter.ConvertAsync(departmentOutsFromExternalList).ConfigureAwait(false);
//Logger.LogInformation($"Read InterfaceCalendar");//账期
//var interfaceCalendarReader = workerContext.ServiceProvider.GetRequiredService<InterfaceCalendarReader>();
//var interfaceCalendarConverter = workerContext.ServiceProvider.GetRequiredService<InterfaceCalendarConverter>();
////读取并保存InterfaceCalendar
//var interfaceCalendarOutsFromExternalList = await interfaceCalendarReader.ReadAsync();
////转换InterfaceCalendar
//await interfaceCalendarConverter.ConvertAsync(interfaceCalendarOutsFromExternalList);
Logger.LogInformation($"Read Dict");//系统代码
var dictReader = workerContext.ServiceProvider.GetRequiredService<DictReader>();
var dictConverter = workerContext.ServiceProvider.GetRequiredService<DictConverter>();
//读取并保存Dict
var dictOutsFromExternalList = await dictReader.ReadAsync().ConfigureAwait(false);
//转换Dict
await dictConverter.ConvertAsync(dictOutsFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Read InterfaceCalendar");//账期
var interfaceCalendarReader = workerContext.ServiceProvider.GetRequiredService<InterfaceCalendarReader>();
var interfaceCalendarConverter = workerContext.ServiceProvider.GetRequiredService<InterfaceCalendarConverter>();
//读取并保存InterfaceCalendar
var interfaceCalendarOutsFromExternalList = await interfaceCalendarReader.ReadAsync().ConfigureAwait(false);
//转换InterfaceCalendar
await interfaceCalendarConverter.ConvertAsync(interfaceCalendarOutsFromExternalList).ConfigureAwait(false);
//Logger.LogInformation($"Read Dict");//系统代码
//var dictReader = workerContext.ServiceProvider.GetRequiredService<DictReader>();
//var dictConverter = workerContext.ServiceProvider.GetRequiredService<DictConverter>();
////读取并保存Dict
//var dictOutsFromExternalList = await dictReader.ReadAsync().ConfigureAwait(false);
////转换Dict
//await dictConverter.ConvertAsync(dictOutsFromExternalList).ConfigureAwait(false);
//Logger.LogInformation($"Read Bom");
//var BomReader = workerContext.ServiceProvider.GetRequiredService<BomReader>();

11
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs

@ -33,16 +33,7 @@ public static class IncomingToWmsExtensions
{
var Dict = JsonSerializer.Deserialize<DictEditInput>(incomingConverted.DataContent);
var DictBasicAppService = workerContext.ServiceProvider.GetRequiredService<IDictAppService>();
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)
{

Loading…
Cancel
Save