From 16dd3c6acf3f0f9ad2dd0bf693f2ae538e283cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Sat, 9 Sep 2023 09:31:42 +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 --- .../Bases/ADJ_SERVICE.cs | 20 ++++--- .../Bases/BA_SERVICE.cs | 52 +++++++++---------- .../Bases/CAN_SA_SERVICE.cs | 6 +-- .../Entities/BQ/BBAC_BA_SERVICE.cs | 9 ++-- .../Entities/BQ/BBAC_CAN_SA_SERVICE.cs | 5 +- .../Entities/BQ/HBPO_BA_SERVICE.cs | 4 +- .../Entities/BQ/HBPO_CAN_SA_SERVICE.cs | 4 +- .../Entities/BQ/INVOICE_SERVICE.cs | 11 ++++ .../Entities/BQ/PUB_BA_SERVICE.cs | 6 +-- .../Entities/BQ/PUB_CAN_SA_SERVICE.cs | 5 +- .../BaseDomainServices/BaseDomainService.cs | 7 +-- .../SettleAccount.Domain/Bases/EntityBase.cs | 7 +++ .../Entities/BQ/BBAC_CAN_SA.cs | 4 +- .../Entities/BQ/HBPO_CAN_SA.cs | 4 +- .../Entities/BQ/INVOICE_GRP.cs | 3 ++ .../Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs | 4 +- .../Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs | 4 +- .../Entities/BQ/Managers/INV_MNG.cs | 25 ++++++++- .../Entities/BQ/Managers/PUB_NOT_SA_MNG.cs | 6 ++- .../Entities/BQ/PUB_CAN_SA.cs | 4 +- 20 files changed, 123 insertions(+), 67 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 3615febe..450d0719 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 @@ -133,7 +133,7 @@ public class ADJ_SERVICE : BASE_SERVICE errorList.Add( new ErrorExportDto() { ItemCode = $"{itm}", Message = $"[客户零件关系表]不存在客户零件号{itm}" }); } - var errorEntitylist = await _baseDomainService.CheckPriceList(entityList); + var errorEntitylist = await _baseDomainService.CheckPriceList(entityList,"1040"); if (errorEntitylist.Count > 0) { foreach (var itm in errorEntitylist) @@ -193,10 +193,14 @@ public class ADJ_SERVICE : BASE_SERVICE int flag = 0; var keylist = p_list.Select(p => p.KeyCode).Distinct(); List errorList = new List(); + //var inv = _invRepository.Where(p => p.InvbillNum == first.InvBillNum).FirstOrDefault(); + var first = p_list.FirstOrDefault(); + var inv = _invRepository.Where(p => p.InvbillNum == first.InvBillNum).FirstOrDefault(); + if (first != null) { - var inv = _invRepository.Where(p => p.InvbillNum == first.InvBillNum).FirstOrDefault(); + string keyname = string.Empty; List adjlist = new List(); @@ -257,6 +261,10 @@ public class ADJ_SERVICE : BASE_SERVICE } } + + + + var entityList = ObjectMapper.Map, List>(p_list); var codelist = entityList.Select(p => p.LU).ToList(); var errors = await _baseDomainService.CheckBase(codelist, new BASE_CONF() { IsRelationShip = true }); @@ -265,7 +273,7 @@ public class ADJ_SERVICE : BASE_SERVICE errorList.Add( new ERR_EXP_DTO() { ItemCode = $"{itm}", Message = $"[客户零件关系表]不存在客户零件号{itm}" }); } - var errorEntitylist = await _baseDomainService.CheckPriceList(entityList); + var errorEntitylist = await _baseDomainService.CheckPriceList(entityList,inv.Site); if (errorEntitylist.Count > 0) { foreach (var itm in errorEntitylist) @@ -275,7 +283,7 @@ public class ADJ_SERVICE : BASE_SERVICE } if (errorList.Count > 0) { - return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message= "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) }); + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) }); } List ls = new List(); @@ -287,7 +295,7 @@ public class ADJ_SERVICE : BASE_SERVICE var inner = from d in p_list join p in pricebjlist on d.LU equals p.LU where - d.SettleDate >= p.BeginDate && d.SettleDate <= p.EndDate + d.SettleDate >= p.BeginDate && d.SettleDate <= p.EndDate select new PUB_ADJ_DETAIL_DTO() { @@ -310,7 +318,7 @@ public class ADJ_SERVICE : BASE_SERVICE 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 + d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.ClientCode== inv.Site select new PUB_ADJ_DETAIL_DTO() { InvBillNum = d.InvBillNum, diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs index 523fb058..c85fa2f2 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs @@ -164,28 +164,28 @@ namespace Win.Sfs.SettleAccount.Bases var wquery = from itm in AMap join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp - select from tm in temp.DefaultIfEmpty() - select - new INVOICE_WAIT_DETAIL_BBAC_DTO() - { - - PartDesc=tm==null?string.Empty:itm.PartDesc, - InvDate = itm1.CreationTime, - RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum, - Version = itm.Version, - InvbillNum = itm.InvbillNum, - InvGroupNum = itm.InvGroupNum, - LU = itm.LU, - PartCode = itm.PartCode, - PRICE = itm.PRICE, - Qty = itm.Qty, - Amt = itm.Amt, - BussiessType = itm.BussiessType, - Extend1 = itm.Extend1, - BeginDate = itm.BeginDate, - EndDate = itm.EndDate, - }; - entity.INVOICE_WAIT_DETAIL_BBAC = AMap; + from tm in temp.DefaultIfEmpty() + select + new INVOICE_WAIT_DETAIL_BBAC_DTO() + { + + PartDesc = tm == null ? string.Empty : itm.PartDesc, + InvDate = itm1.CreationTime, + RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum, + Version = itm.Version, + InvbillNum = itm.InvbillNum, + InvGroupNum = itm.InvGroupNum, + LU = itm.LU, + PartCode = itm.PartCode, + PRICE = itm.PRICE, + Qty = itm.Qty, + Amt = itm.Amt, + BussiessType = itm.BussiessType, + Extend1 = itm.Extend1, + BeginDate = itm.BeginDate, + EndDate = itm.EndDate, + }; + entity.INVOICE_WAIT_DETAIL_BBAC = wquery.ToList(); } else if (invs.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian) { @@ -195,7 +195,7 @@ namespace Win.Sfs.SettleAccount.Bases var wquery = from itm in BMap join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp - select from tm in temp.DefaultIfEmpty() + from tm in temp.DefaultIfEmpty() select new INVOICE_WAIT_DETAIL_BJ_DTO() { @@ -215,7 +215,7 @@ namespace Win.Sfs.SettleAccount.Bases BeginDate = itm.BeginDate, EndDate = itm.EndDate, }; - entity.INVOICE_WAIT_DETAIL_BJ = BMap; + entity.INVOICE_WAIT_DETAIL_BJ = wquery.ToList(); } else { @@ -224,7 +224,7 @@ namespace Win.Sfs.SettleAccount.Bases var wquery = from itm in wdtos join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp - select from tm in temp.DefaultIfEmpty() + from tm in temp.DefaultIfEmpty() select new INVOICE_WAIT_DETAIL_DTO() { @@ -550,7 +550,7 @@ namespace Win.Sfs.SettleAccount.Bases var inner = from d in dto1s join p in p_pricelist on d.LU equals p.LU where - d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime + d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && d.Site==p.ClientCode && p.IsCancel==false select d; var left = from d in dto1s join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs index 9b62c79c..013bec78 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs @@ -256,17 +256,17 @@ namespace Win.Sfs.SettleAccount.Bases /// /// /// - protected async Task> CheckInvoiceGenerationRules(List dto1s, List p_pricelist,EnumBusinessType p_businessType) where T : SA_CAN_BASE + protected async Task> CheckInvoiceGenerationRules(List dto1s,string p_site, List p_pricelist,EnumBusinessType p_businessType) where T : SA_CAN_BASE { //var maxDate = p_pricelist.Max(p => p.Date); - var prices = p_pricelist.Where(p => p.IsCancel == false).ToList(); + var prices = p_pricelist.Where(p =>p.ClientCode==p_site && p.IsCancel == false).ToList(); var inner = from d in dto1s join p in prices on d.LU equals p.LU where - d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime + d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.ClientCode==d.Site && p.IsCancel == false select d; var ls = inner.ToList(); var left = from d in dto1s diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs index 23fbd21b..da51134d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs @@ -164,7 +164,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in dto1s join p in priceList on d.PartCode equals p.LU - where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && d.Site==p.ClientCode && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号 select new TEMP_CAN_SA_DETAIL { Id = d.Id, @@ -291,8 +291,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ } var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in dto1s - join p in priceList on d.LU equals p.LU - where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 + join p in priceList on d.LU equals p.LU + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.ClientCode==inv.Site && p.IsCancel==false//客户零件号 select new TEMP_CAN_SA_DETAIL { Id=d.Id, @@ -413,7 +413,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ } var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据 var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); - var priceList = _priceRepository.ToList();//价格单 //var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); //if (errorList.Count() > 0) @@ -423,7 +422,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in dto1s join p in priceList on d.LU equals p.LU - where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号 select new TEMP_CAN_SA_DETAIL { Id = d.Id, diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs index 184cc433..41f633b9 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs @@ -94,11 +94,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ return new JsonResult(new { Code = 400, Message = "已创建发票不能重复创建" }); } var entitys = await _bbacMng.GetDetalListAsync(invbillNum);//可结算 + var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList(); var datetime = priceList.Select(p => p.Date).Max(); var prices = priceList.Where(p => p.Date == datetime).ToList(); ;//价格单 - var errorList = await CheckInvoiceGenerationRules(entitys, prices, main.BusinessType);//校验生成规则 + var errorList = await CheckInvoiceGenerationRules(entitys,main.Site,prices, main.BusinessType);//校验生成规则 if (errorList.Count() > 0) { return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) }); @@ -111,7 +112,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in dto1s join p in prices on d.LU equals p.LU - where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode ==main.Site select new TEMP_CAN_SA_DETAIL { SettleBillNum = d.SettleBillNum, diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs index 696e6d0a..7fefdf26 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs @@ -248,7 +248,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ // var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in entitys join p in priceList on d.LU equals p.LU - where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel==false && p.ClientCode==inv.Site select new TEMP_CAN_SA_DETAIL { SettleBillNum = d.SettleBillNum, @@ -381,7 +381,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in dto1s join p in priceList on d.PartCode equals p.LU - where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号 select new TEMP_CAN_SA_DETAIL { Id = d.Id, diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs index 801b203c..9392f435 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs @@ -89,7 +89,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ } var entitys = await _hbpoMng.GetDetalListAsync(invbillnum); var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList(); //价格单 - var errorList = await CheckInvoiceGenerationRules(entitys, priceList, main.BusinessType);//校验生成规则 + var errorList = await CheckInvoiceGenerationRules(entitys,main.Site,priceList, main.BusinessType);//校验生成规则 if (errorList.Count() > 0) { return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) }); @@ -103,7 +103,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in dto1s join p in priceList on d.LU equals p.LU - where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == main.Site select new TEMP_CAN_SA_DETAIL { SettleBillNum = d.SettleBillNum, 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 063e18b4..010dbb70 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 @@ -2,6 +2,7 @@ using CodeArts.Db; using DocumentFormat.OpenXml.Bibliography; using DocumentFormat.OpenXml.Drawing.Diagrams; using DocumentFormat.OpenXml.Spreadsheet; +using DocumentFormat.OpenXml.Wordprocessing; using EFCore.BulkExtensions; using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Csv; @@ -32,6 +33,7 @@ using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Managers; +using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.Shared.RepositoryBase; @@ -337,6 +339,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ ); return _fileName; } + + + + /// /// 导出发票组明细 /// @@ -354,6 +360,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); + + var first=entities.FirstOrDefault(); + + + var dtoDetails = ObjectMapper.Map, List>(entities); var invdetail= await DetailQueryAsync(input); var m = invdetail.INVOICE_MAP_GROUP; 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 90d9c5b1..d5048155 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 @@ -152,7 +152,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ // var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in entitys join p in priceList on d.LU equals p.LU - where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site select new TEMP_CAN_SA_DETAIL { SettleBillNum = d.SettleBillNum, @@ -280,7 +280,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ // var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in entitys join p in priceList on d.PartCode equals p.LU - where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site select new TEMP_CAN_SA_DETAIL { SettleBillNum = d.SettleBillNum, @@ -413,7 +413,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in dto1s join p in priceList on d.PartCode equals p.LU - where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号 select new TEMP_CAN_SA_DETAIL { Id = d.Id, 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 da1143dd..88edf6fd 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 @@ -91,19 +91,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单 } - var errorList = await CheckInvoiceGenerationRules(entitys, priceList, main.BusinessType);//校验生成规则 + var errorList = await CheckInvoiceGenerationRules(entitys,main.Site,priceList, main.BusinessType);//校验生成规则 if (errorList.Count() > 0) { return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) }); } - if (await _pubMng.SetForwardState(main, SettleBillState.已开票)) { var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in dto1s join p in priceList on d.LU equals p.LU - where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == main.Site select new TEMP_CAN_SA_DETAIL { Id = d.Id, 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 41d118bd..3a38ddd7 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,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using SettleAccount.Bases; +using SettleAccount.Domain.BQ; using System; using System.Collections.Generic; using System.Linq; @@ -200,7 +201,7 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices return errorList; } - public async Task> CheckPriceList(List p_list,bool isBj=false) + public async Task> CheckPriceList(List p_list,string p_site,bool isBj=false) where TEntity : ISA_BASE,new() { List errorList = new List(); @@ -225,7 +226,7 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices } else { - var pricebjlist = _priceRepository.ToList(); + var pricebjlist = _priceRepository.Where(p=>p.ClientCode==p_site).ToList(); var inner = from d in p_list join p in pricebjlist on d.LU equals p.LU @@ -244,8 +245,8 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices 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 86b2c895..eade44b7 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs @@ -399,6 +399,10 @@ namespace SettleAccount.Bases /// 匹配类型 /// public EnumMappingType MappingType { get; set; } + + + + } public class SA_CAN_BASE : AuditedAggregateRoot, ISA_BASE @@ -461,6 +465,9 @@ namespace SettleAccount.Bases public string PartCode { get; set; } public string RealPartCode { get; set; } + + public string Site { get; set; } + //public SA_CAN_BASE(int version, decimal price, string billNum, DateTime settleDate, string invGroupNum, string lU, string pN, string keyCode, decimal qty, string groupNum) //{ // Version = version; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs index c5274dc2..210f8fd6 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs @@ -88,8 +88,8 @@ public class BBAC_CAN_SA_DETAIL: SA_CAN_BASE /// /// 选择工厂导入 /// - [Display(Name = "工厂地点")] - public string Site { get; set; } = null!; + //[Display(Name = "工厂地点")] + //public string Site { get; set; } = null!; /// /// 对应字段Quantity diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs index 91631388..a0056364 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs @@ -90,8 +90,8 @@ public class HBPO_CAN_SA_DETAIL:SA_CAN_BASE /// /// 对应字段filename 区分 cn1、cn5 /// - [Display(Name = "工厂地点")] - public string Site { get; set; } = null!; + //[Display(Name = "工厂地点")] + //public string Site { get; set; } = null!; ///// ///// 对应字段Qty 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 9bc935fd..82806eb2 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 @@ -56,6 +56,9 @@ public class INVOICE_GRP : FullAuditedAggregateRoot public decimal RealAmt { get; set; } + [Display(Name = "地点")] + public string Site { get; set; } + 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 4c3f6279..ec715ff8 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 @@ -47,9 +47,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers public virtual async Task> GenerateSettlementOrder(List p_list) { + var first = p_list.FirstOrDefault(); List errors = new List(); - var priceErrors = await _service.CheckPriceList(p_list); + var priceErrors = await _service.CheckPriceList(p_list,first.Site); if (priceErrors.Count > 0) { foreach (var itm in priceErrors) @@ -70,6 +71,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers _entity.Version = int.Parse(DateTime.Now.ToString("yyyyMM")); _entity.State = SettleBillState.未结状态; _entity.SettleBillNum = string.Empty; + _entity.Site = first.Site; _entity.BusinessType = EnumBusinessType.JisBBAC; var _entityList = new List(); foreach (var itm in p_list) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs index 7caa22ab..ee2caaed 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs @@ -29,7 +29,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers private readonly INormalEfCoreRepository _detailRepository; private readonly INormalEfCoreRepository _notRepository; private readonly BaseDomainService _service; - public HBPO_NOT_SA_MNG() { } @@ -51,7 +50,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers { var first=p_list.FirstOrDefault(); List errors = new List(); - var priceErrors = await _service.CheckPriceList(p_list); + var priceErrors = await _service.CheckPriceList(p_list,first.Site); if (priceErrors.Count > 0) { foreach (var itm in priceErrors) @@ -83,6 +82,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers _entity.SettleBillNum = string.Empty; _entity.BusinessType = p_list.FirstOrDefault().BusinessType; _entity.SetId(Guid.NewGuid()); + _entity.Site = first.Site; var _entityList = new List(); foreach (var itm in p_list) { 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 2c0db594..baff71d6 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 @@ -1,6 +1,7 @@ using EFCore.BulkExtensions; using EmptyFiles; using Hangfire; +using Microsoft.AspNetCore.Razor.Language.Intermediate; using Microsoft.AspNetCore.SignalR; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.EntityFrameworkCore; @@ -40,6 +41,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers private readonly INormalEfCoreRepository _repository; private readonly INormalEfCoreRepository _groupRepository; private readonly INormalEfCoreRepository _detailRepository; + + private readonly INormalEfCoreRepository _notRepository; private readonly INormalEfCoreRepository _adjRepository; protected readonly INormalEfCoreRepository _codesetRepository; @@ -369,7 +372,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers - + /// + /// 获得发票主表 + /// + /// + /// + /// @@ -1246,7 +1254,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers taxDiff: 0, clientCode: string.Empty, realAmt: readAmt + + + ); + invbill.Site = dtos.FirstOrDefault().Site; invlist.Add(invbill); } await _repository.DbContext.BulkInsertAsync(invlist); @@ -1478,6 +1490,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers clientCode: string.Empty, realAmt: realAmt ); + + invbill.Site= dtos.FirstOrDefault().Site; invbill.CreationTime = DateTime.Now; invlist.Add(invbill); } @@ -1747,6 +1761,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers realAmt:0 ); + invbill.Site = dtos.FirstOrDefault().Site; invbill.CreationTime = DateTime.Now; invlist.Add(invbill); } @@ -1973,6 +1988,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers clientCode: string.Empty, realAmt: realAmt ); + invbill.Site = dtos.FirstOrDefault().Site; invbill.CreationTime = DateTime.Now; invlist.Add(invbill); } @@ -2401,5 +2417,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers } return false; } + + + + + + + } } 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 5eca6fb5..b4186471 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 @@ -76,11 +76,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers if (first.BusinessType == EnumBusinessType.BeiJian) { name = "备件"; - priceErrors = await _service.CheckPriceList(notlist,true); + priceErrors = await _service.CheckPriceList(notlist,first.Site,true); } else { - priceErrors = await _service.CheckPriceList(notlist); + priceErrors = await _service.CheckPriceList(notlist,first.Site); } if (priceErrors.Count > 0) { @@ -102,6 +102,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers _entity.State = SettleBillState.未结状态; _entity.SettleBillNum = string.Empty; _entity.BusinessType = first.BusinessType; + _entity.Site = first.Site; + var _entityList = new List(); foreach (var itm in notlist) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs index 1c3c7a7f..052de155 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs @@ -82,8 +82,8 @@ public class PUB_CAN_SA_DETAIL : SA_CAN_BASE /// /// 对应字段filename 区分 cn1、cn5 /// - [Display(Name = "工厂地点")] - public string Site { get; set; } = null!; + //[Display(Name = "工厂地点")] + //public string Site { get; set; } = null!; /// /// 对应字段Qty