学 赵
1 year ago
12 changed files with 210 additions and 34 deletions
@ -0,0 +1,146 @@ |
|||||
|
using EFCore.BulkExtensions; |
||||
|
using NPOI.SS.Formula.Functions; |
||||
|
using SettleAccount.Domain.BQ; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Domain.Services; |
||||
|
using Win.Sfs.Shared.RepositoryBase; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.Managers |
||||
|
{ |
||||
|
public class INV_MNG:DomainService |
||||
|
{ |
||||
|
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository; |
||||
|
private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _groupRepository; |
||||
|
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _detailRepository; |
||||
|
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _notRepository; |
||||
|
|
||||
|
|
||||
|
public INV_MNG |
||||
|
( |
||||
|
|
||||
|
INormalEfCoreRepository<INVOICE_GRP, Guid> repository, |
||||
|
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> groupRepository, |
||||
|
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> detailRepository, |
||||
|
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> notRepository |
||||
|
|
||||
|
) |
||||
|
{ |
||||
|
_repository = repository; |
||||
|
_detailRepository = detailRepository; |
||||
|
_groupRepository = groupRepository; |
||||
|
_notRepository = notRepository; |
||||
|
} |
||||
|
public virtual async Task<bool> SetForwardState(INVOICE_GRP p_entiy,InvoiceBillState p_State) |
||||
|
{ |
||||
|
var state = p_State; |
||||
|
switch (p_entiy.State) |
||||
|
{ |
||||
|
case InvoiceBillState.财务已审核: |
||||
|
if (state == InvoiceBillState.商务已审核) |
||||
|
{ |
||||
|
p_entiy.State = state; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态"); |
||||
|
} |
||||
|
break; |
||||
|
case InvoiceBillState.商务已审核: |
||||
|
if (state == InvoiceBillState.已开票) |
||||
|
{ |
||||
|
p_entiy.State = state; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【商务已审核】"); |
||||
|
} |
||||
|
break; |
||||
|
case InvoiceBillState.已扣减: |
||||
|
if (state == InvoiceBillState.财务已审核) |
||||
|
{ |
||||
|
p_entiy.State = state; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态"); |
||||
|
} |
||||
|
break; |
||||
|
} |
||||
|
await _repository.UpdateAsync(p_entiy); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public virtual async Task<bool> Reject(INVOICE_GRP p_entity) |
||||
|
{ |
||||
|
|
||||
|
if (p_entity.State == InvoiceBillState.财务已审核 |
||||
|
|| p_entity.State == InvoiceBillState.已开票 || p_entity.State == InvoiceBillState.商务已审核) |
||||
|
{ |
||||
|
var entList = _repository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList(); |
||||
|
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(); |
||||
|
await _repository.DbContext.BulkDeleteAsync(entList); |
||||
|
await _repository.DbContext.BulkDeleteAsync(groupList); |
||||
|
await _repository.DbContext.BulkDeleteAsync(notList); |
||||
|
await _repository.DbContext.BulkDeleteAsync(detailList); |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
return true; |
||||
|
|
||||
|
|
||||
|
//switch (p_entiy.State)
|
||||
|
//{
|
||||
|
// case InvoiceBillState.财务已审核 || InvoiceBillState.已开票:
|
||||
|
|
||||
|
// _repository.re
|
||||
|
|
||||
|
|
||||
|
|
||||
|
// //if (state == InvoiceBillState.商务已审核)
|
||||
|
// //{
|
||||
|
// // p_entiy.State = state;
|
||||
|
// //}
|
||||
|
// //else
|
||||
|
// //{
|
||||
|
// // throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态");
|
||||
|
// //}
|
||||
|
// break;
|
||||
|
// case InvoiceBillState.商务已审核:
|
||||
|
// if (state == InvoiceBillState.已开票)
|
||||
|
// {
|
||||
|
// p_entiy.State = state;
|
||||
|
// }
|
||||
|
// else
|
||||
|
// {
|
||||
|
// throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【商务已审核】");
|
||||
|
// }
|
||||
|
// break;
|
||||
|
// case InvoiceBillState.已扣减:
|
||||
|
// if (state == InvoiceBillState.财务已审核)
|
||||
|
// {
|
||||
|
// p_entiy.State = state;
|
||||
|
// }
|
||||
|
// else
|
||||
|
// {
|
||||
|
// throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态");
|
||||
|
// }
|
||||
|
// break;
|
||||
|
//}
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
Loading…
Reference in new issue