学 赵
1 year ago
16 changed files with 1795 additions and 524 deletions
@ -0,0 +1,269 @@ |
|||
using EFCore.BulkExtensions; |
|||
using Hangfire.Annotations; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using SettleAccount.Bases; |
|||
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.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities; |
|||
using Volo.Abp.Domain.Services; |
|||
using Volo.Abp.Guids; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Win.Sfs.SettleAccount.Bases.DomainServices; |
|||
using Win.Sfs.SettleAccount.Boms; |
|||
using Win.Sfs.SettleAccount.Entities.Materials; |
|||
using Win.Sfs.SettleAccount.MaterialRelationships; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|||
{ |
|||
public class BBAC_CAN_SA_MNG: DomainService |
|||
|
|||
{ |
|||
private readonly INormalEfCoreRepository<BBAC_CAN_SA, Guid> _repository; |
|||
private readonly INormalEfCoreRepository<BBAC_CAN_SA_DETAIL, Guid> _detailRepository; |
|||
public BBAC_CAN_SA_MNG |
|||
( |
|||
INormalEfCoreRepository<BBAC_CAN_SA, Guid> repository, |
|||
INormalEfCoreRepository<BBAC_CAN_SA_DETAIL, Guid> detailRepository |
|||
) |
|||
{ |
|||
_repository = repository; |
|||
_detailRepository = detailRepository; |
|||
} |
|||
|
|||
public BBAC_CAN_SA_MNG() |
|||
{ |
|||
} |
|||
|
|||
public virtual async Task<bool> SetForwardState(BBAC_CAN_SA p_entiy, SettleBillState state) |
|||
{ |
|||
if (await SetForwardState(p_entiy.InvGroupNum, state) == true) |
|||
{ |
|||
return true; |
|||
} |
|||
return false; |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 向前流程
|
|||
/// </summary>
|
|||
/// <param name="p_billNum"></param>
|
|||
/// <param name="state"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="BusinessException"></exception>
|
|||
public virtual async Task<bool> SetForwardState(string p_billNum, SettleBillState state) |
|||
{ |
|||
|
|||
var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList(); |
|||
if (ls == null && ls.Count ==0) |
|||
{ |
|||
throw new BusinessException("8989", string.Format("不存在编号为{0}",p_billNum)); |
|||
} |
|||
foreach (BBAC_CAN_SA p_entiy in ls) |
|||
{ |
|||
switch (state) |
|||
{ |
|||
case SettleBillState.财务已审核: |
|||
if (p_entiy.State == SettleBillState.商务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.商务已审核: |
|||
if (p_entiy.State == SettleBillState.已开票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【商务已审核】"); |
|||
} |
|||
break; |
|||
case SettleBillState.已开票: |
|||
if (p_entiy.State == SettleBillState.未结状态) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【未结状态】状态,无法设置成【已开票】"); |
|||
} |
|||
break; |
|||
case SettleBillState.已扣减: |
|||
if (p_entiy.State == SettleBillState.客户已收票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[客户收票],无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.客户已收票: |
|||
if (p_entiy.State == SettleBillState.财务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[财务已审核],无法设置成【客户已收票】状态"); |
|||
} |
|||
break; |
|||
} |
|||
await _repository.UpdateAsync(p_entiy); |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
/// <summary>
|
|||
/// 向后流程
|
|||
/// </summary>
|
|||
/// <param name="p_billNum"></param>
|
|||
/// <param name="state"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="BusinessException"></exception>
|
|||
public virtual async Task<bool> SetBackwardState(string p_billNum, SettleBillState state) |
|||
{ |
|||
|
|||
var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList(); |
|||
if (ls == null && ls.Count == 0) |
|||
{ |
|||
throw new BusinessException("8989", string.Format("不存在发票分组号为{0}的可结算单", p_billNum)); |
|||
} |
|||
foreach (BBAC_CAN_SA p_entiy in ls) |
|||
{ |
|||
|
|||
switch (state) |
|||
{ |
|||
case SettleBillState.商务已审核: |
|||
if (p_entiy.State == SettleBillState.财务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【财务已审核】,无法设置成【商务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.已开票: |
|||
if (p_entiy.State == SettleBillState.商务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【商务已审核】状态,无法设置成【已开票】"); |
|||
} |
|||
break; |
|||
case SettleBillState.未结状态: |
|||
if (p_entiy.State == SettleBillState.已开票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【未结状态】"); |
|||
} |
|||
break; |
|||
case SettleBillState.客户已收票: |
|||
if (p_entiy.State == SettleBillState.已扣减) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[财务已审核],无法设置成【财务已审核客户收票】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.财务已审核: |
|||
if (p_entiy.State == SettleBillState.客户已收票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[客户已收票],无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
} |
|||
await _repository.UpdateAsync(p_entiy); |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
|
|||
public virtual async Task<bool> SetNewState(BBAC_CAN_SA p_entiy) |
|||
{ |
|||
|
|||
return await SetNewState(p_entiy.BillNum); |
|||
} |
|||
|
|||
public virtual async Task<bool> SetNewState(string billNum) |
|||
{ |
|||
|
|||
var entity= await GetMainAsync(billNum); |
|||
if (entity != null ) |
|||
{ |
|||
|
|||
entity.State = SettleBillState.未结状态; |
|||
|
|||
|
|||
await _repository.UpdateAsync(entity); |
|||
return true; |
|||
} |
|||
return false; |
|||
; |
|||
} |
|||
/// <summary>
|
|||
/// 获得所有明细
|
|||
/// </summary>
|
|||
/// <param name="billNum"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task<List<BBAC_CAN_SA_DETAIL>> GetDetalListAsync(string billNum) |
|||
{ |
|||
return await _detailRepository.Where(p=>p.InvGroupNum==billNum).ToListAsync(); |
|||
} |
|||
/// <summary>
|
|||
/// 获得主表信息
|
|||
/// </summary>
|
|||
/// <param name="billNum"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task<BBAC_CAN_SA> GetMainAsync(string billNum) |
|||
{ |
|||
return await _repository.Where(p => p.InvGroupNum == billNum).FirstOrDefaultAsync(); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,269 @@ |
|||
using EFCore.BulkExtensions; |
|||
using Hangfire.Annotations; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using SettleAccount.Bases; |
|||
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.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities; |
|||
using Volo.Abp.Domain.Services; |
|||
using Volo.Abp.Guids; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Win.Sfs.SettleAccount.Bases.DomainServices; |
|||
using Win.Sfs.SettleAccount.Boms; |
|||
using Win.Sfs.SettleAccount.Entities.Materials; |
|||
using Win.Sfs.SettleAccount.MaterialRelationships; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|||
{ |
|||
public class HBPO_CAN_SA_MNG: DomainService |
|||
|
|||
{ |
|||
private readonly INormalEfCoreRepository<HBPO_CAN_SA, Guid> _repository; |
|||
private readonly INormalEfCoreRepository<HBPO_CAN_SA_DETAIL, Guid> _detailRepository; |
|||
public HBPO_CAN_SA_MNG |
|||
( |
|||
INormalEfCoreRepository<HBPO_CAN_SA, Guid> repository, |
|||
INormalEfCoreRepository<HBPO_CAN_SA_DETAIL, Guid> detailRepository |
|||
) |
|||
{ |
|||
_repository = repository; |
|||
_detailRepository = detailRepository; |
|||
} |
|||
|
|||
public HBPO_CAN_SA_MNG() |
|||
{ |
|||
} |
|||
|
|||
public virtual async Task<bool> SetForwardState(HBPO_CAN_SA p_entiy, SettleBillState state) |
|||
{ |
|||
if (await SetForwardState(p_entiy.InvGroupNum, state) == true) |
|||
{ |
|||
return true; |
|||
} |
|||
return false; |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 向前流程
|
|||
/// </summary>
|
|||
/// <param name="p_billNum"></param>
|
|||
/// <param name="state"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="BusinessException"></exception>
|
|||
public virtual async Task<bool> SetForwardState(string p_billNum, SettleBillState state) |
|||
{ |
|||
|
|||
var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList(); |
|||
if (ls == null && ls.Count ==0) |
|||
{ |
|||
throw new BusinessException("8989", string.Format("不存在编号为{0}",p_billNum)); |
|||
} |
|||
foreach (HBPO_CAN_SA p_entiy in ls) |
|||
{ |
|||
switch (state) |
|||
{ |
|||
case SettleBillState.财务已审核: |
|||
if (p_entiy.State == SettleBillState.商务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.商务已审核: |
|||
if (p_entiy.State == SettleBillState.已开票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【商务已审核】"); |
|||
} |
|||
break; |
|||
case SettleBillState.已开票: |
|||
if (p_entiy.State == SettleBillState.未结状态) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【未结状态】状态,无法设置成【已开票】"); |
|||
} |
|||
break; |
|||
case SettleBillState.已扣减: |
|||
if (p_entiy.State == SettleBillState.客户已收票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[客户收票],无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.客户已收票: |
|||
if (p_entiy.State == SettleBillState.财务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[财务已审核],无法设置成【客户已收票】状态"); |
|||
} |
|||
break; |
|||
} |
|||
await _repository.UpdateAsync(p_entiy); |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
/// <summary>
|
|||
/// 向后流程
|
|||
/// </summary>
|
|||
/// <param name="p_billNum"></param>
|
|||
/// <param name="state"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="BusinessException"></exception>
|
|||
public virtual async Task<bool> SetBackwardState(string p_billNum, SettleBillState state) |
|||
{ |
|||
|
|||
var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList(); |
|||
if (ls == null && ls.Count == 0) |
|||
{ |
|||
throw new BusinessException("8989", string.Format("不存在发票分组号为{0}的可结算单", p_billNum)); |
|||
} |
|||
foreach (HBPO_CAN_SA p_entiy in ls) |
|||
{ |
|||
|
|||
switch (state) |
|||
{ |
|||
case SettleBillState.商务已审核: |
|||
if (p_entiy.State == SettleBillState.财务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【财务已审核】,无法设置成【商务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.已开票: |
|||
if (p_entiy.State == SettleBillState.商务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【商务已审核】状态,无法设置成【已开票】"); |
|||
} |
|||
break; |
|||
case SettleBillState.未结状态: |
|||
if (p_entiy.State == SettleBillState.已开票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【未结状态】"); |
|||
} |
|||
break; |
|||
case SettleBillState.客户已收票: |
|||
if (p_entiy.State == SettleBillState.已扣减) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[财务已审核],无法设置成【财务已审核客户收票】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.财务已审核: |
|||
if (p_entiy.State == SettleBillState.客户已收票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[客户已收票],无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
} |
|||
await _repository.UpdateAsync(p_entiy); |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
|
|||
public virtual async Task<bool> SetNewState(HBPO_CAN_SA p_entiy) |
|||
{ |
|||
|
|||
return await SetNewState(p_entiy.BillNum); |
|||
} |
|||
|
|||
public virtual async Task<bool> SetNewState(string billNum) |
|||
{ |
|||
|
|||
var entity= await GetMainAsync(billNum); |
|||
if (entity != null ) |
|||
{ |
|||
|
|||
entity.State = SettleBillState.未结状态; |
|||
|
|||
|
|||
await _repository.UpdateAsync(entity); |
|||
return true; |
|||
} |
|||
return false; |
|||
; |
|||
} |
|||
/// <summary>
|
|||
/// 获得所有明细
|
|||
/// </summary>
|
|||
/// <param name="billNum"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task<List<HBPO_CAN_SA_DETAIL>> GetDetalListAsync(string billNum) |
|||
{ |
|||
return await _detailRepository.Where(p=>p.InvGroupNum==billNum).ToListAsync(); |
|||
} |
|||
/// <summary>
|
|||
/// 获得主表信息
|
|||
/// </summary>
|
|||
/// <param name="billNum"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task<HBPO_CAN_SA> GetMainAsync(string billNum) |
|||
{ |
|||
return await _repository.Where(p => p.InvGroupNum == billNum).FirstOrDefaultAsync(); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,269 @@ |
|||
using EFCore.BulkExtensions; |
|||
using Hangfire.Annotations; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using SettleAccount.Bases; |
|||
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.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities; |
|||
using Volo.Abp.Domain.Services; |
|||
using Volo.Abp.Guids; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Win.Sfs.SettleAccount.Bases.DomainServices; |
|||
using Win.Sfs.SettleAccount.Boms; |
|||
using Win.Sfs.SettleAccount.Entities.Materials; |
|||
using Win.Sfs.SettleAccount.MaterialRelationships; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|||
{ |
|||
public class PUB_CAN_SA_MNG: DomainService |
|||
|
|||
{ |
|||
private readonly INormalEfCoreRepository<PUB_CAN_SA, Guid> _repository; |
|||
private readonly INormalEfCoreRepository<PUB_CAN_SA_DETAIL, Guid> _detailRepository; |
|||
public PUB_CAN_SA_MNG |
|||
( |
|||
INormalEfCoreRepository<PUB_CAN_SA, Guid> repository, |
|||
INormalEfCoreRepository<PUB_CAN_SA_DETAIL, Guid> detailRepository |
|||
) |
|||
{ |
|||
_repository = repository; |
|||
_detailRepository = detailRepository; |
|||
} |
|||
|
|||
public PUB_CAN_SA_MNG() |
|||
{ |
|||
} |
|||
|
|||
public virtual async Task<bool> SetForwardState(PUB_CAN_SA p_entiy, SettleBillState state) |
|||
{ |
|||
if (await SetForwardState(p_entiy.InvGroupNum, state) == true) |
|||
{ |
|||
return true; |
|||
} |
|||
return false; |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 向前流程
|
|||
/// </summary>
|
|||
/// <param name="p_billNum"></param>
|
|||
/// <param name="state"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="BusinessException"></exception>
|
|||
public virtual async Task<bool> SetForwardState(string p_billNum, SettleBillState state) |
|||
{ |
|||
|
|||
var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList(); |
|||
if (ls == null && ls.Count ==0) |
|||
{ |
|||
throw new BusinessException("8989", string.Format("不存在编号为{0}",p_billNum)); |
|||
} |
|||
foreach (PUB_CAN_SA p_entiy in ls) |
|||
{ |
|||
switch (state) |
|||
{ |
|||
case SettleBillState.财务已审核: |
|||
if (p_entiy.State == SettleBillState.商务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.商务已审核: |
|||
if (p_entiy.State == SettleBillState.已开票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【商务已审核】"); |
|||
} |
|||
break; |
|||
case SettleBillState.已开票: |
|||
if (p_entiy.State == SettleBillState.未结状态) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【未结状态】状态,无法设置成【已开票】"); |
|||
} |
|||
break; |
|||
case SettleBillState.已扣减: |
|||
if (p_entiy.State == SettleBillState.客户已收票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[客户收票],无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.客户已收票: |
|||
if (p_entiy.State == SettleBillState.财务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[财务已审核],无法设置成【客户已收票】状态"); |
|||
} |
|||
break; |
|||
} |
|||
await _repository.UpdateAsync(p_entiy); |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
/// <summary>
|
|||
/// 向后流程
|
|||
/// </summary>
|
|||
/// <param name="p_billNum"></param>
|
|||
/// <param name="state"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="BusinessException"></exception>
|
|||
public virtual async Task<bool> SetBackwardState(string p_billNum, SettleBillState state) |
|||
{ |
|||
|
|||
var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList(); |
|||
if (ls == null && ls.Count == 0) |
|||
{ |
|||
throw new BusinessException("8989", string.Format("不存在发票分组号为{0}的可结算单", p_billNum)); |
|||
} |
|||
foreach (PUB_CAN_SA p_entiy in ls) |
|||
{ |
|||
|
|||
switch (state) |
|||
{ |
|||
case SettleBillState.商务已审核: |
|||
if (p_entiy.State == SettleBillState.财务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【财务已审核】,无法设置成【商务已审核】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.已开票: |
|||
if (p_entiy.State == SettleBillState.商务已审核) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【商务已审核】状态,无法设置成【已开票】"); |
|||
} |
|||
break; |
|||
case SettleBillState.未结状态: |
|||
if (p_entiy.State == SettleBillState.已开票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【未结状态】"); |
|||
} |
|||
break; |
|||
case SettleBillState.客户已收票: |
|||
if (p_entiy.State == SettleBillState.已扣减) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[财务已审核],无法设置成【财务已审核客户收票】状态"); |
|||
} |
|||
break; |
|||
case SettleBillState.财务已审核: |
|||
if (p_entiy.State == SettleBillState.客户已收票) |
|||
{ |
|||
p_entiy.State = state; |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("8989", "当前状态不是[客户已收票],无法设置成【财务已审核】状态"); |
|||
} |
|||
break; |
|||
} |
|||
await _repository.UpdateAsync(p_entiy); |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
|
|||
public virtual async Task<bool> SetNewState(PUB_CAN_SA p_entiy) |
|||
{ |
|||
|
|||
return await SetNewState(p_entiy.BillNum); |
|||
} |
|||
|
|||
public virtual async Task<bool> SetNewState(string billNum) |
|||
{ |
|||
|
|||
var entity= await GetMainAsync(billNum); |
|||
if (entity != null ) |
|||
{ |
|||
|
|||
entity.State = SettleBillState.未结状态; |
|||
|
|||
|
|||
await _repository.UpdateAsync(entity); |
|||
return true; |
|||
} |
|||
return false; |
|||
; |
|||
} |
|||
/// <summary>
|
|||
/// 获得所有明细
|
|||
/// </summary>
|
|||
/// <param name="billNum"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task<List<PUB_CAN_SA_DETAIL>> GetDetalListAsync(string billNum) |
|||
{ |
|||
return await _detailRepository.Where(p=>p.InvGroupNum==billNum).ToListAsync(); |
|||
} |
|||
/// <summary>
|
|||
/// 获得主表信息
|
|||
/// </summary>
|
|||
/// <param name="billNum"></param>
|
|||
/// <returns></returns>
|
|||
public virtual async Task<PUB_CAN_SA> GetMainAsync(string billNum) |
|||
{ |
|||
return await _repository.Where(p => p.InvGroupNum == billNum).FirstOrDefaultAsync(); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Loading…
Reference in new issue