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.Syncs;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.Options;
namespace Win.Sfs.SettleAccount
{
@ -52,6 +53,7 @@ namespace Win.Sfs.SettleAccount
});
services.AddSingleton<JisBBACSeEdiCompareAppService>();
services.AddSingleton<JisHBPOSeEdiCompareAppService>();
services.AddSingleton<InvoiceSyncQadInvocable>();
services.AddSignalR(o => o.EnableDetailedErrors = true);
JobHostdService.AddService(services);
services.AddSingleton<JobHostdService>();
@ -70,6 +72,10 @@ namespace Win.Sfs.SettleAccount
options.MaxRequestBodySize = 268435456;
options.AllowSynchronousIO = true;
});
services.Configure<GlobalConfigOptions>(options =>
{
options.IsSyncInvoiceQadState = true;
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
@ -83,6 +89,7 @@ namespace Win.Sfs.SettleAccount
{
scheduler.Schedule<JisBBACSeEdiCompareAppService>().EveryMinute();
scheduler.Schedule<JisHBPOSeEdiCompareAppService>().EveryMinute();
scheduler.Schedule<InvoiceSyncQadInvocable>().EveryMinute();
});
var contentTypeProvider = new FileExtensionContentTypeProvider();
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.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Polly;
using SettleAccount.Domain.BQ;
using Shouldly;
@ -31,6 +32,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.Options;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
@ -49,6 +51,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// 数据中心数据上下文
/// </summary>
private readonly ExChangeCenterDbContext _exChangeCenterDbContext;
private readonly GlobalConfigOptions _globalConfigOptions;
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository;
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository;
@ -64,6 +67,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
ILogger<BASE_SERVICE> logger,
SettleAccountDbContext settleAccountDbContext,
ExChangeCenterDbContext exChangeCenterDbContext,
IOptions<GlobalConfigOptions> options,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager,
@ -83,6 +87,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_logger = logger;
_settleAccountDbContext = settleAccountDbContext;
_exChangeCenterDbContext = exChangeCenterDbContext;
_globalConfigOptions = options.Value;
_baseservice = baseservice;
_repository = repository;
_wRepository = wRepository;
@ -109,6 +114,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[HttpPost]
public virtual async Task<IActionResult> SubmitToQad(List<string> invbillNums)
{
_globalConfigOptions.IsSyncInvoiceQadState = true;
for (var i = 0; i < invbillNums.Count; i++)
{
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.Threading.Tasks;
using Coravel.Invocable;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using SettleAccount.Domain.BQ;
@ -53,22 +54,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
}
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);
x.UpdateFailedInfo(y.FailedInfo);
return x;
var teaTaskSub = teaTaskSubs.FirstOrDefault(t => t.TaskID == invoiceSyncQad.TaskID);
if (teaTaskSub != null)
{
invoiceSyncQad.UpdateTaskState(teaTaskSub.TaskState);
invoiceSyncQad.UpdateFailedInfo(teaTaskSub.FailedInfo);
}
});
//var query = from a in invoiceSyncQads
// from b in teaTaskSubs
// where a.TaskID == b.TaskID
// select a;
await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false);
}
}
}

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

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

Loading…
Cancel
Save