From 35dce8fcd562b9725295e1836fb3125c67ed8e5a Mon Sep 17 00:00:00 2001 From: mahao Date: Mon, 16 Oct 2023 11:48:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E5=90=8C=E6=AD=A5Qad?= =?UTF-8?q?=E5=8F=91=E7=A5=A8=E5=A4=84=E7=90=86=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/INVOICE_SERVICE.cs | 9 ++++----- .../Entities/BQ/Syncs/InvoiceSyncQadInvocable.cs | 5 +++++ .../SettleAccount.Domain/Entities/BQ/InvoiceSyncQad.cs | 5 +++++ .../SettleAccount.Domain/Entities/BQ/TED_SAS_INVOICE.cs | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs index af43b551..1525a587 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs @@ -199,7 +199,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ await _exChangeCenterDbContext.Set().AddRangeAsync(tedSaInvs).ConfigureAwait(false); invoiceGrp.State = SettleBillState.已提交QAD; //构建发票同步Qad状态表数据 - await BindInvoiceSyncQadAsync(teaTaskSub, invoiceGrp.RealnvBillNum, invoiceGrp.InvbillNum, invoiceGrp.ClientCode, "").ConfigureAwait(false); + await BindInvoiceSyncQadAsync(teaTaskSub, invoiceGrp.RealnvBillNum, invoiceGrp.InvbillNum, invoiceGrp.ClientCode).ConfigureAwait(false); await _exChangeCenterDbContext.SaveChangesAsync().ConfigureAwait(false); var retryPolicyAsync = Policy.Handle().WaitAndRetryAsync(new[] { @@ -280,22 +280,21 @@ namespace Win.Sfs.SettleAccount.Entities.BQ await _exChangeCenterDbContext.Set().AddAsync(teaTaskSub).ConfigureAwait(false); await _exChangeCenterDbContext.Set().AddRangeAsync(tedSaInvs).ConfigureAwait(false); //构建发票同步Qad状态表数据 - await BindInvoiceSyncQadAsync(teaTaskSub, invoiceGrp.RealnvBillNum, invoiceGrp.InvbillNum, invoiceGrp.ClientCode, "").ConfigureAwait(false); + await BindInvoiceSyncQadAsync(teaTaskSub, invoiceGrp.RealnvBillNum, invoiceGrp.InvbillNum, invoiceGrp.ClientCode).ConfigureAwait(false); } } /// /// 构建发票同步Qad状态表数据 /// - private async Task BindInvoiceSyncQadAsync(TEA_TASK_SUB teaTaskSub, string invoiceNumber, string sasInvoiceNumber, string customer, string voucher) + private async Task BindInvoiceSyncQadAsync(TEA_TASK_SUB teaTaskSub, string invoiceNumber, string sasInvoiceNumber, string customer) { var invoiceSyncQad = new InvoiceSyncQad(teaTaskSub.TaskID, invoiceNumber, sasInvoiceNumber) { TableName = teaTaskSub.TableName, Domain = teaTaskSub.Domain, Site = teaTaskSub.Site, - Customer = customer, - Voucher = voucher + Customer = customer }; await _settleAccountDbContext.Set().AddAsync(invoiceSyncQad).ConfigureAwait(false); } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/InvoiceSyncQadInvocable.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/InvoiceSyncQadInvocable.cs index 43883be0..c1a61476 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/InvoiceSyncQadInvocable.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/InvoiceSyncQadInvocable.cs @@ -61,6 +61,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs { invoiceSyncQad.UpdateTaskState(teaTaskSub.TaskState); invoiceSyncQad.UpdateFailedInfo(teaTaskSub.FailedInfo); + var tedSasInvoice = _exChangeCenterDbContext.TED_SAS_INVOICE.AsNoTracking().FirstOrDefault(t => t.Taskid == teaTaskSub.TaskID); + if (tedSasInvoice != null) + { + invoiceSyncQad.UpdateVoucher(tedSasInvoice.Voucher); + } } }); await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/InvoiceSyncQad.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/InvoiceSyncQad.cs index f87f6e86..20b27a89 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/InvoiceSyncQad.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/InvoiceSyncQad.cs @@ -89,5 +89,10 @@ namespace SettleAccount.Domain.BQ { FailedInfo = failedInfo; } + + public void UpdateVoucher(string voucher) + { + Voucher = voucher; + } } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SAS_INVOICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SAS_INVOICE.cs index 8be53ead..850358c5 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SAS_INVOICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SAS_INVOICE.cs @@ -34,5 +34,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ public Guid Dataid { get; set; } [Key] public Guid GUID { get; set; } + public string Voucher { get; set; } } }