|
@ -3,6 +3,7 @@ using System.Collections; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.ComponentModel.DataAnnotations; |
|
|
using System.ComponentModel.DataAnnotations; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
|
|
|
using System.Linq.Dynamic.Core; |
|
|
using System.Reflection; |
|
|
using System.Reflection; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using DocumentFormat.OpenXml.Bibliography; |
|
|
using DocumentFormat.OpenXml.Bibliography; |
|
@ -25,6 +26,7 @@ using SettleAccount.Bases; |
|
|
using SettleAccount.Domain.BQ; |
|
|
using SettleAccount.Domain.BQ; |
|
|
using Shouldly; |
|
|
using Shouldly; |
|
|
using SqlSugar; |
|
|
using SqlSugar; |
|
|
|
|
|
using Volo.Abp; |
|
|
using Volo.Abp.Application.Dtos; |
|
|
using Volo.Abp.Application.Dtos; |
|
|
using Volo.Abp.Data; |
|
|
using Volo.Abp.Data; |
|
|
using Volo.Abp.Uow; |
|
|
using Volo.Abp.Uow; |
|
@ -184,19 +186,32 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
public virtual async Task<IActionResult> CancelToQad(List<string> invbillNums) |
|
|
public virtual async Task<IActionResult> CancelToQad(List<string> invbillNums) |
|
|
{ |
|
|
{ |
|
|
_globalConfigOptions.IsSyncInvoiceQadState = true; |
|
|
_globalConfigOptions.IsSyncInvoiceQadState = true; |
|
|
|
|
|
|
|
|
var invoiceGrps1 = _settleAccountDbContext.Set<INVOICE_GRP>() |
|
|
var invoiceGrps1 = _settleAccountDbContext.Set<INVOICE_GRP>() |
|
|
.Where(t => invbillNums.Contains(t.InvbillNum) && t.State == SettleBillState.红冲发票); |
|
|
.Where(t => invbillNums.Contains(t.InvbillNum) && t.State == SettleBillState.红冲发票); |
|
|
|
|
|
var grouplist=invoiceGrps1.Select(p => p.InvGroupNum).ToList();//发票分组
|
|
|
|
|
|
var invList=_settleAccountDbContext.Set<INVOICE_GRP>().Where(p => grouplist.Contains(p.InvGroupNum)).ToList(); |
|
|
|
|
|
var query =from itm in invList join itm1 in invoiceGrps1 on new { itm.InvGroupNum, itm.InvbillNum } equals new { itm1.InvGroupNum, itm1.InvbillNum } |
|
|
|
|
|
into temp |
|
|
|
|
|
from tm in temp.DefaultIfEmpty() |
|
|
|
|
|
where tm == null |
|
|
|
|
|
select itm; |
|
|
|
|
|
|
|
|
|
|
|
var invoices = query.ToList(); |
|
|
|
|
|
if (invoices.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
var invbilllist=invoices.Select(p => p.InvGroupNum).ToList(); |
|
|
|
|
|
var invs = invoiceGrps1.Where(p => invbilllist.Contains(p.InvGroupNum)).Select(p => p.InvbillNum).ToList(); |
|
|
|
|
|
throw new UserFriendlyException($"发票{string.Join(",", invs.ToArray())}对应结算单(发票分组)有其他发票状态不在撤销状态,不能退回", "400"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
foreach (var itm in invoiceGrps1) |
|
|
foreach (var itm in invoiceGrps1) |
|
|
{ |
|
|
{ |
|
|
itm.State = SettleBillState.提交QAD退回到财务审核中; |
|
|
itm.State = SettleBillState.提交QAD退回到已开票; |
|
|
} |
|
|
} |
|
|
await _settleAccountDbContext.BulkUpdateAsync(invoiceGrps1.ToList()).ConfigureAwait(false); |
|
|
await _settleAccountDbContext.BulkUpdateAsync(invoiceGrps1.ToList()).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var invoiceGrps = _settleAccountDbContext.Set<INVOICE_GRP>() |
|
|
var invoiceGrps = _settleAccountDbContext.Set<INVOICE_GRP>() |
|
|
.Where(t => invbillNums.Contains(t.InvbillNum) && t.State == SettleBillState.提交QAD退回到财务审核中); |
|
|
.Where(t => invbillNums.Contains(t.InvbillNum) && t.State == SettleBillState.提交QAD退回到已开票); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var invoiceBBACGrps = invoiceGrps.Where(p => p.BusinessType == EnumBusinessType.JisBBAC); |
|
|
var invoiceBBACGrps = invoiceGrps.Where(p => p.BusinessType == EnumBusinessType.JisBBAC); |
|
|
var invoicePubGrps = invoiceGrps.Where(p => p.BusinessType != EnumBusinessType.JisBBAC && p.BusinessType != EnumBusinessType.JisHBPO); |
|
|
var invoicePubGrps = invoiceGrps.Where(p => p.BusinessType != EnumBusinessType.JisBBAC && p.BusinessType != EnumBusinessType.JisHBPO); |
|
@ -1983,8 +1998,90 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return new JsonResult(new { Code = 200, Message = "重开成功" }); ; |
|
|
return new JsonResult(new { Code = 200, Message = "退回成功" }); ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//[HttpPost]
|
|
|
|
|
|
//public virtual async Task<IActionResult> RejectAsync(INVOICE_GRP_DTO p_dto)
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
|
|
// var invgrouplist=_repository.Where(p=>p.InvGroupNum==p_dto.InvGroupNum);
|
|
|
|
|
|
|
|
|
|
|
|
// if (invgrouplist.Count(p => p.State < SettleBillState.财务已审核) == invgrouplist.Count())//所有发票分组下的放票全为财务已审核的
|
|
|
|
|
|
// {
|
|
|
|
|
|
// await RejectAsync(p_dto.InvGroupNum).ConfigureAwait(false);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var inv= _repository.FirstOrDefault(p => p.InvbillNum == p_dto.InvbillNum);
|
|
|
|
|
|
// if (inv == null)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// return new JsonResult(new { Code = 500, Message = "发票不存在" });
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //var entities = await _invMng.GetMainListAsync(p_invGroupNum).ConfigureAwait(false);
|
|
|
|
|
|
// //var entity = entities.FirstOrDefault();
|
|
|
|
|
|
// //bool state = await _invMng.Reject(p_invGroupNum).ConfigureAwait(false);
|
|
|
|
|
|
// //if (state == true)
|
|
|
|
|
|
// //{
|
|
|
|
|
|
// // switch (entity.BusinessType)
|
|
|
|
|
|
// // {
|
|
|
|
|
|
// // case EnumBusinessType.BeiJian:
|
|
|
|
|
|
// // await _pubMng.SetNewState(p_invGroupNum).ConfigureAwait(false);
|
|
|
|
|
|
// // break;
|
|
|
|
|
|
// // case EnumBusinessType.ZhiGongJianBBAC:
|
|
|
|
|
|
// // await _pubMng.SetNewState(p_invGroupNum).ConfigureAwait(false);
|
|
|
|
|
|
// // break;
|
|
|
|
|
|
// // case EnumBusinessType.ZhiGongJianHBPO:
|
|
|
|
|
|
// // await _pubMng.SetNewState(p_invGroupNum).ConfigureAwait(false);
|
|
|
|
|
|
// // break;
|
|
|
|
|
|
// // case EnumBusinessType.YinDuJian:
|
|
|
|
|
|
// // await _pubMng.SetNewState(p_invGroupNum).ConfigureAwait(false);
|
|
|
|
|
|
// // break;
|
|
|
|
|
|
// // case EnumBusinessType.JisBBAC:
|
|
|
|
|
|
// // await _bbacMng.SetNewState(p_invGroupNum).ConfigureAwait(false);
|
|
|
|
|
|
// // break;
|
|
|
|
|
|
// // case EnumBusinessType.JisHBPO:
|
|
|
|
|
|
// // await _hbpoMng.SetNewState(p_invGroupNum).ConfigureAwait(false);
|
|
|
|
|
|
// // break;
|
|
|
|
|
|
// // }
|
|
|
|
|
|
// //}
|
|
|
|
|
|
// return new JsonResult(new { Code = 200, Message = "退回成功" }); ;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 同步QAD
|
|
|
/// 同步QAD
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|