|
|
@ -2,6 +2,7 @@ using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using EFCore.BulkExtensions; |
|
|
|
using NPOI.OpenXmlFormats.Spreadsheet; |
|
|
|
using SettleAccount.Bases; |
|
|
|
using SettleAccount.Domain.BQ; |
|
|
|
using TaskJob.EventArgs; |
|
|
@ -232,6 +233,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
|
var billList = p_ls.Select(p => p.BillNum).Distinct().ToList();//同步数据的发票号
|
|
|
|
var pdList = _dbcontext.Set<PUB_PD>().Where(p => billList.Contains(p.BillNum)).ToList();//扣减单内容
|
|
|
|
var pdinvList = _dbcontext.Set<INVOICE_GRP>().Where(p => billList.Contains(p.InvbillNum)).ToList(); |
|
|
|
var pddetail = _dbcontext.Set<PUB_PD_DETAIL>().Where(p => billList.Contains(p.BillNum)).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
if (pdList.Count > 0) |
|
|
|
{ |
|
|
|
if (flag == true) |
|
|
@ -255,7 +259,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
|
} |
|
|
|
foreach (var item in pdinvList) |
|
|
|
{ |
|
|
|
|
|
|
|
if (item.State == SettleBillState.已提交QAD) |
|
|
|
{ |
|
|
|
item.State = SettleBillState.红冲发票; |
|
|
@ -265,12 +268,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
|
item.State = SettleBillState.客户已收票; |
|
|
|
} |
|
|
|
} |
|
|
|
_dbcontext.BulkUpdate(pdList); |
|
|
|
_dbcontext.BulkDelete(pdList); |
|
|
|
_dbcontext.BulkDelete(pddetail); |
|
|
|
_dbcontext.BulkUpdate(pdinvList); |
|
|
|
} |
|
|
|
} |
|
|
|
var bbacList = _dbcontext.Set<BBAC_PD>().Where(p => billList.Contains(p.BillNum)).ToList(); |
|
|
|
var bbacinvList = _dbcontext.Set<INVOICE_GRP>().Where(p => billList.Contains(p.InvbillNum)).ToList(); |
|
|
|
var bbacDetail = _dbcontext.Set<BBAC_PD_DETAIL>().Where(p => billList.Contains(p.BillNum)).ToList(); |
|
|
|
if (bbacList.Count > 0) |
|
|
|
{ |
|
|
|
if (flag == true) |
|
|
@ -304,12 +309,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
|
item.State = SettleBillState.客户已收票; |
|
|
|
} |
|
|
|
} |
|
|
|
_dbcontext.BulkUpdate(bbacList); |
|
|
|
_dbcontext.BulkDelete(bbacDetail); |
|
|
|
_dbcontext.BulkDelete(bbacList); |
|
|
|
_dbcontext.BulkUpdate(bbacinvList); |
|
|
|
} |
|
|
|
} |
|
|
|
var hbpoList = _dbcontext.Set<HBPO_PD>().Where(p => billList.Contains(p.BillNum)).ToList(); |
|
|
|
var hbpoinvList = _dbcontext.Set<INVOICE_GRP>().Where(p => billList.Contains(p.InvbillNum)).ToList();//发票
|
|
|
|
var hbpoDetail = _dbcontext.Set<HBPO_PD_DETAIL>().Where(p => billList.Contains(p.BillNum)).ToList(); |
|
|
|
if (hbpoList.Count > 0) |
|
|
|
{ |
|
|
|
if (flag == true) |
|
|
@ -333,7 +340,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
|
} |
|
|
|
foreach (var item in hbpoinvList) |
|
|
|
{ |
|
|
|
|
|
|
|
if (item.State == SettleBillState.已提交QAD) |
|
|
|
{ |
|
|
|
item.State = SettleBillState.红冲发票; |
|
|
@ -343,8 +349,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
|
item.State = SettleBillState.客户已收票; |
|
|
|
} |
|
|
|
} |
|
|
|
_dbcontext.BulkUpdate(hbpoList); |
|
|
|
_dbcontext.BulkDelete(hbpoList); |
|
|
|
_dbcontext.BulkDelete(hbpoDetail); |
|
|
|
_dbcontext.BulkUpdate(hbpoinvList); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|