|
@ -1,6 +1,7 @@ |
|
|
using EFCore.BulkExtensions; |
|
|
using EFCore.BulkExtensions; |
|
|
using Hangfire; |
|
|
using Hangfire; |
|
|
using Microsoft.AspNetCore.SignalR; |
|
|
using Microsoft.AspNetCore.SignalR; |
|
|
|
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
using NPOI.SS.Formula.Functions; |
|
|
using NPOI.SS.Formula.Functions; |
|
|
using SettleAccount.Bases; |
|
|
using SettleAccount.Bases; |
|
@ -39,9 +40,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
PUB_CAN_SA_MNG pubMng, |
|
|
PUB_CAN_SA_MNG pubMng, |
|
|
BBAC_CAN_SA_MNG bbacMng, |
|
|
BBAC_CAN_SA_MNG bbacMng, |
|
|
HBPO_CAN_SA_MNG hbpoMng, |
|
|
HBPO_CAN_SA_MNG hbpoMng, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INormalEfCoreRepository<INVOICE_GRP, Guid> repository, |
|
|
INormalEfCoreRepository<INVOICE_GRP, Guid> repository, |
|
|
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> groupRepository, |
|
|
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> groupRepository, |
|
|
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> detailRepository, |
|
|
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> detailRepository, |
|
@ -136,12 +134,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
/// <exception cref="BusinessException"></exception>
|
|
|
/// <exception cref="BusinessException"></exception>
|
|
|
public virtual async Task<bool> SetForwardState(INVOICE_GRP p_entiy, SettleBillState p_State) |
|
|
public virtual async Task<bool> SetForwardState(INVOICE_GRP p_entiy, SettleBillState p_State) |
|
|
{ |
|
|
{ |
|
|
|
|
|
if (p_entiy.InvoiceState == InvoiceBillState.报废) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new BusinessException("8989", "当前发票已报废不能进行操作"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var state = p_State; |
|
|
var state = p_State; |
|
|
switch (p_State) |
|
|
switch (p_State) |
|
|
{ |
|
|
{ |
|
|
case SettleBillState.财务已审核: |
|
|
case SettleBillState.财务已审核: |
|
|
if (p_entiy.State == SettleBillState.商务已审核) |
|
|
if (p_entiy.State == SettleBillState.商务已审核) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
p_entiy.State = state; |
|
|
p_entiy.State = state; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
@ -170,8 +174,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var flag = await SetSettleState(p_entiy, p_State, true); |
|
|
var flag = await SetSettleState(p_entiy, p_State, true); |
|
|
if (flag == true) |
|
|
if (flag == true) |
|
|
{ |
|
|
{ |
|
@ -434,12 +436,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
/// <returns></returns>
|
|
|
/// <returns></returns>
|
|
|
public virtual async Task<bool> Reject(string groupbillNum) |
|
|
public virtual async Task<bool> Reject(string groupbillNum) |
|
|
{ |
|
|
{ |
|
|
|
|
|
var ls = await _repository.Where(p => p.InvGroupNum == groupbillNum).ToListAsync(); |
|
|
var _ls = await _repository.Where(p => p.InvGroupNum == groupbillNum).ToListAsync(); |
|
|
if (ls != null && ls.Count > 0) |
|
|
|
|
|
|
|
|
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.财务已审核 |
|
|
if (p_entity.State == SettleBillState.财务已审核 |
|
|
|| p_entity.State == SettleBillState.已开票 || 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 groupList = _groupRepository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList(); |
|
|
var notList = _notRepository.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 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(entList); |
|
|
await _repository.DbContext.BulkDeleteAsync(groupList); |
|
|
await _repository.DbContext.BulkDeleteAsync(groupList); |
|
|
await _repository.DbContext.BulkDeleteAsync(notList); |
|
|
await _repository.DbContext.BulkDeleteAsync(notList); |
|
|
await _repository.DbContext.BulkDeleteAsync(detailList); |
|
|
await _repository.DbContext.BulkDeleteAsync(detailList); |
|
|
//await _repository.DbContext.BulkUpdateAsync(canList);
|
|
|
if (first.BusinessType == EnumBusinessType.JisBBAC) |
|
|
|
|
|
{ |
|
|
|
|
|
await _bbacMng.SetNewState(groupbillNum); |
|
|
} |
|
|
} |
|
|
if (p_entity.State == SettleBillState.已扣减) |
|
|
else if (first.BusinessType == EnumBusinessType.JisHBPO) |
|
|
{ |
|
|
{ |
|
|
|
|
|
await _hbpoMng.SetNewState(groupbillNum); |
|
|
} |
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
await _pubMng.SetNewState(groupbillNum); |
|
|
|
|
|
} |
|
|
|
|
|
//await _repository.DbContext.BulkUpdateAsync(canList);
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
|
|
|
throw new BusinessException("8989",$"查询不到发票分组号为{groupbillNum}发票分组"); |
|
|
} |
|
|
} |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
@ -892,7 +901,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
///
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="dtos"></param>
|
|
|
|
|
|
/// <param name="p_OldInvBillNum"></param>
|
|
|
|
|
|
/// <param name="p_version"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <exception cref="BusinessException"></exception>
|
|
|
public async Task<bool> ReissueFirstInvoice(List<TEMP_CAN_SA_DETAIL> dtos, string p_OldInvBillNum, int p_version) |
|
|
public async Task<bool> ReissueFirstInvoice(List<TEMP_CAN_SA_DETAIL> dtos, string p_OldInvBillNum, int p_version) |
|
|
{ |
|
|
{ |
|
|
if (!string.IsNullOrEmpty(p_OldInvBillNum)) |
|
|
if (!string.IsNullOrEmpty(p_OldInvBillNum)) |
|
@ -914,6 +930,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
} |
|
|
} |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
///
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="dtos"></param>
|
|
|
|
|
|
/// <param name="p_OldInvBillNum"></param>
|
|
|
|
|
|
/// <param name="p_version"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <exception cref="BusinessException"></exception>
|
|
|
public async Task<bool> ReissueSecInvoice(List<TEMP_CAN_SA_DETAIL> dtos, string p_OldInvBillNum, int p_version) |
|
|
public async Task<bool> ReissueSecInvoice(List<TEMP_CAN_SA_DETAIL> dtos, string p_OldInvBillNum, int p_version) |
|
|
{ |
|
|
{ |
|
|
if (!string.IsNullOrEmpty(p_OldInvBillNum)) |
|
|
if (!string.IsNullOrEmpty(p_OldInvBillNum)) |
|
|