mahao 1 year ago
parent
commit
f96ef0c8eb
  1. 14
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/AuthServerHostModule.cs
  2. 18
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/BaseServiceHostModule.cs
  3. 24
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs
  4. 36
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs
  5. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  6. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs
  7. 19
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs

14
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")); options.Languages.Add(new LanguageInfo("en", "en", "English"));
}); });
context.Services.AddStackExchangeRedisCache(options => //context.Services.AddStackExchangeRedisCache(options =>
{ //{
options.Configuration = configuration["Redis:Configuration"]; // options.Configuration = configuration["Redis:Configuration"];
}); //});
context.Services.AddCors(options => context.Services.AddCors(options =>
{ {
@ -90,9 +90,9 @@ namespace AuthServer.Host
options.ApplicationName = "AuthServer"; options.ApplicationName = "AuthServer";
}); });
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); //var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services.AddDataProtection() //context.Services.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys"); // .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys");
} }
public override void OnApplicationInitialization(ApplicationInitializationContext context) public override void OnApplicationInitialization(ApplicationInitializationContext context)

18
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.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Cors;
@ -145,14 +145,14 @@ namespace BaseService
private static void ConfigureRedis(ServiceConfigurationContext context, IConfiguration configuration) private static void ConfigureRedis(ServiceConfigurationContext context, IConfiguration configuration)
{ {
context.Services.AddStackExchangeRedisCache(options => //context.Services.AddStackExchangeRedisCache(options =>
{ //{
options.Configuration = configuration["Redis:Configuration"]; // options.Configuration = configuration["Redis:Configuration"];
}); //});
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); //var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services.AddDataProtection() //context.Services.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys"); // .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys");
} }
private void ConfigureDbContext() private void ConfigureDbContext()
@ -271,4 +271,4 @@ namespace BaseService
}); });
} }
} }
} }

24
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs

@ -375,18 +375,18 @@ namespace Win.Sfs.SettleAccount
{ {
var hostingEnvironment = context.Services.GetHostingEnvironment(); var hostingEnvironment = context.Services.GetHostingEnvironment();
context.Services.AddStackExchangeRedisCache(options => //context.Services.AddStackExchangeRedisCache(options =>
{ //{
options.Configuration = configuration["Redis:Configuration"]; // options.Configuration = configuration["Redis:Configuration"];
}); //});
if (!hostingEnvironment.IsDevelopment()) //if (!hostingEnvironment.IsDevelopment())
{ //{
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); // var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services // context.Services
.AddDataProtection() // .AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys"); // .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys");
} //}
} }
private void ConfigureHangfire(ServiceConfigurationContext context, IConfiguration configuration) private void ConfigureHangfire(ServiceConfigurationContext context, IConfiguration configuration)
@ -460,4 +460,4 @@ namespace Win.Sfs.SettleAccount
}); });
} }
} }
} }

36
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs

@ -2,6 +2,7 @@ using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Threading; using System.Threading;
@ -21,6 +22,7 @@ public class JobHostdService : BackgroundService, IApplicationService
{ {
private readonly object _lockObj = new object(); private readonly object _lockObj = new object();
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
private FileSystemWatcher _watcher;
private CancellationToken _stoppingToken; private CancellationToken _stoppingToken;
public JobHostdService(IServiceProvider serviceProvider) public JobHostdService(IServiceProvider serviceProvider)
@ -28,6 +30,40 @@ public class JobHostdService : BackgroundService, IApplicationService
this._serviceProvider = serviceProvider; 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<IHubContext<PageHub>>().Clients.All.ServerToClient("Refresh", e.FullPath, "");
}
public override Task StopAsync(CancellationToken cancellationToken)
{
this._watcher?.Dispose();
return base.StopAsync(cancellationToken);
}
public static List<Type> ServiceTypes { get; private set; } public static List<Type> ServiceTypes { get; private set; }
public ConcurrentDictionary<JobItem, Tuple<CancellationTokenSource, Thread>> Jobs { get; } = new(); public ConcurrentDictionary<JobItem, Tuple<CancellationTokenSource, Thread>> Jobs { get; } = new();

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

@ -192,13 +192,9 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
/// </summary> /// </summary>
[HttpPost("invoke")] [HttpPost("invoke")]
[DisableValidation] [DisableValidation]
public virtual Task VmiBackup() public virtual async Task VmiBackup()
{ {
Task.Run(async () => await Invoke(_serviceProvider).ConfigureAwait(false);
{
await Invoke(_serviceProvider).ConfigureAwait(false);
});
return Task.CompletedTask;
} }
/// <summary> /// <summary>

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

@ -48,16 +48,16 @@ public class VmiBalance : BasicAggregateRoot<Guid>, IHasConcurrencyStamp
/// 发货类型 /// 发货类型
/// </summary> /// </summary>
[Display(Name = "发货类型")] [Display(Name = "发货类型")]
public EnumDeliverBjBmpBillType BillType { get; set; } public EnumDeliverBjBmpBillType? BillType { get; set; }
[Display(Name = "数量")] [Display(Name = "数量")]
public decimal Qty { get; set; } public decimal Qty { get; set; }
[Display(Name = "发运日期")] [Display(Name = "发运日期")]
public DateTime BillTime { get; set; } public DateTime? BillTime { get; set; }
[Display(Name = "订单日期")] [Display(Name = "订单日期")]
public DateTime DeliverTime { get; set; } public DateTime? DeliverTime { get; set; }
/// <summary> /// <summary>
/// ERP库位 /// ERP库位
@ -87,7 +87,7 @@ public class VmiBalance : BasicAggregateRoot<Guid>, IHasConcurrencyStamp
public string factory { get; set; } public string factory { get; set; }
[Display(Name = "发货子类型")] [Display(Name = "发货子类型")]
public EnumDeliverSubBillType SubBillType { get; set; } public EnumDeliverSubBillType? SubBillType { get; set; }
[Display(Name = "WMS实发生产码")] [Display(Name = "WMS实发生产码")]
public string RealCode { get; set; } public string RealCode { get; set; }

19
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs

@ -99,6 +99,9 @@ public class VmiLog : BasicAggregateRoot<Guid>
[Display(Name = "LU零件号")] [Display(Name = "LU零件号")]
public string PartCode { get; set; } public string PartCode { get; set; }
/// <summary>
/// 生产码
/// </summary>
[Display(Name = "生产码")] [Display(Name = "生产码")]
public string VinCode { get; set; } public string VinCode { get; set; }
@ -108,22 +111,26 @@ public class VmiLog : BasicAggregateRoot<Guid>
[Display(Name = "客户零件号")] [Display(Name = "客户零件号")]
public string CustomerPartCode { get; set; } public string CustomerPartCode { get; set; }
/// <summary>
/// 生产码类型
/// </summary>
[Display(Name = "生产码类型")] [Display(Name = "生产码类型")]
public string CodeType { get; set; } public string CodeType { get; set; }
[Display(Name = "发货类型")]
public EnumDeliverBjBmpBillType BillType { get; set; }
/// <summary> /// <summary>
/// 数量 /// 发货类型
/// </summary> /// </summary>
[Display(Name = "发货类型")]
public EnumDeliverBjBmpBillType? BillType { get; set; }
[Display(Name = "数量")] [Display(Name = "数量")]
public decimal Qty { get; set; } public decimal Qty { get; set; }
[Display(Name = "发运日期")] [Display(Name = "发运日期")]
public DateTime BillTime { get; set; } public DateTime? BillTime { get; set; }
[Display(Name = "订单日期")] [Display(Name = "订单日期")]
public DateTime DeliverTime { get; set; } public DateTime? DeliverTime { get; set; }
/// <summary> /// <summary>
/// ERP库位 /// ERP库位
@ -153,7 +160,7 @@ public class VmiLog : BasicAggregateRoot<Guid>
public string factory { get; set; } public string factory { get; set; }
[Display(Name = "发货子类型")] [Display(Name = "发货子类型")]
public EnumDeliverSubBillType SubBillType { get; set; } public EnumDeliverSubBillType? SubBillType { get; set; }
[Display(Name = "WMS实发生产码")] [Display(Name = "WMS实发生产码")]
public string RealCode { get; set; } public string RealCode { get; set; }

Loading…
Cancel
Save