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; } } }