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