Browse Source

Qad发票同步状态导出接口

master
mahao 1 year ago
parent
commit
ef175c4304
  1. 7
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs
  2. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  3. 23
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/InvoiceSyncQadInvocable.cs
  4. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

7
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs

@ -18,6 +18,7 @@ using SettleAccount.Job.SignalR;
using Win.Sfs.SettleAccount.Entities.BQ; using Win.Sfs.SettleAccount.Entities.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs; using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.Options;
namespace Win.Sfs.SettleAccount namespace Win.Sfs.SettleAccount
{ {
@ -52,6 +53,7 @@ namespace Win.Sfs.SettleAccount
}); });
services.AddSingleton<JisBBACSeEdiCompareAppService>(); services.AddSingleton<JisBBACSeEdiCompareAppService>();
services.AddSingleton<JisHBPOSeEdiCompareAppService>(); services.AddSingleton<JisHBPOSeEdiCompareAppService>();
services.AddSingleton<InvoiceSyncQadInvocable>();
services.AddSignalR(o => o.EnableDetailedErrors = true); services.AddSignalR(o => o.EnableDetailedErrors = true);
JobHostdService.AddService(services); JobHostdService.AddService(services);
services.AddSingleton<JobHostdService>(); services.AddSingleton<JobHostdService>();
@ -70,6 +72,10 @@ namespace Win.Sfs.SettleAccount
options.MaxRequestBodySize = 268435456; options.MaxRequestBodySize = 268435456;
options.AllowSynchronousIO = true; options.AllowSynchronousIO = true;
}); });
services.Configure<GlobalConfigOptions>(options =>
{
options.IsSyncInvoiceQadState = true;
});
} }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
@ -83,6 +89,7 @@ namespace Win.Sfs.SettleAccount
{ {
scheduler.Schedule<JisBBACSeEdiCompareAppService>().EveryMinute(); scheduler.Schedule<JisBBACSeEdiCompareAppService>().EveryMinute();
scheduler.Schedule<JisHBPOSeEdiCompareAppService>().EveryMinute(); scheduler.Schedule<JisHBPOSeEdiCompareAppService>().EveryMinute();
scheduler.Schedule<InvoiceSyncQadInvocable>().EveryMinute();
}); });
var contentTypeProvider = new FileExtensionContentTypeProvider(); var contentTypeProvider = new FileExtensionContentTypeProvider();
contentTypeProvider.Mappings.Add(".mjs", "text/javascript"); contentTypeProvider.Mappings.Add(".mjs", "text/javascript");

6
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs

@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Polly; using Polly;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using Shouldly; using Shouldly;
@ -31,6 +32,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.Options;
using Win.Sfs.Shared.Filter; using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
@ -49,6 +51,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// 数据中心数据上下文 /// 数据中心数据上下文
/// </summary> /// </summary>
private readonly ExChangeCenterDbContext _exChangeCenterDbContext; private readonly ExChangeCenterDbContext _exChangeCenterDbContext;
private readonly GlobalConfigOptions _globalConfigOptions;
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository; private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository;
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository; private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository;
@ -64,6 +67,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
ILogger<BASE_SERVICE> logger, ILogger<BASE_SERVICE> logger,
SettleAccountDbContext settleAccountDbContext, SettleAccountDbContext settleAccountDbContext,
ExChangeCenterDbContext exChangeCenterDbContext, ExChangeCenterDbContext exChangeCenterDbContext,
IOptions<GlobalConfigOptions> options,
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager, ICommonManager commonManager,
@ -83,6 +87,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_logger = logger; _logger = logger;
_settleAccountDbContext = settleAccountDbContext; _settleAccountDbContext = settleAccountDbContext;
_exChangeCenterDbContext = exChangeCenterDbContext; _exChangeCenterDbContext = exChangeCenterDbContext;
_globalConfigOptions = options.Value;
_baseservice = baseservice; _baseservice = baseservice;
_repository = repository; _repository = repository;
_wRepository = wRepository; _wRepository = wRepository;
@ -109,6 +114,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[HttpPost] [HttpPost]
public virtual async Task<IActionResult> SubmitToQad(List<string> invbillNums) public virtual async Task<IActionResult> SubmitToQad(List<string> invbillNums)
{ {
_globalConfigOptions.IsSyncInvoiceQadState = true;
for (var i = 0; i < invbillNums.Count; i++) for (var i = 0; i < invbillNums.Count; i++)
{ {
await SubmitToQadSingle(invbillNums[i]).ConfigureAwait(false); await SubmitToQadSingle(invbillNums[i]).ConfigureAwait(false);

23
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/InvoiceSyncQadInvocable.cs

@ -2,6 +2,7 @@ using System.Linq;
using System.Linq.Dynamic.Core; using System.Linq.Dynamic.Core;
using System.Threading.Tasks; using System.Threading.Tasks;
using Coravel.Invocable; using Coravel.Invocable;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
@ -53,22 +54,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
} }
var taskIDs = invoiceSyncQads.Select(t => t.TaskID); var taskIDs = invoiceSyncQads.Select(t => t.TaskID);
var teaTaskSubs = _exChangeCenterDbContext.TEA_TASK_SUB.Where(t => taskIDs.Contains(t.TaskID)).ToList(); var teaTaskSubs = _exChangeCenterDbContext.TEA_TASK_SUB.AsNoTracking().Where(t => taskIDs.Contains(t.TaskID)).ToList();
invoiceSyncQads.Join(teaTaskSubs, x => x.TaskID, y => y.TaskID, (x, y) => invoiceSyncQads.ForEach(invoiceSyncQad =>
{ {
x.UpdateTaskState(y.TaskState); var teaTaskSub = teaTaskSubs.FirstOrDefault(t => t.TaskID == invoiceSyncQad.TaskID);
x.UpdateFailedInfo(y.FailedInfo); if (teaTaskSub != null)
return x; {
invoiceSyncQad.UpdateTaskState(teaTaskSub.TaskState);
invoiceSyncQad.UpdateFailedInfo(teaTaskSub.FailedInfo);
}
}); });
await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false);
//var query = from a in invoiceSyncQads
// from b in teaTaskSubs
// where a.TaskID == b.TaskID
// select a;
} }
} }
} }

1
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -527,6 +527,7 @@ namespace Win.Sfs.SettleAccount
private void CreateMapInvoiceSyncQad() private void CreateMapInvoiceSyncQad()
{ {
CreateMap<InvoiceSyncQad, InvoiceSyncQadDto>(); CreateMap<InvoiceSyncQad, InvoiceSyncQadDto>();
CreateMap<InvoiceSyncQad, InvoiceSyncQadExportDto>();
} }
private void CreateMapInvoiceSettledDiff() private void CreateMapInvoiceSettledDiff()

Loading…
Cancel
Save