diff --git a/host/WmsWebApi.HttpApi.Host/WmsWebApiHttpApiHostModule.cs b/host/WmsWebApi.HttpApi.Host/WmsWebApiHttpApiHostModule.cs index 88a0958..86dffbc 100644 --- a/host/WmsWebApi.HttpApi.Host/WmsWebApiHttpApiHostModule.cs +++ b/host/WmsWebApi.HttpApi.Host/WmsWebApiHttpApiHostModule.cs @@ -36,6 +36,9 @@ using Volo.Abp.Swashbuckle; using Volo.Abp.VirtualFileSystem; using WmsWebApi.Wms; using Volo.Abp.AspNetCore.ExceptionHandling; +using Autofac.Core; +using Polly; +using System.Net.Http; namespace WmsWebApi { diff --git a/host/WmsWebApi.HttpApi.Host/appsettings.json b/host/WmsWebApi.HttpApi.Host/appsettings.json index d01bc15..f27b84f 100644 --- a/host/WmsWebApi.HttpApi.Host/appsettings.json +++ b/host/WmsWebApi.HttpApi.Host/appsettings.json @@ -6,8 +6,19 @@ "ConnectionStrings": { //"Default": "Server=192.168.0.63;Database=ABP;User ID=sa;Password=Microsoft2008", //"WmsWebApi": "Server=192.168.0.63;Database=CPAT_WMS;User ID=sa;Password=Microsoft2008", - "Default": "Server=192.168.0.140;Database=ABP;User ID=sa;Password=Microsoft2008", - "WmsWebApi": "Server=192.168.0.140;Database=CPAT_WMS_TEST;User ID=sa;Password=Microsoft2008", + //"WmsWebApiJson": "Server=192.168.0.63;Database=CPAT_WMS_Json;User ID=sa;Password=Microsoft2008", + //"AbpBackgroundJobs": "Server=192.168.0.63;Database=CPAT_WMS_Json;User ID=sa;Password=Microsoft2008", + + //"Default": "Server=192.168.0.140;Database=ABP;User ID=sa;Password=Microsoft2008", + //"WmsWebApi": "Server=192.168.0.140;Database=CPAT_WMS_TEST;User ID=sa;Password=Microsoft2008", + //"WmsWebApiJson": "Server=192.168.0.140;Database=CPAT_WMS_Json_TEST;User ID=sa;Password=Microsoft2008", + //"AbpBackgroundJobs": "Server=192.168.0.140;Database=CPAT_WMS_Json_TEST;User ID=sa;Password=Microsoft2008", + + "Default": "Server=dev.ccwin-in.com,13319;Database=WmsAuth;uid=ccwin-in;pwd=Microsoft@2022;Packet Size=512;", + "WmsWebApi": "Server=192.168.0.228,1433;Database=CPAT_WMS;User ID=sa;Password=ChangkeTec@2021", + "WmsWebApiJson": "Server=192.168.0.228,1433;Database=CPAT_WMS_Json;User ID=sa;Password=ChangkeTec@2021", + "AbpBackgroundJobs": "Server=192.168.0.228,1433;Database=CPAT_WMS_Json;User ID=sa;Password=ChangkeTec@2021", + "AgvInLoc": "A01", "AgvOutLoc": "B01" }, diff --git a/src/WmsWebApi.Application/BackgroundWorker/RequestRetryWorker.cs b/src/WmsWebApi.Application/BackgroundWorker/RequestRetryWorker.cs deleted file mode 100644 index fba69f2..0000000 --- a/src/WmsWebApi.Application/BackgroundWorker/RequestRetryWorker.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Quartz; -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.BackgroundWorkers; -using Volo.Abp.BackgroundWorkers.Quartz; -using Volo.Abp.Threading; - -namespace WmsWebApi.BackgroundWorker -{ - /// - /// 请求重试工作者 - /// - public class RequestRetryWorker : QuartzBackgroundWorkerBase - { - public DateTimeOffset StartDateTime { get; set; } - - public RequestRetryWorker() - { - StartDateTime = new DateTimeOffset(DateTimeOffset.UtcNow.Date.AddDays(1)); - JobDetail = JobBuilder.Create().WithIdentity(nameof(RequestRetryWorker)).Build(); - Trigger = TriggerBuilder.Create().WithIdentity(nameof(RequestRetryWorker)).StartAt(StartDateTime).WithSimpleSchedule(s => s.WithIntervalInHours(24).RepeatForever()).Build(); - //Trigger = TriggerBuilder.Create().WithIdentity(nameof(RequestRetryWorker)).StartAt(DateTimeOffset.UtcNow.AddSeconds(20)).WithSimpleSchedule(s => s.WithIntervalInSeconds(2).RepeatForever()).Build(); - - ScheduleJob = async scheduler => - { - if (!await scheduler.CheckExists(JobDetail.Key)) - { - await scheduler.ScheduleJob(JobDetail, Trigger); - } - }; - } - - public override Task Execute(IJobExecutionContext context) - { - Logger.LogInformation("Executed RequestRetryWorker..!"); - return Task.CompletedTask; - } - } -} diff --git a/src/WmsWebApi.Application/Boms/BomService.cs b/src/WmsWebApi.Application/Boms/BomService.cs index 6a111e3..40eefb0 100644 --- a/src/WmsWebApi.Application/Boms/BomService.cs +++ b/src/WmsWebApi.Application/Boms/BomService.cs @@ -1,19 +1,19 @@ -using System; +using Castle.Core.Logging; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Polly; +using Polly.Retry; +using System; using System.Collections.Generic; +using System.Drawing; using System.Linq; -using System.Net.Mail; using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Newtonsoft.Json; using Volo.Abp.Application.Services; -using Volo.Abp.BackgroundJobs; -using Volo.Abp.Domain.Repositories; using Volo.Abp.Uow; -using WmsWebApi.BackgroundJob; using WmsWebApi.BackgroundJobs; using WmsWebApi.EntityFrameworkCore; -using WmsWebApi.Enums; -using WmsWebApi.OtherZll; +using WmsWebApi.Jsons; using WmsWebApi.Wms; namespace WmsWebApi.Boms; @@ -28,6 +28,8 @@ public class BomService : ApplicationService, IBomService private readonly TmPgWmsUpdate _tmPgWmsUpdate; private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; + private readonly IBomJsonRepository _bomJsonRepository; + private readonly AsyncRetryPolicy _asyncRetryPolicy; /// /// 是否是请求重试 @@ -40,7 +42,8 @@ public class BomService : ApplicationService, IBomService IBomManager bomDtoRepository, TmPgWmsUpdate tmPgWmsUpdate , Volo.Abp.Uow.IUnitOfWorkManager unitOfWorkManager, - IBackgroundJobRequestRetry backgroundJobRequestRetry) + IBackgroundJobRequestRetry backgroundJobRequestRetry, + IBomJsonRepository bomJsonRepository) { _tmPgPartgroupRepository = tmPgPartgroupRepository; _taBomRepository = taBomRepository; @@ -49,6 +52,17 @@ public class BomService : ApplicationService, IBomService _tmPgWmsUpdate = tmPgWmsUpdate; _unitOfWorkManager = unitOfWorkManager; _backgroundJobRequestRetry = backgroundJobRequestRetry; + _bomJsonRepository = bomJsonRepository; + _asyncRetryPolicy = Policy.Handle() + .WaitAndRetryAsync(new[] { + TimeSpan.FromSeconds(1), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5) + }, (exception, timeSpan, retryCount, context) => + { + Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); + }); } [HttpPost("add")] @@ -244,7 +258,23 @@ public class BomService : ApplicationService, IBomService { bomdto.ITYPE += "删除!"; } - await AddWmsWebApiBOMDtoNowUnitOfWorkAsync(bomdto); + try + { + await AddWmsWebApiBOMDtoNowUnitOfWorkAsync(bomdto); + } + catch (Exception) + { + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await AddJsonNowUnitOfWorkAsync(bomdto)); + } + catch (Exception ex) + { + Logger.LogError("Bom JSON记录失败"); + Logger.LogError(bomdto.JSON); + Logger.LogError(ex.Message); + } + } } } return result; @@ -260,4 +290,15 @@ public class BomService : ApplicationService, IBomService await uow.SaveChangesAsync(); } } + + private async Task AddJsonNowUnitOfWorkAsync(WmsWebApiBOMDTO wmsWebApiBOMDTO) + { + if (wmsWebApiBOMDTO == null) { return; } + + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + { + await _bomJsonRepository.InsertAsync(wmsWebApiBOMDTO); + await uow.SaveChangesAsync(); + } + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application/OtherZll/OtherZllService.cs b/src/WmsWebApi.Application/OtherZll/OtherZllService.cs index f4760f6..890f203 100644 --- a/src/WmsWebApi.Application/OtherZll/OtherZllService.cs +++ b/src/WmsWebApi.Application/OtherZll/OtherZllService.cs @@ -1,20 +1,19 @@ -using System; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Polly; +using Polly.Retry; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Abp.Domain.Uow; -using Microsoft.AspNetCore.Mvc; -using Newtonsoft.Json; -using Volo.Abp; using Volo.Abp.Application.Services; -using Volo.Abp.BackgroundJobs; using Volo.Abp.Domain.Repositories; using Volo.Abp.Uow; -using WmsWebApi.BackgroundJob; using WmsWebApi.BackgroundJobs; using WmsWebApi.EntityFrameworkCore; using WmsWebApi.Enums; -using WmsWebApi.Purchase; +using WmsWebApi.Jsons; using WmsWebApi.Wms; namespace WmsWebApi.OtherZll; @@ -35,6 +34,8 @@ public class OtherZllService : ApplicationService, IOtherZllService private readonly TmPgWmsUpdate _tmPgWmsUpdate; private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; + private readonly IOtherZllJsonRepository _otherZllJsonRepository; + private readonly AsyncRetryPolicy _asyncRetryPolicy; /// /// 是否是请求重试 @@ -50,7 +51,8 @@ public class OtherZllService : ApplicationService, IOtherZllService ITLTransactionRepository tlTransactionRepository, TmPgWmsUpdate tmPgWmsUpdate, Volo.Abp.Uow.IUnitOfWorkManager unitOfWorkManager, - IBackgroundJobRequestRetry backgroundJobRequestRetry) + IBackgroundJobRequestRetry backgroundJobRequestRetry, + IOtherZllJsonRepository otherZllJsonRepository) { _tsStockDetailRepository = tsStockDetailRepository; _tbProductReceiveRepository = tbProductReceiveRepository; @@ -62,6 +64,17 @@ public class OtherZllService : ApplicationService, IOtherZllService _tmPgWmsUpdate = tmPgWmsUpdate; _unitOfWorkManager = unitOfWorkManager; _backgroundJobRequestRetry = backgroundJobRequestRetry; + _otherZllJsonRepository = otherZllJsonRepository; + _asyncRetryPolicy = Policy.Handle() + .WaitAndRetryAsync(new[] { + TimeSpan.FromSeconds(1), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5) + }, (exception, timeSpan, retryCount, context) => + { + Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); + }); } [HttpPost("add")] @@ -345,7 +358,14 @@ public class OtherZllService : ApplicationService, IOtherZllService if (IsRequestRetry == false) { - await _backgroundJobRequestRetry.AddBackgroundJobAsync(EnumActionName.OtherZllAdd, content.ToString()); + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await _backgroundJobRequestRetry.AddBackgroundJobAsync(EnumActionName.OtherZllAdd, content.ToString())); + } + catch (Exception) + { + throw new Exception("操作数据库失败,请稍后重试。", ex); + } } throw new Exception("操作数据库失败,稍后系统自动重试。", ex); @@ -354,7 +374,23 @@ public class OtherZllService : ApplicationService, IOtherZllService { if (IsRequestRetry == false) { - await AddOtherZLLDtoNowUnitOfWorkAsync(dto); + try + { + await AddOtherZLLDtoNowUnitOfWorkAsync(dto); + } + catch (Exception) + { + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await AddJsonNowUnitOfWorkAsync(dto)); + } + catch (Exception ex) + { + Logger.LogError("OtherZll JSON记录失败"); + Logger.LogError(dto.JSON); + Logger.LogError(ex.Message); + } + } } } @@ -371,4 +407,15 @@ public class OtherZllService : ApplicationService, IOtherZllService await uow.SaveChangesAsync(); } } + + private async Task AddJsonNowUnitOfWorkAsync(WmsWebApiOtherZLLDTO wmsWebApiOtherZLLDTO) + { + if (wmsWebApiOtherZLLDTO == null) { return; } + + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + { + await _otherZllJsonRepository.InsertAsync(wmsWebApiOtherZLLDTO); + await uow.SaveChangesAsync(); + } + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application/PPlan/PPlanService.cs b/src/WmsWebApi.Application/PPlan/PPlanService.cs index 822d80a..d4471e8 100644 --- a/src/WmsWebApi.Application/PPlan/PPlanService.cs +++ b/src/WmsWebApi.Application/PPlan/PPlanService.cs @@ -1,17 +1,16 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; using Newtonsoft.Json; +using Polly; +using Polly.Retry; +using System; +using System.Threading.Tasks; using Volo.Abp.Application.Services; -using Volo.Abp.BackgroundJobs; using Volo.Abp.Domain.Repositories; using Volo.Abp.Uow; -using WmsWebApi.BackgroundJob; using WmsWebApi.BackgroundJobs; using WmsWebApi.EntityFrameworkCore; -using WmsWebApi.Enums; +using WmsWebApi.Jsons; using WmsWebApi.PPLan; using WmsWebApi.Wms; @@ -31,6 +30,8 @@ public class PPlanService : ApplicationService, IPPlanService private readonly TmPgWmsUpdate _tmPgWmsUpdate; private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; + private readonly IPPlanJsonRepository _pPlanJsonRepository; + private readonly AsyncRetryPolicy _asyncRetryPolicy; /// /// 是否是请求重试 @@ -44,7 +45,8 @@ public class PPlanService : ApplicationService, IPPlanService IPPlanManager pplanDtoRepository, TmPgWmsUpdate tmPgWmsUpdate, Volo.Abp.Uow.IUnitOfWorkManager unitOfWorkManager, - IBackgroundJobRequestRetry backgroundJobRequestRetry) + IBackgroundJobRequestRetry backgroundJobRequestRetry, + IPPlanJsonRepository pPlanJsonRepository) { _tmPgPartgroupRepository = tmPgPartgroupRepository; _tmPgPlanRepository = tmPgPlanRepository; @@ -54,6 +56,17 @@ public class PPlanService : ApplicationService, IPPlanService _tmPgWmsUpdate = tmPgWmsUpdate; _unitOfWorkManager = unitOfWorkManager; _backgroundJobRequestRetry = backgroundJobRequestRetry; + _pPlanJsonRepository = pPlanJsonRepository; + _asyncRetryPolicy = Policy.Handle() + .WaitAndRetryAsync(new[] { + TimeSpan.FromSeconds(1), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5) + }, (exception, timeSpan, retryCount, context) => + { + Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); + }); } [HttpPost("add")] @@ -203,7 +216,23 @@ public class PPlanService : ApplicationService, IPPlanService { dto.ITYPE = result.MESSAGE; } - await AddWmsWebApiPPLANDTONowUnitOfWorkAsync(dto); + try + { + await AddWmsWebApiPPLANDTONowUnitOfWorkAsync(dto); + } + catch (Exception) + { + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await AddJsonNowUnitOfWorkAsync(dto)); + } + catch (Exception ex) + { + Logger.LogError("PPlan JSON记录失败"); + Logger.LogError(dto.JSON); + Logger.LogError(ex.Message); + } + } } } @@ -220,4 +249,15 @@ public class PPlanService : ApplicationService, IPPlanService await uow.SaveChangesAsync(); } } + + private async Task AddJsonNowUnitOfWorkAsync(WmsWebApiPPLANDTO wmsWebApiPPLANDTO) + { + if (wmsWebApiPPLANDTO == null) { return; } + + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + { + await _pPlanJsonRepository.InsertAsync(wmsWebApiPPLANDTO); + await uow.SaveChangesAsync(); + } + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs b/src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs index 71d0eb9..a80e13c 100644 --- a/src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs +++ b/src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs @@ -1,22 +1,20 @@ -using System; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Polly; +using Polly.Retry; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Abp.Webhooks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Configuration; -using Newtonsoft.Json; using Volo.Abp.Application.Services; -using Volo.Abp.BackgroundJobs; using Volo.Abp.Domain.Repositories; using Volo.Abp.Uow; -using WmsWebApi.BackgroundJob; using WmsWebApi.BackgroundJobs; using WmsWebApi.Domain; using WmsWebApi.EntityFrameworkCore; -using WmsWebApi.Enums; -using WmsWebApi.PPlan; -using WmsWebApi.ProductRecieve; +using WmsWebApi.Jsons; using WmsWebApi.Wms; namespace WmsWebApi.ProductRecieve; @@ -38,6 +36,8 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService private readonly IConfiguration _configuration; private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; + private readonly IProductRecieveJsonRepository _productRecieveJsonRepository; + private readonly AsyncRetryPolicy _asyncRetryPolicy; /// /// 是否是请求重试 @@ -54,7 +54,8 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService TmPgWmsUpdate tmPgWmsUpdate, IConfiguration configuration, IUnitOfWorkManager unitOfWorkManager, - IBackgroundJobRequestRetry backgroundJobRequestRetry) + IBackgroundJobRequestRetry backgroundJobRequestRetry, + IProductRecieveJsonRepository productRecieveJsonRepository) { _tsStockDetailRepository = tsStockDetailRepository; _tbProductReceiveRepository = tbProductReceiveRepository; @@ -67,6 +68,17 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService _configuration = configuration; _unitOfWorkManager = unitOfWorkManager; _backgroundJobRequestRetry = backgroundJobRequestRetry; + _productRecieveJsonRepository = productRecieveJsonRepository; + _asyncRetryPolicy = Policy.Handle() + .WaitAndRetryAsync(new[] { + TimeSpan.FromSeconds(1), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5) + }, (exception, timeSpan, retryCount, context) => + { + Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); + }); } [HttpPost("add")] @@ -281,7 +293,23 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService result.TYPE = 'E'; apiPRdto.ITYPE = result.MESSAGE; } - await AddWmsWebApiProductRecieveDTONowUnitOfWorkAsync(apiPRdto); + try + { + await AddWmsWebApiProductRecieveDTONowUnitOfWorkAsync(apiPRdto); + } + catch (Exception) + { + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await AddJsonNowUnitOfWorkAsync(apiPRdto)); + } + catch (Exception ex) + { + Logger.LogError("ProductRecieve JSON记录失败"); + Logger.LogError(apiPRdto.JSON); + Logger.LogError(ex.Message); + } + } } } @@ -302,4 +330,15 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService await uow.SaveChangesAsync(); } } + + private async Task AddJsonNowUnitOfWorkAsync(WmsWebApiProductRecieveDTO wmsWebApiProductRecieveDTO) + { + if (wmsWebApiProductRecieveDTO == null) { return; } + + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + { + await _productRecieveJsonRepository.InsertAsync(wmsWebApiProductRecieveDTO); + await uow.SaveChangesAsync(); + } + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application/Purchase/PurchaseService.cs b/src/WmsWebApi.Application/Purchase/PurchaseService.cs index a61d57d..df62c91 100644 --- a/src/WmsWebApi.Application/Purchase/PurchaseService.cs +++ b/src/WmsWebApi.Application/Purchase/PurchaseService.cs @@ -1,18 +1,19 @@ -using System; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Polly; +using Polly.Retry; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Newtonsoft.Json; using Volo.Abp.Application.Services; -using Volo.Abp.BackgroundJobs; using Volo.Abp.Domain.Repositories; using Volo.Abp.Uow; -using WmsWebApi.BackgroundJob; using WmsWebApi.BackgroundJobs; -using WmsWebApi.Domain; using WmsWebApi.EntityFrameworkCore; using WmsWebApi.Enums; +using WmsWebApi.Jsons; using WmsWebApi.Purchase; using WmsWebApi.Wms; @@ -34,6 +35,8 @@ public class PurchaseService : ApplicationService, IPurchaseService private readonly TmPgWmsUpdate _tmPgWmsUpdate; private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; + private readonly IPurchaseJsonRepository _purchaseJsonRepository; + private readonly AsyncRetryPolicy _asyncRetryPolicy; /// /// 是否是请求重试 @@ -49,7 +52,8 @@ public class PurchaseService : ApplicationService, IPurchaseService ITLTransactionRepository tlTransactionRepository, TmPgWmsUpdate tmPgWmsUpdate, IUnitOfWorkManager unitOfWorkManager, - IBackgroundJobRequestRetry backgroundJobRequestRetry) + IBackgroundJobRequestRetry backgroundJobRequestRetry, + IPurchaseJsonRepository purchaseJsonRepository) { _tsStockDetailRepository = tsStockDetailRepository; _tbProductReceiveRepository = tbProductReceiveRepository; @@ -61,6 +65,17 @@ public class PurchaseService : ApplicationService, IPurchaseService _tmPgWmsUpdate = tmPgWmsUpdate; _unitOfWorkManager = unitOfWorkManager; _backgroundJobRequestRetry = backgroundJobRequestRetry; + _purchaseJsonRepository = purchaseJsonRepository; + _asyncRetryPolicy = Policy.Handle() + .WaitAndRetryAsync(new[] { + TimeSpan.FromSeconds(1), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5) + }, (exception, timeSpan, retryCount, context) => + { + Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); + }); } [HttpPost("add")] @@ -360,10 +375,17 @@ public class PurchaseService : ApplicationService, IPurchaseService if (IsRequestRetry == false) { - await _backgroundJobRequestRetry.AddBackgroundJobAsync(EnumActionName.PurchaseAdd, content.ToString()); + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await _backgroundJobRequestRetry.AddBackgroundJobAsync(EnumActionName.PurchaseAdd, content.ToString())); + } + catch (Exception) + { + throw new Exception("操作数据库失败,请稍后重试。", ex); + } } - throw new Exception($"接口异常,请稍后重试:{ex.GetBaseException().Message}", ex); + throw new Exception("操作数据库失败,稍后系统自动重试。", ex); } finally { @@ -381,7 +403,23 @@ public class PurchaseService : ApplicationService, IPurchaseService { dto.ITYPE = result.MESSAGE; } - await AddWmsWebApiPURCHASEDTONowUnitOfWorkAsync(dto); + try + { + await AddWmsWebApiPURCHASEDTONowUnitOfWorkAsync(dto); + } + catch (Exception) + { + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await AddJsonNowUnitOfWorkAsync(dto)); + } + catch (Exception ex) + { + Logger.LogError("Purchase JSON记录失败"); + Logger.LogError(dto.JSON); + Logger.LogError(ex.Message); + } + } } } @@ -398,4 +436,15 @@ public class PurchaseService : ApplicationService, IPurchaseService await uow.SaveChangesAsync(); } } + + private async Task AddJsonNowUnitOfWorkAsync(WmsWebApiPURCHASEDTO wmsWebApiPURCHASEDTO) + { + if (wmsWebApiPURCHASEDTO == null) { return; } + + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + { + await _purchaseJsonRepository.InsertAsync(wmsWebApiPURCHASEDTO); + await uow.SaveChangesAsync(); + } + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application/StockMove/StockMoveService.cs b/src/WmsWebApi.Application/StockMove/StockMoveService.cs index f8a647f..3c3e05c 100644 --- a/src/WmsWebApi.Application/StockMove/StockMoveService.cs +++ b/src/WmsWebApi.Application/StockMove/StockMoveService.cs @@ -4,7 +4,10 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; using Newtonsoft.Json; +using Polly; +using Polly.Retry; using Volo.Abp.Application.Services; using Volo.Abp.BackgroundJobs; using Volo.Abp.Domain.Repositories; @@ -14,6 +17,7 @@ using WmsWebApi.BackgroundJobs; using WmsWebApi.Domain; using WmsWebApi.EntityFrameworkCore; using WmsWebApi.Enums; +using WmsWebApi.Jsons; using WmsWebApi.StockMove; using WmsWebApi.Wms; @@ -36,6 +40,8 @@ public class StockMoveService : ApplicationService, IStockMoveService private readonly IConfiguration _configuration; private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; + private readonly IStockMoveJsonRepository _stockMoveJsonRepository; + private readonly AsyncRetryPolicy _asyncRetryPolicy; /// /// 是否是请求重试 @@ -52,7 +58,8 @@ public class StockMoveService : ApplicationService, IStockMoveService TmPgWmsUpdate tmPgWmsUpdate, IConfiguration configuration, IUnitOfWorkManager unitOfWorkManager, - IBackgroundJobRequestRetry backgroundJobRequestRetry) + IBackgroundJobRequestRetry backgroundJobRequestRetry, + IStockMoveJsonRepository stockMoveJsonRepository) { _tsStockDetailRepository = tsStockDetailRepository; _tbStockMoveRepository = tbStockMoveRepository; @@ -65,6 +72,17 @@ public class StockMoveService : ApplicationService, IStockMoveService _configuration = configuration; _unitOfWorkManager = unitOfWorkManager; _backgroundJobRequestRetry = backgroundJobRequestRetry; + _stockMoveJsonRepository = stockMoveJsonRepository; + _asyncRetryPolicy = Policy.Handle() + .WaitAndRetryAsync(new[] { + TimeSpan.FromSeconds(1), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5) + }, (exception, timeSpan, retryCount, context) => + { + Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); + }); } /// @@ -416,7 +434,23 @@ public class StockMoveService : ApplicationService, IStockMoveService result.TYPE = 'E'; apiSSdto.ITYPE = result.MESSAGE; } - await AddWmsWebApiStockMoveDTONowUnitOfWorkAsync(apiSSdto); + try + { + await AddWmsWebApiStockMoveDTONowUnitOfWorkAsync(apiSSdto); + } + catch (Exception) + { + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await AddJsonNowUnitOfWorkAsync(apiSSdto)); + } + catch (Exception ex) + { + Logger.LogError("StockMove JSON记录失败"); + Logger.LogError(apiSSdto.JSON); + Logger.LogError(ex.Message); + } + } } } @@ -433,4 +467,15 @@ public class StockMoveService : ApplicationService, IStockMoveService await uow.SaveChangesAsync(); } } + + private async Task AddJsonNowUnitOfWorkAsync(WmsWebApiStockMoveDTO wmsWebApiStockMoveDTO) + { + if (wmsWebApiStockMoveDTO == null) { return; } + + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + { + await _stockMoveJsonRepository.InsertAsync(wmsWebApiStockMoveDTO); + await uow.SaveChangesAsync(); + } + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application/TbParts/PartService.cs b/src/WmsWebApi.Application/TbParts/PartService.cs index eb7d8f1..fd5b72f 100644 --- a/src/WmsWebApi.Application/TbParts/PartService.cs +++ b/src/WmsWebApi.Application/TbParts/PartService.cs @@ -1,19 +1,17 @@ -using System; -using System.Collections.Generic; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Polly; +using Polly.Retry; +using System; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore.Diagnostics; -using Newtonsoft.Json; using Volo.Abp.Application.Services; -using Volo.Abp.BackgroundJobs; using Volo.Abp.Domain.Repositories; using Volo.Abp.Uow; -using WmsWebApi.BackgroundJob; using WmsWebApi.BackgroundJobs; -using WmsWebApi.Domain; using WmsWebApi.EntityFrameworkCore; -using WmsWebApi.Enums; +using WmsWebApi.Jsons; using WmsWebApi.Wms; namespace WmsWebApi.Parts; @@ -31,6 +29,8 @@ public class PartService : ApplicationService, IPartService private readonly TmPgWmsUpdate _tmPgWmsUpdate; private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; + private readonly IPartJsonRepository _partJsonRepository; + private readonly AsyncRetryPolicy _asyncRetryPolicy; /// /// 是否是请求重试 @@ -42,7 +42,8 @@ public class PartService : ApplicationService, IPartService IPartManager partDtoRepository, TmPgWmsUpdate tmPgWmsUpdate, IUnitOfWorkManager unitOfWorkManager, - IBackgroundJobRequestRetry backgroundJobRequestRetry) + IBackgroundJobRequestRetry backgroundJobRequestRetry, + IPartJsonRepository partJsonRepository) { _tmPgPartgroupRepository = tmPgPartgroupRepository; _taPartRepository = taPartRepository; @@ -51,6 +52,17 @@ public class PartService : ApplicationService, IPartService _tmPgWmsUpdate = tmPgWmsUpdate; _unitOfWorkManager = unitOfWorkManager; _backgroundJobRequestRetry = backgroundJobRequestRetry; + _partJsonRepository = partJsonRepository; + _asyncRetryPolicy = Policy.Handle() + .WaitAndRetryAsync(new[] { + TimeSpan.FromSeconds(1), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5) + }, (exception, timeSpan, retryCount, context) => + { + Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); + }); } [HttpPost("add")] @@ -306,7 +318,23 @@ public class PartService : ApplicationService, IPartService { partdto.ITYPE = result.MESSAGE; } - await AddWmsWebApiPARTDTONowUnitOfWorkAsync(partdto); + try + { + await AddWmsWebApiPARTDTONowUnitOfWorkAsync(partdto); + } + catch (Exception) + { + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await AddJsonNowUnitOfWorkAsync(partdto)); + } + catch (Exception ex) + { + Logger.LogError("Part JSON记录失败"); + Logger.LogError(partdto.JSON); + Logger.LogError(ex.Message); + } + } } } @@ -323,4 +351,15 @@ public class PartService : ApplicationService, IPartService await uow.SaveChangesAsync(); } } + + private async Task AddJsonNowUnitOfWorkAsync(WmsWebApiPARTDTO wmsWebApiPARTDTO) + { + if (wmsWebApiPARTDTO == null) { return; } + + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + { + await _partJsonRepository.InsertAsync(wmsWebApiPARTDTO); + await uow.SaveChangesAsync(); + } + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application/WmsWebApi.Application.csproj b/src/WmsWebApi.Application/WmsWebApi.Application.csproj index ef7052c..e573bc6 100644 --- a/src/WmsWebApi.Application/WmsWebApi.Application.csproj +++ b/src/WmsWebApi.Application/WmsWebApi.Application.csproj @@ -10,10 +10,10 @@ + - diff --git a/src/WmsWebApi.Application/WmsWebApiApplicationModule.cs b/src/WmsWebApi.Application/WmsWebApiApplicationModule.cs index c84e461..d7b416b 100644 --- a/src/WmsWebApi.Application/WmsWebApiApplicationModule.cs +++ b/src/WmsWebApi.Application/WmsWebApiApplicationModule.cs @@ -1,11 +1,13 @@ using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Polly; +using System; +using System.Net.Http; using Volo.Abp.Application; using Volo.Abp.Auditing; using Volo.Abp.AutoMapper; using Volo.Abp.BackgroundJobs; using Volo.Abp.BackgroundJobs.EntityFrameworkCore; -using Volo.Abp.EntityFrameworkCore; -using Volo.Abp.EntityFrameworkCore.SqlServer; using Volo.Abp.Modularity; namespace WmsWebApi diff --git a/src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs b/src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs index 33d6cb3..68a7dae 100644 --- a/src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs +++ b/src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs @@ -1,22 +1,22 @@ -using System; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Polly; +using Polly.Retry; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Newtonsoft.Json; using Volo.Abp; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; using Volo.Abp.Uow; -using WmsWebApi.EntityFrameworkCore; -using WmsWebApi.Wms; -using Abp.Web.Models; -using Microsoft.EntityFrameworkCore; -using Abp.Domain.Uow; -using WmsWebApi.BackgroundJob; -using Volo.Abp.BackgroundJobs; using WmsWebApi.BackgroundJobs; +using WmsWebApi.EntityFrameworkCore; using WmsWebApi.Enums; +using WmsWebApi.Jsons; +using WmsWebApi.Wms; namespace WmsWebApi.ZlldcjLogs; @@ -33,6 +33,8 @@ public class ZlldcjLogAppService : ApplicationService, IZlldcjLogAppService private readonly TmOtherAskRepositoryUpdate _tmOtherAskRepositoryUpdate; private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; + private readonly IZlldcjLogJsonRepository _zlldcjLogJsonRepository; + private readonly AsyncRetryPolicy _asyncRetryPolicy; /// /// 是否是请求重试 @@ -45,7 +47,8 @@ public class ZlldcjLogAppService : ApplicationService, IZlldcjLogAppService , ITmOtherAskRepository tbOtherInOutAskRepository , TmOtherAskRepositoryUpdate tmOtherAskRepositoryUpdate , Volo.Abp.Uow.IUnitOfWorkManager unitOfWorkManager, - IBackgroundJobRequestRetry backgroundJobRequestRetry) + IBackgroundJobRequestRetry backgroundJobRequestRetry, + IZlldcjLogJsonRepository zlldcjLogJsonRepository) { _zlldcjLogManager = zlldcjLogManager; _tbBillRepository = tbBillRepository; @@ -54,6 +57,17 @@ public class ZlldcjLogAppService : ApplicationService, IZlldcjLogAppService _tmOtherAskRepositoryUpdate = tmOtherAskRepositoryUpdate; _unitOfWorkManager = unitOfWorkManager; _backgroundJobRequestRetry = backgroundJobRequestRetry; + _zlldcjLogJsonRepository = zlldcjLogJsonRepository; + _asyncRetryPolicy = Policy.Handle() + .WaitAndRetryAsync(new[] { + TimeSpan.FromSeconds(1), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5) + }, (exception, timeSpan, retryCount, context) => + { + Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); + }); } [HttpPost("add")] @@ -249,7 +263,14 @@ public class ZlldcjLogAppService : ApplicationService, IZlldcjLogAppService if (IsRequestRetry == false) { - await _backgroundJobRequestRetry.AddBackgroundJobAsync(EnumActionName.ZlldcjLogAdd, content.ToString()); + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await _backgroundJobRequestRetry.AddBackgroundJobAsync(EnumActionName.ZlldcjLogAdd, content.ToString())); + } + catch (Exception) + { + throw new Exception("操作数据库失败,请稍后重试。", ex); + } } throw new Exception("操作数据库失败,稍后系统自动重试。", ex); } @@ -261,7 +282,23 @@ public class ZlldcjLogAppService : ApplicationService, IZlldcjLogAppService { zlldcjdto.ITYPE = result.MESSAGE; } - await AddDtoAsync(zlldcjdto); + try + { + await AddDtoAsync(zlldcjdto); + } + catch (Exception) + { + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await AddJsonNowUnitOfWorkAsync(zlldcjdto)); + } + catch (Exception ex) + { + Logger.LogError("ZlldcjLog JSON记录失败"); + Logger.LogError(zlldcjdto.JSON); + Logger.LogError(ex.Message); + } + } } } @@ -275,6 +312,18 @@ public class ZlldcjLogAppService : ApplicationService, IZlldcjLogAppService using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) { await _zlldcjLogManager.AddDtoAsync(dto); + throw new Exception("dd"); + await uow.SaveChangesAsync(); + } + } + + private async Task AddJsonNowUnitOfWorkAsync(WmsWebApiZLLDCJDTO dto) + { + if (dto == null) { return; } + + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + { + await _zlldcjLogJsonRepository.InsertAsync(dto); await uow.SaveChangesAsync(); } } diff --git a/src/WmsWebApi.Domain/Jsons/IBomJsonRepository.cs b/src/WmsWebApi.Domain/Jsons/IBomJsonRepository.cs new file mode 100644 index 0000000..44b3eb7 --- /dev/null +++ b/src/WmsWebApi.Domain/Jsons/IBomJsonRepository.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Repositories; +using WmsWebApi.Boms; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public interface IBomJsonRepository : IRepository + { + + } +} diff --git a/src/WmsWebApi.Domain/Jsons/IOtherZllJsonRepository.cs b/src/WmsWebApi.Domain/Jsons/IOtherZllJsonRepository.cs new file mode 100644 index 0000000..8f65add --- /dev/null +++ b/src/WmsWebApi.Domain/Jsons/IOtherZllJsonRepository.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Repositories; +using WmsWebApi.OtherZll; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public interface IOtherZllJsonRepository : IRepository + { + + } +} diff --git a/src/WmsWebApi.Domain/Jsons/IPPlanJsonRepository.cs b/src/WmsWebApi.Domain/Jsons/IPPlanJsonRepository.cs new file mode 100644 index 0000000..a9c6602 --- /dev/null +++ b/src/WmsWebApi.Domain/Jsons/IPPlanJsonRepository.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Repositories; +using WmsWebApi.PPlan; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public interface IPPlanJsonRepository : IRepository + { + + } +} diff --git a/src/WmsWebApi.Domain/Jsons/IPartJsonRepository.cs b/src/WmsWebApi.Domain/Jsons/IPartJsonRepository.cs new file mode 100644 index 0000000..7aa70a1 --- /dev/null +++ b/src/WmsWebApi.Domain/Jsons/IPartJsonRepository.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Repositories; +using WmsWebApi.Parts; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public interface IPartJsonRepository : IRepository + { + + } +} diff --git a/src/WmsWebApi.Domain/Jsons/IProductRecieveJsonRepository.cs b/src/WmsWebApi.Domain/Jsons/IProductRecieveJsonRepository.cs new file mode 100644 index 0000000..6933922 --- /dev/null +++ b/src/WmsWebApi.Domain/Jsons/IProductRecieveJsonRepository.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Repositories; +using WmsWebApi.Domain; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public interface IProductRecieveJsonRepository : IRepository + { + + } +} diff --git a/src/WmsWebApi.Domain/Jsons/IPurchaseJsonRepository.cs b/src/WmsWebApi.Domain/Jsons/IPurchaseJsonRepository.cs new file mode 100644 index 0000000..496cc72 --- /dev/null +++ b/src/WmsWebApi.Domain/Jsons/IPurchaseJsonRepository.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Repositories; +using WmsWebApi.Purchase; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public interface IPurchaseJsonRepository : IRepository + { + + } +} diff --git a/src/WmsWebApi.Domain/Jsons/IStockMoveJsonRepository.cs b/src/WmsWebApi.Domain/Jsons/IStockMoveJsonRepository.cs new file mode 100644 index 0000000..42e9ff1 --- /dev/null +++ b/src/WmsWebApi.Domain/Jsons/IStockMoveJsonRepository.cs @@ -0,0 +1,15 @@ +using System; +using Volo.Abp.Domain.Repositories; +using WmsWebApi.Boms; +using WmsWebApi.Domain; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public interface IStockMoveJsonRepository : IRepository + { + + } +} diff --git a/src/WmsWebApi.Domain/Jsons/IZlldcjLogJsonRepository.cs b/src/WmsWebApi.Domain/Jsons/IZlldcjLogJsonRepository.cs new file mode 100644 index 0000000..edeef0b --- /dev/null +++ b/src/WmsWebApi.Domain/Jsons/IZlldcjLogJsonRepository.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Repositories; +using WmsWebApi.ZlldcjLogs; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public interface IZlldcjLogJsonRepository : IRepository + { + + } +} diff --git a/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContext.cs b/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContext.cs index 43d6618..4938c88 100644 --- a/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContext.cs +++ b/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContext.cs @@ -1,4 +1,5 @@ using Microsoft.EntityFrameworkCore; +using System; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using WmsWebApi.Boms; @@ -46,7 +47,7 @@ namespace WmsWebApi.EntityFrameworkCore public WmsWebApiDbContext(DbContextOptions options) : base(options) { - this.Database.SetCommandTimeout(40); + this.Database.SetCommandTimeout(60); } protected override void OnModelCreating(ModelBuilder builder) diff --git a/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiEntityFrameworkCoreModule.cs b/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiEntityFrameworkCoreModule.cs index 3aa2dc0..fd7d7c1 100644 --- a/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiEntityFrameworkCoreModule.cs +++ b/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiEntityFrameworkCoreModule.cs @@ -1,4 +1,7 @@ using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using System; +using Volo.Abp; using Volo.Abp.Dapper; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Modularity; @@ -23,6 +26,11 @@ namespace WmsWebApi.EntityFrameworkCore options.AddDefaultRepositories(includeAllEntities: true); }); + context.Services.AddAbpDbContext(options => + { + + }); + context.Services.AddTransient(typeof(ITmOtherAskRepository),typeof(TmOtherAskRepositoryAdd)); context.Services.AddTransient(typeof(ITaCustPartRepository), typeof(TaCustPartRepository)); context.Services.AddTransient(typeof(ITbBillRepository), typeof(TbBillRepository)); diff --git a/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiJsonDbContext.cs b/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiJsonDbContext.cs new file mode 100644 index 0000000..83cfe9d --- /dev/null +++ b/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiJsonDbContext.cs @@ -0,0 +1,92 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Data; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; +using WmsWebApi.Boms; +using WmsWebApi.Domain; +using WmsWebApi.OtherZll; +using WmsWebApi.Parts; +using WmsWebApi.PPlan; +using WmsWebApi.Purchase; +using WmsWebApi.ZlldcjLogs; + +namespace WmsWebApi.EntityFrameworkCore +{ + /// + /// Add-Migration xxx -c WmsWebApiJsonDbContext + /// Update-Database -Context WmsWebApiJsonDbContext + /// + [ConnectionStringName("WmsWebApiJson")] + public class WmsWebApiJsonDbContext : AbpDbContext + { + public DbSet BOMJsons { get; set; } + public DbSet OtherZllJsons { get; set; } + public DbSet PPlanJsons { get; set; } + public DbSet ProductRecieveJsons { get; set; } + public DbSet PurchaseJsons { get; set; } + public DbSet StockMoveJsons { get; set; } + public DbSet PartJsons { get; set; } + public DbSet ZlldcjLogJsons { get; set; } + + public WmsWebApiJsonDbContext(DbContextOptions options) : base(options) + { + this.Database.SetCommandTimeout(60); + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + var options = new WmsWebApiModelBuilderConfigurationOptions(WmsWebApiDbProperties.DbTablePrefix,WmsWebApiDbProperties.DbSchema); + + modelBuilder.Entity(b => + { + b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "BOMJsons", WmsWebApiDbProperties.DbSchema); + b.ConfigureByConvention(); + }); + + modelBuilder.Entity(b => + { + b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "OtherZllJsons", WmsWebApiDbProperties.DbSchema); + b.ConfigureByConvention(); + }); + + modelBuilder.Entity(b => + { + b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "PPlanJsons", WmsWebApiDbProperties.DbSchema); + b.ConfigureByConvention(); + }); + + modelBuilder.Entity(b => + { + b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "ProductRecieveJsons", WmsWebApiDbProperties.DbSchema); + b.ConfigureByConvention(); + }); + + modelBuilder.Entity(b => + { + b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "PurchaseJsons", WmsWebApiDbProperties.DbSchema); + b.ConfigureByConvention(); + }); + + modelBuilder.Entity(b => + { + b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "StockMoveJsons", WmsWebApiDbProperties.DbSchema); + b.ConfigureByConvention(); + }); + + modelBuilder.Entity(b => + { + b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "PartJsons", WmsWebApiDbProperties.DbSchema); + b.ConfigureByConvention(); + }); + + modelBuilder.Entity(b => + { + b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "ZlldcjLogJsons", WmsWebApiDbProperties.DbSchema); + b.ConfigureByConvention(); + }); + + } + } +} diff --git a/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreBomJsonRepository.cs b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreBomJsonRepository.cs new file mode 100644 index 0000000..837f91c --- /dev/null +++ b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreBomJsonRepository.cs @@ -0,0 +1,18 @@ +using System; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using WmsWebApi.Boms; +using WmsWebApi.EntityFrameworkCore; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public class EfCoreBomJsonRepository : EfCoreRepository, IBomJsonRepository + { + public EfCoreBomJsonRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} diff --git a/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreOtherZllJsonRepository.cs b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreOtherZllJsonRepository.cs new file mode 100644 index 0000000..ed55aeb --- /dev/null +++ b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreOtherZllJsonRepository.cs @@ -0,0 +1,18 @@ +using System; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using WmsWebApi.EntityFrameworkCore; +using WmsWebApi.OtherZll; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public class EfCoreOtherZllJsonRepository : EfCoreRepository, IOtherZllJsonRepository + { + public EfCoreOtherZllJsonRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} diff --git a/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCorePPlanJsonRepository.cs b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCorePPlanJsonRepository.cs new file mode 100644 index 0000000..e263442 --- /dev/null +++ b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCorePPlanJsonRepository.cs @@ -0,0 +1,18 @@ +using System; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using WmsWebApi.EntityFrameworkCore; +using WmsWebApi.PPlan; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public class EfCorePPlanJsonRepository : EfCoreRepository, IPPlanJsonRepository + { + public EfCorePPlanJsonRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} diff --git a/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCorePartJsonRepository.cs b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCorePartJsonRepository.cs new file mode 100644 index 0000000..9347b5d --- /dev/null +++ b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCorePartJsonRepository.cs @@ -0,0 +1,18 @@ +using System; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using WmsWebApi.EntityFrameworkCore; +using WmsWebApi.Parts; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public class EfCorePartJsonRepository : EfCoreRepository, IPartJsonRepository + { + public EfCorePartJsonRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} diff --git a/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreProductRecieveJsonRepository.cs b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreProductRecieveJsonRepository.cs new file mode 100644 index 0000000..81c2625 --- /dev/null +++ b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreProductRecieveJsonRepository.cs @@ -0,0 +1,18 @@ +using System; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using WmsWebApi.Domain; +using WmsWebApi.EntityFrameworkCore; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public class EfCoreProductRecieveJsonRepository : EfCoreRepository, IProductRecieveJsonRepository + { + public EfCoreProductRecieveJsonRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} diff --git a/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCorePurchaseJsonRepository.cs b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCorePurchaseJsonRepository.cs new file mode 100644 index 0000000..687b4ec --- /dev/null +++ b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCorePurchaseJsonRepository.cs @@ -0,0 +1,19 @@ +using System; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using WmsWebApi.Boms; +using WmsWebApi.EntityFrameworkCore; +using WmsWebApi.Purchase; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public class EfCorePurchaseJsonRepository : EfCoreRepository, IPurchaseJsonRepository + { + public EfCorePurchaseJsonRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} diff --git a/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreStockMoveJsonRepository.cs b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreStockMoveJsonRepository.cs new file mode 100644 index 0000000..a69d7b7 --- /dev/null +++ b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreStockMoveJsonRepository.cs @@ -0,0 +1,19 @@ +using System; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using WmsWebApi.Boms; +using WmsWebApi.Domain; +using WmsWebApi.EntityFrameworkCore; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public class EfCoreStockMoveJsonRepository : EfCoreRepository, IStockMoveJsonRepository + { + public EfCoreStockMoveJsonRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} diff --git a/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreZlldcjLogJsonRepository.cs b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreZlldcjLogJsonRepository.cs new file mode 100644 index 0000000..8ecf1a1 --- /dev/null +++ b/src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreZlldcjLogJsonRepository.cs @@ -0,0 +1,18 @@ +using System; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using WmsWebApi.EntityFrameworkCore; +using WmsWebApi.ZlldcjLogs; + +namespace WmsWebApi.Jsons +{ + /// + /// 仓储 + /// + public class EfCoreZlldcjLogJsonRepository : EfCoreRepository, IZlldcjLogJsonRepository + { + public EfCoreZlldcjLogJsonRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} diff --git a/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307014143_202303070941.Designer.cs b/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307014143_202303070941.Designer.cs new file mode 100644 index 0000000..56c4296 --- /dev/null +++ b/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307014143_202303070941.Designer.cs @@ -0,0 +1,77 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using WmsWebApi.EntityFrameworkCore; + +namespace WmsWebApi.Migrations.WmsWebApiJsonDb +{ + [DbContext(typeof(WmsWebApiJsonDbContext))] + [Migration("20230307014143_202303070941")] + partial class _202303070941 + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.17") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("WmsWebApi.Boms.WmsWebApiBOMDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BMENG") + .HasColumnType("decimal(18,2)"); + + b.Property("DATUV") + .HasColumnType("nvarchar(max)"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("LOEKZ") + .HasColumnType("nvarchar(max)"); + + b.Property("MAKTX") + .HasColumnType("nvarchar(max)"); + + b.Property("MATNR") + .HasColumnType("nvarchar(max)"); + + b.Property("STLAL") + .HasColumnType("nvarchar(max)"); + + b.Property("STLAN") + .HasColumnType("nvarchar(max)"); + + b.Property("STLST") + .HasColumnType("nvarchar(max)"); + + b.Property("WERKS") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiBOMJsons"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307014143_202303070941.cs b/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307014143_202303070941.cs new file mode 100644 index 0000000..1a957ea --- /dev/null +++ b/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307014143_202303070941.cs @@ -0,0 +1,41 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace WmsWebApi.Migrations.WmsWebApiJsonDb +{ + public partial class _202303070941 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "WmsWebApiBOMJsons", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + MATNR = table.Column(type: "nvarchar(max)", nullable: true), + MAKTX = table.Column(type: "nvarchar(max)", nullable: true), + WERKS = table.Column(type: "nvarchar(max)", nullable: true), + STLAN = table.Column(type: "nvarchar(max)", nullable: true), + STLAL = table.Column(type: "nvarchar(max)", nullable: true), + DATUV = table.Column(type: "nvarchar(max)", nullable: true), + BMENG = table.Column(type: "decimal(18,2)", nullable: true), + STLST = table.Column(type: "nvarchar(max)", nullable: true), + LOEKZ = table.Column(type: "nvarchar(max)", nullable: true), + JSON = table.Column(type: "nvarchar(max)", nullable: true), + DYSJ = table.Column(type: "datetime2", nullable: false), + ITYPE = table.Column(type: "nvarchar(max)", nullable: true), + EnumRetryStatus = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WmsWebApiBOMJsons", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "WmsWebApiBOMJsons"); + } + } +} diff --git a/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307062843_202303071428.Designer.cs b/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307062843_202303071428.Designer.cs new file mode 100644 index 0000000..6bd00f6 --- /dev/null +++ b/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307062843_202303071428.Designer.cs @@ -0,0 +1,387 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using WmsWebApi.EntityFrameworkCore; + +namespace WmsWebApi.Migrations.WmsWebApiJsonDb +{ + [DbContext(typeof(WmsWebApiJsonDbContext))] + [Migration("20230307062843_202303071428")] + partial class _202303071428 + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.17") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("WmsWebApi.Boms.WmsWebApiBOMDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BMENG") + .HasColumnType("decimal(18,2)"); + + b.Property("DATUV") + .HasColumnType("nvarchar(max)"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("LOEKZ") + .HasColumnType("nvarchar(max)"); + + b.Property("MAKTX") + .HasColumnType("nvarchar(max)"); + + b.Property("MATNR") + .HasColumnType("nvarchar(max)"); + + b.Property("STLAL") + .HasColumnType("nvarchar(max)"); + + b.Property("STLAN") + .HasColumnType("nvarchar(max)"); + + b.Property("STLST") + .HasColumnType("nvarchar(max)"); + + b.Property("WERKS") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiBOMJsons"); + }); + + modelBuilder.Entity("WmsWebApi.Domain.WmsWebApiProductRecieveDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AccountDate") + .HasColumnType("nvarchar(max)"); + + b.Property("BillTime") + .HasColumnType("nvarchar(max)"); + + b.Property("BillType") + .HasColumnType("nvarchar(max)"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("GUID") + .HasColumnType("nvarchar(max)"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("OperName") + .HasColumnType("nvarchar(max)"); + + b.Property("ReceiveDate") + .HasColumnType("nvarchar(max)"); + + b.Property("SourceBillNum") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiProductRecieveJsons"); + }); + + modelBuilder.Entity("WmsWebApi.Domain.WmsWebApiStockMoveDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AccountDate") + .HasColumnType("nvarchar(max)"); + + b.Property("BillTime") + .HasColumnType("nvarchar(max)"); + + b.Property("BillType") + .HasColumnType("nvarchar(max)"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("GUID") + .HasColumnType("nvarchar(max)"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("OperName") + .HasColumnType("nvarchar(max)"); + + b.Property("ReceiveDate") + .HasColumnType("nvarchar(max)"); + + b.Property("SourceBillNum") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiStockMoveJsons"); + }); + + modelBuilder.Entity("WmsWebApi.OtherZll.WmsWebApiOtherZLLDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("MBLNR") + .HasColumnType("nvarchar(max)"); + + b.Property("MJAHR") + .HasColumnType("nvarchar(max)"); + + b.Property("ZLLDJ") + .HasColumnType("nvarchar(max)"); + + b.Property("ZLLR") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiOtherZllJsons"); + }); + + modelBuilder.Entity("WmsWebApi.PPlan.WmsWebApiPPLANDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DISPO") + .HasColumnType("nvarchar(max)"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("GSMNG") + .HasColumnType("decimal(18,2)"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("KAPTPROG") + .HasColumnType("nvarchar(max)"); + + b.Property("MAKTX") + .HasColumnType("nvarchar(max)"); + + b.Property("MATNR") + .HasColumnType("nvarchar(max)"); + + b.Property("PEDTR") + .HasColumnType("nvarchar(max)"); + + b.Property("SCHGRUP") + .HasColumnType("nvarchar(max)"); + + b.Property("VERID") + .HasColumnType("nvarchar(max)"); + + b.Property("WERKS") + .HasColumnType("nvarchar(max)"); + + b.Property("XUBNAME") + .HasColumnType("nvarchar(max)"); + + b.Property("ZBZSM") + .HasColumnType("nvarchar(max)"); + + b.Property("ZCDATE") + .HasColumnType("nvarchar(max)"); + + b.Property("ZCTIME") + .HasColumnType("nvarchar(max)"); + + b.Property("ZMACD") + .HasColumnType("nvarchar(max)"); + + b.Property("ZMATX") + .HasColumnType("nvarchar(max)"); + + b.Property("ZSCSX") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiPPlanJsons"); + }); + + modelBuilder.Entity("WmsWebApi.Parts.WmsWebApiPARTDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DISGR") + .HasColumnType("nvarchar(max)"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("GROES") + .HasColumnType("nvarchar(max)"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("MAKTX") + .HasColumnType("nvarchar(max)"); + + b.Property("MAKTX1") + .HasColumnType("nvarchar(max)"); + + b.Property("MATKL") + .HasColumnType("nvarchar(max)"); + + b.Property("MATNR") + .HasColumnType("nvarchar(max)"); + + b.Property("MBRSH") + .HasColumnType("nvarchar(max)"); + + b.Property("MEINS") + .HasColumnType("nvarchar(max)"); + + b.Property("MTART") + .HasColumnType("nvarchar(max)"); + + b.Property("VTWEG") + .HasColumnType("nvarchar(max)"); + + b.Property("WERKS") + .HasColumnType("nvarchar(max)"); + + b.Property("ZTEXT22") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiPartJsons"); + }); + + modelBuilder.Entity("WmsWebApi.Purchase.WmsWebApiPURCHASEDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BUDAT") + .HasColumnType("nvarchar(max)"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("MBLNR") + .HasColumnType("nvarchar(max)"); + + b.Property("MJAHR") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiPurchaseJsons"); + }); + + modelBuilder.Entity("WmsWebApi.ZlldcjLogs.WmsWebApiZLLDCJDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("ZDJLX") + .HasColumnType("nvarchar(max)"); + + b.Property("ZLLDJ") + .HasColumnType("nvarchar(max)"); + + b.Property("ZLTLX") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiZlldcjLogJsons"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307062843_202303071428.cs b/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307062843_202303071428.cs new file mode 100644 index 0000000..080d905 --- /dev/null +++ b/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307062843_202303071428.cs @@ -0,0 +1,192 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace WmsWebApi.Migrations.WmsWebApiJsonDb +{ + public partial class _202303071428 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "WmsWebApiOtherZllJsons", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ZLLR = table.Column(type: "nvarchar(max)", nullable: true), + ZLLDJ = table.Column(type: "nvarchar(max)", nullable: true), + MBLNR = table.Column(type: "nvarchar(max)", nullable: true), + MJAHR = table.Column(type: "nvarchar(max)", nullable: true), + JSON = table.Column(type: "nvarchar(max)", nullable: true), + DYSJ = table.Column(type: "datetime2", nullable: false), + ITYPE = table.Column(type: "nvarchar(max)", nullable: true), + EnumRetryStatus = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WmsWebApiOtherZllJsons", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "WmsWebApiPartJsons", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + MATNR = table.Column(type: "nvarchar(max)", nullable: true), + MBRSH = table.Column(type: "nvarchar(max)", nullable: true), + MTART = table.Column(type: "nvarchar(max)", nullable: true), + WERKS = table.Column(type: "nvarchar(max)", nullable: true), + VTWEG = table.Column(type: "nvarchar(max)", nullable: true), + MAKTX = table.Column(type: "nvarchar(max)", nullable: true), + MAKTX1 = table.Column(type: "nvarchar(max)", nullable: true), + MEINS = table.Column(type: "nvarchar(max)", nullable: true), + MATKL = table.Column(type: "nvarchar(max)", nullable: true), + GROES = table.Column(type: "nvarchar(max)", nullable: true), + ZTEXT22 = table.Column(type: "nvarchar(max)", nullable: true), + DISGR = table.Column(type: "nvarchar(max)", nullable: true), + JSON = table.Column(type: "nvarchar(max)", nullable: true), + DYSJ = table.Column(type: "datetime2", nullable: false), + ITYPE = table.Column(type: "nvarchar(max)", nullable: true), + EnumRetryStatus = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WmsWebApiPartJsons", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "WmsWebApiPPlanJsons", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + PEDTR = table.Column(type: "nvarchar(max)", nullable: true), + SCHGRUP = table.Column(type: "nvarchar(max)", nullable: true), + KAPTPROG = table.Column(type: "nvarchar(max)", nullable: true), + MATNR = table.Column(type: "nvarchar(max)", nullable: true), + MAKTX = table.Column(type: "nvarchar(max)", nullable: true), + WERKS = table.Column(type: "nvarchar(max)", nullable: true), + VERID = table.Column(type: "nvarchar(max)", nullable: true), + ZSCSX = table.Column(type: "nvarchar(max)", nullable: true), + ZMACD = table.Column(type: "nvarchar(max)", nullable: true), + ZMATX = table.Column(type: "nvarchar(max)", nullable: true), + DISPO = table.Column(type: "nvarchar(max)", nullable: true), + GSMNG = table.Column(type: "decimal(18,2)", nullable: false), + ZBZSM = table.Column(type: "nvarchar(max)", nullable: true), + XUBNAME = table.Column(type: "nvarchar(max)", nullable: true), + ZCDATE = table.Column(type: "nvarchar(max)", nullable: true), + ZCTIME = table.Column(type: "nvarchar(max)", nullable: true), + JSON = table.Column(type: "nvarchar(max)", nullable: true), + DYSJ = table.Column(type: "datetime2", nullable: false), + ITYPE = table.Column(type: "nvarchar(max)", nullable: true), + EnumRetryStatus = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WmsWebApiPPlanJsons", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "WmsWebApiProductRecieveJsons", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + AccountDate = table.Column(type: "nvarchar(max)", nullable: true), + BillType = table.Column(type: "nvarchar(max)", nullable: true), + ReceiveDate = table.Column(type: "nvarchar(max)", nullable: true), + GUID = table.Column(type: "nvarchar(max)", nullable: true), + OperName = table.Column(type: "nvarchar(max)", nullable: true), + BillTime = table.Column(type: "nvarchar(max)", nullable: true), + SourceBillNum = table.Column(type: "nvarchar(max)", nullable: true), + JSON = table.Column(type: "nvarchar(max)", nullable: true), + DYSJ = table.Column(type: "datetime2", nullable: false), + ITYPE = table.Column(type: "nvarchar(max)", nullable: true), + EnumRetryStatus = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WmsWebApiProductRecieveJsons", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "WmsWebApiPurchaseJsons", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + MBLNR = table.Column(type: "nvarchar(max)", nullable: true), + MJAHR = table.Column(type: "nvarchar(max)", nullable: true), + BUDAT = table.Column(type: "nvarchar(max)", nullable: true), + JSON = table.Column(type: "nvarchar(max)", nullable: true), + DYSJ = table.Column(type: "datetime2", nullable: false), + ITYPE = table.Column(type: "nvarchar(max)", nullable: true), + EnumRetryStatus = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WmsWebApiPurchaseJsons", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "WmsWebApiStockMoveJsons", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + AccountDate = table.Column(type: "nvarchar(max)", nullable: true), + BillType = table.Column(type: "nvarchar(max)", nullable: true), + ReceiveDate = table.Column(type: "nvarchar(max)", nullable: true), + GUID = table.Column(type: "nvarchar(max)", nullable: true), + OperName = table.Column(type: "nvarchar(max)", nullable: true), + BillTime = table.Column(type: "nvarchar(max)", nullable: true), + SourceBillNum = table.Column(type: "nvarchar(max)", nullable: true), + JSON = table.Column(type: "nvarchar(max)", nullable: true), + DYSJ = table.Column(type: "datetime2", nullable: false), + ITYPE = table.Column(type: "nvarchar(max)", nullable: true), + EnumRetryStatus = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WmsWebApiStockMoveJsons", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "WmsWebApiZlldcjLogJsons", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ZLLDJ = table.Column(type: "nvarchar(max)", nullable: true), + ZDJLX = table.Column(type: "nvarchar(max)", nullable: true), + ZLTLX = table.Column(type: "nvarchar(max)", nullable: true), + JSON = table.Column(type: "nvarchar(max)", nullable: true), + DYSJ = table.Column(type: "datetime2", nullable: false), + ITYPE = table.Column(type: "nvarchar(max)", nullable: true), + EnumRetryStatus = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WmsWebApiZlldcjLogJsons", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "WmsWebApiOtherZllJsons"); + + migrationBuilder.DropTable( + name: "WmsWebApiPartJsons"); + + migrationBuilder.DropTable( + name: "WmsWebApiPPlanJsons"); + + migrationBuilder.DropTable( + name: "WmsWebApiProductRecieveJsons"); + + migrationBuilder.DropTable( + name: "WmsWebApiPurchaseJsons"); + + migrationBuilder.DropTable( + name: "WmsWebApiStockMoveJsons"); + + migrationBuilder.DropTable( + name: "WmsWebApiZlldcjLogJsons"); + } + } +} diff --git a/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/WmsWebApiJsonDbContextModelSnapshot.cs b/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/WmsWebApiJsonDbContextModelSnapshot.cs new file mode 100644 index 0000000..7591973 --- /dev/null +++ b/src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/WmsWebApiJsonDbContextModelSnapshot.cs @@ -0,0 +1,385 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using WmsWebApi.EntityFrameworkCore; + +namespace WmsWebApi.Migrations.WmsWebApiJsonDb +{ + [DbContext(typeof(WmsWebApiJsonDbContext))] + partial class WmsWebApiJsonDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.17") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("WmsWebApi.Boms.WmsWebApiBOMDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BMENG") + .HasColumnType("decimal(18,2)"); + + b.Property("DATUV") + .HasColumnType("nvarchar(max)"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("LOEKZ") + .HasColumnType("nvarchar(max)"); + + b.Property("MAKTX") + .HasColumnType("nvarchar(max)"); + + b.Property("MATNR") + .HasColumnType("nvarchar(max)"); + + b.Property("STLAL") + .HasColumnType("nvarchar(max)"); + + b.Property("STLAN") + .HasColumnType("nvarchar(max)"); + + b.Property("STLST") + .HasColumnType("nvarchar(max)"); + + b.Property("WERKS") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiBOMJsons"); + }); + + modelBuilder.Entity("WmsWebApi.Domain.WmsWebApiProductRecieveDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AccountDate") + .HasColumnType("nvarchar(max)"); + + b.Property("BillTime") + .HasColumnType("nvarchar(max)"); + + b.Property("BillType") + .HasColumnType("nvarchar(max)"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("GUID") + .HasColumnType("nvarchar(max)"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("OperName") + .HasColumnType("nvarchar(max)"); + + b.Property("ReceiveDate") + .HasColumnType("nvarchar(max)"); + + b.Property("SourceBillNum") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiProductRecieveJsons"); + }); + + modelBuilder.Entity("WmsWebApi.Domain.WmsWebApiStockMoveDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AccountDate") + .HasColumnType("nvarchar(max)"); + + b.Property("BillTime") + .HasColumnType("nvarchar(max)"); + + b.Property("BillType") + .HasColumnType("nvarchar(max)"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("GUID") + .HasColumnType("nvarchar(max)"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("OperName") + .HasColumnType("nvarchar(max)"); + + b.Property("ReceiveDate") + .HasColumnType("nvarchar(max)"); + + b.Property("SourceBillNum") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiStockMoveJsons"); + }); + + modelBuilder.Entity("WmsWebApi.OtherZll.WmsWebApiOtherZLLDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("MBLNR") + .HasColumnType("nvarchar(max)"); + + b.Property("MJAHR") + .HasColumnType("nvarchar(max)"); + + b.Property("ZLLDJ") + .HasColumnType("nvarchar(max)"); + + b.Property("ZLLR") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiOtherZllJsons"); + }); + + modelBuilder.Entity("WmsWebApi.PPlan.WmsWebApiPPLANDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DISPO") + .HasColumnType("nvarchar(max)"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("GSMNG") + .HasColumnType("decimal(18,2)"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("KAPTPROG") + .HasColumnType("nvarchar(max)"); + + b.Property("MAKTX") + .HasColumnType("nvarchar(max)"); + + b.Property("MATNR") + .HasColumnType("nvarchar(max)"); + + b.Property("PEDTR") + .HasColumnType("nvarchar(max)"); + + b.Property("SCHGRUP") + .HasColumnType("nvarchar(max)"); + + b.Property("VERID") + .HasColumnType("nvarchar(max)"); + + b.Property("WERKS") + .HasColumnType("nvarchar(max)"); + + b.Property("XUBNAME") + .HasColumnType("nvarchar(max)"); + + b.Property("ZBZSM") + .HasColumnType("nvarchar(max)"); + + b.Property("ZCDATE") + .HasColumnType("nvarchar(max)"); + + b.Property("ZCTIME") + .HasColumnType("nvarchar(max)"); + + b.Property("ZMACD") + .HasColumnType("nvarchar(max)"); + + b.Property("ZMATX") + .HasColumnType("nvarchar(max)"); + + b.Property("ZSCSX") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiPPlanJsons"); + }); + + modelBuilder.Entity("WmsWebApi.Parts.WmsWebApiPARTDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DISGR") + .HasColumnType("nvarchar(max)"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("GROES") + .HasColumnType("nvarchar(max)"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("MAKTX") + .HasColumnType("nvarchar(max)"); + + b.Property("MAKTX1") + .HasColumnType("nvarchar(max)"); + + b.Property("MATKL") + .HasColumnType("nvarchar(max)"); + + b.Property("MATNR") + .HasColumnType("nvarchar(max)"); + + b.Property("MBRSH") + .HasColumnType("nvarchar(max)"); + + b.Property("MEINS") + .HasColumnType("nvarchar(max)"); + + b.Property("MTART") + .HasColumnType("nvarchar(max)"); + + b.Property("VTWEG") + .HasColumnType("nvarchar(max)"); + + b.Property("WERKS") + .HasColumnType("nvarchar(max)"); + + b.Property("ZTEXT22") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiPartJsons"); + }); + + modelBuilder.Entity("WmsWebApi.Purchase.WmsWebApiPURCHASEDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BUDAT") + .HasColumnType("nvarchar(max)"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("MBLNR") + .HasColumnType("nvarchar(max)"); + + b.Property("MJAHR") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiPurchaseJsons"); + }); + + modelBuilder.Entity("WmsWebApi.ZlldcjLogs.WmsWebApiZLLDCJDTO", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DYSJ") + .HasColumnType("datetime2"); + + b.Property("EnumRetryStatus") + .HasColumnType("int"); + + b.Property("ITYPE") + .HasColumnType("nvarchar(max)"); + + b.Property("JSON") + .HasColumnType("nvarchar(max)"); + + b.Property("ZDJLX") + .HasColumnType("nvarchar(max)"); + + b.Property("ZLLDJ") + .HasColumnType("nvarchar(max)"); + + b.Property("ZLTLX") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("WmsWebApiZlldcjLogJsons"); + }); +#pragma warning restore 612, 618 + } + } +}