From b09760007a8754880df679f0e4d8c214654684cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Thu, 24 Aug 2023 08:52:03 +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 --- .../Entities/BQ/Dtos/INVOICE_GRP_DTO.cs | 6 ++-- .../Bases/ADJ_SERVICE.cs | 1 + .../Entities/BQ/INVOICE_SERVICE.cs | 32 ++++++++++++++++--- .../Entities/BQ/Managers/INV_MNG.cs | 16 ++++++++++ 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs index c8fd591e..e787eeb9 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs @@ -79,7 +79,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos /// ///未税金额 /// - [Display(Name = "未税金额")] + [Display(Name = "税率")] public decimal Tax { get; set; } @@ -125,7 +125,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos /// ///税额 /// - [ExporterHeader(DisplayName = "税额")] + [ExporterHeader(DisplayName = "税率")] public decimal Tax { get; set; } /// ///税后金额 @@ -174,7 +174,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos /// ///税额 /// - [ImporterHeader(Name = "税额", FixAllSpace = true)] + [ImporterHeader(Name = "税率", FixAllSpace = true)] [Required(ErrorMessage = "{0}是必填项")] public decimal Tax { get; set; } 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 f23a920b..8b3b088e 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 @@ -87,6 +87,7 @@ public class ADJ_SERVICE : BASE_SERVICE public virtual async Task> DetailQueryAsync(PUB_ADJ_DETAIL_REQ_DTO input) { + var entitys = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); var totalCount = await _repository.GetCountByFilterAsync(input.Filters); var dtos = ObjectMapper.Map, List>(entitys); 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 fbfaca70..1854434c 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 @@ -29,6 +29,7 @@ using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.ExcelImporter; +using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ @@ -83,10 +84,35 @@ namespace Win.Sfs.SettleAccount.Entities.BQ /// [HttpPost] [UnitOfWork(false)] - public virtual async Task ApprovalPassed(List p_invs) + public virtual async Task ApprovalPassed(List p_invs) { + List errors = new List(); + var invs = await _invMng.GetInvoiceListAsync(p_invs); + if (invs.Count > 0) + { + var ls = invs.Where(p => p.State != SettleBillState.商务已审核).Distinct(); + if (ls.Count() > 0) + { + foreach (var itm in ls) + { + errors.Add(new ERR_EXP_DTO() { Message = $"{itm.InvbillNum}发票号状态不是商务审核!" }); + } + } + var ls1 = invs.Where(p => p.InvoiceState == InvoiceBillState.报废).Distinct(); + if (ls1.Count() > 1) + { + foreach (var itm in ls1) + { + errors.Add(new ERR_EXP_DTO() { Message = $"{itm.InvbillNum}发票号状态不是商务审核!" }); + } + } + if (errors.Count() > 0) + { + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errors) }); + } + } await _invMng.SetForwardState(p_invs, SettleBillState.财务已审核); - return ApplicationConsts.SuccessStr; + return new JsonResult(new { Code = "200", Message = "审核成功" }); } /// @@ -193,8 +219,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ _excel.Append(adj, "发票调整数据" + itm.InvbillNum).SeparateBySheet(); } _excel.Append(not, "发票分组未结对应结算分组"); - - var result = _excel.ExportAppendDataAsByteArray(); result.ShouldNotBeNull(); //保存导出文件到服务器存成二进制 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 46b2d704..9fbaca26 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 @@ -377,6 +377,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers } + + /// + /// 获得发票主表 + /// + /// + /// + public virtual async Task> GetInvoiceListAsync(List invs) + { + return await _repository.Where(p => invs.Contains(p.InvbillNum)).ToListAsync(); + } + + + + + + /// /// 客户已收票 ///