Browse Source

定时同步Qad发票处理状态

master
mahao 1 year ago
parent
commit
35dce8fcd5
  1. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  2. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/InvoiceSyncQadInvocable.cs
  3. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/InvoiceSyncQad.cs
  4. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SAS_INVOICE.cs

9
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<TED_SAS_INVOICE>().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<Exception>().WaitAndRetryAsync(new[] {
@ -280,22 +280,21 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
await _exChangeCenterDbContext.Set<TEA_TASK_SUB>().AddAsync(teaTaskSub).ConfigureAwait(false);
await _exChangeCenterDbContext.Set<TED_SAS_INVOICE>().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);
}
}
/// <summary>
/// 构建发票同步Qad状态表数据
/// </summary>
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<InvoiceSyncQad>().AddAsync(invoiceSyncQad).ConfigureAwait(false);
}

5
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);

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

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

Loading…
Cancel
Save