|
|
@ -1965,6 +1965,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
{ |
|
|
|
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) |
|
|
|
{ |
|
|
@ -1993,7 +1996,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
return new JsonResult(new { Code = 200, Message = "退回成功" }); ; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[UnitOfWork(false)] |
|
|
|
private async Task RejectionAsync<Tmain, Tdetail>(Tmain main,List<Tdetail> details) |
|
|
|
where Tdetail: SA_CAN_BASE, new() where Tmain : SA_CAN_BASE_MAIN, new() |
|
|
|
{ |
|
|
@ -2015,21 +2018,25 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
newmain.InvGroupNum = billNum; |
|
|
|
} |
|
|
|
newmain.CreationTime = DateTime.Now; |
|
|
|
newmain.State = SettleBillState.已退回; |
|
|
|
newmain.State = SettleBillState.未结状态; |
|
|
|
newmain.ExtraProperties.TryAdd("ParentBillNum", main.BillNum); |
|
|
|
newmain.ExtraProperties.TryAdd("InvBillNum", details.FirstOrDefault().InvbillNum); |
|
|
|
newmain.ExtraProperties.TryAdd("IsReturn", "是"); |
|
|
|
var _dbcontext = await _repository.GetDbContextAsync().ConfigureAwait(false); |
|
|
|
var list = details; |
|
|
|
foreach (var item in list) |
|
|
|
|
|
|
|
foreach (var item in details) |
|
|
|
{ |
|
|
|
item.BillNum = billNum; |
|
|
|
item.InvbillNum = string.Empty; |
|
|
|
} |
|
|
|
await _dbcontext.BulkInsertAsync(new List<Tmain>() { newmain }).ConfigureAwait(false); |
|
|
|
await _dbcontext.BulkUpdateAsync(list).ConfigureAwait(false); |
|
|
|
await _dbcontext.BulkUpdateAsync(details).ConfigureAwait(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[UnitOfWork(false)] |
|
|
|
[HttpPost] |
|
|
|
public virtual async Task<IActionResult> ReturnAsync(INVOICE_GRP_DTO p_dto) |
|
|
|
{ |
|
|
@ -2050,17 +2057,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
switch(inv.BusinessType) |
|
|
|
{ |
|
|
|
case EnumBusinessType.JisBBAC: |
|
|
|
var bbaclist = await dbcontext.Set<BBAC_CAN_SA_DETAIL>().Where(p => p.InvbillNum == p_dto.InvbillNum).ToListAsync().ConfigureAwait(false); |
|
|
|
var bbaclist = await dbcontext.Set<BBAC_CAN_SA_DETAIL>().Where(p => p.InvbillNum == p_dto.InvbillNum).AsNoTracking().ToListAsync().ConfigureAwait(false); |
|
|
|
var bbacfirst = await dbcontext.Set<BBAC_CAN_SA>().FirstOrDefaultAsync(p => p.BillNum == p_dto.InvGroupNum).ConfigureAwait(false); |
|
|
|
await RejectionAsync<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL>(bbacfirst, bbaclist.ToList()).ConfigureAwait(false); |
|
|
|
break; |
|
|
|
case EnumBusinessType.JisHBPO: |
|
|
|
var hbpolist = await dbcontext.Set<HBPO_CAN_SA_DETAIL>().Where(p => p.InvbillNum == p_dto.InvbillNum).ToListAsync().ConfigureAwait(false); |
|
|
|
var hbpolist = await dbcontext.Set<HBPO_CAN_SA_DETAIL>().Where(p => p.InvbillNum == p_dto.InvbillNum).AsNoTracking().ToListAsync().ConfigureAwait(false); |
|
|
|
var hbpofirst = await dbcontext.Set<HBPO_CAN_SA>().FirstOrDefaultAsync(p => p.BillNum == p_dto.InvGroupNum).ConfigureAwait(false); |
|
|
|
await RejectionAsync<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL>(hbpofirst, hbpolist.ToList()).ConfigureAwait(false); |
|
|
|
break; |
|
|
|
default: |
|
|
|
var publist = await dbcontext.Set<PUB_CAN_SA_DETAIL>().Where(p => p.InvbillNum == p_dto.InvbillNum).ToListAsync().ConfigureAwait(false); |
|
|
|
var publist = await dbcontext.Set<PUB_CAN_SA_DETAIL>().Where(p => p.InvbillNum == p_dto.InvbillNum).AsNoTracking().ToListAsync().ConfigureAwait(false); |
|
|
|
var pubfirst = await dbcontext.Set<PUB_CAN_SA>().FirstOrDefaultAsync(p => p.BillNum == p_dto.InvGroupNum).ConfigureAwait(false); |
|
|
|
await RejectionAsync<PUB_CAN_SA, PUB_CAN_SA_DETAIL>(pubfirst, publist.ToList()).ConfigureAwait(false); |
|
|
|
break; |
|
|
@ -2069,14 +2076,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
var invgourp=dbcontext.Set<INVOICE_MAP_GROUP>().Where(p => p.InvbillNum == p_dto.InvbillNum).ToList(); |
|
|
|
var detial=dbcontext.Set<INVOICE_WAIT_DETAIL>().Where(p => p.InvbillNum == p_dto.InvbillNum).ToList(); |
|
|
|
var notsettle=dbcontext.Set<INVOICE_NOT_SETTLE>().Where(p => p.InvBillNum == p_dto.InvbillNum).ToList(); |
|
|
|
dbcontext.BulkDeleteAsync(invList).Wait(); |
|
|
|
dbcontext.BulkDeleteAsync(invgourp).Wait(); |
|
|
|
dbcontext.BulkDeleteAsync(detial).Wait(); |
|
|
|
dbcontext.BulkDeleteAsync(notsettle).Wait(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dbcontext.BulkDelete(invList); |
|
|
|
dbcontext.BulkDelete(invgourp); |
|
|
|
dbcontext.BulkDelete(detial); |
|
|
|
dbcontext.BulkDelete(notsettle); |
|
|
|
} |
|
|
|
|
|
|
|
return new JsonResult(new { Code = 200, Message = "退回成功" }); ; |
|
|
|