From c5eb5ec603ad35db40b7ad21fbe01dda14758faf Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Mon, 21 Aug 2023 17:15:47 +0800 Subject: [PATCH] update --- .../AuthServer/AuthServerHostModule.cs | 14 ++++---- .../BaseServiceHostModule.cs | 18 +++++----- .../SettleAccountHttpApiHostModule.cs | 24 ++++++------- .../Entities/BQ/JobHostdService.cs | 36 +++++++++++++++++++ .../Entities/BQ/VmiAppService.cs | 8 ++--- .../Entities/BQ/Vmi/VmiBalance.cs | 8 ++--- .../Entities/BQ/Vmi/VmiLog.cs | 19 ++++++---- 7 files changed, 83 insertions(+), 44 deletions(-) diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/AuthServerHostModule.cs b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/AuthServerHostModule.cs index 5cb16f78..3e71211a 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/AuthServerHostModule.cs +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/AuthServerHostModule.cs @@ -62,10 +62,10 @@ namespace AuthServer.Host options.Languages.Add(new LanguageInfo("en", "en", "English")); }); - context.Services.AddStackExchangeRedisCache(options => - { - options.Configuration = configuration["Redis:Configuration"]; - }); + //context.Services.AddStackExchangeRedisCache(options => + //{ + // options.Configuration = configuration["Redis:Configuration"]; + //}); context.Services.AddCors(options => { @@ -90,9 +90,9 @@ namespace AuthServer.Host options.ApplicationName = "AuthServer"; }); - var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); - context.Services.AddDataProtection() - .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys"); + //var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); + //context.Services.AddDataProtection() + // .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys"); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/BaseServiceHostModule.cs b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/BaseServiceHostModule.cs index d8318944..38f03882 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/BaseServiceHostModule.cs +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/BaseServiceHostModule.cs @@ -1,4 +1,4 @@ -using BaseService.EntityFrameworkCore; +using BaseService.EntityFrameworkCore; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Cors; @@ -145,14 +145,14 @@ namespace BaseService private static void ConfigureRedis(ServiceConfigurationContext context, IConfiguration configuration) { - context.Services.AddStackExchangeRedisCache(options => - { - options.Configuration = configuration["Redis:Configuration"]; - }); + //context.Services.AddStackExchangeRedisCache(options => + //{ + // options.Configuration = configuration["Redis:Configuration"]; + //}); - var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); - context.Services.AddDataProtection() - .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys"); + //var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); + //context.Services.AddDataProtection() + // .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys"); } private void ConfigureDbContext() @@ -271,4 +271,4 @@ namespace BaseService }); } } -} \ No newline at end of file +} diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs index 0f2868cc..6aa861e5 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs @@ -375,18 +375,18 @@ namespace Win.Sfs.SettleAccount { var hostingEnvironment = context.Services.GetHostingEnvironment(); - context.Services.AddStackExchangeRedisCache(options => - { - options.Configuration = configuration["Redis:Configuration"]; - }); + //context.Services.AddStackExchangeRedisCache(options => + //{ + // options.Configuration = configuration["Redis:Configuration"]; + //}); - if (!hostingEnvironment.IsDevelopment()) - { - var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); - context.Services - .AddDataProtection() - .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys"); - } + //if (!hostingEnvironment.IsDevelopment()) + //{ + // var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); + // context.Services + // .AddDataProtection() + // .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys"); + //} } private void ConfigureHangfire(ServiceConfigurationContext context, IConfiguration configuration) @@ -460,4 +460,4 @@ namespace Win.Sfs.SettleAccount }); } } -} \ No newline at end of file +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs index 0fa87108..d8dd821d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Linq; using System.Net; using System.Threading; @@ -21,6 +22,7 @@ public class JobHostdService : BackgroundService, IApplicationService { private readonly object _lockObj = new object(); private readonly IServiceProvider _serviceProvider; + private FileSystemWatcher _watcher; private CancellationToken _stoppingToken; public JobHostdService(IServiceProvider serviceProvider) @@ -28,6 +30,40 @@ public class JobHostdService : BackgroundService, IApplicationService this._serviceProvider = serviceProvider; } + public override Task StartAsync(CancellationToken cancellationToken) + { + var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"); + var filter = "*.js"; + this._watcher = new FileSystemWatcher(path, filter); + this._watcher.NotifyFilter = NotifyFilters.Attributes + | NotifyFilters.CreationTime + | NotifyFilters.DirectoryName + | NotifyFilters.FileName + | NotifyFilters.LastAccess + | NotifyFilters.LastWrite + | NotifyFilters.Security + | NotifyFilters.Size; + this._watcher.Created += _watcher_Created; + this._watcher.Deleted += _watcher_Created; + this._watcher.Changed += _watcher_Created; + this._watcher.Renamed += _watcher_Created; + this._watcher.IncludeSubdirectories = true; + this._watcher.EnableRaisingEvents = true; + return base.StartAsync(cancellationToken); + } + + private void _watcher_Created(object sender, FileSystemEventArgs e) + { + using var scope = this._serviceProvider.CreateScope(); + scope.ServiceProvider.GetRequiredService>().Clients.All.ServerToClient("Refresh", e.FullPath, ""); + } + + public override Task StopAsync(CancellationToken cancellationToken) + { + this._watcher?.Dispose(); + return base.StopAsync(cancellationToken); + } + public static List ServiceTypes { get; private set; } public ConcurrentDictionary> Jobs { get; } = new(); 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 20b9677e..023e4cfb 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 @@ -192,13 +192,9 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran /// [HttpPost("invoke")] [DisableValidation] - public virtual Task VmiBackup() + public virtual async Task VmiBackup() { - Task.Run(async () => - { - await Invoke(_serviceProvider).ConfigureAwait(false); - }); - return Task.CompletedTask; + await Invoke(_serviceProvider).ConfigureAwait(false); } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs index 0e10a422..254f4c7b 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs @@ -48,16 +48,16 @@ public class VmiBalance : BasicAggregateRoot, IHasConcurrencyStamp /// 发货类型 /// [Display(Name = "发货类型")] - public EnumDeliverBjBmpBillType BillType { get; set; } + public EnumDeliverBjBmpBillType? BillType { get; set; } [Display(Name = "数量")] public decimal Qty { get; set; } [Display(Name = "发运日期")] - public DateTime BillTime { get; set; } + public DateTime? BillTime { get; set; } [Display(Name = "订单日期")] - public DateTime DeliverTime { get; set; } + public DateTime? DeliverTime { get; set; } /// /// ERP库位 @@ -87,7 +87,7 @@ public class VmiBalance : BasicAggregateRoot, IHasConcurrencyStamp public string factory { get; set; } [Display(Name = "发货子类型")] - public EnumDeliverSubBillType SubBillType { get; set; } + public EnumDeliverSubBillType? SubBillType { get; set; } [Display(Name = "WMS实发生产码")] public string RealCode { get; set; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs index f33d32c9..5fb0177d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs @@ -99,6 +99,9 @@ public class VmiLog : BasicAggregateRoot [Display(Name = "LU零件号")] public string PartCode { get; set; } + /// + /// 生产码 + /// [Display(Name = "生产码")] public string VinCode { get; set; } @@ -108,22 +111,26 @@ public class VmiLog : BasicAggregateRoot [Display(Name = "客户零件号")] public string CustomerPartCode { get; set; } + /// + /// 生产码类型 + /// [Display(Name = "生产码类型")] public string CodeType { get; set; } - [Display(Name = "发货类型")] - public EnumDeliverBjBmpBillType BillType { get; set; } /// - /// 数量 + /// 发货类型 /// + [Display(Name = "发货类型")] + public EnumDeliverBjBmpBillType? BillType { get; set; } + [Display(Name = "数量")] public decimal Qty { get; set; } [Display(Name = "发运日期")] - public DateTime BillTime { get; set; } + public DateTime? BillTime { get; set; } [Display(Name = "订单日期")] - public DateTime DeliverTime { get; set; } + public DateTime? DeliverTime { get; set; } /// /// ERP库位 @@ -153,7 +160,7 @@ public class VmiLog : BasicAggregateRoot public string factory { get; set; } [Display(Name = "发货子类型")] - public EnumDeliverSubBillType SubBillType { get; set; } + public EnumDeliverSubBillType? SubBillType { get; set; } [Display(Name = "WMS实发生产码")] public string RealCode { get; set; }