From db435f2995d4cf5151e19d6c8e5093147feb8858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Fri, 28 Jul 2023 16:58:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs | 4 - .../Entities/BQ/Managers/INV_MNG.cs | 76 ++++++++++++------- 2 files changed, 50 insertions(+), 30 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs index ef6bbccf..4752bd03 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs @@ -51,9 +51,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers } - - - /// /// 向前流程 /// @@ -209,7 +206,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers public virtual async Task SetNewState(BBAC_CAN_SA p_entiy) { - return await SetNewState(p_entiy.BillNum); } 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 0dbc75c5..d3929488 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 Hangfire; using Microsoft.AspNetCore.SignalR; +using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.EntityFrameworkCore; using NPOI.SS.Formula.Functions; using SettleAccount.Bases; @@ -39,14 +40,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers PUB_CAN_SA_MNG pubMng, BBAC_CAN_SA_MNG bbacMng, HBPO_CAN_SA_MNG hbpoMng, - - - - INormalEfCoreRepository repository, - INormalEfCoreRepository groupRepository, - INormalEfCoreRepository detailRepository, - INormalEfCoreRepository notRepository, - INormalEfCoreRepository adjRepository + INormalEfCoreRepository repository, + INormalEfCoreRepository groupRepository, + INormalEfCoreRepository detailRepository, + INormalEfCoreRepository notRepository, + INormalEfCoreRepository adjRepository ) { //_canRepository = canRepository; @@ -136,12 +134,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers /// public virtual async Task SetForwardState(INVOICE_GRP p_entiy, SettleBillState p_State) { + if (p_entiy.InvoiceState == InvoiceBillState.报废) + { + throw new BusinessException("8989", "当前发票已报废不能进行操作"); + } + var state = p_State; switch (p_State) { case SettleBillState.财务已审核: if (p_entiy.State == SettleBillState.商务已审核) { + p_entiy.State = state; } else @@ -170,8 +174,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers } break; } - - var flag = await SetSettleState(p_entiy, p_State, true); if (flag == true) { @@ -434,12 +436,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers /// public virtual async Task Reject(string groupbillNum) { - - var _ls = await _repository.Where(p => p.InvGroupNum == groupbillNum).ToListAsync(); - - if (_ls != null && _ls.Count > 0) + var ls = await _repository.Where(p => p.InvGroupNum == groupbillNum).ToListAsync(); + if (ls != null && ls.Count > 0) { - foreach (var p_entity in _ls) + var first = ls.FirstOrDefault(); + if(first.State==SettleBillState.客户已收票 || first.State== SettleBillState.已扣减) + { + throw new BusinessException("8989",$"发票分组{groupbillNum}客户已经是客户已收票或已扣减状态不能退回"); + } + foreach (var p_entity in ls) { if (p_entity.State == SettleBillState.财务已审核 || p_entity.State == SettleBillState.已开票 || p_entity.State == SettleBillState.商务已审核) @@ -448,26 +453,30 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers var groupList = _groupRepository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList(); var notList = _notRepository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList(); var detailList = _detailRepository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList(); - //var canList = _canRepository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList(); - //foreach (var itm in canList) - //{ - // itm.State = SettleBillState.未结状态; - //} await _repository.DbContext.BulkDeleteAsync(entList); await _repository.DbContext.BulkDeleteAsync(groupList); await _repository.DbContext.BulkDeleteAsync(notList); await _repository.DbContext.BulkDeleteAsync(detailList); + if (first.BusinessType == EnumBusinessType.JisBBAC) + { + await _bbacMng.SetNewState(groupbillNum); + } + else if (first.BusinessType == EnumBusinessType.JisHBPO) + { + await _hbpoMng.SetNewState(groupbillNum); + } + else + { + await _pubMng.SetNewState(groupbillNum); + } //await _repository.DbContext.BulkUpdateAsync(canList); } - if (p_entity.State == SettleBillState.已扣减) - { - - } + } } else { - + throw new BusinessException("8989",$"查询不到发票分组号为{groupbillNum}发票分组"); } return true; } @@ -892,7 +901,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers return true; } - + /// + /// + /// + /// + /// + /// + /// + /// public async Task ReissueFirstInvoice(List dtos, string p_OldInvBillNum, int p_version) { if (!string.IsNullOrEmpty(p_OldInvBillNum)) @@ -914,6 +930,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers } return false; } + /// + /// + /// + /// + /// + /// + /// + /// public async Task ReissueSecInvoice(List dtos, string p_OldInvBillNum, int p_version) { if (!string.IsNullOrEmpty(p_OldInvBillNum))