From 36397d3c4c1f8c22274ad45154eacaedb041921a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Mon, 9 Oct 2023 13:53:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=BA=9F=E9=87=8D=E5=BC=80=E6=97=B6?= =?UTF-8?q?=E5=A4=87=E4=BB=B6=E4=BB=B7=E6=A0=BC=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/BBAC_BA_SERVICE.cs | 4 +- .../Entities/BQ/HBPO_BA_SERVICE.cs | 2 +- .../Entities/BQ/INVOICE_SERVICE.cs | 5 +- .../Entities/BQ/PUB_BA_SERVICE.cs | 76 ++++++++++++------- .../Entities/BQ/Managers/INV_MNG.cs | 1 - 5 files changed, 53 insertions(+), 35 deletions(-) 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 eab068c8..037f7b4d 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 @@ -529,7 +529,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ && inv.State != SettleBillState.客户已收票 ) { - throw new UserFriendlyException($"发票只有在财务已审核、客户已收票、已扣减、已提交QAD状态下可以报废!", "400"); + throw new UserFriendlyException($"发票只有在财务已审核、红冲状态下可以报废!", "400"); } var settle = await _bbacMng.GetMainAsync(inv.InvGroupNum).ConfigureAwait(false); @@ -695,7 +695,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ && inv.State != SettleBillState.客户已收票 ) { - throw new UserFriendlyException($"发票只有在财务已审核、客户已收票、已扣减、已提交QAD状态下可以报废!", "400"); + throw new UserFriendlyException($"发票只有在财务已审核、红冲状态下可以报废!", "400"); } 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 2ade3340..267d6fe0 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 @@ -492,7 +492,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ && inv.State != SettleBillState.客户已收票 ) { - throw new UserFriendlyException($"发票只有在财务已审核、客户已收票、已扣减、已提交QAD状态下可以报废!", "400"); + throw new UserFriendlyException($"发票只有在财务已审核、红冲状态下可以报废!", "400"); } 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 813b90b3..3c5a94b5 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 @@ -312,10 +312,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { errors.Add(new ERR_EXP_DTO() { Message = $"选择发票有没有金税发票号发票,不能审核!" }); } - - - - + var ls = invs.Where(p => p.State != SettleBillState.商务已审核).Distinct(); if (ls.Any()) { 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 4d5b2251..0eb0fe06 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 @@ -143,7 +143,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var priceListbj = _pricebjRepository.ToList();//价格单 foreach (var itm in priceListbj) { - priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1049" }); + priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1049", ContractNo = itm.ContractNo }); } } else @@ -161,6 +161,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ 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, SettleBillNum = d.SettleBillNum, Site = d.Site, Version = d.Version, @@ -169,15 +170,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ SettleDate = d.SettleDate, InvGroupNum = d.InvGroupNum, LU = d.LU, - // MaterialDesc = d.MaterialDesc, PN = d.PN, Qty = d.Qty, GroupNum = d.GroupNum, Amt = Math.Round(d.Qty * p.Price, 2), - ContractDocID = "n", + ContractDocID = (d.BusinessType != EnumBusinessType.BeiJian) ? string.Empty : p.ContractNo, BeginDate = p.BeginTime, EndDate = p.EndTime, - PartCode = d.PartCode + PartCode = d.PartCode,//客户零件号 + LineCode = d.IndexNum }; var dtos = q.ToList(); @@ -302,7 +303,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var priceListbj = _pricebjRepository.ToList();//价格单 foreach (var itm in priceListbj) { - priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price,ClientCode="1049" }); + priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price,ClientCode="1049", ContractNo = itm.ContractNo }); } } else @@ -320,6 +321,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ 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, SettleBillNum = d.SettleBillNum, Site = d.Site, Version = d.Version, @@ -328,15 +330,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ SettleDate = d.SettleDate, InvGroupNum = d.InvGroupNum, LU = d.LU, - // MaterialDesc = d.MaterialDesc, PN = d.PN, Qty = d.Qty, GroupNum = d.GroupNum, Amt = Math.Round(d.Qty * p.Price, 2), - ContractDocID = "n", + ContractDocID = (d.BusinessType != EnumBusinessType.BeiJian) ? string.Empty : p.ContractNo, BeginDate = p.BeginTime, EndDate = p.EndTime, - PartCode = d.PartCode + PartCode = d.PartCode,//客户零件号 + LineCode = d.IndexNum }; var dtos = q.ToList(); @@ -426,7 +428,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); //var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算 - var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单 + List priceList = new List(); + if (inv.BusinessType == EnumBusinessType.BeiJian) + { + var priceListbj = _pricebjRepository.ToList();//价格单 + foreach (var itm in priceListbj) + { + priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1049", ContractNo = itm.ContractNo }); + } + } + else + { + priceList = _priceRepository.Where(p => p.IsCancel == false && p.ClientCode == inv.Site).ToList();//价格单 + } var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType).ConfigureAwait(false); if (errorList.Count > 0) { @@ -438,6 +452,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ 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, SettleBillNum = d.SettleBillNum, Site = d.Site, Version = d.Version, @@ -446,17 +461,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ SettleDate = d.SettleDate, InvGroupNum = d.InvGroupNum, LU = d.LU, - // MaterialDesc = d.MaterialDesc, PN = d.PN, Qty = d.Qty, GroupNum = d.GroupNum, Amt = Math.Round(d.Qty * p.Price, 2), - ContractDocID = "n", + ContractDocID = (d.BusinessType != EnumBusinessType.BeiJian) ? string.Empty : p.ContractNo, BeginDate = p.BeginTime, EndDate = p.EndTime, - PartCode= d.PartCode + PartCode = d.PartCode,//客户零件号 + LineCode = d.IndexNum - }; + }; var dtos = q.ToList(); if (dtos != null && dtos.Count > 0) { @@ -531,7 +546,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ && inv.State != SettleBillState.客户已收票 ) { - throw new UserFriendlyException($"发票只有在财务已审核、客户已收票、已扣减、已提交QAD状态下可以报废!", "400"); + throw new UserFriendlyException($"发票只有在财务已审核、红冲状态下可以报废!", "400"); } @@ -612,15 +627,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ SettleDate = d.SettleDate, InvGroupNum = d.InvGroupNum, LU = d.LU, - MaterialDesc = d.MaterialDesc, PN = d.PN, Qty = d.Qty, GroupNum = d.GroupNum, Amt = Math.Round(d.Qty * p.Price, 2), - ContractDocID = "N", + ContractDocID = (d.BusinessType != EnumBusinessType.BeiJian) ? string.Empty : p.ContractNo, BeginDate = p.BeginTime, EndDate = p.EndTime, - PartCode = d.PartCode + PartCode = d.PartCode,//客户零件号 + LineCode = d.IndexNum }; var dtos = q.ToList(); @@ -732,7 +747,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ && inv.State != SettleBillState.客户已收票 ) { - throw new UserFriendlyException($"发票只有在财务已审核、客户已收票、已扣减、已提交QAD状态下可以报废!", "400"); + throw new UserFriendlyException($"发票只有在财务已审核、红冲状态下可以报废!", "400"); } @@ -792,12 +807,19 @@ 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) - //{ - // return await ExportErrorReportAsync(errorList); - //} + List priceList = new List(); + if (inv.BusinessType == EnumBusinessType.BeiJian) + { + var priceListbj = _pricebjRepository.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 = "1049", ContractNo = itm.ContractNo }); + } + } + else + { + priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单 + } var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in dto1s join p in priceList on d.LU equals p.LU @@ -813,15 +835,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ SettleDate = d.SettleDate, InvGroupNum = d.InvGroupNum, LU = d.LU, - MaterialDesc = d.MaterialDesc, PN = d.PN, Qty = d.Qty, GroupNum = d.GroupNum, Amt = Math.Round(d.Qty * p.Price, 2), - ContractDocID = "N", + ContractDocID = (d.BusinessType != EnumBusinessType.BeiJian) ? string.Empty : p.ContractNo, BeginDate = p.BeginTime, EndDate = p.EndTime, - PartCode = d.PartCode + PartCode = d.PartCode,//客户零件号 + LineCode = d.IndexNum }; var dtos = q.ToList(); 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 5145f70d..dc204d96 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 @@ -2309,7 +2309,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers entity.SetProperty("PartGroup", detail.PartGroup); entity.SetProperty("PN", detail.PN); entity.SetProperty("SettleDate", detail.SettleDate); - _entityDetailList.Add(entity); } if (_entityDetailList.Count > 0)