学 赵 1 year ago
parent
commit
6502c43bf5
  1. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/BaseServiceHostModule.cs
  2. 19
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Program.cs
  3. 42
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs
  4. 5
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/compare/compare.js
  5. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HandSeSyncAppService.cs
  6. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncAppService.cs
  7. 202
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncBaseAppService.cs
  8. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncAppService.cs
  9. 198
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs
  10. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs
  11. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MaiDanBBACSeSyncAppService.cs
  12. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MaiDanHBPOSeSyncAppService.cs
  13. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs
  14. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/SeSyncExtendManager.cs
  15. 128
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  16. 40
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs
  17. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  18. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs
  19. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs
  20. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs
  21. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiMessage.cs
  22. 9
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  23. 5820
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230831024215_vmi19.Designer.cs
  24. 228
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230831024215_vmi19.cs
  25. 37
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  26. 1
      code/src/Shared/Win.Sfs.Shared/Win.Sfs.Shared.csproj

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/BaseServiceHostModule.cs

@ -217,7 +217,7 @@ namespace BaseService
.ConventionalControllers .ConventionalControllers
.Create(typeof(BaseServiceApplicationModule).Assembly, opts .Create(typeof(BaseServiceApplicationModule).Assembly, opts
=> =>
{ opts.RootPath = "base"; }) { opts.RootPath = "base"; })
; ;
}); });
} }

19
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Program.cs

@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Serilog; using Serilog;
using Serilog.Settings.Configuration;
namespace Win.Sfs.SettleAccount; namespace Win.Sfs.SettleAccount;
@ -13,21 +12,13 @@ public class Program
{ {
var configuration = new ConfigurationBuilder() var configuration = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true);
.Build();
//try
//{
// new InfluxHelper(configuration).Start();
//}
//catch (Exception ex)
//{
// Console.Write("时序数据库启动失败");
// Console.Write(ex.ToString());
// //throw;
//}
Log.Logger = new LoggerConfiguration() Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration, ConfigurationAssemblySource.AlwaysScanDllFiles) .WriteTo.Async(c => c.File("Logs/logs.txt"
, rollingInterval: RollingInterval.Day
, rollOnFileSizeLimit: true
, fileSizeLimitBytes: 30 * 1024 * 1024))
.WriteTo.Async(c => c.Console()) .WriteTo.Async(c => c.Console())
.CreateLogger(); .CreateLogger();

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

@ -1,25 +1,26 @@
using System;
using System.IO;
using System.Linq;
using System.Text.Json;
using AuthServer.Host; using AuthServer.Host;
using BaseService; using BaseService;
using Hangfire; using Hangfire;
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;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using StackExchange.Redis;
using Swashbuckle.AspNetCore.SwaggerUI; using Swashbuckle.AspNetCore.SwaggerUI;
using System;
using System.IO;
using System.Linq;
using System.Text.Json;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.AspNetCore.ExceptionHandling; using Volo.Abp.AspNetCore.ExceptionHandling;
using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.ExceptionHandling;
using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Autofac; using Volo.Abp.Autofac;
@ -37,7 +38,6 @@ using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.Threading; using Volo.Abp.Threading;
using Volo.Abp.VirtualFileSystem; using Volo.Abp.VirtualFileSystem;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.ImportExcelCommon; using Win.Sfs.SettleAccount.ImportExcelCommon;
using Win.Sfs.Shared.Constant; using Win.Sfs.Shared.Constant;
using Win.Utils; using Win.Utils;
@ -258,6 +258,17 @@ namespace Win.Sfs.SettleAccount
{ {
//将错误明细发送给客户端 //将错误明细发送给客户端
Configure<AbpExceptionHandlingOptions>(options => { options.SendExceptionsDetailsToClients = true; }); Configure<AbpExceptionHandlingOptions>(options => { options.SendExceptionsDetailsToClients = true; });
Configure<MvcOptions>(options =>
{
var index = options.Filters.ToList().FindIndex(filter => filter is ServiceFilterAttribute attr && attr.ServiceType.Equals(typeof(AbpExceptionFilter)));
if (index > -1)
{
options.Filters.RemoveAt(index);
}
options.Filters.Add(typeof(CustomExceptionFilter));
});
} }
private void ConfigureMultiTenancy() private void ConfigureMultiTenancy()
@ -476,4 +487,21 @@ namespace Win.Sfs.SettleAccount
}); });
} }
} }
public class CustomExceptionFilter : IExceptionFilter
{
private readonly ILogger<CustomExceptionFilter> logger;
public CustomExceptionFilter(ILogger<CustomExceptionFilter> logger)
{
this.logger = logger;
}
public void OnException(ExceptionContext context)
{
logger.LogError(new EventId(context.Exception.HResult), context.Exception, context.Exception.Message);
var message = context.Exception.InnerException?.InnerException?.Message ?? context.Exception.Message;
context.Result = new JsonResult(new { code = 400, message });
context.ExceptionHandled = true;
}
}
} }

5
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/compare/compare.js

@ -10,6 +10,11 @@ const defaultCompareSchema = {
title: "发运日期", title: "发运日期",
type: "array", type: "array",
input: "datetimerange", input: "datetimerange",
rules: [
{
required: true,
},
],
}, },
downLineDateTime: { downLineDateTime: {
title: "下线日期", title: "下线日期",

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HandSeSyncAppService.cs

@ -32,7 +32,7 @@ public class HandSeSyncAppService : ApplicationService
public virtual async Task SyncAsync([FromBody] EnumBusinessType businessType) public virtual async Task SyncAsync([FromBody] EnumBusinessType businessType)
{ {
using var scope = this._applicationServices.CreateScope(); using var scope = this._applicationServices.CreateScope();
IInvocable jitSeSyncAppService = businessType switch IInvocable seSyncAppService = businessType switch
{ {
EnumBusinessType.JisBBAC => scope.ServiceProvider.GetRequiredService<JisBBACSeSyncAppService>(), EnumBusinessType.JisBBAC => scope.ServiceProvider.GetRequiredService<JisBBACSeSyncAppService>(),
EnumBusinessType.JisHBPO => scope.ServiceProvider.GetRequiredService<JisHBPOSeSyncAppService>(), EnumBusinessType.JisHBPO => scope.ServiceProvider.GetRequiredService<JisHBPOSeSyncAppService>(),
@ -44,6 +44,6 @@ public class HandSeSyncAppService : ApplicationService
EnumBusinessType.YinDuJian => scope.ServiceProvider.GetRequiredService<YinDuSeSyncAppService>(), EnumBusinessType.YinDuJian => scope.ServiceProvider.GetRequiredService<YinDuSeSyncAppService>(),
_ => throw new ArgumentOutOfRangeException(nameof(businessType), $"Not expected direction value: {businessType}"), _ => throw new ArgumentOutOfRangeException(nameof(businessType), $"Not expected direction value: {businessType}"),
}; };
await jitSeSyncAppService.Invoke().ConfigureAwait(false); await seSyncAppService.Invoke().ConfigureAwait(false);
} }
} }

12
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncAppService.cs

@ -3,11 +3,9 @@ using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ; using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
@ -24,11 +22,8 @@ public class JisBBACSeSyncAppService : JisBBACSeSyncBaseAppService, IJobService
public JisBBACSeSyncAppService( public JisBBACSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext, WMSBJBMPTDbContext wmsBJBMPTContext,
SettleAccountDbContext settleAccountDbContext, SettleAccountDbContext settleAccountDbContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository, SeSyncExtendManager syncExtendManager
INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> jisSeDetailRepository, ) : base(wmsBJBMPTContext, settleAccountDbContext, syncExtendManager)
MaterialRelationshipManager materialRelationshipManager,
VmiAppService vmiService
) : base(wmsBJBMPTContext, settleAccountDbContext, syncPositionFlagRepository, jisSeDetailRepository, materialRelationshipManager, vmiService)
{ {
base.SeSyncConfigInfo = new SeSyncConfig() base.SeSyncConfigInfo = new SeSyncConfig()
{ {
@ -43,6 +38,7 @@ public class JisBBACSeSyncAppService : JisBBACSeSyncBaseAppService, IJobService
}; };
} }
[UnitOfWork(IsDisabled = true)]
public async Task Invoke(IServiceProvider serviceProvider) public async Task Invoke(IServiceProvider serviceProvider)
{ {
await this.Invoke().ConfigureAwait(false); await this.Invoke().ConfigureAwait(false);

202
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncBaseAppService.cs

@ -1,14 +1,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using Coravel.Invocable; using Coravel.Invocable;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using LinqToDB;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
@ -25,28 +24,14 @@ public class JisBBACSeSyncBaseAppService : ApplicationService, IInvocable
/// WMS数据上下文 /// WMS数据上下文
/// </summary> /// </summary>
private readonly WMSBJBMPTDbContext _wmsBJBMPTContext; private readonly WMSBJBMPTDbContext _wmsBJBMPTContext;
/// <summary> /// <summary>
/// 数据上下文 /// 数据上下文
/// </summary> /// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext; private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary> /// <summary>
/// 同步位置标记 /// 发运同步扩展
/// </summary> /// </summary>
private readonly INormalEfCoreRepository<SyncPositionFlag, Guid> _syncPositionFlagRepository; private readonly SeSyncExtendManager _syncExtendManager;
/// <summary>
/// Jis发运数据仓储
/// </summary>
private readonly INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> _jisSeDetailRepository;
/// <summary>
/// 客户零件关系领域
/// </summary>
private readonly MaterialRelationshipManager _materialRelationshipManager;
//private readonly IVmiService _vmiService;
/// <summary> /// <summary>
/// 构造 /// 构造
@ -54,17 +39,11 @@ public class JisBBACSeSyncBaseAppService : ApplicationService, IInvocable
public JisBBACSeSyncBaseAppService( public JisBBACSeSyncBaseAppService(
WMSBJBMPTDbContext wmsBJBMPTContext, WMSBJBMPTDbContext wmsBJBMPTContext,
SettleAccountDbContext settleAccountDbContext, SettleAccountDbContext settleAccountDbContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository, SeSyncExtendManager syncExtendManager)
INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> jisSeDetailRepository,
MaterialRelationshipManager materialRelationshipManager,
VmiAppService vmiService)
{ {
_wmsBJBMPTContext = wmsBJBMPTContext; _wmsBJBMPTContext = wmsBJBMPTContext;
_settleAccountDbContext = settleAccountDbContext; _settleAccountDbContext = settleAccountDbContext;
_syncPositionFlagRepository = syncPositionFlagRepository; _syncExtendManager = syncExtendManager;
_jisSeDetailRepository = jisSeDetailRepository;
_materialRelationshipManager = materialRelationshipManager;
//_vmiService = vmiService;
} }
/// <summary> /// <summary>
@ -80,7 +59,6 @@ public class JisBBACSeSyncBaseAppService : ApplicationService, IInvocable
return; return;
} }
await SyncJitRecordAsync().ConfigureAwait(false); await SyncJitRecordAsync().ConfigureAwait(false);
await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false);
await SyncJisRecordAsync().ConfigureAwait(false); await SyncJisRecordAsync().ConfigureAwait(false);
} }
@ -97,53 +75,27 @@ public class JisBBACSeSyncBaseAppService : ApplicationService, IInvocable
var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes; var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes;
//业务类别 //业务类别
var businessType = SeSyncConfigInfo.BusinessType; var businessType = SeSyncConfigInfo.BusinessType;
var seed = 0;
Expression<Func<TM_BJBMPT_JIT_RECORD, bool>> predicate = (t) => t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType); while (seed < 10)
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
if (syncPositionFlag != null)
{
predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType);
}
//WMS发运记录
var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_JIT_RECORD.Where(predicate).OrderBy(b => b.UID).Take(100000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords);
if (jisSeDetails.Any())
{ {
//客户零件号和厂内零件号 seed++;
var luRePartCodes = jisSeDetails.Where(t => !string.IsNullOrEmpty(t.LU) && !string.IsNullOrEmpty(t.FactoryPartCode)).Select(t => new { t.LU, t.FactoryPartCode }).Distinct().ToList(); var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
if (luRePartCodes.Any()) var syncPosition = syncPositionFlag?.Position ?? "0";
//WMS发运记录
var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_JIT_RECORD
.Where(t => t.UID > int.Parse(syncPosition))
.Where(t => t.DeliverBillType == deliverBillType)
.Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType))
.OrderBy(b => b.UID).Take(100_000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords);
if (jisSeDetails.Any())
{ {
var materialRelationships = luRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.FactoryPartCode, "", t.LU, businessType)); await SeDataPutInStorageAsync(jisSeDetails, false).ConfigureAwait(false);
await this.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false);
}
jisSeDetails.ForEach(t =>
{
t.SetId(GuidGenerator.Create());
t.BusinessType = businessType;
t.CustomerPartCodeNoSpace = t.LU.Replace(" ", "");
t.KeyCode = t.PN + t.LU;
if (t.BillTime != null)
{
t.Version = int.Parse(t.BillTime?.ToString("yyyyMM"));
}
});
await _settleAccountDbContext.BulkInsertAsync(jisSeDetails).ConfigureAwait(false);
if (syncPositionFlag != null)
{
syncPositionFlag.Position = wmsSeRecords.Last().UID.ToString();
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag).ConfigureAwait(false);
} }
else else
{ {
syncPositionFlag = new SyncPositionFlag() break;
{
TableName = syncTableName,
Position = wmsSeRecords.Last().UID.ToString()
};
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag).ConfigureAwait(false);
} }
} }
} }
@ -161,74 +113,90 @@ public class JisBBACSeSyncBaseAppService : ApplicationService, IInvocable
var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes; var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes;
//业务类别 //业务类别
var businessType = SeSyncConfigInfo.BusinessType; var businessType = SeSyncConfigInfo.BusinessType;
var seed = 0;
while (seed < 10)
{
seed++;
var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
var syncPosition = syncPositionFlag?.Position ?? "0";
//WMS发运记录
var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_JIS_RECORD
.Where(t => t.UID > int.Parse(syncPosition))
.Where(t => t.DeliverBillType == deliverBillType)
.Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType))
.OrderBy(b => b.UID).Take(100_000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords);
if (jisSeDetails.Any())
{
await SeDataPutInStorageAsync(jisSeDetails, true).ConfigureAwait(false);
}
else
{
break;
}
}
}
/// <summary>
/// 发运数据入库
/// </summary>
private async Task SeDataPutInStorageAsync(List<BBAC_SE_DETAIL> seDetails, bool isJisTable)
{
//同步表名称
var syncTableName = isJisTable ? SeSyncConfigInfo.SyncTableName +
"_Jis" : SeSyncConfigInfo.SyncTableName + "_Jit";
//业务类别
var businessType = SeSyncConfigInfo.BusinessType;
Expression<Func<TM_BJBMPT_JIS_RECORD, bool>> predicate = (t) => t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType); //客户零件号和厂内零件号
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName).ConfigureAwait(false); var luRePartCodes = seDetails.Where(t => !string.IsNullOrEmpty(t.LU) && !string.IsNullOrEmpty(t.FactoryPartCode)).Select(t => new { t.LU, t.FactoryPartCode }).Distinct().ToList();
if (syncPositionFlag != null) if (luRePartCodes.Any())
{ {
predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType); var materialRelationships = luRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.FactoryPartCode, "", t.LU, businessType));
await _syncExtendManager.AddNewMaterialRelationshipsAsync(materialRelationships).ConfigureAwait(false);
} }
//WMS发运数据 seDetails.ForEach(t =>
var wmsRecords = _wmsBJBMPTContext.TM_BJBMPT_JIS_RECORD.Where(predicate).OrderBy(b => b.UID).Take(100000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<BBAC_SE_DETAIL>>(wmsRecords);
if (jisSeDetails.Any())
{ {
//客户零件号和厂内零件号 t.SetId(GuidGenerator.Create());
var luRePartCodes = jisSeDetails.Where(t => !string.IsNullOrEmpty(t.LU) && !string.IsNullOrEmpty(t.FactoryPartCode)).Select(t => new { t.LU, t.FactoryPartCode }).Distinct().ToList(); t.BusinessType = businessType;
if (luRePartCodes.Any()) t.CustomerPartCodeNoSpace = t.LU.Replace(" ", "");
t.KeyCode = t.PN + t.LU;
if (t.BillTime != null)
{ {
var materialRelationships = luRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.FactoryPartCode, "", t.LU, businessType)); t.Version = int.Parse(t.BillTime?.ToString("yyyyMM"));
await this.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false);
} }
});
var syncPosition = seDetails.Last().UID.ToString();
jisSeDetails.ForEach(t => using var transaction = await _settleAccountDbContext.Database.BeginTransactionAsync().ConfigureAwait(false);
{ try
t.SetId(GuidGenerator.Create()); {
t.BusinessType = businessType; var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
t.CustomerPartCodeNoSpace = t.LU.Replace(" ", "");
t.KeyCode = t.PN + t.LU;
if (t.BillTime != null)
{
t.Version = int.Parse(t.BillTime?.ToString("yyyyMM"));
}
});
await _settleAccountDbContext.BulkInsertAsync(jisSeDetails).ConfigureAwait(false);
if (syncPositionFlag != null) if (syncPositionFlag != null)
{ {
syncPositionFlag.Position = wmsRecords.Last().UID.ToString(); syncPositionFlag.Position = syncPosition;
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag).ConfigureAwait(false); _settleAccountDbContext.Update<SyncPositionFlag>(syncPositionFlag);
} }
else else
{ {
syncPositionFlag = new SyncPositionFlag() syncPositionFlag = new SyncPositionFlag()
{ {
TableName = syncTableName, TableName = syncTableName,
Position = wmsRecords.Last().UID.ToString() Position = syncPosition
}; };
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag).ConfigureAwait(false); ; _settleAccountDbContext.Add<SyncPositionFlag>(syncPositionFlag);
} }
await _settleAccountDbContext.BulkInsertAsync(seDetails).ConfigureAwait(false);
await _syncExtendManager.JisSeDetailsSaveConsignAsync<BBAC_SE_DETAIL>(seDetails, isJisTable).ConfigureAwait(false);
await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false);
await transaction.CommitAsync().ConfigureAwait(false);
} }
} catch (Exception)
/// <summary>
/// 添加零件关系
/// </summary>
public async Task AddNewMaterialRelationships(IEnumerable<MaterialRelationship> materialRelationships)
{
//新客户零件号和厂内零件号
var noHaveLuRePartCodes = from item1 in materialRelationships
join item2 in _settleAccountDbContext.Set<MaterialRelationship>()
on new { item1.ErpMaterialCode, item1.SettleMaterialCode } equals new { item2.ErpMaterialCode, item2.SettleMaterialCode }
into temp
from item3 in temp.DefaultIfEmpty()
where item3 == null
select item1;
if (noHaveLuRePartCodes.Any())
{ {
await _settleAccountDbContext.BulkInsertAsync(noHaveLuRePartCodes.ToList()).ConfigureAwait(false); await transaction.RollbackAsync().ConfigureAwait(false);
throw;
} }
} }
} }

11
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncAppService.cs

@ -1,14 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
@ -24,11 +20,8 @@ public class JisHBPOSeSyncAppService : JisHBPOSeSyncBaseAppService, IJobService
public JisHBPOSeSyncAppService( public JisHBPOSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext, WMSBJBMPTDbContext wmsBJBMPTContext,
SettleAccountDbContext settleAccountDbContext, SettleAccountDbContext settleAccountDbContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> jisSeDetailRepository,
MaterialRelationshipManager materialRelationshipManager,
SeSyncExtendManager syncExtendManager SeSyncExtendManager syncExtendManager
) : base(wmsBJBMPTContext, settleAccountDbContext, syncPositionFlagRepository, jisSeDetailRepository, materialRelationshipManager, syncExtendManager) ) : base(wmsBJBMPTContext, settleAccountDbContext, syncExtendManager)
{ {
base.SeSyncConfigInfo = new SeSyncConfig() base.SeSyncConfigInfo = new SeSyncConfig()
{ {
@ -43,7 +36,7 @@ public class JisHBPOSeSyncAppService : JisHBPOSeSyncBaseAppService, IJobService
}; };
} }
[UnitOfWork(IsDisabled = false)] [UnitOfWork(IsDisabled = true)]
public virtual async Task Invoke(IServiceProvider serviceProvider) public virtual async Task Invoke(IServiceProvider serviceProvider)
{ {
await this.Invoke().ConfigureAwait(false); await this.Invoke().ConfigureAwait(false);

198
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs

@ -1,17 +1,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions;
using System.LinqAsync;
using System.Threading.Tasks; using System.Threading.Tasks;
using Coravel.Invocable; using Coravel.Invocable;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using LinqToDB;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Org.BouncyCastle.Asn1.Cmp;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.MaterialRelationships;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
@ -28,26 +24,10 @@ public class JisHBPOSeSyncBaseAppService : ApplicationService, IInvocable
/// WMS数据上下文 /// WMS数据上下文
/// </summary> /// </summary>
private readonly WMSBJBMPTDbContext _wmsBJBMPTContext; private readonly WMSBJBMPTDbContext _wmsBJBMPTContext;
/// <summary> /// <summary>
/// 数据上下文 /// 数据上下文
/// </summary> /// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext; private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary>
/// 同步位置标记
/// </summary>
private readonly INormalEfCoreRepository<SyncPositionFlag, Guid> _syncPositionFlagRepository;
/// <summary>
/// Jis发运数据仓储
/// </summary>
private readonly INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> _jisSeDetailRepository;
/// <summary>
/// 客户零件关系领域
/// </summary>
private readonly MaterialRelationshipManager _materialRelationshipManager;
/// <summary> /// <summary>
/// 发运同步扩展 /// 发运同步扩展
/// </summary> /// </summary>
@ -59,17 +39,12 @@ public class JisHBPOSeSyncBaseAppService : ApplicationService, IInvocable
public JisHBPOSeSyncBaseAppService( public JisHBPOSeSyncBaseAppService(
WMSBJBMPTDbContext wmsBJBMPTContext, WMSBJBMPTDbContext wmsBJBMPTContext,
SettleAccountDbContext settleAccountDbContext, SettleAccountDbContext settleAccountDbContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> jisSeDetailRepository,
MaterialRelationshipManager materialRelationshipManager,
SeSyncExtendManager syncExtendManager) SeSyncExtendManager syncExtendManager)
{ {
_wmsBJBMPTContext = wmsBJBMPTContext; _wmsBJBMPTContext = wmsBJBMPTContext;
_settleAccountDbContext = settleAccountDbContext; _settleAccountDbContext = settleAccountDbContext;
_syncPositionFlagRepository = syncPositionFlagRepository;
_jisSeDetailRepository = jisSeDetailRepository;
_materialRelationshipManager = materialRelationshipManager;
_syncExtendManager = syncExtendManager; _syncExtendManager = syncExtendManager;
_syncExtendManager._settleAccountDbContext = settleAccountDbContext;
} }
/// <summary> /// <summary>
@ -78,7 +53,7 @@ public class JisHBPOSeSyncBaseAppService : ApplicationService, IInvocable
public SeSyncConfig SeSyncConfigInfo { get; set; } public SeSyncConfig SeSyncConfigInfo { get; set; }
[HttpPost] [HttpPost]
public async Task Invoke() public virtual async Task Invoke()
{ {
if (SeSyncConfigInfo == null) if (SeSyncConfigInfo == null)
{ {
@ -101,64 +76,27 @@ public class JisHBPOSeSyncBaseAppService : ApplicationService, IInvocable
var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes; var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes;
//业务类别 //业务类别
var businessType = SeSyncConfigInfo.BusinessType; var businessType = SeSyncConfigInfo.BusinessType;
var seed = 0;
var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false); while (seed < 10)
var syncPosition = syncPositionFlag?.Position ?? "0";
Expression<Func<TM_BJBMPT_JIT_RECORD, bool>> predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType);
//WMS发运记录
var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_JIT_RECORD.Where(predicate).OrderBy(b => b.UID).Take(100_000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<HBPO_SE_DETAIL>>(wmsSeRecords);
if (jisSeDetails.Any())
{ {
//客户零件号和厂内零件号 seed++;
var luRePartCodes = jisSeDetails.Where(t => !string.IsNullOrEmpty(t.LU) && !string.IsNullOrEmpty(t.FactoryPartCode)).Select(t => new { t.LU, t.FactoryPartCode }).Distinct().ToList(); var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
if (luRePartCodes.Any()) var syncPosition = syncPositionFlag?.Position ?? "0";
//WMS发运记录
var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_JIT_RECORD
.Where(t => t.UID > int.Parse(syncPosition))
.Where(t => t.DeliverBillType == deliverBillType)
.Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType))
.OrderBy(b => b.UID).Take(100_000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<HBPO_SE_DETAIL>>(wmsSeRecords);
if (jisSeDetails.Any())
{ {
var materialRelationships = luRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.FactoryPartCode, "", t.LU, businessType)); await SeDataPutInStorageAsync(jisSeDetails, false).ConfigureAwait(false);
await _syncExtendManager.AddNewMaterialRelationshipsAsync(materialRelationships).ConfigureAwait(false);
} }
else
jisSeDetails.ForEach(t =>
{
t.SetId(GuidGenerator.Create());
t.BusinessType = businessType;
t.CustomerPartCodeNoSpace = t.LU.Replace(" ", "");
t.KeyCode = t.PN + t.LU;
if (t.BillTime != null)
{
t.Version = int.Parse(t.BillTime?.ToString("yyyyMM"));
}
});
var syncPositionNew = jisSeDetails.Last().UID.ToString();
using var transaction = await _settleAccountDbContext.Database.BeginTransactionAsync().ConfigureAwait(false);
try
{
if (syncPositionFlag != null)
{
syncPositionFlag.Position = syncPositionNew;
_settleAccountDbContext.Update<SyncPositionFlag>(syncPositionFlag);
}
else
{
syncPositionFlag = new SyncPositionFlag()
{
TableName = syncTableName,
Position = syncPositionNew
};
_settleAccountDbContext.Add<SyncPositionFlag>(syncPositionFlag);
}
await _settleAccountDbContext.BulkInsertAsync(jisSeDetails).ConfigureAwait(false);
await _syncExtendManager.JisSeDetailsSaveConsignAsync(jisSeDetails, false).ConfigureAwait(false);
await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false);
await transaction.CommitAsync().ConfigureAwait(false);
}
catch (Exception)
{ {
await transaction.RollbackAsync().ConfigureAwait(false); break;
throw;
} }
} }
} }
@ -176,54 +114,90 @@ public class JisHBPOSeSyncBaseAppService : ApplicationService, IInvocable
var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes; var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes;
//业务类别 //业务类别
var businessType = SeSyncConfigInfo.BusinessType; var businessType = SeSyncConfigInfo.BusinessType;
var seed = 0;
while (seed < 10)
{
seed++;
var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
var syncPosition = syncPositionFlag?.Position ?? "0";
//WMS发运记录
var wmsRecords = _wmsBJBMPTContext.TM_BJBMPT_JIS_RECORD
.Where(t => t.UID > int.Parse(syncPosition))
.Where(t => t.DeliverBillType == deliverBillType)
.Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType))
.OrderBy(b => b.UID).Take(100_000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<HBPO_SE_DETAIL>>(wmsRecords);
if (jisSeDetails.Any())
{
await SeDataPutInStorageAsync(jisSeDetails, true).ConfigureAwait(false);
}
else
{
break;
}
}
}
Expression<Func<TM_BJBMPT_JIS_RECORD, bool>> predicate = (t) => t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType); /// <summary>
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName).ConfigureAwait(false); /// 发运数据入库
if (syncPositionFlag != null) /// </summary>
private async Task SeDataPutInStorageAsync(List<HBPO_SE_DETAIL> seDetails, bool isJisTable)
{
//同步表名称
var syncTableName = isJisTable ? SeSyncConfigInfo.SyncTableName +
"_Jis" : SeSyncConfigInfo.SyncTableName + "_Jit";
//业务类别
var businessType = SeSyncConfigInfo.BusinessType;
//客户零件号和厂内零件号
var luRePartCodes = seDetails.Where(t => !string.IsNullOrEmpty(t.LU) && !string.IsNullOrEmpty(t.FactoryPartCode)).Select(t => new { t.LU, t.FactoryPartCode }).Distinct().ToList();
if (luRePartCodes.Any())
{ {
predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType); var materialRelationships = luRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.FactoryPartCode, "", t.LU, businessType));
await _syncExtendManager.AddNewMaterialRelationshipsAsync(materialRelationships).ConfigureAwait(false);
} }
//WMS发运数据 seDetails.ForEach(t =>
var wmsRecords = _wmsBJBMPTContext.TM_BJBMPT_JIS_RECORD.Where(predicate).OrderBy(b => b.UID).Take(100000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<HBPO_SE_DETAIL>>(wmsRecords);
if (jisSeDetails.Any())
{ {
//客户零件号和厂内零件号 t.SetId(GuidGenerator.Create());
var luRePartCodes = jisSeDetails.Where(t => !string.IsNullOrEmpty(t.LU) && !string.IsNullOrEmpty(t.FactoryPartCode)).Select(t => new { t.LU, t.FactoryPartCode }).Distinct().ToList(); t.BusinessType = businessType;
if (luRePartCodes.Any()) t.CustomerPartCodeNoSpace = t.LU.Replace(" ", "");
t.KeyCode = t.PN + t.LU;
if (t.BillTime != null)
{ {
var materialRelationships = luRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.FactoryPartCode, "", t.LU, businessType)); t.Version = int.Parse(t.BillTime?.ToString("yyyyMM"));
await _syncExtendManager.AddNewMaterialRelationshipsAsync(materialRelationships).ConfigureAwait(false);
} }
});
var syncPosition = seDetails.Last().UID.ToString();
jisSeDetails.ForEach(t => using var transaction = await _settleAccountDbContext.Database.BeginTransactionAsync().ConfigureAwait(false);
{ try
t.SetId(GuidGenerator.Create()); {
t.BusinessType = businessType; var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
t.CustomerPartCodeNoSpace = t.LU.Replace(" ", "");
t.KeyCode = t.PN + t.LU;
if (t.BillTime != null)
{
t.Version = int.Parse(t.BillTime?.ToString("yyyyMM"));
}
});
await _settleAccountDbContext.BulkInsertAsync(jisSeDetails).ConfigureAwait(false);
if (syncPositionFlag != null) if (syncPositionFlag != null)
{ {
syncPositionFlag.Position = wmsRecords.Last().UID.ToString(); syncPositionFlag.Position = syncPosition;
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag).ConfigureAwait(false); _settleAccountDbContext.Update<SyncPositionFlag>(syncPositionFlag);
} }
else else
{ {
syncPositionFlag = new SyncPositionFlag() syncPositionFlag = new SyncPositionFlag()
{ {
TableName = syncTableName, TableName = syncTableName,
Position = wmsRecords.Last().UID.ToString() Position = syncPosition
}; };
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag).ConfigureAwait(false); _settleAccountDbContext.Add<SyncPositionFlag>(syncPositionFlag);
} }
await _settleAccountDbContext.BulkInsertAsync(seDetails).ConfigureAwait(false);
await _syncExtendManager.JisSeDetailsSaveConsignAsync<HBPO_SE_DETAIL>(seDetails, isJisTable).ConfigureAwait(false);
await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false);
await transaction.CommitAsync().ConfigureAwait(false);
}
catch (Exception)
{
await transaction.RollbackAsync().ConfigureAwait(false);
throw;
} }
} }
} }

10
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs

@ -49,10 +49,6 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
/// 发运同步配置 /// 发运同步配置
/// </summary> /// </summary>
public SeSyncConfig SeSyncConfigInfo { get; set; } public SeSyncConfig SeSyncConfigInfo { get; set; }
/// <summary>
/// Seed
/// </summary>
public int Seed { get; set; }
[HttpPost] [HttpPost]
public async Task Invoke() public async Task Invoke()
@ -69,10 +65,10 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes; var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes;
//业务类别 //业务类别
var businessType = SeSyncConfigInfo.BusinessType; var businessType = SeSyncConfigInfo.BusinessType;
var seed = 0;
while (Seed < 10) while (seed < 10)
{ {
Seed++; seed++;
var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false); var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
var syncPosition = syncPositionFlag?.Position ?? "0"; var syncPosition = syncPositionFlag?.Position ?? "0";

12
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MaiDanBBACSeSyncAppService.cs

@ -3,11 +3,9 @@ using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ; using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
@ -24,11 +22,8 @@ public class MaiDanBBACSeSyncAppService : JisBBACSeSyncBaseAppService, IJobServi
public MaiDanBBACSeSyncAppService( public MaiDanBBACSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext, WMSBJBMPTDbContext wmsBJBMPTContext,
SettleAccountDbContext settleAccountDbContext, SettleAccountDbContext settleAccountDbContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository, SeSyncExtendManager syncExtendManager
INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> jisSeDetailRepository, ) : base(wmsBJBMPTContext, settleAccountDbContext, syncExtendManager)
MaterialRelationshipManager materialRelationshipManager,
VmiAppService vmiService
) : base(wmsBJBMPTContext, settleAccountDbContext, syncPositionFlagRepository, jisSeDetailRepository, materialRelationshipManager, vmiService)
{ {
base.SeSyncConfigInfo = new SeSyncConfig() base.SeSyncConfigInfo = new SeSyncConfig()
{ {
@ -43,6 +38,7 @@ public class MaiDanBBACSeSyncAppService : JisBBACSeSyncBaseAppService, IJobServi
}; };
} }
[UnitOfWork(IsDisabled = true)]
public async Task Invoke(IServiceProvider serviceProvider) public async Task Invoke(IServiceProvider serviceProvider)
{ {
await this.Invoke().ConfigureAwait(false); await this.Invoke().ConfigureAwait(false);

10
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MaiDanHBPOSeSyncAppService.cs

@ -2,12 +2,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
@ -23,11 +20,8 @@ public class MaiDanHBPOSeSyncAppService : JisHBPOSeSyncBaseAppService, IJobServi
public MaiDanHBPOSeSyncAppService( public MaiDanHBPOSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext, WMSBJBMPTDbContext wmsBJBMPTContext,
SettleAccountDbContext settleAccountDbContext, SettleAccountDbContext settleAccountDbContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> jisSeDetailRepository,
MaterialRelationshipManager materialRelationshipManager,
SeSyncExtendManager syncExtendManager SeSyncExtendManager syncExtendManager
) : base(wmsBJBMPTContext, settleAccountDbContext, syncPositionFlagRepository, jisSeDetailRepository, materialRelationshipManager, syncExtendManager) ) : base(wmsBJBMPTContext, settleAccountDbContext, syncExtendManager)
{ {
base.SeSyncConfigInfo = new SeSyncConfig() base.SeSyncConfigInfo = new SeSyncConfig()
{ {
@ -42,7 +36,7 @@ public class MaiDanHBPOSeSyncAppService : JisHBPOSeSyncBaseAppService, IJobServi
}; };
} }
[UnitOfWork(IsDisabled = false)] [UnitOfWork(IsDisabled = true)]
public async Task Invoke(IServiceProvider serviceProvider) public async Task Invoke(IServiceProvider serviceProvider)
{ {
await this.Invoke().ConfigureAwait(false); await this.Invoke().ConfigureAwait(false);

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs

@ -143,9 +143,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
foreach (var item in lst) foreach (var item in lst)
{ {
item.SetId(GuidGenerator.Create()); var message = new VmiMessage
var message = new VmiMessage(Guid.NewGuid())
{ {
Message = System.Text.Json.JsonSerializer.Serialize(item), Message = System.Text.Json.JsonSerializer.Serialize(item),
}; };

12
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/SeSyncExtendManager.cs

@ -37,7 +37,7 @@ public class SeSyncExtendManager : DomainService
//新客户零件号和厂内零件号 //新客户零件号和厂内零件号
var noHaveLuRePartCodes = from item1 in materialRelationships var noHaveLuRePartCodes = from item1 in materialRelationships
join item2 in _settleAccountDbContext.Set<MaterialRelationship>() join item2 in _settleAccountDbContext.Set<MaterialRelationship>()
on new { item1.ErpMaterialCode, item1.SettleMaterialCode } equals new { item2.ErpMaterialCode, item2.SettleMaterialCode } on new { item1.ErpMaterialCode, item1.SettleMaterialCode, item1.BusinessType } equals new { item2.ErpMaterialCode, item2.SettleMaterialCode, item2.BusinessType }
into temp into temp
from item3 in temp.DefaultIfEmpty() from item3 in temp.DefaultIfEmpty()
where item3 == null where item3 == null
@ -58,7 +58,7 @@ public class SeSyncExtendManager : DomainService
var returnSeDetails = seDetails.FindAll(t => t.TransType == EnumDelTransType.退); var returnSeDetails = seDetails.FindAll(t => t.TransType == EnumDelTransType.退);
var dateTimeNow = DateTime.Now; var dateTimeNow = DateTime.Now;
var vmiLogList = deliverSeDetails.Select(t => new VmiLog(Guid.NewGuid()) var vmiLogList = deliverSeDetails.Select(t => new VmiLog
{ {
LogType = VmiLogType.Type100, LogType = VmiLogType.Type100,
ChangedQty = t.Qty, ChangedQty = t.Qty,
@ -86,7 +86,7 @@ public class SeSyncExtendManager : DomainService
VinCode = t.VinCode, VinCode = t.VinCode,
factory = t.Factory factory = t.Factory
}).ToList(); }).ToList();
var returnVmiLogList = returnSeDetails.Select(t => new VmiLog(Guid.NewGuid()) var returnVmiLogList = returnSeDetails.Select(t => new VmiLog
{ {
LogType = VmiLogType.Type400, LogType = VmiLogType.Type400,
ChangedQty = t.Qty, ChangedQty = t.Qty,
@ -127,7 +127,7 @@ public class SeSyncExtendManager : DomainService
var returnSeDetails = seDetails.FindAll(t => t.TransType == EnumDelTransType.退); var returnSeDetails = seDetails.FindAll(t => t.TransType == EnumDelTransType.退);
var dateTimeNow = DateTime.Now; var dateTimeNow = DateTime.Now;
var vmiLogList = deliverSeDetails.Select(t => new VmiLog(Guid.NewGuid()) var vmiLogList = deliverSeDetails.Select(t => new VmiLog
{ {
LogType = VmiLogType.Type100, LogType = VmiLogType.Type100,
ChangedQty = t.Qty, ChangedQty = t.Qty,
@ -146,7 +146,7 @@ public class SeSyncExtendManager : DomainService
ReMark = t.Remark, ReMark = t.Remark,
RealPartCode = t.PartCode RealPartCode = t.PartCode
}).ToList(); }).ToList();
var returnVmiLogList = returnSeDetails.Select(t => new VmiLog(Guid.NewGuid()) var returnVmiLogList = returnSeDetails.Select(t => new VmiLog
{ {
LogType = VmiLogType.Type400, LogType = VmiLogType.Type400,
ChangedQty = t.Qty, ChangedQty = t.Qty,
@ -183,7 +183,7 @@ public class SeSyncExtendManager : DomainService
/// </summary> /// </summary>
private async Task SaveVmiMessagesAsync(List<VmiLog> vmiLogs) private async Task SaveVmiMessagesAsync(List<VmiLog> vmiLogs)
{ {
var vmiMessages = vmiLogs.Select(t => new VmiMessage(Guid.NewGuid()) var vmiMessages = vmiLogs.Select(t => new VmiMessage
{ {
Message = JsonConvert.SerializeObject(t) Message = JsonConvert.SerializeObject(t)
}).ToList(); }).ToList();

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

@ -11,6 +11,8 @@ using System.Reflection;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using ClosedXML.Excel; using ClosedXML.Excel;
using DocumentFormat.OpenXml;
using LinqToDB.Data;
using LinqToDB.EntityFrameworkCore; using LinqToDB.EntityFrameworkCore;
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Core.Extension; using Magicodes.ExporterAndImporter.Core.Extension;
@ -21,6 +23,7 @@ using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using RestSharp.Extensions; using RestSharp.Extensions;
using SettleAccount.Job.SignalR; using SettleAccount.Job.SignalR;
using SqlSugar; using SqlSugar;
@ -34,9 +37,9 @@ using Volo.Abp.Validation;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.Shared;
using Win.Sfs.Shared.Filter; using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
using Win.Sfs.Shared;
namespace Win.Sfs.SettleAccount.Entities.BQ; namespace Win.Sfs.SettleAccount.Entities.BQ;
@ -53,6 +56,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
private readonly IBlobContainer<MyFileContainer> _fileContainer; private readonly IBlobContainer<MyFileContainer> _fileContainer;
private readonly IHubContext<PageHub> _hubContext; private readonly IHubContext<PageHub> _hubContext;
private readonly ICurrentUser _currentUser; private readonly ICurrentUser _currentUser;
private readonly ILogger<VmiAppService> _logger;
public VmiAppService(IConfiguration cfg, public VmiAppService(IConfiguration cfg,
IServiceProvider serviceProvider, IServiceProvider serviceProvider,
@ -61,7 +65,8 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
INormalEfCoreRepository<VmiLog, Guid> logRepository, INormalEfCoreRepository<VmiLog, Guid> logRepository,
IBlobContainer<MyFileContainer> fileContainer, IBlobContainer<MyFileContainer> fileContainer,
IHubContext<PageHub> hubContext, IHubContext<PageHub> hubContext,
ICurrentUser currentUser) ICurrentUser currentUser,
ILogger<VmiAppService> logger)
{ {
this._cfg = cfg; this._cfg = cfg;
this._guidGenerator = guidGenerator; this._guidGenerator = guidGenerator;
@ -71,6 +76,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
this._fileContainer = fileContainer; this._fileContainer = fileContainer;
this._hubContext = hubContext; this._hubContext = hubContext;
this._currentUser = currentUser; this._currentUser = currentUser;
this._logger = logger;
LinqToDBForEFTools.Initialize(); LinqToDBForEFTools.Initialize();
} }
@ -260,7 +266,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
} }
else else
{ {
Debug.WriteLine($"{tableName}不存在"); this._logger.LogInformation($"{tableName}不存在");
} }
} }
} }
@ -270,8 +276,12 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
if (tables.Any()) if (tables.Any())
{ {
//生成 union all 的 SQL使用 FromSqlRaw 查询,如果没有分表则使用原始表 //生成 union all 的 SQL使用 FromSqlRaw 查询,如果没有分表则使用原始表
sql = $"select * from {tables.First()}"; sql = $"select * from {tables.First()} WITH(NOLOCK)";
tables.Skip(1).ForEach(o => sql += $" union all select * from ${o}"); tables.Skip(1).ForEach(o => sql += $" union all select * from ${o} WITH(NOLOCK)");
}
else
{
sql = "select * from Set_VmiLog WITH(NOLOCK)";
} }
var query = string.IsNullOrEmpty(sql) ? db.Set<VmiLog>().AsQueryable() : db.Set<VmiLog>().FromSqlRaw(sql); var query = string.IsNullOrEmpty(sql) ? db.Set<VmiLog>().AsQueryable() : db.Set<VmiLog>().FromSqlRaw(sql);
var filters = input.Filters.ToLambda<VmiLog>(); var filters = input.Filters.ToLambda<VmiLog>();
@ -333,23 +343,9 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options; var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
using var context = new SettleAccountDbContext(options); using var context = new SettleAccountDbContext(options);
context.Database.UseTransaction(transaction); context.Database.UseTransaction(transaction);
log.SetId(this._guidGenerator.Create()); Update(log);
if (log.ChangedQty >= decimal.Zero)
{
log.Qty = log.ChangedQty;
log.LogType = VmiLogType.Type500;
log.ChangedType = VmiType.In;
}
else
{
log.Qty = -log.Qty;
log.LogType = VmiLogType.Type600;
log.ChangedType = VmiType.Out;
}
log.ChangedBy = this._currentUser.UserName;
log.ChangedTime = DateTime.Now;
context.Set<VmiLog>().Add(log); context.Set<VmiLog>().Add(log);
context.Set<VmiMessage>().Add(new VmiMessage(this._guidGenerator.Create()) { Message = JsonSerializer.Serialize(log) }); context.Set<VmiMessage>().Add(new VmiMessage { Message = JsonSerializer.Serialize(log) });
context.SaveChanges(); context.SaveChanges();
transaction.Commit(); transaction.Commit();
return new OkResult(); return new OkResult();
@ -357,11 +353,29 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
catch (Exception ex) catch (Exception ex)
{ {
transaction.Rollback(); transaction.Rollback();
Console.WriteLine(ex.ToString()); this._logger.LogError(ex.ToString());
return new JsonResult(new { code = 400, data = ex.ToString(), message = ex.Message }); ; return new JsonResult(new { code = 400, data = ex.ToString(), message = ex.Message }); ;
} }
} }
private void Update(VmiLog log)
{
log.ChangedTime = log.Id.ToDateTime().Value;
if (log.ChangedQty >= decimal.Zero)
{
log.Qty = log.ChangedQty;
log.LogType = VmiLogType.Type500;
log.ChangedType = VmiType.In;
}
else
{
log.Qty = -log.Qty;
log.LogType = VmiLogType.Type600;
log.ChangedType = VmiType.Out;
}
log.ChangedBy = this._currentUser.UserName;
}
/// <summary> /// <summary>
/// 库存调整导入 /// 库存调整导入
/// </summary> /// </summary>
@ -369,6 +383,8 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
[HttpPost] [HttpPost]
public async Task<IActionResult> Import(List<IFormFile> files) public async Task<IActionResult> Import(List<IFormFile> files)
{ {
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString);
try try
{ {
using var ms = new MemoryStream(); using var ms = new MemoryStream();
@ -381,11 +397,11 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
using var workbook = new XLWorkbook(new MemoryStream(data)); using var workbook = new XLWorkbook(new MemoryStream(data));
var ws = workbook.Worksheets.FirstOrDefault(); var ws = workbook.Worksheets.FirstOrDefault();
var header = ws.Row(1); var header = ws.Row(1);
var errorIndex = ws.ColumnsUsed().Count(); var errorIndex = ws.ColumnsUsed().Count() + 1;
header.Cell(errorIndex).Value = "提示信息"; header.Cell(errorIndex).Value = "提示信息";
for (int i = 2; i < ws.RowsUsed().Count(); i++) for (int i = 0; i < ws.RowsUsed().Count() - 1; i++)
{ {
ws.Row(2).Cell(errorIndex).Value = string.Join(',', validationResults[i - 2].Select(o => o.ErrorMessage)); ws.Row(i + 2).Cell(errorIndex).Value = string.Join(',', validationResults[i].Select(o => o.ErrorMessage));
} }
SetStyle(ws); SetStyle(ws);
using var stream = new MemoryStream(); using var stream = new MemoryStream();
@ -395,16 +411,26 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
await this._fileContainer.SaveAsync(fileName, stream, true).ConfigureAwait(false); await this._fileContainer.SaveAsync(fileName, stream, true).ConfigureAwait(false);
return new JsonResult(new { code = 400, message = "输入异常", fileName }); return new JsonResult(new { code = 400, message = "输入异常", fileName });
} }
foreach (var item in list) var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connection).Options;
{ using var context = new SettleAccountDbContext(options);
Adjust(item); list.ForEach(Update);
} var messageList = list.Select(log => new VmiMessage { Message = JsonSerializer.Serialize(log) });
using var dc = context.CreateLinqToDBConnection();
dc.BeginTransaction();
var st = new Stopwatch();
st.Start();
this._logger.LogInformation("事务开始");
await dc.BulkCopyAsync(new BulkCopyOptions { TableName = "Set_VmiLog", MaxBatchSize = 1000 }, list).ConfigureAwait(false);
await dc.BulkCopyAsync(new BulkCopyOptions { TableName = "Set_VmiMessage", MaxBatchSize = 1000 }, messageList).ConfigureAwait(false);
dc.CommitTransaction();
st.Stop();
this._logger.LogInformation($"事务结束,耗时 ${st.ElapsedMilliseconds / 1000 / 60}分钟");
return new JsonResult(new { code = 200, message = "ok" }); return new JsonResult(new { code = 200, message = "ok" });
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex.ToString()); this._logger.LogError(ex.ToString());
throw; return new JsonResult(new { code = 500, data = ex.ToString(), message = ex.Message }); ;
} }
} }
@ -416,8 +442,8 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
{ {
using var workbook = new XLWorkbook(new MemoryStream(data)); using var workbook = new XLWorkbook(new MemoryStream(data));
var properties = typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty) var properties = typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty)
.Where(o => o.GetAttributes<ImporterHeaderAttribute>().Any()) .Where(o => o.GetAttributes<ImporterHeaderAttribute>().Any() || o.GetAttributes<DisplayAttribute>().Any())
.ToDictionary(o => o.GetAttribute<ImporterHeaderAttribute>().Name, o => o); .ToDictionary(o => o.GetAttribute<ImporterHeaderAttribute>()?.Name ?? o.GetAttribute<DisplayAttribute>()?.Name, o => o);
var ws = workbook.Worksheets.FirstOrDefault(); var ws = workbook.Worksheets.FirstOrDefault();
for (int rowIndex = 2; rowIndex <= ws.RowsUsed().Count(); rowIndex++) for (int rowIndex = 2; rowIndex <= ws.RowsUsed().Count(); rowIndex++)
@ -430,10 +456,38 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
var headerName = ws.Cell(1, columnIndex).Value.ToString().Trim(); var headerName = ws.Cell(1, columnIndex).Value.ToString().Trim();
if (properties.TryGetValue(headerName, out var property)) if (properties.TryGetValue(headerName, out var property))
{ {
var propertyType = property.PropertyType;
var value = cell.Value.ToString(); var value = cell.Value.ToString();
if (!string.IsNullOrEmpty(value)) if (!string.IsNullOrEmpty(value))
{ {//值非空
property.SetValue(model, Convert.ChangeType(value, property.PropertyType)); if (propertyType.IsValueType())
{//值类型
if (propertyType.IsGenericType() && propertyType.GetGenericTypeDefinition() == typeof(Nullable<>))
{//可空值类型
propertyType = propertyType.GetGenericArguments()[0];//取原始类型
}
if (propertyType.IsEnum)
{//枚举
var enumValue = Enum.GetNames(propertyType)
.Select(o => new KeyValuePair<string, Enum>(o, (Enum)Enum.Parse(propertyType, o)))
.Where(o => o.Value.GetDisplayName() == value.ToString())
.Select(o => o.Value)
.FirstOrDefault();
property.SetValue(model, enumValue);
}
else if (propertyType == typeof(DateTime))
{
property.SetValue(model, DateTime.Parse(value));
}
else
{
property.SetValue(model, Convert.ChangeType(value, property.PropertyType));
}
}
else
{//引用类型
property.SetValue(model, Convert.ChangeType(value, property.PropertyType));
}
} }
} }
} }
@ -446,7 +500,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex.ToString()); this._logger.LogError(ex.ToString());
throw; throw;
} }
} }
@ -514,7 +568,7 @@ public class VmiAppService : Controller, IApplicationService, IJobService, ITran
} }
else if (propertyType.IsEnum) else if (propertyType.IsEnum)
{ {
cell.Value = (Enum.Parse(propertyType, value) as Enum)?.GetDisplayName(); cell.Value = (Enum.Parse(propertyType, value) as Enum)?.GetDisplayName();
} }
else if (propertyType == typeof(DateTime)) else if (propertyType == typeof(DateTime))
{ {

40
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs

@ -1,13 +1,16 @@
using System; using System;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Linq.Dynamic.Core; using System.Linq.Dynamic.Core;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Core.Extension; using Magicodes.ExporterAndImporter.Core.Extension;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Omu.ValueInjecter; using Omu.ValueInjecter;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
@ -19,19 +22,37 @@ namespace Win.Sfs.SettleAccount.Entities.BQ;
/// <summary> /// <summary>
/// 异步更新库存 /// 异步更新库存
/// </summary> /// </summary>
public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransientDependency [Route("[controller]/[action]")]
public class VmiAsyncBalanceService : Controller, IApplicationService, IJobService, ITransientDependency
{ {
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
private readonly ILogger<VmiAsyncBalanceService> _logger;
public VmiAsyncBalanceService(IServiceProvider serviceProvider) public VmiAsyncBalanceService(IServiceProvider serviceProvider, ILogger<VmiAsyncBalanceService> logger)
{ {
this._serviceProvider = serviceProvider; this._serviceProvider = serviceProvider;
this._logger = logger;
} }
/// <summary>
/// 异步更新库存,手动测试
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<double> Test()
{
var now = DateTime.Now;
await Invoke(_serviceProvider).ConfigureAwait(false);
return (DateTime.Now - now).TotalMinutes;
}
[NonAction]
public async Task Invoke(IServiceProvider serviceProvider) public async Task Invoke(IServiceProvider serviceProvider)
{ {
for (var i = 0; i < 50; i++) for (var i = 0; i < 100; i++)
{ {
var sw = new Stopwatch();
sw.Start();
var connectionString = serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); var connectionString = serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
using var connection = new SqlConnection(connectionString); using var connection = new SqlConnection(connectionString);
connection.Open(); connection.Open();
@ -81,7 +102,7 @@ public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransien
o.Configcode == log.Configcode); o.Configcode == log.Configcode);
if (balance == null) if (balance == null)
{ {
balance = new VmiBalance(GuidGenerator.Create()); balance = new VmiBalance();
balance.InjectFrom(log); balance.InjectFrom(log);
await repo.AddAsync(balance).ConfigureAwait(false); await repo.AddAsync(balance).ConfigureAwait(false);
log.InjectFrom(balance); log.InjectFrom(balance);
@ -130,14 +151,15 @@ public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransien
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex.ToString()); this._logger.LogError(ex.ToString());
transaction.Rollback(); transaction.Rollback();
throw; throw;
} }
finally
{
sw.Stop();
this._logger.LogInformation($"结束,耗时 ${sw.ElapsedMilliseconds / 1000 / 60}分钟");
}
} }
} }
public async Task InvokeInternal(IServiceProvider serviceProvider)
{
}
} }

11
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs

@ -90,17 +90,18 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
var query = from item1 in entityList var query = from item1 in entityList
join item2 in entityList join item2 in entityList
on new { item1.LU } equals new { item2.LU } on new { item1.LU } equals new { item2.LU }
where (item1.BeginTime > item2.BeginTime && item1.EndTime < item2.EndTime) || (item2.BeginTime > item1.BeginTime && item2.EndTime < item1.EndTime) where (item1.BeginTime >= item2.BeginTime && item1.EndTime <= item2.EndTime) || (item2.BeginTime >= item1.BeginTime && item2.EndTime <= item1.EndTime)
select item1; select item1.LU;
foreach (var item in query) var repeat = query.Distinct().ToList();
foreach (var item in repeat)
{ {
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item.LU},时间区间存在交集", string.Empty)); checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item},时间区间存在交集", string.Empty));
} }
} }
if (checkList.Count > 0) if (checkList.Count > 0)
{ {
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false); string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName = fileName });
} }
#endregion #endregion
var lus = entityList.Select(p => p.LU); var lus = entityList.Select(p => p.LU);

7
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

@ -71,16 +71,17 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
join item2 in entityList join item2 in entityList
on new { item1.LU } equals new { item2.LU } on new { item1.LU } equals new { item2.LU }
where (item1.BeginDate > item2.BeginDate && item1.EndDate < item2.EndDate) || (item2.BeginDate > item1.BeginDate && item2.EndDate < item1.EndDate) where (item1.BeginDate > item2.BeginDate && item1.EndDate < item2.EndDate) || (item2.BeginDate > item1.BeginDate && item2.EndDate < item1.EndDate)
select item1; select item1.LU;
var repeat = query.Distinct().ToList();
foreach (var item in query) foreach (var item in query)
{ {
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item.LU},时间区间存在交集", string.Empty)); checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"导入文件中物料号:{item},时间区间存在交集", string.Empty));
} }
} }
if (checkList.Count > 0) if (checkList.Count > 0)
{ {
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false); string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName = fileName });
} }
#endregion #endregion
var lus = entityList.Select(p => p.LU); var lus = entityList.Select(p => p.LU);

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

@ -6,6 +6,8 @@ public class VmiBalance : VmiBalanceBase
{ {
public VmiBalance() public VmiBalance()
{ {
Id = SequentialGuid.SequentialSqlGuidGenerator.Instance.NewGuid();
CreatedTime = Id.ToDateTime().Value;
ConcurrencyStamp = Guid.NewGuid().ToString("N"); ConcurrencyStamp = Guid.NewGuid().ToString("N");
} }

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

@ -7,15 +7,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// <summary> /// <summary>
/// 库存事务 /// 库存事务
/// </summary> /// </summary>
public class VmiLog : VmiBalanceBase,IValidatableObject public class VmiLog : VmiBalanceBase, IValidatableObject
{ {
public VmiLog() public VmiLog()
{ {
ConcurrencyStamp = Guid.NewGuid().ToString("N"); Id = SequentialGuid.SequentialSqlGuidGenerator.Instance.NewGuid();
} ChangedTime = Id.ToDateTime().Value;
public VmiLog(Guid id) : base(id)
{
ConcurrencyStamp = Guid.NewGuid().ToString("N"); ConcurrencyStamp = Guid.NewGuid().ToString("N");
} }
@ -26,9 +23,9 @@ public class VmiLog : VmiBalanceBase,IValidatableObject
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{ {
if(string.IsNullOrEmpty(this.RealPartCode)) if (string.IsNullOrEmpty(this.RealPartCode))
{ {
yield return new ValidationResult("LU零件号不能为空",new string[] { nameof(this.RealPartCode)}); yield return new ValidationResult("LU零件号不能为空", new string[] { nameof(this.RealPartCode) });
} }
if (string.IsNullOrEmpty(this.ErpToLoc)) if (string.IsNullOrEmpty(this.ErpToLoc))
{ {
@ -47,7 +44,7 @@ public class VmiLog : VmiBalanceBase,IValidatableObject
public string ChangedNumber { get; set; } public string ChangedNumber { get; set; }
[Display(Name = "变动时间", Order = 2)] [Display(Name = "变动时间", Order = 2)]
public DateTime ChangedTime { get; set; } = DateTime.Now; public DateTime ChangedTime { get; set; }
[Display(Name = "变动类型", Order = 3)] [Display(Name = "变动类型", Order = 3)]
public VmiType ChangedType { get; set; } public VmiType ChangedType { get; set; }

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

@ -7,16 +7,14 @@ public class VmiMessage : Entity<Guid>
{ {
public VmiMessage() public VmiMessage()
{ {
Id = SequentialGuid.SequentialSqlGuidGenerator.Instance.NewGuid();
CreatedTime = Id.ToDateTime().Value;
ConcurrencyStamp = Guid.NewGuid().ToString("N"); ConcurrencyStamp = Guid.NewGuid().ToString("N");
} }
public VmiMessage(Guid id) : base(id)
{
ConcurrencyStamp = Guid.NewGuid().ToString("N");
}
public long Number { get; set; } public long Number { get; set; }
public string Message { get; set; } public string Message { get; set; }
public bool isConsumed { get; set; } public bool isConsumed { get; set; }
public DateTime CreatedTime { get; set; } = DateTime.Now; public DateTime CreatedTime { get; set; }
public string ConcurrencyStamp { get; set; } public string ConcurrencyStamp { get; set; }
} }

9
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -1326,6 +1326,7 @@ namespace Win.Sfs.SettleAccount
o.factory, o.factory,
o.Configcode o.Configcode
})).IsUnique(); })).IsUnique();
b.Property(o => o.RealPartCode).HasMaxLength(50);
})); }));
builder.Entity<VmiLog>(b => builder.Entity<VmiLog>(b =>
@ -1336,6 +1337,7 @@ namespace Win.Sfs.SettleAccount
b.Property(o => o.CreatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAdd().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); b.Property(o => o.CreatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAdd().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);
b.Property(o => o.UpdatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAddOrUpdate().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore); b.Property(o => o.UpdatedTime).HasDefaultValueSql("getdate()").ValueGeneratedOnAddOrUpdate().Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);
b.HasIndex(o => o.BillTime).IsClustered(); b.HasIndex(o => o.BillTime).IsClustered();
b.Property(o => o.RealPartCode).HasMaxLength(50);
}); });
builder.Entity<VmiReplenished>(b => builder.Entity<VmiReplenished>(b =>
@ -1343,6 +1345,7 @@ namespace Win.Sfs.SettleAccount
b.ToTable($"{options.TablePrefix}_VmiReplenished", options.Schema); b.ToTable($"{options.TablePrefix}_VmiReplenished", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.HasIndex(o => o.BillTime).IsClustered(); b.HasIndex(o => o.BillTime).IsClustered();
b.Property(o => o.RealPartCode).HasMaxLength(50);
}); });
builder.Entity<VmiSnapshot>(b => builder.Entity<VmiSnapshot>(b =>
@ -1352,9 +1355,9 @@ namespace Win.Sfs.SettleAccount
}); });
//seed //seed
builder.Entity<JobItem>().HasData(new JobItem("vmi".ToGuid()) { Name = "库存快照备份", Cron = "0 0 8 26 *", Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAppService" }); builder.Entity<JobItem>().HasData(new JobItem("vmi".ToGuid()) { Name = "时点库存备份", Cron = "0 0 8 26 *", Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAppService" });
builder.Entity<JobItem>().HasData(new JobItem("vmi.balance".ToGuid()) { Name = "同步结算库存", Cron = "0 0/1 * * * ?", Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAsyncBalanceService" }); builder.Entity<JobItem>().HasData(new JobItem("vmi.balance".ToGuid()) { Name = "库存余额同步", Cron = "0 0/1 * * * ?", Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAsyncBalanceService" });
builder.Entity<JobItem>().HasData(new JobItem("vmi.message".ToGuid()) { Name = "事务消息监控", Cron = "0 0/1 * * * ?", Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAsyncMessageService" }); builder.Entity<JobItem>().HasData(new JobItem("vmi.message".ToGuid()) { Name = "库存事务消息监控", Cron = "0 0/1 * * * ?", Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAsyncMessageService" });
builder.Entity<JobItem>().HasData(new JobItem("JisBBACSeSync".ToGuid()) { Name = "JisBBAC发运数据同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.JisBBACSeSyncAppService" }); builder.Entity<JobItem>().HasData(new JobItem("JisBBACSeSync".ToGuid()) { Name = "JisBBAC发运数据同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.JisBBACSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("JisHBPOSeSync".ToGuid()) { Name = "JisHBPO发运数据同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.JisHBPOSeSyncAppService" }); builder.Entity<JobItem>().HasData(new JobItem("JisHBPOSeSync".ToGuid()) { Name = "JisHBPO发运数据同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.JisHBPOSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("MaiDanBBACSeSync".ToGuid()) { Name = "买单件BBAC发运数据同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.MaiDanBBACSeSyncAppService" }); builder.Entity<JobItem>().HasData(new JobItem("MaiDanBBACSeSync".ToGuid()) { Name = "买单件BBAC发运数据同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.MaiDanBBACSeSyncAppService" });

5820
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230831024215_vmi19.Designer.cs

File diff suppressed because it is too large

228
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230831024215_vmi19.cs

@ -0,0 +1,228 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class vmi19 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "RealPartCode",
table: "Set_VmiReplenished",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RealPartCode",
table: "Set_VmiLog",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RealPartCode",
table: "Set_VmiBalance",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(450)",
oldNullable: true);
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
columns: new[] { "ConcurrencyStamp", "Name" },
values: new object[] { "89ee40808b37440e89bc3e3c9c0312a7", "库存余额同步" });
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
columns: new[] { "ConcurrencyStamp", "Name" },
values: new object[] { "b9efd317f87e4288841ddcd9fef8f6a2", "库存事务消息监控" });
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "862d578df0fe406995bc827f9feaae60");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "dc1523b4145f4c60a1e9543aa36da361");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "76d675a5b6d644ef8ec3358006afcb36");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "658f74bf334f4a34a3fb10eaf00a840a");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "1f52b09ccce24e3fb30c5549b19b23e4");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "5ebb150f3f9e4ccd89d5fab0a6dde4e4");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "71311c84551343b099c049672a4c421f");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
columns: new[] { "ConcurrencyStamp", "Name" },
values: new object[] { "681ede5c262642f1a02d7a67dbd83d1b", "时点库存备份" });
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "eb2e56c9379e4cb0b0f0f5f0bc8d4292");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "RealPartCode",
table: "Set_VmiReplenished",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RealPartCode",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RealPartCode",
table: "Set_VmiBalance",
type: "nvarchar(450)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
columns: new[] { "ConcurrencyStamp", "Name" },
values: new object[] { "64c6af2dbd034e919161ff37304b57b0", "同步结算库存" });
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
columns: new[] { "ConcurrencyStamp", "Name" },
values: new object[] { "087376a7732a4f0caec36a83389a856d", "事务消息监控" });
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "e6a18e47a9d0467ba66dfb6a70ae8f80");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "6c08bd3ad65b4d29b613fe0a72015cc2");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "51f7bc3b725847c3b3bc7f1702e775d7");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "2a423514ae5e4c19a4524fa4b675c28e");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "11992367052c4b459c68966b7fab6b13");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "6c75a4d283954fbc895242d9405340e0");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "ecb2819e7667499295cea61d7bf4eae3");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
columns: new[] { "ConcurrencyStamp", "Name" },
values: new object[] { "466f09814b2d4da1988a382e45ce2601", "库存快照备份" });
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "1d2d6618d5644fafaab03c543f178128");
}
}
}

37
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -4453,37 +4453,37 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"), Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
ConcurrencyStamp = "466f09814b2d4da1988a382e45ce2601", ConcurrencyStamp = "681ede5c262642f1a02d7a67dbd83d1b",
Cron = "0 0 8 26 *", Cron = "0 0 8 26 *",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
Name = "库存快照备份", Name = "时点库存备份",
Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAppService" Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAppService"
}, },
new new
{ {
Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"), Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
ConcurrencyStamp = "64c6af2dbd034e919161ff37304b57b0", ConcurrencyStamp = "89ee40808b37440e89bc3e3c9c0312a7",
Cron = "0 0/1 * * * ?", Cron = "0 0/1 * * * ?",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
Name = "同步结算库存", Name = "库存余额同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAsyncBalanceService" Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAsyncBalanceService"
}, },
new new
{ {
Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"), Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
ConcurrencyStamp = "087376a7732a4f0caec36a83389a856d", ConcurrencyStamp = "b9efd317f87e4288841ddcd9fef8f6a2",
Cron = "0 0/1 * * * ?", Cron = "0 0/1 * * * ?",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
Name = "事务消息监控", Name = "库存事务消息监控",
Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAsyncMessageService" Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAsyncMessageService"
}, },
new new
{ {
Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"), Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
ConcurrencyStamp = "11992367052c4b459c68966b7fab6b13", ConcurrencyStamp = "1f52b09ccce24e3fb30c5549b19b23e4",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4493,7 +4493,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"), Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
ConcurrencyStamp = "e6a18e47a9d0467ba66dfb6a70ae8f80", ConcurrencyStamp = "862d578df0fe406995bc827f9feaae60",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4503,7 +4503,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"), Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
ConcurrencyStamp = "51f7bc3b725847c3b3bc7f1702e775d7", ConcurrencyStamp = "76d675a5b6d644ef8ec3358006afcb36",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4513,7 +4513,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"), Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
ConcurrencyStamp = "6c08bd3ad65b4d29b613fe0a72015cc2", ConcurrencyStamp = "dc1523b4145f4c60a1e9543aa36da361",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4523,7 +4523,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"), Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
ConcurrencyStamp = "1d2d6618d5644fafaab03c543f178128", ConcurrencyStamp = "eb2e56c9379e4cb0b0f0f5f0bc8d4292",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4533,7 +4533,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
ConcurrencyStamp = "2a423514ae5e4c19a4524fa4b675c28e", ConcurrencyStamp = "658f74bf334f4a34a3fb10eaf00a840a",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4543,7 +4543,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
ConcurrencyStamp = "ecb2819e7667499295cea61d7bf4eae3", ConcurrencyStamp = "71311c84551343b099c049672a4c421f",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4553,7 +4553,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new new
{ {
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
ConcurrencyStamp = "6c75a4d283954fbc895242d9405340e0", ConcurrencyStamp = "5ebb150f3f9e4ccd89d5fab0a6dde4e4",
Cron = "0 0/30 * * * ? ", Cron = "0 0/30 * * * ? ",
IsDisabled = false, IsDisabled = false,
IsRunning = false, IsRunning = false,
@ -4655,7 +4655,8 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("RealPartCode") b.Property<string>("RealPartCode")
.HasColumnType("nvarchar(450)"); .HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Seq") b.Property<string>("Seq")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@ -4772,7 +4773,8 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("RealPartCode") b.Property<string>("RealPartCode")
.HasColumnType("nvarchar(max)"); .HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Seq") b.Property<string>("Seq")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@ -4911,7 +4913,8 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("RealPartCode") b.Property<string>("RealPartCode")
.HasColumnType("nvarchar(max)"); .HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Seq") b.Property<string>("Seq")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");

1
code/src/Shared/Win.Sfs.Shared/Win.Sfs.Shared.csproj

@ -13,6 +13,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="SequentialGuid" Version="4.0.4" />
<PackageReference Include="Volo.Abp.Caching" Version="4.3.3" /> <PackageReference Include="Volo.Abp.Caching" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="4.3.3" /> <PackageReference Include="Volo.Abp.Ddd.Application" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="4.3.3" /> <PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="4.3.3" />

Loading…
Cancel
Save