|
|
@ -194,33 +194,33 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
{ |
|
|
|
detailList.AddRange(_entityDetailList); |
|
|
|
} |
|
|
|
decimal amt = detailList.Sum(k => k.Amt); |
|
|
|
decimal txtAmt = Math.Round(detailList.Sum(k => k.Amt), 2); |
|
|
|
|
|
|
|
decimal amt = detailList.Sum(k => k.Amt);//金额
|
|
|
|
decimal txtAmt = detailList.Sum(k => k.Amt) + Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税后金额
|
|
|
|
decimal readAmt = Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税额
|
|
|
|
var contractList = ls.Select(p => p.ContractDocID).Distinct(); |
|
|
|
var _groupList = dtos.Where(p => contractList.Contains(p.ContractDocID)).GroupBy(p => new { p.GroupNum }) |
|
|
|
.Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }).Distinct(); |
|
|
|
//var _groupList = dtos.GroupBy(p => new { p.GroupNum })
|
|
|
|
// .Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }).Distinct();
|
|
|
|
List<INVOICE_MAP_GROUP> group1 = new List<INVOICE_MAP_GROUP>(); |
|
|
|
//List<INVOICE_MAP_GROUP> group1 = new List<INVOICE_MAP_GROUP>();
|
|
|
|
|
|
|
|
foreach (var en in _groupList) |
|
|
|
{ |
|
|
|
group1.Add( |
|
|
|
new INVOICE_MAP_GROUP( |
|
|
|
guid: GuidGenerator.Create(), |
|
|
|
version: p_version, |
|
|
|
invbillNum: key, |
|
|
|
invGroupNum: p_InvGroupNum, |
|
|
|
settleGroupNum: en.GroupNum, |
|
|
|
amt: en.Amt, |
|
|
|
extend1: string.Empty, |
|
|
|
extend2: string.Empty)); |
|
|
|
} |
|
|
|
if (group1.Count > 0) |
|
|
|
{ |
|
|
|
groupList.AddRange(group1); |
|
|
|
} |
|
|
|
//foreach (var en in _groupList)
|
|
|
|
//{
|
|
|
|
// group1.Add(
|
|
|
|
// new INVOICE_MAP_GROUP(
|
|
|
|
// guid: GuidGenerator.Create(),
|
|
|
|
// version: p_version,
|
|
|
|
// invbillNum: key,
|
|
|
|
// invGroupNum: p_InvGroupNum,
|
|
|
|
// settleGroupNum: en.GroupNum,
|
|
|
|
// amt: en.Amt,
|
|
|
|
// extend1: string.Empty,
|
|
|
|
// extend2: string.Empty));
|
|
|
|
//}
|
|
|
|
//if (group1.Count > 0)
|
|
|
|
//{
|
|
|
|
// groupList.AddRange(group1);
|
|
|
|
//}
|
|
|
|
|
|
|
|
var invbill = new INVOICE_GRP |
|
|
|
(guid: GuidGenerator.Create(), |
|
|
@ -238,26 +238,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
preTaxDiff: 0, |
|
|
|
taxDiff: 0, |
|
|
|
clientCode: string.Empty, |
|
|
|
realAmt: 0 |
|
|
|
realAmt: readAmt |
|
|
|
); |
|
|
|
invlist.Add(invbill); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//await _repository.DbContext.BulkInsertAsync(invlist);
|
|
|
|
//await _repository.DbContext.BulkInsertAsync(groupList);
|
|
|
|
//await _repository.DbContext.BulkInsertAsync(detailList);
|
|
|
|
//if(salist.Count>0)
|
|
|
|
//{
|
|
|
|
// await _repository.DbContext.BulkUpdateAsync(salist);
|
|
|
|
//}
|
|
|
|
//if (adjlist.Count > 0)
|
|
|
|
//{
|
|
|
|
// await _repository.DbContext.BulkUpdateAsync(adjlist);
|
|
|
|
//}
|
|
|
|
|
|
|
|
//await _repository.DbContext.BulkInsertAsync(notDetialList);
|
|
|
|
//_invls = invlist.Select(p => p.InvbillNum).ToList();
|
|
|
|
} |
|
|
|
return detailList; |
|
|
|
|
|
|
@ -327,28 +312,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
var ls = itm.Value;//结算分组号列表
|
|
|
|
//反向查找结算数据
|
|
|
|
var invdetails = p_list.Where(p => ls.Contains(p.GroupNum)).ToList(); |
|
|
|
//foreach (var detail in invdetails)
|
|
|
|
//{
|
|
|
|
// detail.InvbillNum = key;
|
|
|
|
// salist.Add(detail);
|
|
|
|
//}
|
|
|
|
//if (!string.IsNullOrEmpty(p_parentInvBillNum))
|
|
|
|
//{
|
|
|
|
// //反向查找调整数据
|
|
|
|
// var adjdetails = p_adjlist.Where(p => ls.Contains(p.GroupNum)).ToList();
|
|
|
|
// foreach (var detail in adjdetails)
|
|
|
|
// {
|
|
|
|
// detail.InvBillNum = key;
|
|
|
|
// adjdetails.Add(detail);
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }) |
|
|
|
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode,p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }) |
|
|
|
.Select(itm => new |
|
|
|
{ |
|
|
|
PartCode = itm.Key.PartCode, |
|
|
|
InvGroupNum = itm.Key.InvGroupNum, |
|
|
|
LU = itm.Key.PartCode, |
|
|
|
LU = itm.Key.LU, |
|
|
|
ContactDocID = itm.Key.ContractDocID, |
|
|
|
Price = itm.Key.Price, |
|
|
|
Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2), |
|
|
@ -357,27 +327,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
EndDate = itm.Key.EndDate |
|
|
|
}) |
|
|
|
.ToList(); |
|
|
|
decimal amt = detailDtos.Sum(k => k.Amt); |
|
|
|
decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); |
|
|
|
var mapList = new List<INVOICE_MAP_GROUP>(); |
|
|
|
foreach (var groupnum in ls) |
|
|
|
{ |
|
|
|
mapList.Add(new INVOICE_MAP_GROUP( |
|
|
|
guid: GuidGenerator.Create(), |
|
|
|
version: p_version, |
|
|
|
invbillNum: key, |
|
|
|
invGroupNum: p_InvGroupNum, |
|
|
|
settleGroupNum: groupnum, |
|
|
|
amt: 0, |
|
|
|
extend1: string.Empty, |
|
|
|
extend2: string.Empty |
|
|
|
) |
|
|
|
); |
|
|
|
} |
|
|
|
if (mapList.Count > 0) |
|
|
|
{ |
|
|
|
groupList.AddRange(mapList); |
|
|
|
} |
|
|
|
decimal amt = detailDtos.Sum(k => k.Amt);//金额
|
|
|
|
decimal txtAmt = detailDtos.Sum(k => k.Amt) + Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税后金额
|
|
|
|
decimal realAmt = Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税额
|
|
|
|
|
|
|
|
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>(); |
|
|
|
foreach (var detail in detailDtos) |
|
|
|
{ |
|
|
@ -403,31 +356,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
{ |
|
|
|
detailList.AddRange(_entityDetailList); |
|
|
|
} |
|
|
|
//var innotls = new List<INVOICE_NOT_SETTLE>();
|
|
|
|
//if (p_notlist != null && p_notlist.Count > 0)
|
|
|
|
//{
|
|
|
|
// var notls = p_notlist.Where(p=>ls.Contains(p.GroupNum)).GroupBy(p => new { p.GroupNum, p.LU }).Select(p => new { GroupNum = p.Key.GroupNum, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty) });
|
|
|
|
// foreach (var nitm in notls)
|
|
|
|
// {
|
|
|
|
// innotls.Add(new INVOICE_NOT_SETTLE(
|
|
|
|
// guid: GuidGenerator.Create(),
|
|
|
|
// version: p_version,
|
|
|
|
// invGroupNum: p_InvGroupNum,
|
|
|
|
// settleGroupNum: nitm.GroupNum,
|
|
|
|
// lU: string.Empty,
|
|
|
|
// lU1: nitm.LU,
|
|
|
|
// extend1: string.Empty,
|
|
|
|
// extend2: string.Empty,
|
|
|
|
// qty: nitm.Qty,
|
|
|
|
// p_invbillnum:key
|
|
|
|
|
|
|
|
// ));
|
|
|
|
// }
|
|
|
|
// if (innotls.Count > 0)
|
|
|
|
// {
|
|
|
|
// notDetialList.AddRange(innotls);
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
var invbill = new INVOICE_GRP |
|
|
|
(guid: GuidGenerator.Create(), |
|
|
|
realnvBillNum: string.Empty, |
|
|
@ -444,27 +373,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
preTaxDiff: 0, |
|
|
|
taxDiff: 0, |
|
|
|
clientCode: string.Empty, |
|
|
|
realAmt: 0 |
|
|
|
realAmt: realAmt |
|
|
|
); |
|
|
|
invlist.Add(invbill); |
|
|
|
} |
|
|
|
//await _repository.DbContext.BulkInsertAsync(invlist);
|
|
|
|
//await _repository.DbContext.BulkInsertAsync(groupList);
|
|
|
|
//await _repository.DbContext.BulkInsertAsync(detailList);
|
|
|
|
|
|
|
|
//if (salist.Count > 0)
|
|
|
|
//{
|
|
|
|
// await _repository.DbContext.BulkUpdateAsync(salist);
|
|
|
|
//}
|
|
|
|
//if (adjlist.Count > 0)
|
|
|
|
//{
|
|
|
|
// await _repository.DbContext.BulkUpdateAsync(adjlist);
|
|
|
|
//}
|
|
|
|
//if (notDetialList.Count > 0)
|
|
|
|
//{
|
|
|
|
// await _repository.DbContext.BulkInsertAsync(notDetialList);
|
|
|
|
//}
|
|
|
|
//_invls = invlist.Select(p => p.InvbillNum).ToList();
|
|
|
|
} |
|
|
|
|
|
|
|
return detailList; |
|
|
@ -635,8 +548,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
{ |
|
|
|
detailList.AddRange(_entityDetailList); |
|
|
|
} |
|
|
|
decimal amt = detailList.Sum(k => k.Amt); |
|
|
|
decimal txtAmt = Math.Round(detailList.Sum(k => k.Amt), 2); |
|
|
|
decimal amt = detailList.Sum(k => k.Amt);//金额
|
|
|
|
decimal txtAmt = detailList.Sum(k => k.Amt) + Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税后金额
|
|
|
|
decimal realAmt = Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税额
|
|
|
|
|
|
|
|
var invbill = new INVOICE_GRP |
|
|
|
(guid: GuidGenerator.Create(), |
|
|
@ -654,24 +568,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
preTaxDiff:0, |
|
|
|
taxDiff:0, |
|
|
|
clientCode:string.Empty, |
|
|
|
realAmt:0 |
|
|
|
realAmt:realAmt |
|
|
|
|
|
|
|
); |
|
|
|
invlist.Add(invbill); |
|
|
|
} |
|
|
|
//await _repository.DbContext.BulkInsertAsync(invlist);
|
|
|
|
////await _repository.DbContext.BulkInsertAsync(groupList);
|
|
|
|
//await _repository.DbContext.BulkInsertAsync(detailList);
|
|
|
|
//if (salist.Count > 0)
|
|
|
|
//{
|
|
|
|
// await _repository.DbContext.BulkUpdateAsync(salist);
|
|
|
|
//}
|
|
|
|
//if (adjlist.Count > 0)
|
|
|
|
//{
|
|
|
|
// await _repository.DbContext.BulkUpdateAsync(adjlist);
|
|
|
|
//}
|
|
|
|
//await _repository.DbContext.BulkInsertAsync(notDetialList);
|
|
|
|
//_invls = invlist.Select(p => p.InvbillNum).ToList();
|
|
|
|
|
|
|
|
} |
|
|
|
return detailList; |
|
|
|
} |
|
|
@ -776,12 +678,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
adjdetails.Add(detail); |
|
|
|
} |
|
|
|
} |
|
|
|
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }) |
|
|
|
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID,p.LU }) |
|
|
|
.Select(itm => new |
|
|
|
{ |
|
|
|
PartCode=itm.Key.PartCode, |
|
|
|
InvGroupNum = itm.Key.InvGroupNum, |
|
|
|
LU = itm.Key.PartCode, |
|
|
|
LU = itm.Key.LU, |
|
|
|
ContactDocID = itm.Key.ContractDocID, |
|
|
|
Price = itm.Key.Price, |
|
|
|
Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2), |
|
|
@ -790,8 +692,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
EndDate = itm.Key.EndDate |
|
|
|
}) |
|
|
|
.ToList(); |
|
|
|
decimal amt = detailDtos.Sum(k => k.Amt); |
|
|
|
decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); |
|
|
|
decimal amt = detailDtos.Sum(k => k.Amt);//金额
|
|
|
|
decimal txtAmt = detailDtos.Sum(k => k.Amt) + Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税后金额
|
|
|
|
decimal realAmt = Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税额
|
|
|
|
var mapList = new List<INVOICE_MAP_GROUP>(); |
|
|
|
foreach (var groupnum in ls) |
|
|
|
{ |
|
|
@ -876,27 +779,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
preTaxDiff: 0, |
|
|
|
taxDiff: 0, |
|
|
|
clientCode: string.Empty, |
|
|
|
realAmt: 0 |
|
|
|
realAmt: realAmt |
|
|
|
); |
|
|
|
invlist.Add(invbill); |
|
|
|
} |
|
|
|
//await _repository.DbContext.BulkInsertAsync(invlist);
|
|
|
|
//await _repository.DbContext.BulkInsertAsync(groupList);
|
|
|
|
//await _repository.DbContext.BulkInsertAsync(detailList);
|
|
|
|
|
|
|
|
//if(salist.Count>0)
|
|
|
|
//{
|
|
|
|
// await _repository.DbContext.BulkUpdateAsync(salist);
|
|
|
|
//}
|
|
|
|
//if (adjlist.Count > 0)
|
|
|
|
//{
|
|
|
|
// await _repository.DbContext.BulkUpdateAsync(adjlist);
|
|
|
|
//}
|
|
|
|
//if (notDetialList.Count > 0)
|
|
|
|
//{
|
|
|
|
// await _repository.DbContext.BulkInsertAsync(notDetialList);
|
|
|
|
//}
|
|
|
|
//_invls = invlist.Select(p => p.InvbillNum).ToList();
|
|
|
|
} |
|
|
|
|
|
|
|
return detailList; |
|
|
@ -1059,12 +946,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }) |
|
|
|
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID,p.LU }) |
|
|
|
.Select(itm => new |
|
|
|
{ |
|
|
|
PartCode = itm.Key.PartCode, |
|
|
|
InvGroupNum = itm.Key.InvGroupNum, |
|
|
|
LU = itm.Key.PartCode, |
|
|
|
LU = itm.Key.LU, |
|
|
|
ContactDocID = itm.Key.ContractDocID, |
|
|
|
Price = itm.Key.Price, |
|
|
|
Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2), |
|
|
@ -1097,8 +984,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
PartName = inv1.GetProperty("PartName", ""),//零件名称
|
|
|
|
}; |
|
|
|
|
|
|
|
decimal amt = detailDtos.Sum(k => k.Amt); |
|
|
|
decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); |
|
|
|
decimal amt = detailDtos.Sum(k => k.Amt);//金额
|
|
|
|
decimal txtAmt = detailDtos.Sum(k => k.Amt) + Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税后金额
|
|
|
|
decimal readAmt = Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税额
|
|
|
|
var mapList = new List<INVOICE_MAP_GROUP>(); |
|
|
|
foreach (var groupnum in ls) |
|
|
|
{ |
|
|
@ -1191,27 +1079,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
preTaxDiff: 0, |
|
|
|
taxDiff: 0, |
|
|
|
clientCode: string.Empty, |
|
|
|
realAmt: 0 |
|
|
|
realAmt: readAmt |
|
|
|
); |
|
|
|
invlist.Add(invbill); |
|
|
|
} |
|
|
|
//await _repository.DbContext.BulkInsertAsync(invlist);
|
|
|
|
//await _repository.DbContext.BulkInsertAsync(groupList);
|
|
|
|
//await _repository.DbContext.BulkInsertAsync(detailList);
|
|
|
|
|
|
|
|
//if (salist.Count > 0)
|
|
|
|
//{
|
|
|
|
// await _repository.DbContext.BulkUpdateAsync(salist);
|
|
|
|
//}
|
|
|
|
//if (adjlist.Count > 0)
|
|
|
|
//{
|
|
|
|
// await _repository.DbContext.BulkUpdateAsync(adjlist);
|
|
|
|
//}
|
|
|
|
//if (notDetialList.Count > 0)
|
|
|
|
//{
|
|
|
|
// await _repository.DbContext.BulkInsertAsync(notDetialList);
|
|
|
|
//}
|
|
|
|
//_invls = invlist.Select(p => p.InvbillNum).ToList();
|
|
|
|
} |
|
|
|
|
|
|
|
return detailList; |
|
|
|