|
@ -48,6 +48,7 @@ using Win.Sfs.Shared.RepositoryBase; |
|
|
using static Dm.parser.LVal; |
|
|
using static Dm.parser.LVal; |
|
|
using static LinqToDB.Sql; |
|
|
using static LinqToDB.Sql; |
|
|
using Win.Sfs.Shared.Filter; |
|
|
using Win.Sfs.Shared.Filter; |
|
|
|
|
|
using Polly; |
|
|
|
|
|
|
|
|
namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
{ |
|
|
{ |
|
@ -117,12 +118,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
/// 提交到QAD
|
|
|
/// 提交到QAD
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <remarks>
|
|
|
/// <remarks>
|
|
|
/// 已扣减发票提交到QAD
|
|
|
/// * 已扣减发票提交到QAD
|
|
|
/// 查询状态为已扣减的数据
|
|
|
/// * 查询状态为已扣减的数据
|
|
|
/// 判断ParentInvbillNum是否有数据
|
|
|
/// * 判断ParentInvbillNum是否有数据
|
|
|
/// 有数据查询出对应发票数据状态为已提交QAD(置换成负数据)需要提交到QAD
|
|
|
/// * 有数据查询出对应发票数据状态为已提交QAD(置换成负数据)需要提交到QAD
|
|
|
/// 已扣减的数据提交到QAD
|
|
|
/// * 已扣减的数据提交到QAD
|
|
|
/// 成功提交后修改状态为已提交QAD
|
|
|
/// * 成功提交后修改状态为已提交QAD
|
|
|
/// </remarks>
|
|
|
/// </remarks>
|
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
public virtual async Task<IActionResult> SubmitToQad(List<string> invbillNums) |
|
|
public virtual async Task<IActionResult> SubmitToQad(List<string> invbillNums) |
|
@ -208,7 +209,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
invoiceGrps.ForEach(t => t.State = SettleBillState.已提交QAD); |
|
|
invoiceGrps.ForEach(t => t.State = SettleBillState.已提交QAD); |
|
|
|
|
|
|
|
|
await _exChangeCenterDbContext.SaveChangesAsync().ConfigureAwait(false); |
|
|
await _exChangeCenterDbContext.SaveChangesAsync().ConfigureAwait(false); |
|
|
await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false); |
|
|
|
|
|
|
|
|
var retryPolicyAsync = Policy.Handle<Exception>().WaitAndRetryAsync(new[] { |
|
|
|
|
|
TimeSpan.FromSeconds(1), |
|
|
|
|
|
TimeSpan.FromSeconds(5), |
|
|
|
|
|
TimeSpan.FromSeconds(5), |
|
|
|
|
|
TimeSpan.FromSeconds(5) |
|
|
|
|
|
}, (exception, timeSpan, retryCount, context) => |
|
|
|
|
|
{ |
|
|
|
|
|
Console.WriteLine($"执行失败,第 {retryCount} 次重试"); |
|
|
|
|
|
}); |
|
|
|
|
|
await retryPolicyAsync.ExecuteAsync(async () => await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false)).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
await Task.CompletedTask.ConfigureAwait(false); |
|
|
await Task.CompletedTask.ConfigureAwait(false); |
|
@ -355,7 +366,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
INVOICE_GRP_DETAIL_DTO entity = new INVOICE_GRP_DETAIL_DTO(); |
|
|
INVOICE_GRP_DETAIL_DTO entity = new INVOICE_GRP_DETAIL_DTO(); |
|
|
|
|
|
|
|
|
var condition = input.Filters.FirstOrDefault(p => p.Column == "invbillNum"); |
|
|
var condition = input.Filters.FirstOrDefault(p => p.Column == "invbillNum"); |
|
|
if( condition==null ) |
|
|
if (condition == null) |
|
|
{ |
|
|
{ |
|
|
input.Filters.Add(new FilterCondition("InvoiceState", "1", EnumFilterAction.Equal, EnumFilterLogic.And)); |
|
|
input.Filters.Add(new FilterCondition("InvoiceState", "1", EnumFilterAction.Equal, EnumFilterLogic.And)); |
|
|
} |
|
|
} |
|
@ -576,11 +587,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
.GroupBy(p => new { p.LU, p.SettleGroupNum }) |
|
|
.GroupBy(p => new { p.LU, p.SettleGroupNum }) |
|
|
.Select(p => new JIT_UNSETTLED_DETAIL_DTO { LU = p.Key.LU, GroupNum = p.Key.SettleGroupNum, Qty = p.Sum(itm => itm.Qty.Value) }); |
|
|
.Select(p => new JIT_UNSETTLED_DETAIL_DTO { LU = p.Key.LU, GroupNum = p.Key.SettleGroupNum, Qty = p.Sum(itm => itm.Qty.Value) }); |
|
|
entity.JIT_UNSETTLED_DETAIL = unsettledList.ToList().OrderBy(p => p.GroupNum).ThenBy(p => p.LU).ToList(); |
|
|
entity.JIT_UNSETTLED_DETAIL = unsettledList.ToList().OrderBy(p => p.GroupNum).ThenBy(p => p.LU).ToList(); |
|
|
|
|
|
|
|
|
entity.INVOICE_MAP_GROUP =mdtos; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if (first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO) |
|
|
if (first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO) |
|
|
{ |
|
|
{ |
|
@ -744,13 +750,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
{ |
|
|
{ |
|
|
_excel.Append(jitunsettle, "未结零件汇总"); |
|
|
_excel.Append(jitunsettle, "未结零件汇总"); |
|
|
} |
|
|
} |
|
|
if (m != null) |
|
|
|
|
|
{ |
|
|
|
|
|
_excel.Append(m, "发票结算分组对应"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
//jis业务,发票分组对应关系,未结数据,调整数据
|
|
|
//jis业务,发票分组对应关系,未结数据,调整数据
|
|
|
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO) |
|
|
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO) |
|
|