From 14a5986d153d951f6eae44df79e2b8696bfaca38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Wed, 20 Nov 2024 08:31:00 +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 --- .../BQ/Syncs/GenerateJisInvoiceService.cs | 41 ++++++++++++++----- .../Entities/BQ/INVOICE_GRP.cs | 4 ++ 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/GenerateJisInvoiceService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/GenerateJisInvoiceService.cs index 86f5f6c3..d5f4a556 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/GenerateJisInvoiceService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/GenerateJisInvoiceService.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.Json; using System.Threading.Tasks; using AutoMapper; using CodeArts.Db.Lts; @@ -12,6 +13,7 @@ using EFCore.BulkExtensions; using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; using Minio.DataModel; using Org.BouncyCastle.Asn1.Cmp; using SettleAccount.Bases; @@ -50,9 +52,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs public class GenerateJisInvoiceService : ApplicationService, ITransientDependency, IExportJob { protected readonly SettleAccountDbContext _dbcontext; - public GenerateJisInvoiceService(SettleAccountDbContext dbcontext) + protected readonly ILogger _log; + public GenerateJisInvoiceService(SettleAccountDbContext dbcontext, ILogger log) { _dbcontext = dbcontext; + _log = log; } public string ExportFile(Guid id, List exportName, List property) { @@ -657,16 +661,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs } } - - var groupList = new List(); - var notDetialList = new List(); - var detailList = new List(); - var invlist = new List(); - var salist = new List(); - var adjlist = new List(); +; foreach (var big in biglist)//单条大于1000W的开票,拆成多张 { + + var groupList = new List(); + var notDetialList = new List(); + var detailList = new List(); + var invlist = new List(); + var salist = new List(); + var adjlist = new List(); + var list = p_list.Where(p => p.InvGroupNum == big.InvGroupNum && p.PartCode == big.PartCode && p.Price == big.Price && p.LU == big.LU ); var gener = new InvoiceGeneratorSame(); @@ -921,6 +927,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs } } } + + + _log.LogDebug(JsonSerializer.Serialize(invlist)); + + + + + + //foreach (var itm in invlist) + //{ + // itm.SetId(Guid.NewGuid()); + //} _dbcontext.BulkInsert(invlist); _dbcontext.BulkInsert(groupList); _dbcontext.BulkInsert(detailList); @@ -964,6 +982,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs } if (smalllist.Count > 0) { + smalllist = smalllist.OrderBy(p => p.Amt).ToList(); _invls = GenSecInvoice(smalllist, p_list, p_adjlist, dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType); } @@ -1045,7 +1064,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs foreach (var sitm in sq) { innotls.Add(new INVOICE_NOT_SETTLE( - guid: GuidGenerator.Create(), + guid: Guid.NewGuid(), version: p_version, invGroupNum: p_InvGroupNum, settleGroupNum: sitm.GroupNum, @@ -1069,7 +1088,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs foreach (var sitm in sq) { innotls.Add(new INVOICE_NOT_SETTLE( - guid: GuidGenerator.Create(), + guid: Guid.NewGuid(), version: p_version, invGroupNum: p_InvGroupNum, settleGroupNum: sitm.GroupNum, @@ -1118,7 +1137,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs } var invbill = new INVOICE_GRP ( - guid: GuidGenerator.Create(), + guid: Guid.NewGuid(), realnvBillNum: string.Empty, invbillNum: inv.InvBillNum, amt: amt, diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs index 351a4363..1234dad1 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs @@ -92,6 +92,10 @@ namespace SettleAccount.Domain.BQ } + public void SetId(Guid guid) + { + Id = guid; + } public INVOICE_GRP() { }