From 3496e04d9dbc67318b30202baa660632b269f1e5 Mon Sep 17 00:00:00 2001 From: zhaoxinyu <89237069@qq.com> Date: Mon, 3 Jun 2024 10:40:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/INVOICE_SERVICE.cs | 44 ++++++++++--- .../Entities/BQ/Syncs/PDMakeService.cs | 11 ++++ .../Entities/BQ/INVOICE_GRP_EXTEND.cs | 61 +++++++++++++++++++ .../src/SettleAccount.Domain/EnumBillState.cs | 3 +- 4 files changed, 111 insertions(+), 8 deletions(-) create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP_EXTEND.cs 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 1da8ccda..f8e0717b 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 @@ -144,21 +144,48 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var invoiceGrps = _settleAccountDbContext.Set() .Where(t => invbillNums.Contains(t.InvbillNum)); - var invoiceBBACGrps = invoiceGrps.Where(p => p.BusinessType == EnumBusinessType.JisBBAC).Where(t => t.State == SettleBillState.已扣减).Select(p=>p.InvbillNum); + var invoiceBBACGrps = invoiceGrps.Where(p => p.BusinessType == EnumBusinessType.JisBBAC).Where(t => t.State == SettleBillState.已扣减); var invoicePubGrps = invoiceGrps.Where(p => p.BusinessType != EnumBusinessType.JisBBAC && p.BusinessType != EnumBusinessType.JisHBPO) - .Where(t => t.State == SettleBillState.已扣减).Select(p=>p.InvbillNum); - var invoiceHbpoGrps = invoiceGrps.Where(p => p.BusinessType == EnumBusinessType.JisHBPO).Where(t => t.State == SettleBillState.已扣减).Select(p=>p.InvbillNum); + .Where(t => t.State == SettleBillState.已扣减); + var invoiceHbpoGrps = invoiceGrps.Where(p => p.BusinessType == EnumBusinessType.JisHBPO).Where(t => t.State == SettleBillState.已扣减); if (invoiceBBACGrps.Any()) { - await CreateBBACTaskAsync(invoiceBBACGrps.ToList()).ConfigureAwait(false); + + var invlist = await invoiceBBACGrps.ToListAsync().ConfigureAwait(false); + foreach (var itm in invlist) + { + itm.State = SettleBillState.发票同步中; + } + await _settleAccountDbContext.BulkUpdateAsync(invlist).ConfigureAwait(false); + + var billinvs=invlist.Select(p => p.InvbillNum).ToList(); + + await CreateBBACTaskAsync(billinvs).ConfigureAwait(false); } if (invoicePubGrps.Any()) { - await CreatePubTaskAsync(invoicePubGrps.ToList()).ConfigureAwait(false); + var invlist = await invoicePubGrps.ToListAsync().ConfigureAwait(false); + foreach (var itm in invlist) + { + itm.State = SettleBillState.发票同步中; + } + await _settleAccountDbContext.BulkUpdateAsync(invlist).ConfigureAwait(false); + + var billinvs = invlist.Select(p => p.InvbillNum).ToList(); + + await CreatePubTaskAsync(billinvs).ConfigureAwait(false); } if (invoiceHbpoGrps.Any()) { - await CreateHBPOTaskAsync(invoiceHbpoGrps.ToList()).ConfigureAwait(false); + var invlist = await invoiceHbpoGrps.ToListAsync().ConfigureAwait(false); + foreach (var itm in invlist) + { + itm.State = SettleBillState.发票同步中; + } + await _settleAccountDbContext.BulkUpdateAsync(invlist).ConfigureAwait(false); + + var billinvs = invlist.Select(p => p.InvbillNum).ToList(); + await CreateHBPOTaskAsync(billinvs).ConfigureAwait(false); } return new OkResult(); @@ -819,6 +846,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ private async Task CreateBBACTaskAsync(List invoiceGrps) { + + var invDetails = await _settleAccountDbContext.Set().Where(p => invoiceGrps.Contains(p.InvbillNum)).AsNoTracking().ToListAsync().ConfigureAwait(false); foreach (var itm in invoiceGrps) { @@ -924,9 +953,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ private async Task CreateHBPOTaskAsync(List invoiceGrps) { + var invDetails=await _settleAccountDbContext.Set().Where(p =>invoiceGrps.Contains(p.InvbillNum)).AsNoTracking().ToListAsync().ConfigureAwait(false); - + foreach (var itm in invoiceGrps) { var ls = invDetails.Where(p => p.InvbillNum == itm).ToList(); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PDMakeService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PDMakeService.cs index 3661935c..bb979b9b 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PDMakeService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PDMakeService.cs @@ -109,6 +109,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs { var entitys = invList.Where(p => newlist.Contains(p.InvbillNum)).ToList(); var entityDetail = _dbcontext.Set().Where(p => newlist.Contains(p.InvbillNum)).ToList();//结算明细 + + + + + + var adjlist = _dbcontext.Set().Where(p => newlist.Contains(p.InvBillNum)).ToList();//发票关联调整表明细 if (adjlist != null && adjlist.Count > 0) { @@ -185,6 +191,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs bbacDetail.Add(detail); } + + + + + _dbcontext.BulkInsert(bbacmainlist); _dbcontext.BulkInsert(bbacDetail); foreach (var itm in invList) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP_EXTEND.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP_EXTEND.cs new file mode 100644 index 00000000..77d00894 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP_EXTEND.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities; + +namespace Win.Sfs.SettleAccount.Entities.BQ +{ + public class INVOICE_GRP_EXTEND:Entity + { + + public string invoiceNumber { get; set; } + public string sasInvoiceNumber { get; set; } + public string Customer { get; set; } + public string BillTo { get; set; } + public DateTime InvoiceDate { get; set; } + public string Site { get; set; } + public string TYPE { get; set; } + public string PartNumber { get; set; } + public decimal InvoiceQuatity { get; set; } + public decimal Price { get; set; } + public string Supplier { get; set; } + public string Remark { get; set; } + public decimal InvoiceNetAmount { get; set; } + public decimal InvoiceTaxAmount { get; set; } + public decimal TaxRate { get; set; } + public string Location { get; set; } + public decimal InvoiceNet { get; set; } + public decimal InvoiceTax { get; set; } + public string commandtype { get; set; } + public string domain { get; set; } + public string LINE { get; set; } + + public INVOICE_GRP_EXTEND(string invoiceNumber, string sasInvoiceNumber, string customer, string billTo, DateTime invoiceDate, string site, string tYPE, string partNumber, decimal invoiceQuatity, decimal price, string supplier, string remark, decimal invoiceNetAmount, decimal invoiceTaxAmount, decimal taxRate, string location, decimal invoiceNet, decimal invoiceTax, string commandtype, string domain, string lINE) + { + this.invoiceNumber = invoiceNumber; + this.sasInvoiceNumber = sasInvoiceNumber; + Customer = customer; + BillTo = billTo; + InvoiceDate = invoiceDate; + Site = site; + TYPE = tYPE; + PartNumber = partNumber; + InvoiceQuatity = invoiceQuatity; + Price = price; + Supplier = supplier; + Remark = remark; + InvoiceNetAmount = invoiceNetAmount; + InvoiceTaxAmount = invoiceTaxAmount; + TaxRate = taxRate; + Location = location; + InvoiceNet = invoiceNet; + InvoiceTax = invoiceTax; + this.commandtype = commandtype; + this.domain = domain; + LINE = lINE; + } + } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs index 8501fc94..fe91be69 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs @@ -37,7 +37,8 @@ namespace Win.Sfs.SettleAccount 发票生成中 = 10, [Description("扣减单生成中")] 扣减单生成中 = 11, - + [Description("发票同步中")] + 发票同步中 = 12, }