From e19efe6b1aec8a4488c0809c823f43b565167abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Fri, 1 Sep 2023 13:11:00 +0800 Subject: [PATCH 1/2] =?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 --- .../BaseDomainServices/BaseDomainService.cs | 35 ++++++++++++++++--- .../Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs | 8 +---- .../Entities/BQ/Managers/INV_MNG.cs | 11 ++++++ 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs index 9d8902b3..99ed2e02 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs @@ -1,3 +1,5 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; using SettleAccount.Bases; using System; using System.Collections.Generic; @@ -39,9 +41,9 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices INormalEfCoreRepository bomshipRepository, INormalEfCoreRepository priceRepository, INormalEfCoreRepository pricebjRepository - //IExcelImportAppService excelImportService, - //ISnowflakeIdGenerator snowflakeIdGenerator, - //ICommonManager commonManager + //IExcelImportAppService excelImportService, + //ISnowflakeIdGenerator snowflakeIdGenerator, + //ICommonManager commonManager ) { _priceRepository = priceRepository; @@ -52,6 +54,31 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices } + public static async Task DoWorkBulkWithTransaction(DbContext dbContext, Action p_dowork) + { + using (var transaction = await dbContext.Database.BeginTransactionAsync()) + { + try + { + // 执行批量数据操作 + p_dowork(); + // 提交事务 + await transaction.CommitAsync(); + } + catch (Exception) + { + // 回滚事务 + await transaction.RollbackAsync(); + + + throw; + } + } + } + + + + public async Task> CheckBase(List p_list, BASE_CONF p_config) { @@ -67,7 +94,6 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices from tm in temp.DefaultIfEmpty() where tm == null select itm; - foreach (var itm1 in query.ToList()) { errorList.Add(itm1); @@ -75,7 +101,6 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices } if (p_config.IsMaterial == true) { - var materialList = await _materialRepository.ToListAsync(); var query = from itm in partList join itm1 in materialList on itm equals itm1.MaterialCode diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs index a5b13479..08f2292a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs @@ -52,13 +52,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers { return true; } - return false; - + return false; } - - - - /// ///正向流程 /// @@ -68,7 +63,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers /// public virtual async Task SetForwardState(string p_billNum, SettleBillState state) { - var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList(); if (ls == null && ls.Count ==0) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs index 2ba51274..edd4ae39 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.SignalR; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.EntityFrameworkCore; using NPOI.SS.Formula.Functions; +using NPOI.Util; using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; using SettleAccount.Bases; using SettleAccount.Domain.BQ; @@ -1509,10 +1510,20 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers _invls = invlist.Select(p => p.InvbillNum).ToList(); } + + + + + + return _invls; } + + + + /// /// hbpojis From c1cae97b6f5eea3c751e34a02a0cd2f3506f1a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Fri, 1 Sep 2023 13:57:08 +0800 Subject: [PATCH 2/2] =?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/Managers/BBAC_NOT_SA_MNG.cs | 2 +- .../SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs index ed9ca806..4c3f6279 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs @@ -33,7 +33,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers public BBAC_NOT_SA_MNG ( BaseDomainService service, - INormalEfCoreRepository repository, + INormalEfCoreRepository repository, INormalEfCoreRepository detailRepository, INormalEfCoreRepository notRepository ) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs index 484a3b52..b65a42f5 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs @@ -66,7 +66,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers var first= p_list.FirstOrDefault(); if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO - || first.BusinessType == EnumBusinessType.BeiJian + || first.BusinessType == EnumBusinessType.BeiJian || first.BusinessType == EnumBusinessType.YinDuJian ) { var ls = p_list.Select(p => p.GroupNum).Distinct().ToList();