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