|
|
@ -48,6 +48,7 @@ using Win.Sfs.Shared.RepositoryBase; |
|
|
|
using static Dm.parser.LVal; |
|
|
|
using static LinqToDB.Sql; |
|
|
|
using Win.Sfs.Shared.Filter; |
|
|
|
using Polly; |
|
|
|
|
|
|
|
namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
{ |
|
|
@ -117,12 +118,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
/// 提交到QAD
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// 已扣减发票提交到QAD
|
|
|
|
/// 查询状态为已扣减的数据
|
|
|
|
/// 判断ParentInvbillNum是否有数据
|
|
|
|
/// 有数据查询出对应发票数据状态为已提交QAD(置换成负数据)需要提交到QAD
|
|
|
|
/// 已扣减的数据提交到QAD
|
|
|
|
/// 成功提交后修改状态为已提交QAD
|
|
|
|
/// * 已扣减发票提交到QAD
|
|
|
|
/// * 查询状态为已扣减的数据
|
|
|
|
/// * 判断ParentInvbillNum是否有数据
|
|
|
|
/// * 有数据查询出对应发票数据状态为已提交QAD(置换成负数据)需要提交到QAD
|
|
|
|
/// * 已扣减的数据提交到QAD
|
|
|
|
/// * 成功提交后修改状态为已提交QAD
|
|
|
|
/// </remarks>
|
|
|
|
[HttpPost] |
|
|
|
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); |
|
|
|
|
|
|
|
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); |
|
|
@ -355,13 +366,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
INVOICE_GRP_DETAIL_DTO entity = new INVOICE_GRP_DETAIL_DTO(); |
|
|
|
|
|
|
|
var condition = input.Filters.FirstOrDefault(p => p.Column == "invbillNum"); |
|
|
|
if( condition==null ) |
|
|
|
{ |
|
|
|
input.Filters.Add(new FilterCondition("InvoiceState", "1", EnumFilterAction.Equal, EnumFilterLogic.And)); |
|
|
|
if (condition == null) |
|
|
|
{ |
|
|
|
input.Filters.Add(new FilterCondition("InvoiceState", "1", EnumFilterAction.Equal, EnumFilterLogic.And)); |
|
|
|
} |
|
|
|
var invs = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var m = await _mRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount).ConfigureAwait(false); |
|
|
|
var mdtos = ObjectMapper.Map<List<INVOICE_MAP_GROUP>, List<INVOICE_MAP_GROUP_DTO>>(m); |
|
|
@ -576,11 +587,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
.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) }); |
|
|
|
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) |
|
|
|
{ |
|
|
@ -622,7 +628,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -744,13 +750,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
{ |
|
|
|
_excel.Append(jitunsettle, "未结零件汇总"); |
|
|
|
} |
|
|
|
if (m != null) |
|
|
|
{ |
|
|
|
_excel.Append(m, "发票结算分组对应"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
//jis业务,发票分组对应关系,未结数据,调整数据
|
|
|
|
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO) |
|
|
|