Browse Source

Policy重试

master
mahao 2 years ago
parent
commit
f5387f70af
  1. 3
      host/WmsWebApi.HttpApi.Host/WmsWebApiHttpApiHostModule.cs
  2. 15
      host/WmsWebApi.HttpApi.Host/appsettings.json
  3. 43
      src/WmsWebApi.Application/BackgroundWorker/RequestRetryWorker.cs
  4. 63
      src/WmsWebApi.Application/Boms/BomService.cs
  5. 69
      src/WmsWebApi.Application/OtherZll/OtherZllService.cs
  6. 60
      src/WmsWebApi.Application/PPlan/PPlanService.cs
  7. 63
      src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs
  8. 69
      src/WmsWebApi.Application/Purchase/PurchaseService.cs
  9. 49
      src/WmsWebApi.Application/StockMove/StockMoveService.cs
  10. 61
      src/WmsWebApi.Application/TbParts/PartService.cs
  11. 2
      src/WmsWebApi.Application/WmsWebApi.Application.csproj
  12. 6
      src/WmsWebApi.Application/WmsWebApiApplicationModule.cs
  13. 75
      src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs
  14. 14
      src/WmsWebApi.Domain/Jsons/IBomJsonRepository.cs
  15. 14
      src/WmsWebApi.Domain/Jsons/IOtherZllJsonRepository.cs
  16. 14
      src/WmsWebApi.Domain/Jsons/IPPlanJsonRepository.cs
  17. 14
      src/WmsWebApi.Domain/Jsons/IPartJsonRepository.cs
  18. 14
      src/WmsWebApi.Domain/Jsons/IProductRecieveJsonRepository.cs
  19. 14
      src/WmsWebApi.Domain/Jsons/IPurchaseJsonRepository.cs
  20. 15
      src/WmsWebApi.Domain/Jsons/IStockMoveJsonRepository.cs
  21. 14
      src/WmsWebApi.Domain/Jsons/IZlldcjLogJsonRepository.cs
  22. 3
      src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContext.cs
  23. 8
      src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiEntityFrameworkCoreModule.cs
  24. 92
      src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiJsonDbContext.cs
  25. 18
      src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreBomJsonRepository.cs
  26. 18
      src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreOtherZllJsonRepository.cs
  27. 18
      src/WmsWebApi.EntityFrameworkCore/Jsons/EfCorePPlanJsonRepository.cs
  28. 18
      src/WmsWebApi.EntityFrameworkCore/Jsons/EfCorePartJsonRepository.cs
  29. 18
      src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreProductRecieveJsonRepository.cs
  30. 19
      src/WmsWebApi.EntityFrameworkCore/Jsons/EfCorePurchaseJsonRepository.cs
  31. 19
      src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreStockMoveJsonRepository.cs
  32. 18
      src/WmsWebApi.EntityFrameworkCore/Jsons/EfCoreZlldcjLogJsonRepository.cs
  33. 77
      src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307014143_202303070941.Designer.cs
  34. 41
      src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307014143_202303070941.cs
  35. 387
      src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307062843_202303071428.Designer.cs
  36. 192
      src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307062843_202303071428.cs
  37. 385
      src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/WmsWebApiJsonDbContextModelSnapshot.cs

3
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
{

15
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"
},

43
src/WmsWebApi.Application/BackgroundWorker/RequestRetryWorker.cs

@ -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
{
/// <summary>
/// 请求重试工作者
/// </summary>
public class RequestRetryWorker : QuartzBackgroundWorkerBase
{
public DateTimeOffset StartDateTime { get; set; }
public RequestRetryWorker()
{
StartDateTime = new DateTimeOffset(DateTimeOffset.UtcNow.Date.AddDays(1));
JobDetail = JobBuilder.Create<RequestRetryWorker>().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;
}
}
}

63
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;
/// <summary>
/// 是否是请求重试
@ -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<Exception>()
.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();
}
}
}

69
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;
/// <summary>
/// 是否是请求重试
@ -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<Exception>()
.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();
}
}
}

60
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;
/// <summary>
/// 是否是请求重试
@ -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<Exception>()
.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();
}
}
}

63
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;
/// <summary>
/// 是否是请求重试
@ -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<Exception>()
.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();
}
}
}

69
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;
/// <summary>
/// 是否是请求重试
@ -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<Exception>()
.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();
}
}
}

49
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;
/// <summary>
/// 是否是请求重试
@ -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<Exception>()
.WaitAndRetryAsync(new[] {
TimeSpan.FromSeconds(1),
TimeSpan.FromSeconds(5),
TimeSpan.FromSeconds(5),
TimeSpan.FromSeconds(5)
}, (exception, timeSpan, retryCount, context) =>
{
Logger.LogInformation($"执行失败,第 {retryCount} 次重试");
});
}
/// <summary>
@ -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();
}
}
}

61
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;
/// <summary>
/// 是否是请求重试
@ -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<Exception>()
.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();
}
}
}

2
src/WmsWebApi.Application/WmsWebApi.Application.csproj

@ -10,10 +10,10 @@
<ItemGroup>
<PackageReference Include="Abp" Version="7.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Polly" Version="7.2.3" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="4.4.4" />
<PackageReference Include="Volo.Abp.BackgroundJobs" Version="4.4.4" />
<PackageReference Include="Volo.Abp.BackgroundJobs.EntityFrameworkCore" Version="4.4.4" />
<PackageReference Include="Volo.Abp.BackgroundWorkers.Quartz" Version="4.4.4" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="4.4.4" />
<ProjectReference Include="..\WmsWebApi.Application.Contracts\WmsWebApi.Application.Contracts.csproj" />
<ProjectReference Include="..\WmsWebApi.Domain\WmsWebApi.Domain.csproj" />

6
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

75
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;
/// <summary>
/// 是否是请求重试
@ -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<Exception>()
.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();
}
}

14
src/WmsWebApi.Domain/Jsons/IBomJsonRepository.cs

@ -0,0 +1,14 @@
using System;
using Volo.Abp.Domain.Repositories;
using WmsWebApi.Boms;
namespace WmsWebApi.Jsons
{
/// <summary>
/// 仓储
/// </summary>
public interface IBomJsonRepository : IRepository<WmsWebApiBOMDTO, Guid>
{
}
}

14
src/WmsWebApi.Domain/Jsons/IOtherZllJsonRepository.cs

@ -0,0 +1,14 @@
using System;
using Volo.Abp.Domain.Repositories;
using WmsWebApi.OtherZll;
namespace WmsWebApi.Jsons
{
/// <summary>
/// 仓储
/// </summary>
public interface IOtherZllJsonRepository : IRepository<WmsWebApiOtherZLLDTO, Guid>
{
}
}

14
src/WmsWebApi.Domain/Jsons/IPPlanJsonRepository.cs

@ -0,0 +1,14 @@
using System;
using Volo.Abp.Domain.Repositories;
using WmsWebApi.PPlan;
namespace WmsWebApi.Jsons
{
/// <summary>
/// 仓储
/// </summary>
public interface IPPlanJsonRepository : IRepository<WmsWebApiPPLANDTO, Guid>
{
}
}

14
src/WmsWebApi.Domain/Jsons/IPartJsonRepository.cs

@ -0,0 +1,14 @@
using System;
using Volo.Abp.Domain.Repositories;
using WmsWebApi.Parts;
namespace WmsWebApi.Jsons
{
/// <summary>
/// 仓储
/// </summary>
public interface IPartJsonRepository : IRepository<WmsWebApiPARTDTO, Guid>
{
}
}

14
src/WmsWebApi.Domain/Jsons/IProductRecieveJsonRepository.cs

@ -0,0 +1,14 @@
using System;
using Volo.Abp.Domain.Repositories;
using WmsWebApi.Domain;
namespace WmsWebApi.Jsons
{
/// <summary>
/// 仓储
/// </summary>
public interface IProductRecieveJsonRepository : IRepository<WmsWebApiProductRecieveDTO, Guid>
{
}
}

14
src/WmsWebApi.Domain/Jsons/IPurchaseJsonRepository.cs

@ -0,0 +1,14 @@
using System;
using Volo.Abp.Domain.Repositories;
using WmsWebApi.Purchase;
namespace WmsWebApi.Jsons
{
/// <summary>
/// 仓储
/// </summary>
public interface IPurchaseJsonRepository : IRepository<WmsWebApiPURCHASEDTO, Guid>
{
}
}

15
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
{
/// <summary>
/// 仓储
/// </summary>
public interface IStockMoveJsonRepository : IRepository<WmsWebApiStockMoveDTO, Guid>
{
}
}

14
src/WmsWebApi.Domain/Jsons/IZlldcjLogJsonRepository.cs

@ -0,0 +1,14 @@
using System;
using Volo.Abp.Domain.Repositories;
using WmsWebApi.ZlldcjLogs;
namespace WmsWebApi.Jsons
{
/// <summary>
/// 仓储
/// </summary>
public interface IZlldcjLogJsonRepository : IRepository<WmsWebApiZLLDCJDTO, Guid>
{
}
}

3
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<WmsWebApiDbContext> options)
: base(options)
{
this.Database.SetCommandTimeout(40);
this.Database.SetCommandTimeout(60);
}
protected override void OnModelCreating(ModelBuilder builder)

8
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<WmsWebApiJsonDbContext>(options =>
{
});
context.Services.AddTransient(typeof(ITmOtherAskRepository),typeof(TmOtherAskRepositoryAdd));
context.Services.AddTransient(typeof(ITaCustPartRepository), typeof(TaCustPartRepository));
context.Services.AddTransient(typeof(ITbBillRepository), typeof(TbBillRepository));

92
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
{
/// <summary>
/// Add-Migration xxx -c WmsWebApiJsonDbContext
/// Update-Database -Context WmsWebApiJsonDbContext
/// </summary>
[ConnectionStringName("WmsWebApiJson")]
public class WmsWebApiJsonDbContext : AbpDbContext<WmsWebApiJsonDbContext>
{
public DbSet<WmsWebApiBOMDTO> BOMJsons { get; set; }
public DbSet<WmsWebApiOtherZLLDTO> OtherZllJsons { get; set; }
public DbSet<WmsWebApiPPLANDTO> PPlanJsons { get; set; }
public DbSet<WmsWebApiProductRecieveDTO> ProductRecieveJsons { get; set; }
public DbSet<WmsWebApiPURCHASEDTO> PurchaseJsons { get; set; }
public DbSet<WmsWebApiStockMoveDTO> StockMoveJsons { get; set; }
public DbSet<WmsWebApiPARTDTO> PartJsons { get; set; }
public DbSet<WmsWebApiZLLDCJDTO> ZlldcjLogJsons { get; set; }
public WmsWebApiJsonDbContext(DbContextOptions<WmsWebApiJsonDbContext> 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<WmsWebApiBOMDTO>(b =>
{
b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "BOMJsons", WmsWebApiDbProperties.DbSchema);
b.ConfigureByConvention();
});
modelBuilder.Entity<WmsWebApiOtherZLLDTO>(b =>
{
b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "OtherZllJsons", WmsWebApiDbProperties.DbSchema);
b.ConfigureByConvention();
});
modelBuilder.Entity<WmsWebApiPPLANDTO>(b =>
{
b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "PPlanJsons", WmsWebApiDbProperties.DbSchema);
b.ConfigureByConvention();
});
modelBuilder.Entity<WmsWebApiProductRecieveDTO>(b =>
{
b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "ProductRecieveJsons", WmsWebApiDbProperties.DbSchema);
b.ConfigureByConvention();
});
modelBuilder.Entity<WmsWebApiPURCHASEDTO>(b =>
{
b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "PurchaseJsons", WmsWebApiDbProperties.DbSchema);
b.ConfigureByConvention();
});
modelBuilder.Entity<WmsWebApiStockMoveDTO>(b =>
{
b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "StockMoveJsons", WmsWebApiDbProperties.DbSchema);
b.ConfigureByConvention();
});
modelBuilder.Entity<WmsWebApiPARTDTO>(b =>
{
b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "PartJsons", WmsWebApiDbProperties.DbSchema);
b.ConfigureByConvention();
});
modelBuilder.Entity<WmsWebApiZLLDCJDTO>(b =>
{
b.ToTable(WmsWebApiDbProperties.DbTablePrefix + "ZlldcjLogJsons", WmsWebApiDbProperties.DbSchema);
b.ConfigureByConvention();
});
}
}
}

18
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
{
/// <summary>
/// 仓储
/// </summary>
public class EfCoreBomJsonRepository : EfCoreRepository<WmsWebApiJsonDbContext, WmsWebApiBOMDTO, Guid>, IBomJsonRepository
{
public EfCoreBomJsonRepository(IDbContextProvider<WmsWebApiJsonDbContext> dbContextProvider) : base(dbContextProvider)
{
}
}
}

18
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
{
/// <summary>
/// 仓储
/// </summary>
public class EfCoreOtherZllJsonRepository : EfCoreRepository<WmsWebApiJsonDbContext, WmsWebApiOtherZLLDTO, Guid>, IOtherZllJsonRepository
{
public EfCoreOtherZllJsonRepository(IDbContextProvider<WmsWebApiJsonDbContext> dbContextProvider) : base(dbContextProvider)
{
}
}
}

18
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
{
/// <summary>
/// 仓储
/// </summary>
public class EfCorePPlanJsonRepository : EfCoreRepository<WmsWebApiJsonDbContext, WmsWebApiPPLANDTO, Guid>, IPPlanJsonRepository
{
public EfCorePPlanJsonRepository(IDbContextProvider<WmsWebApiJsonDbContext> dbContextProvider) : base(dbContextProvider)
{
}
}
}

18
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
{
/// <summary>
/// 仓储
/// </summary>
public class EfCorePartJsonRepository : EfCoreRepository<WmsWebApiJsonDbContext, WmsWebApiPARTDTO, Guid>, IPartJsonRepository
{
public EfCorePartJsonRepository(IDbContextProvider<WmsWebApiJsonDbContext> dbContextProvider) : base(dbContextProvider)
{
}
}
}

18
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
{
/// <summary>
/// 仓储
/// </summary>
public class EfCoreProductRecieveJsonRepository : EfCoreRepository<WmsWebApiJsonDbContext, WmsWebApiProductRecieveDTO, Guid>, IProductRecieveJsonRepository
{
public EfCoreProductRecieveJsonRepository(IDbContextProvider<WmsWebApiJsonDbContext> dbContextProvider) : base(dbContextProvider)
{
}
}
}

19
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
{
/// <summary>
/// 仓储
/// </summary>
public class EfCorePurchaseJsonRepository : EfCoreRepository<WmsWebApiJsonDbContext, WmsWebApiPURCHASEDTO, Guid>, IPurchaseJsonRepository
{
public EfCorePurchaseJsonRepository(IDbContextProvider<WmsWebApiJsonDbContext> dbContextProvider) : base(dbContextProvider)
{
}
}
}

19
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
{
/// <summary>
/// 仓储
/// </summary>
public class EfCoreStockMoveJsonRepository : EfCoreRepository<WmsWebApiJsonDbContext, WmsWebApiStockMoveDTO, Guid>, IStockMoveJsonRepository
{
public EfCoreStockMoveJsonRepository(IDbContextProvider<WmsWebApiJsonDbContext> dbContextProvider) : base(dbContextProvider)
{
}
}
}

18
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
{
/// <summary>
/// 仓储
/// </summary>
public class EfCoreZlldcjLogJsonRepository : EfCoreRepository<WmsWebApiJsonDbContext, WmsWebApiZLLDCJDTO, Guid>, IZlldcjLogJsonRepository
{
public EfCoreZlldcjLogJsonRepository(IDbContextProvider<WmsWebApiJsonDbContext> dbContextProvider) : base(dbContextProvider)
{
}
}
}

77
src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307014143_202303070941.Designer.cs

@ -0,0 +1,77 @@
// <auto-generated />
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<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<decimal?>("BMENG")
.HasColumnType("decimal(18,2)");
b.Property<string>("DATUV")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("LOEKZ")
.HasColumnType("nvarchar(max)");
b.Property<string>("MAKTX")
.HasColumnType("nvarchar(max)");
b.Property<string>("MATNR")
.HasColumnType("nvarchar(max)");
b.Property<string>("STLAL")
.HasColumnType("nvarchar(max)");
b.Property<string>("STLAN")
.HasColumnType("nvarchar(max)");
b.Property<string>("STLST")
.HasColumnType("nvarchar(max)");
b.Property<string>("WERKS")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiBOMJsons");
});
#pragma warning restore 612, 618
}
}
}

41
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<Guid>(type: "uniqueidentifier", nullable: false),
MATNR = table.Column<string>(type: "nvarchar(max)", nullable: true),
MAKTX = table.Column<string>(type: "nvarchar(max)", nullable: true),
WERKS = table.Column<string>(type: "nvarchar(max)", nullable: true),
STLAN = table.Column<string>(type: "nvarchar(max)", nullable: true),
STLAL = table.Column<string>(type: "nvarchar(max)", nullable: true),
DATUV = table.Column<string>(type: "nvarchar(max)", nullable: true),
BMENG = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
STLST = table.Column<string>(type: "nvarchar(max)", nullable: true),
LOEKZ = table.Column<string>(type: "nvarchar(max)", nullable: true),
JSON = table.Column<string>(type: "nvarchar(max)", nullable: true),
DYSJ = table.Column<DateTime>(type: "datetime2", nullable: false),
ITYPE = table.Column<string>(type: "nvarchar(max)", nullable: true),
EnumRetryStatus = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WmsWebApiBOMJsons", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "WmsWebApiBOMJsons");
}
}
}

387
src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/20230307062843_202303071428.Designer.cs

@ -0,0 +1,387 @@
// <auto-generated />
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<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<decimal?>("BMENG")
.HasColumnType("decimal(18,2)");
b.Property<string>("DATUV")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("LOEKZ")
.HasColumnType("nvarchar(max)");
b.Property<string>("MAKTX")
.HasColumnType("nvarchar(max)");
b.Property<string>("MATNR")
.HasColumnType("nvarchar(max)");
b.Property<string>("STLAL")
.HasColumnType("nvarchar(max)");
b.Property<string>("STLAN")
.HasColumnType("nvarchar(max)");
b.Property<string>("STLST")
.HasColumnType("nvarchar(max)");
b.Property<string>("WERKS")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiBOMJsons");
});
modelBuilder.Entity("WmsWebApi.Domain.WmsWebApiProductRecieveDTO", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("AccountDate")
.HasColumnType("nvarchar(max)");
b.Property<string>("BillTime")
.HasColumnType("nvarchar(max)");
b.Property<string>("BillType")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("GUID")
.HasColumnType("nvarchar(max)");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("OperName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ReceiveDate")
.HasColumnType("nvarchar(max)");
b.Property<string>("SourceBillNum")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiProductRecieveJsons");
});
modelBuilder.Entity("WmsWebApi.Domain.WmsWebApiStockMoveDTO", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("AccountDate")
.HasColumnType("nvarchar(max)");
b.Property<string>("BillTime")
.HasColumnType("nvarchar(max)");
b.Property<string>("BillType")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("GUID")
.HasColumnType("nvarchar(max)");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("OperName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ReceiveDate")
.HasColumnType("nvarchar(max)");
b.Property<string>("SourceBillNum")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiStockMoveJsons");
});
modelBuilder.Entity("WmsWebApi.OtherZll.WmsWebApiOtherZLLDTO", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("MBLNR")
.HasColumnType("nvarchar(max)");
b.Property<string>("MJAHR")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZLLDJ")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZLLR")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiOtherZllJsons");
});
modelBuilder.Entity("WmsWebApi.PPlan.WmsWebApiPPLANDTO", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("DISPO")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<decimal>("GSMNG")
.HasColumnType("decimal(18,2)");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("KAPTPROG")
.HasColumnType("nvarchar(max)");
b.Property<string>("MAKTX")
.HasColumnType("nvarchar(max)");
b.Property<string>("MATNR")
.HasColumnType("nvarchar(max)");
b.Property<string>("PEDTR")
.HasColumnType("nvarchar(max)");
b.Property<string>("SCHGRUP")
.HasColumnType("nvarchar(max)");
b.Property<string>("VERID")
.HasColumnType("nvarchar(max)");
b.Property<string>("WERKS")
.HasColumnType("nvarchar(max)");
b.Property<string>("XUBNAME")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZBZSM")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZCDATE")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZCTIME")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZMACD")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZMATX")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZSCSX")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiPPlanJsons");
});
modelBuilder.Entity("WmsWebApi.Parts.WmsWebApiPARTDTO", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("DISGR")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("GROES")
.HasColumnType("nvarchar(max)");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("MAKTX")
.HasColumnType("nvarchar(max)");
b.Property<string>("MAKTX1")
.HasColumnType("nvarchar(max)");
b.Property<string>("MATKL")
.HasColumnType("nvarchar(max)");
b.Property<string>("MATNR")
.HasColumnType("nvarchar(max)");
b.Property<string>("MBRSH")
.HasColumnType("nvarchar(max)");
b.Property<string>("MEINS")
.HasColumnType("nvarchar(max)");
b.Property<string>("MTART")
.HasColumnType("nvarchar(max)");
b.Property<string>("VTWEG")
.HasColumnType("nvarchar(max)");
b.Property<string>("WERKS")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZTEXT22")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiPartJsons");
});
modelBuilder.Entity("WmsWebApi.Purchase.WmsWebApiPURCHASEDTO", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("BUDAT")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("MBLNR")
.HasColumnType("nvarchar(max)");
b.Property<string>("MJAHR")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiPurchaseJsons");
});
modelBuilder.Entity("WmsWebApi.ZlldcjLogs.WmsWebApiZLLDCJDTO", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZDJLX")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZLLDJ")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZLTLX")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiZlldcjLogJsons");
});
#pragma warning restore 612, 618
}
}
}

192
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<Guid>(type: "uniqueidentifier", nullable: false),
ZLLR = table.Column<string>(type: "nvarchar(max)", nullable: true),
ZLLDJ = table.Column<string>(type: "nvarchar(max)", nullable: true),
MBLNR = table.Column<string>(type: "nvarchar(max)", nullable: true),
MJAHR = table.Column<string>(type: "nvarchar(max)", nullable: true),
JSON = table.Column<string>(type: "nvarchar(max)", nullable: true),
DYSJ = table.Column<DateTime>(type: "datetime2", nullable: false),
ITYPE = table.Column<string>(type: "nvarchar(max)", nullable: true),
EnumRetryStatus = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WmsWebApiOtherZllJsons", x => x.Id);
});
migrationBuilder.CreateTable(
name: "WmsWebApiPartJsons",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
MATNR = table.Column<string>(type: "nvarchar(max)", nullable: true),
MBRSH = table.Column<string>(type: "nvarchar(max)", nullable: true),
MTART = table.Column<string>(type: "nvarchar(max)", nullable: true),
WERKS = table.Column<string>(type: "nvarchar(max)", nullable: true),
VTWEG = table.Column<string>(type: "nvarchar(max)", nullable: true),
MAKTX = table.Column<string>(type: "nvarchar(max)", nullable: true),
MAKTX1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
MEINS = table.Column<string>(type: "nvarchar(max)", nullable: true),
MATKL = table.Column<string>(type: "nvarchar(max)", nullable: true),
GROES = table.Column<string>(type: "nvarchar(max)", nullable: true),
ZTEXT22 = table.Column<string>(type: "nvarchar(max)", nullable: true),
DISGR = table.Column<string>(type: "nvarchar(max)", nullable: true),
JSON = table.Column<string>(type: "nvarchar(max)", nullable: true),
DYSJ = table.Column<DateTime>(type: "datetime2", nullable: false),
ITYPE = table.Column<string>(type: "nvarchar(max)", nullable: true),
EnumRetryStatus = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WmsWebApiPartJsons", x => x.Id);
});
migrationBuilder.CreateTable(
name: "WmsWebApiPPlanJsons",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PEDTR = table.Column<string>(type: "nvarchar(max)", nullable: true),
SCHGRUP = table.Column<string>(type: "nvarchar(max)", nullable: true),
KAPTPROG = table.Column<string>(type: "nvarchar(max)", nullable: true),
MATNR = table.Column<string>(type: "nvarchar(max)", nullable: true),
MAKTX = table.Column<string>(type: "nvarchar(max)", nullable: true),
WERKS = table.Column<string>(type: "nvarchar(max)", nullable: true),
VERID = table.Column<string>(type: "nvarchar(max)", nullable: true),
ZSCSX = table.Column<string>(type: "nvarchar(max)", nullable: true),
ZMACD = table.Column<string>(type: "nvarchar(max)", nullable: true),
ZMATX = table.Column<string>(type: "nvarchar(max)", nullable: true),
DISPO = table.Column<string>(type: "nvarchar(max)", nullable: true),
GSMNG = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
ZBZSM = table.Column<string>(type: "nvarchar(max)", nullable: true),
XUBNAME = table.Column<string>(type: "nvarchar(max)", nullable: true),
ZCDATE = table.Column<string>(type: "nvarchar(max)", nullable: true),
ZCTIME = table.Column<string>(type: "nvarchar(max)", nullable: true),
JSON = table.Column<string>(type: "nvarchar(max)", nullable: true),
DYSJ = table.Column<DateTime>(type: "datetime2", nullable: false),
ITYPE = table.Column<string>(type: "nvarchar(max)", nullable: true),
EnumRetryStatus = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WmsWebApiPPlanJsons", x => x.Id);
});
migrationBuilder.CreateTable(
name: "WmsWebApiProductRecieveJsons",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
AccountDate = table.Column<string>(type: "nvarchar(max)", nullable: true),
BillType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ReceiveDate = table.Column<string>(type: "nvarchar(max)", nullable: true),
GUID = table.Column<string>(type: "nvarchar(max)", nullable: true),
OperName = table.Column<string>(type: "nvarchar(max)", nullable: true),
BillTime = table.Column<string>(type: "nvarchar(max)", nullable: true),
SourceBillNum = table.Column<string>(type: "nvarchar(max)", nullable: true),
JSON = table.Column<string>(type: "nvarchar(max)", nullable: true),
DYSJ = table.Column<DateTime>(type: "datetime2", nullable: false),
ITYPE = table.Column<string>(type: "nvarchar(max)", nullable: true),
EnumRetryStatus = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WmsWebApiProductRecieveJsons", x => x.Id);
});
migrationBuilder.CreateTable(
name: "WmsWebApiPurchaseJsons",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
MBLNR = table.Column<string>(type: "nvarchar(max)", nullable: true),
MJAHR = table.Column<string>(type: "nvarchar(max)", nullable: true),
BUDAT = table.Column<string>(type: "nvarchar(max)", nullable: true),
JSON = table.Column<string>(type: "nvarchar(max)", nullable: true),
DYSJ = table.Column<DateTime>(type: "datetime2", nullable: false),
ITYPE = table.Column<string>(type: "nvarchar(max)", nullable: true),
EnumRetryStatus = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WmsWebApiPurchaseJsons", x => x.Id);
});
migrationBuilder.CreateTable(
name: "WmsWebApiStockMoveJsons",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
AccountDate = table.Column<string>(type: "nvarchar(max)", nullable: true),
BillType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ReceiveDate = table.Column<string>(type: "nvarchar(max)", nullable: true),
GUID = table.Column<string>(type: "nvarchar(max)", nullable: true),
OperName = table.Column<string>(type: "nvarchar(max)", nullable: true),
BillTime = table.Column<string>(type: "nvarchar(max)", nullable: true),
SourceBillNum = table.Column<string>(type: "nvarchar(max)", nullable: true),
JSON = table.Column<string>(type: "nvarchar(max)", nullable: true),
DYSJ = table.Column<DateTime>(type: "datetime2", nullable: false),
ITYPE = table.Column<string>(type: "nvarchar(max)", nullable: true),
EnumRetryStatus = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WmsWebApiStockMoveJsons", x => x.Id);
});
migrationBuilder.CreateTable(
name: "WmsWebApiZlldcjLogJsons",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ZLLDJ = table.Column<string>(type: "nvarchar(max)", nullable: true),
ZDJLX = table.Column<string>(type: "nvarchar(max)", nullable: true),
ZLTLX = table.Column<string>(type: "nvarchar(max)", nullable: true),
JSON = table.Column<string>(type: "nvarchar(max)", nullable: true),
DYSJ = table.Column<DateTime>(type: "datetime2", nullable: false),
ITYPE = table.Column<string>(type: "nvarchar(max)", nullable: true),
EnumRetryStatus = table.Column<int>(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");
}
}
}

385
src/WmsWebApi.EntityFrameworkCore/Migrations/WmsWebApiJsonDb/WmsWebApiJsonDbContextModelSnapshot.cs

@ -0,0 +1,385 @@
// <auto-generated />
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<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<decimal?>("BMENG")
.HasColumnType("decimal(18,2)");
b.Property<string>("DATUV")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("LOEKZ")
.HasColumnType("nvarchar(max)");
b.Property<string>("MAKTX")
.HasColumnType("nvarchar(max)");
b.Property<string>("MATNR")
.HasColumnType("nvarchar(max)");
b.Property<string>("STLAL")
.HasColumnType("nvarchar(max)");
b.Property<string>("STLAN")
.HasColumnType("nvarchar(max)");
b.Property<string>("STLST")
.HasColumnType("nvarchar(max)");
b.Property<string>("WERKS")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiBOMJsons");
});
modelBuilder.Entity("WmsWebApi.Domain.WmsWebApiProductRecieveDTO", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("AccountDate")
.HasColumnType("nvarchar(max)");
b.Property<string>("BillTime")
.HasColumnType("nvarchar(max)");
b.Property<string>("BillType")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("GUID")
.HasColumnType("nvarchar(max)");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("OperName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ReceiveDate")
.HasColumnType("nvarchar(max)");
b.Property<string>("SourceBillNum")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiProductRecieveJsons");
});
modelBuilder.Entity("WmsWebApi.Domain.WmsWebApiStockMoveDTO", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("AccountDate")
.HasColumnType("nvarchar(max)");
b.Property<string>("BillTime")
.HasColumnType("nvarchar(max)");
b.Property<string>("BillType")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("GUID")
.HasColumnType("nvarchar(max)");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("OperName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ReceiveDate")
.HasColumnType("nvarchar(max)");
b.Property<string>("SourceBillNum")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiStockMoveJsons");
});
modelBuilder.Entity("WmsWebApi.OtherZll.WmsWebApiOtherZLLDTO", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("MBLNR")
.HasColumnType("nvarchar(max)");
b.Property<string>("MJAHR")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZLLDJ")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZLLR")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiOtherZllJsons");
});
modelBuilder.Entity("WmsWebApi.PPlan.WmsWebApiPPLANDTO", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("DISPO")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<decimal>("GSMNG")
.HasColumnType("decimal(18,2)");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("KAPTPROG")
.HasColumnType("nvarchar(max)");
b.Property<string>("MAKTX")
.HasColumnType("nvarchar(max)");
b.Property<string>("MATNR")
.HasColumnType("nvarchar(max)");
b.Property<string>("PEDTR")
.HasColumnType("nvarchar(max)");
b.Property<string>("SCHGRUP")
.HasColumnType("nvarchar(max)");
b.Property<string>("VERID")
.HasColumnType("nvarchar(max)");
b.Property<string>("WERKS")
.HasColumnType("nvarchar(max)");
b.Property<string>("XUBNAME")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZBZSM")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZCDATE")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZCTIME")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZMACD")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZMATX")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZSCSX")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiPPlanJsons");
});
modelBuilder.Entity("WmsWebApi.Parts.WmsWebApiPARTDTO", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("DISGR")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("GROES")
.HasColumnType("nvarchar(max)");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("MAKTX")
.HasColumnType("nvarchar(max)");
b.Property<string>("MAKTX1")
.HasColumnType("nvarchar(max)");
b.Property<string>("MATKL")
.HasColumnType("nvarchar(max)");
b.Property<string>("MATNR")
.HasColumnType("nvarchar(max)");
b.Property<string>("MBRSH")
.HasColumnType("nvarchar(max)");
b.Property<string>("MEINS")
.HasColumnType("nvarchar(max)");
b.Property<string>("MTART")
.HasColumnType("nvarchar(max)");
b.Property<string>("VTWEG")
.HasColumnType("nvarchar(max)");
b.Property<string>("WERKS")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZTEXT22")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiPartJsons");
});
modelBuilder.Entity("WmsWebApi.Purchase.WmsWebApiPURCHASEDTO", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("BUDAT")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("MBLNR")
.HasColumnType("nvarchar(max)");
b.Property<string>("MJAHR")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiPurchaseJsons");
});
modelBuilder.Entity("WmsWebApi.ZlldcjLogs.WmsWebApiZLLDCJDTO", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DYSJ")
.HasColumnType("datetime2");
b.Property<int>("EnumRetryStatus")
.HasColumnType("int");
b.Property<string>("ITYPE")
.HasColumnType("nvarchar(max)");
b.Property<string>("JSON")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZDJLX")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZLLDJ")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZLTLX")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("WmsWebApiZlldcjLogJsons");
});
#pragma warning restore 612, 618
}
}
}
Loading…
Cancel
Save