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 3773b689..fc538ad2 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 @@ -105,7 +105,6 @@ namespace Win.Sfs.SettleAccount.Bases [HttpPost] public virtual async Task GenerateInvoice(List p_invs) { - var issucess=await _invMng.SetForwardState(p_invs, SettleBillState.商务已审核); if (issucess == true) { @@ -122,11 +121,7 @@ namespace Win.Sfs.SettleAccount.Bases [HttpPost] public virtual async Task ReissueInvoice([FromBody] string input) { - - // await _invMng.SetForwardState(input.InvGroupNum, SettleBillState.商务已审核); - return new JsonResult(new { Code = 200, Message = "重开成功" }); - } /// /// 主表查询 @@ -144,7 +139,6 @@ namespace Win.Sfs.SettleAccount.Bases { itm.TaxAmtDiff = itm.TaxAmt + itm.TaxDiff; } - return new PagedResultDto(totalCount, dtos); } /// @@ -314,8 +308,6 @@ namespace Win.Sfs.SettleAccount.Bases { itm.TaxAmtDiff = itm.TaxAmt + itm.TaxDiff; } - - var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute()?.Name ?? typeof(INVOICE_GRP_DTO).Name; string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; byte[] result = null; @@ -354,12 +346,9 @@ namespace Win.Sfs.SettleAccount.Bases { return new JsonResult(new { Code = 200, Message = "退回成功" }); } - return new JsonResult(new { Code = 400, Message = "退回失败" }); } - [HttpPost] - public virtual async Task ReceivedAsync(List p_ins) { @@ -478,8 +467,7 @@ namespace Win.Sfs.SettleAccount.Bases { return true; } - throw new BusinessException("8989", "生成失败,请检查调整表和旧发票内容"); - + throw new BusinessException("8989", "生成失败,请检查调整表和旧发票内容"); } [UnitOfWork(false)] /// @@ -526,9 +514,11 @@ namespace Win.Sfs.SettleAccount.Bases - - - + /// + /// 检查是否有重复 + /// + /// 调整明细数据 + /// protected async Task> CheckRepeat(List p_list) { var errorlist = p_list.GroupBy(p => new { p.PN, p.LU }).Where(p => p.Count() > 1).Select(p => new { p.Key.PN, p.Key.LU }).ToList(); @@ -544,9 +534,6 @@ namespace Win.Sfs.SettleAccount.Bases } - - - /// /// 校验规则 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs index 2d20047e..0dcbd774 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs @@ -138,8 +138,6 @@ namespace Win.Sfs.SettleAccount.Bases //[Route("generateinvoice")] public virtual async Task ApprovalPassed(List p_list) { - - return ApplicationConsts.SuccessStr; } /// @@ -164,21 +162,7 @@ namespace Win.Sfs.SettleAccount.Bases [HttpPost] public virtual async Task RejectAsync(TRequestMainInput input) { - - - - - - - - - - - - - return ApplicationConsts.SuccessStr; - } public virtual async Task GetMainAsync([FromBody] string billNum) { 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 c32da713..00ba8d47 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 @@ -226,16 +226,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ /// public virtual async Task ReissueInvoiceExtend(List p_list) { - - - var errorlist = await CheckRepeat(p_list); + var errorlist = await CheckRepeat(p_list);//是否录入数据重复 if (errorlist.Count > 0) { - return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorlist) }); - } - var adjlist = ObjectMapper.Map, List>(p_list); if (adjlist == null && adjlist.Count == 0) { @@ -243,18 +238,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ } var first = p_list.FirstOrDefault(); var invbillnum = first.InvBillNum; - var version=int.Parse(DateTime.Now.ToString("yyyymm")); - var inv= await GetInvoiceGroupByInvBillNum(invbillnum); - var settle =await _bbacMng.GetMainAsync(inv.InvGroupNum); - if(settle==null) { throw new UserFriendlyException( $"选择发票:{invbillnum}对应的可结算单不粗拿在在请检查!", "400"); } - version=settle.Version; if (inv != null) { @@ -298,7 +288,7 @@ 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.ToList();//价格单 + var priceList = _priceRepository.Where(p => p.ClientCode == inv.Site && p.IsCancel == false).ToList();//价格单 //var errorList =await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); //if (errorList.Count() > 0) //{ diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs index f0f6b483..9f22e696 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs @@ -1,5 +1,5 @@ using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components; +//using Microsoft.AspNetCore.Components; using SettleAccount.Domain.BQ; using SettleAccount.Job.Services.Report; using SettleAccount.Job.Services; @@ -23,6 +23,7 @@ using Win.Sfs.SettleAccount.Entities.TaskJobs; using Volo.Abp.Uow; using Volo.Abp; using EFCore.BulkExtensions; +using Microsoft.AspNetCore.Mvc; namespace Win.Sfs.SettleAccount.Entities.BQ { @@ -70,7 +71,33 @@ namespace Win.Sfs.SettleAccount.Entities.BQ }); return _taskid; - } + //[HttpPost] + //public virtual async Task RejectAsync(List p_list) + //{ + // var detailist = _detailRepository.Where(p => p_list.Contains(p.BillNum)).ToList(); + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "BillNumList", Value = string.Join(",", p_list) }); + // customConditionList.Add(new CustomCondition() { Name = "Type", Value = EnumBusinessType.JisBBAC.ToString() }); + // customConditionList.Add(new CustomCondition() { Name = "IsOut", Value = "out" }); + // var ls = _repository.Where(p => p_list.Contains(p.BillNum)).ToList(); + // var lst = ls.Where(p => (p.State == SettleBillState.已提交扣减 || p.State == SettleBillState.已扣减)); + // if (lst.Count() > 0) + // { + // throw new UserFriendlyException("当前状态是已提交状态,不能重复已提交", "400"); + // } + // foreach (var item in ls) + // { + // item.State = SettleBillState.已提交扣减; + // } + // await _repository.DbContext.BulkUpdateAsync(ls); + // var _taskid = await _service.ExportEnqueueAsync("BBAC待扣减任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(PendingDeductionService), customConditionList, (rs) => + // { + // }); + // return _taskid; + + //} + + } } 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 f050dcd5..59f3b0aa 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 @@ -655,7 +655,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ //inv.TaxAmt = inv.Amt+ Math.Round(inv.Amt * newinv.Tax, 2); inv.RealnvBillNum = newinv.RealnvBillNum; // inv.RealAmt = newinv.RealAmt; - inv.TaxDiff =inv.TaxAmt+ newinv.PreTaxDiff; + inv.TaxDiff =newinv.PreTaxDiff; // inv.ClientCode = newinv.ClientCode; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs index dcaa113b..173fe31a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Linq.Dynamic.Core; +using System.Security.Policy; using System.Text.RegularExpressions; using System.Threading.Tasks; using EFCore.BulkExtensions; @@ -153,7 +154,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase [HttpPost] public async Task> GetListAsync(PUB_SARequestDto input) { - input.Filters.RemoveAll(t => t.Column.ToLower() == "site"); var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); var dtos = ObjectMapper.Map, List>(entities); @@ -451,6 +451,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase EnumBusinessType.YinDuJian => "1040", _ => throw new UserFriendlyException($"业务编码错误", "400") }; + site = clientCode; if (businessType == EnumBusinessType.BeiJian) { @@ -526,7 +527,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase BillNum = pubSaBillNum, State = "0", BusinessType = pubSaFirstDetail.BusinessType, - Version = pubSaFirstDetail.Version + Version = pubSaFirstDetail.Version, + Site = site }; //可结算单号 var pubCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C"); @@ -538,13 +540,15 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase SettleBillNum = pubSaBillNum, State = SettleBillState.未结状态, BusinessType = pubSa.BusinessType, - Version = pubSa.Version + Version = pubSa.Version, + Site = site }; #region 入库数据赋值 pubSaDetails.ForEach(pubSaDetail => { pubSaDetail.BillNum = pubSaBillNum; + pubSaDetail.Site = site; }); //不可结算 结算分组号码(根据价格区分结算、不可结算) var pubNotSaGroupNums = pubSaDetails.FindAll(t => t.Price == default(decimal)).Select(t => t.GroupNum).Distinct(); 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 1dc172fd..d1d9b4f9 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 @@ -1376,6 +1376,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers foreach (var detail in adjdetails) { detail.InvBillNum = key; + adjlist.Add(detail); } } var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID, p.LU }) @@ -1916,7 +1917,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers foreach (var detail in adjdetails) { detail.InvBillNum = key; - adjdetails.Add(detail); + adjlist.Add(detail); } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs index a3af7837..f0b5878d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs @@ -577,6 +577,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers } return detailList; } + [UnitOfWork(false)] /// /// 第一次开票 /// @@ -675,7 +676,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers foreach (var detail in adjdetails) { detail.InvBillNum = key; - adjdetails.Add(detail); + } } var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID,p.LU }) @@ -942,7 +943,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers foreach (var detail in adjdetails) { detail.InvBillNum = key; - adjdetails.Add(detail); + } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs index 45ba3486..dadd788a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs @@ -34,6 +34,30 @@ namespace Win.Sfs.SettleAccount 已提交扣减 = 6 } + public enum PDBillState + { + + [Description("新建")] + 新建 = 4, + [Description("已扣减")] + 已扣减 = 5, + [Description("已提交扣减")] + 已提交扣减 = 6, + [Description("已提交反结")] + 已提交反结 = 7 + } + + + + + + + + + + + + public enum InvoiceBillState { [Description("在用")]