|
|
@ -988,9 +988,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
|
|
|
|
{ |
|
|
|
List<string> _invls = new List<string>(); |
|
|
|
var groups1 = dtos.GroupBy(p => new {p.PartCode, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV |
|
|
|
var groups1 = dtos.GroupBy(p => new { p.PartCode, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV |
|
|
|
{ |
|
|
|
PartCode=p.Key.PartCode, |
|
|
|
PartCode = p.Key.PartCode, |
|
|
|
LU = p.Key.LU, |
|
|
|
Amt = p.Sum(itm => itm.Amt), |
|
|
|
Qty = p.Sum(itm => itm.Qty), |
|
|
@ -999,7 +999,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
BeginDate = p.Key.BeginDate, |
|
|
|
EndDate = p.Key.EndDate |
|
|
|
}).ToList();//汇总记录不出现重复值
|
|
|
|
var groups = dtos.GroupBy(p => new {p.PartCode, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV |
|
|
|
var groups = dtos.GroupBy(p => new { p.PartCode, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV |
|
|
|
{ |
|
|
|
PartCode = p.Key.PartCode, |
|
|
|
LU = p.Key.LU, |
|
|
@ -1014,7 +1014,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
foreach (var group in groups) |
|
|
|
{ |
|
|
|
int i = groups1.Count(p => p.LU == group.LU |
|
|
|
&& p.PartCode==group.PartCode |
|
|
|
&& p.PartCode == group.PartCode |
|
|
|
&& p.BeginDate == group.BeginDate |
|
|
|
&& p.EndDate == group.EndDate |
|
|
|
&& p.ContractDocID == group.ContractDocID |
|
|
@ -1053,8 +1053,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
invoiceMap.Add(invoiceBillNum, tempList); |
|
|
|
var query = from itm in groups1 //更新分组
|
|
|
|
join itm1 in tempList |
|
|
|
on new { itm.LU, itm.BeginDate, itm.EndDate, itm.ContractDocID ,itm.PartCode} |
|
|
|
equals new { itm1.LU, itm1.BeginDate, itm1.EndDate, itm1.ContractDocID,itm1.PartCode } into temp |
|
|
|
on new { itm.LU, itm.BeginDate, itm.EndDate, itm.ContractDocID, itm.PartCode } |
|
|
|
equals new { itm1.LU, itm1.BeginDate, itm1.EndDate, itm1.ContractDocID, itm1.PartCode } into temp |
|
|
|
from tm in temp |
|
|
|
where tm == null |
|
|
|
select new TMEP_INV |
|
|
@ -1071,7 +1071,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
} |
|
|
|
if (invoiceMap.Count > 0) |
|
|
|
{ |
|
|
|
|
|
|
|
var groupList = new List<INVOICE_MAP_GROUP>(); |
|
|
|
var notDetialList = new List<INVOICE_NOT_SETTLE>(); |
|
|
|
var detailList = new List<INVOICE_WAIT_DETAIL>(); |
|
|
@ -1082,36 +1081,32 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
{ |
|
|
|
var key = group.Key;//发票票号
|
|
|
|
var ls = group.Value;//发票明细
|
|
|
|
|
|
|
|
//反向查找结算数据
|
|
|
|
var query = from itm in dtos |
|
|
|
join itm1 in ls |
|
|
|
on new { itm.LU,itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU,itm1.PartCode, itm1.BeginDate, itm1.EndDate } |
|
|
|
join itm2 in p_list on new { itm.PartCode,itm.PN, itm.SettleDate } equals new { itm2.PartCode,itm2.PN, itm2.SettleDate } |
|
|
|
select itm2; |
|
|
|
foreach (var itm in query) |
|
|
|
{ |
|
|
|
itm.InvbillNum = key; |
|
|
|
salist.Add(itm); |
|
|
|
} |
|
|
|
//反向查找结算数据
|
|
|
|
var query = from itm in dtos |
|
|
|
join itm1 in ls |
|
|
|
on new { itm.LU, itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.PartCode, itm1.BeginDate, itm1.EndDate } |
|
|
|
join itm2 in p_list on new { itm.PartCode, itm.PN, itm.SettleDate } equals new { itm2.PartCode, itm2.PN, itm2.SettleDate } |
|
|
|
select itm2; |
|
|
|
foreach (var itm in query) |
|
|
|
{ |
|
|
|
itm.InvbillNum = key; |
|
|
|
salist.Add(itm); |
|
|
|
} |
|
|
|
if (!string.IsNullOrEmpty(p_parentInvBillNum)) |
|
|
|
{ |
|
|
|
//反向查找调整数据
|
|
|
|
var query1 = from itm in dtos |
|
|
|
join itm1 in ls |
|
|
|
on new { itm.LU,itm.PartCode ,itm.BeginDate, itm.EndDate } equals new { itm1.LU,itm1.PartCode, itm1.BeginDate, itm1.EndDate } |
|
|
|
join itm2 in p_ajdlist on new { itm.PartCode, itm.PN, itm.SettleDate } equals new { itm2.PartCode, itm2.PN, itm2.SettleDate } |
|
|
|
select itm2; |
|
|
|
|
|
|
|
join itm1 in ls |
|
|
|
on new { itm.LU, itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.PartCode, itm1.BeginDate, itm1.EndDate } |
|
|
|
join itm2 in p_ajdlist on new { itm.PartCode, itm.PN, itm.SettleDate } equals new { itm2.PartCode, itm2.PN, itm2.SettleDate } |
|
|
|
select itm2; |
|
|
|
foreach (var itm in query1) |
|
|
|
{ |
|
|
|
itm.InvBillNum = key; |
|
|
|
adjlist.Add(itm); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List < INVOICE_WAIT_DETAIL > _entityDetailList = new List<INVOICE_WAIT_DETAIL>(); |
|
|
|
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>(); |
|
|
|
foreach (var detail in ls) |
|
|
|
{ |
|
|
|
_entityDetailList.Add( |
|
|
@ -1129,7 +1124,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
extend2: string.Empty, |
|
|
|
beginDate: detail.BeginDate, |
|
|
|
endDate: detail.EndDate, |
|
|
|
partcode:detail.PartCode |
|
|
|
partcode: detail.PartCode |
|
|
|
)); |
|
|
|
} |
|
|
|
if (_entityDetailList.Count > 0) |
|
|
@ -1184,12 +1179,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
); |
|
|
|
invlist.Add(invbill); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await _repository.DbContext.BulkInsertAsync(invlist); |
|
|
|
await _repository.DbContext.BulkInsertAsync(groupList); |
|
|
|
await _repository.DbContext.BulkInsertAsync(detailList); |
|
|
|
if(salist.Count>0) |
|
|
|
if (salist.Count > 0) |
|
|
|
{ |
|
|
|
await _repository.DbContext.BulkUpdateAsync(salist); |
|
|
|
} |
|
|
@ -1197,7 +1190,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
{ |
|
|
|
await _repository.DbContext.BulkUpdateAsync(adjlist); |
|
|
|
} |
|
|
|
|
|
|
|
//await _repository.DbContext.BulkInsertAsync(notDetialList);
|
|
|
|
_invls = invlist.Select(p => p.InvbillNum).ToList(); |
|
|
|
} |
|
|
|