From 0b048362cc82471d296892666345e25747a4d33d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Thu, 12 Oct 2023 09:22:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=B0=E5=BA=A6=E4=BB=B6?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E5=8D=95=E6=A0=A1=E9=AA=8C=EF=BC=8C=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=E5=8D=95=E6=8D=AE=E5=9F=BA=E7=B1=BB=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E7=B1=BB=E5=9E=8B=E5=AD=97=E6=AE=B5,?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=AC=E5=85=B1=E6=A0=A1=E9=AA=8C=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bases/ADJ_SERVICE.cs | 9 ++++ .../Entities/BQ/PUB_BA_SERVICE.cs | 42 ++++++++++++++- .../Entities/BQ/PUB_CAN_SA_SERVICE.cs | 14 ++++- .../BaseDomainServices/BaseDomainService.cs | 54 ++++++++++++++----- .../SettleAccount.Domain/Bases/EntityBase.cs | 2 + 5 files changed, 105 insertions(+), 16 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs index 6fefb7b4..cc9880d8 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs @@ -260,6 +260,15 @@ namespace Win.Sfs.SettleAccount.Bases { errorEntitylist = await _baseDomainService.CheckPriceList(entityList, inv.Site,true).ConfigureAwait(false); } + + if (inv.BusinessType == EnumBusinessType.YinDuJian) + { + foreach (var itm in entityList) + { + itm.BusinessType = EnumBusinessType.YinDuJian; + } + errorEntitylist = await _baseDomainService.CheckPriceList(entityList, inv.Site, true).ConfigureAwait(false); + } else { errorEntitylist = await _baseDomainService.CheckPriceList(entityList, inv.Site).ConfigureAwait(false); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs index 12a3ef25..6e973699 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs @@ -33,6 +33,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ private readonly ADJ_SERVICE _adjservice; private readonly INormalEfCoreRepository _relationRepository; private readonly INormalEfCoreRepository _pdRepository; + + private readonly INormalEfCoreRepository _priceYinDuRepository; + public PUB_BA_SERVICE(IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository pubRepository, INormalEfCoreRepository repository, INormalEfCoreRepository wRepository, INormalEfCoreRepository sRepository, INormalEfCoreRepository mRepository, INormalEfCoreRepository adjRepository, BBAC_CAN_SA_MNG bbacMng, HBPO_CAN_SA_MNG hbpoMng, PUB_CAN_SA_MNG pubMng, INV_MNG invMng, TaskJobService service, BaseDomainService baseservice, @@ -40,7 +43,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ INormalEfCoreRepository pricebjRepository, ADJ_SERVICE adjservice, INormalEfCoreRepository relationRepository, - INormalEfCoreRepository pdRepository + INormalEfCoreRepository pdRepository, + INormalEfCoreRepository priceYinDuRepository ) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, wRepository, sRepository, mRepository, adjRepository, bbacMng, hbpoMng, pubMng, invMng, service, baseservice) { @@ -49,6 +53,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ _adjservice = adjservice; _relationRepository = relationRepository; _pdRepository = pdRepository; + _priceYinDuRepository = priceYinDuRepository; } /// /// 提交发票 @@ -146,6 +151,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1049", ContractNo = itm.ContractNo }); } } + if (inv.BusinessType == EnumBusinessType.YinDuJian) + { + var priceListYindu = _priceYinDuRepository.ToList();//价格单 + foreach (var itm in priceListYindu) + { + priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1041", ContractNo = itm.ContractNo }); + } + } + else { priceList = _priceRepository.Where(p => p.IsCancel == false && p.ClientCode == inv.Site).ToList();//价格单 @@ -306,6 +320,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1049", ContractNo = itm.ContractNo }); } } + if (inv.BusinessType == EnumBusinessType.YinDuJian) + { + var priceListYindu = _priceYinDuRepository.ToList();//价格单 + foreach (var itm in priceListYindu) + { + priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1041", ContractNo = itm.ContractNo }); + } + } else { priceList = _priceRepository.Where(p => p.IsCancel == false && p.ClientCode == inv.Site).ToList();//价格单 @@ -622,6 +644,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1049", ContractNo = itm.ContractNo }); } } + if (inv.BusinessType == EnumBusinessType.YinDuJian) + { + var priceListYindu = _priceYinDuRepository.ToList();//价格单 + foreach (var itm in priceListYindu) + { + priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1041", ContractNo = itm.ContractNo }); + } + } + + else { priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单 @@ -822,6 +854,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1049", ContractNo = itm.ContractNo }); } } + if (inv.BusinessType == EnumBusinessType.YinDuJian) + { + var priceListYindu = _priceYinDuRepository.ToList();//价格单 + foreach (var itm in priceListYindu) + { + priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1041", ContractNo = itm.ContractNo }); + } + } else { priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs index 0f682dc5..665a3c2f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs @@ -39,6 +39,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { private readonly PUB_CAN_SA_MNG _pubMng; private readonly INormalEfCoreRepository _priceRepository; + private readonly INormalEfCoreRepository _priceYinDuRepository; + private readonly INormalEfCoreRepository _pricebjRepository; private readonly INormalEfCoreRepository _notRepository; @@ -53,7 +55,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ INormalEfCoreRepository pricebjRepository, PUB_CAN_SA_MNG pubMng, BaseDomainService baseservice, - INormalEfCoreRepository notRepository + INormalEfCoreRepository notRepository, + INormalEfCoreRepository priceYinDuRepository ) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, detailRepository, invmng, baseservice) { @@ -61,6 +64,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ _priceRepository = priceRepository; _pricebjRepository = pricebjRepository; _notRepository = notRepository; + _priceYinDuRepository= priceYinDuRepository; } [HttpPost] [UnitOfWork(false)] @@ -83,6 +87,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price ,ClientCode="1049", ContractNo=itm.ContractNo}); } } + if (main.BusinessType == EnumBusinessType.YinDuJian) + { + var priceListbj = _priceYinDuRepository.Where(p => p.IsCancel == false).ToList(); //价格单 + foreach (var itm in priceListbj) + { + priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1041", ContractNo = itm.ContractNo }); + } + } else { priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单 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 d943db3b..327ae02e 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 @@ -22,6 +22,7 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices private readonly INormalEfCoreRepository _relationshipRepository; private readonly INormalEfCoreRepository _priceRepository; private readonly INormalEfCoreRepository _pricebjRepository; + private readonly INormalEfCoreRepository _priceYinDuRepository; private readonly INormalEfCoreRepository _bomshipRepository; public BaseDomainService( IGuidGenerator guidGenerator, @@ -30,12 +31,14 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices INormalEfCoreRepository relationshipRepository, INormalEfCoreRepository bomshipRepository, INormalEfCoreRepository priceRepository, - INormalEfCoreRepository pricebjRepository + INormalEfCoreRepository pricebjRepository, + INormalEfCoreRepository priceYinDuRepository //IExcelImportAppService excelImportService, //ISnowflakeIdGenerator snowflakeIdGenerator, //ICommonManager commonManager ) { + _priceYinDuRepository = priceYinDuRepository; _priceRepository = priceRepository; _pricebjRepository = pricebjRepository; _materialRepository = materialRepository; @@ -260,20 +263,43 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices } else { - var pricelist = _priceRepository.Where(p => p.ClientCode == p_site && p.IsCancel == false).ToList(); + var first= p_list.FirstOrDefault(); - var inner = from d in p_list - join p in pricelist on d.LU equals p.LU - where - d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime - select d; - var left = from d in p_list - join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN } - into temp - from tm in temp.DefaultIfEmpty()//校验错误项 - where tm == null - select d; - errorList = left.ToList(); + if (first.BusinessType == EnumBusinessType.YinDuJian) + { + var pricelist = _priceYinDuRepository.Where(p => p.ClientCode == p_site && p.IsCancel == false).ToList(); + + var inner = from d in p_list + join p in pricelist on d.LU equals p.LU + where + d.SettleDate >= p.BeginDate && d.SettleDate <= p.EndDate + select d; + var left = from d in p_list + join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN } + into temp + from tm in temp.DefaultIfEmpty()//校验错误项 + where tm == null + select d; + errorList = left.ToList(); + + } + else + { + var pricelist = _priceRepository.Where(p => p.ClientCode == p_site && p.IsCancel == false).ToList(); + + var inner = from d in p_list + join p in pricelist on d.LU equals p.LU + where + d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime + select d; + var left = from d in p_list + join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN } + into temp + from tm in temp.DefaultIfEmpty()//校验错误项 + where tm == null + select d; + errorList = left.ToList(); + } } return errorList; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs index 63f0f814..402e46fc 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs @@ -124,6 +124,8 @@ namespace SettleAccount.Bases /// public string GroupNum { set; get; } + public EnumBusinessType BusinessType { get; set; } + } public interface ISA_CAN_BASE : ISBASE