From de73b69c2aec99ecfcf7261f7b5d318ec2df7afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Wed, 27 Sep 2023 13:32:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=89=A3=E5=87=8F=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bases/PD_SERVICE.cs | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) 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 4ff28d13..03d4f3a5 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 @@ -140,7 +140,21 @@ namespace Win.Sfs.SettleAccount.Bases [UnitOfWork(false)] public virtual async Task ApprovalPassed(List p_list) { - return await InvokePD(p_list, _service); + var invlist = _repository.Where(p => p_list.Contains(p.BillNum)).ToList(); + var states = invlist.Select(p => p.State).Distinct().ToList(); + if (states.Count > 1) + { + throw new UserFriendlyException($"扣减单不是同一状态", "400"); + } + var first = invlist.FirstOrDefault();//发票状态 + if (first.State != SettleBillState.客户已收票) + { + throw new UserFriendlyException($"扣减单状态不是【客户已收票】状态", "400"); + + } + + + return await InvokePD(invlist,p_list, _service, false); } [HttpPost] [UnitOfWork(false)] @@ -150,7 +164,7 @@ namespace Win.Sfs.SettleAccount.Bases var states = invlist.Select(p => p.State).Distinct().ToList(); if (states.Count > 1) { - throw new UserFriendlyException($"发票不是同一状态", "400"); + throw new UserFriendlyException($"扣减单不是同一状态", "400"); } var first = invlist.FirstOrDefault();//发票状态 if (first.State == SettleBillState.客户已收票) @@ -175,7 +189,11 @@ namespace Win.Sfs.SettleAccount.Bases } else { - return await InvokePD(p_list, _service); + if (first.State != SettleBillState.已扣减) + { + throw new UserFriendlyException($"扣减单状态不是【已扣减】状态", "400"); + } + return await InvokePD(invlist,p_list, _service,true); } } @@ -193,9 +211,10 @@ namespace Win.Sfs.SettleAccount.Bases /// /// [UnitOfWork(false)] - protected async Task InvokePD(List p_list, TaskJobService p_service, bool isback=false) + protected async Task InvokePD(List p_invs,List p_list, TaskJobService p_service, bool isback=false) where T:PD_BASE_MAIN { - var invlist=_repository.Where(p=>p_list.Contains(p.BillNum)).ToList(); + var invlist = p_invs; + // var invlist=_repository.Where(p=>p_list.Contains(p.BillNum)).ToList(); var states= invlist.Select(p => p.State).Distinct().ToList(); if (states.Count > 1) { @@ -209,14 +228,7 @@ namespace Win.Sfs.SettleAccount.Bases } - if (first.State == SettleBillState.客户已收票) - { - isback = false; - } - if(first.State==SettleBillState.已扣减) - { - isback = true; - } + var detailist = _detailRepository.Where(p => p_list.Contains(p.BillNum)).ToList(); var first1=detailist.FirstOrDefault(); List customConditionList = new List();