|
|
@ -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; |
|
|
|
|
|
|
@ -342,13 +327,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.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 +341,28 @@ 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);//税额
|
|
|
|
//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);
|
|
|
|
//}
|
|
|
|
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>(); |
|
|
|
foreach (var detail in detailDtos) |
|
|
|
{ |
|
|
@ -444,7 +429,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
preTaxDiff: 0, |
|
|
|
taxDiff: 0, |
|
|
|
clientCode: string.Empty, |
|
|
|
realAmt: 0 |
|
|
|
realAmt: realAmt |
|
|
|
); |
|
|
|
invlist.Add(invbill); |
|
|
|
} |
|
|
@ -635,8 +620,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 +640,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 +750,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 +764,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 +851,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 +1018,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 +1056,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 +1151,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; |
|
|
|