|
@ -194,33 +194,33 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
{ |
|
|
{ |
|
|
detailList.AddRange(_entityDetailList); |
|
|
detailList.AddRange(_entityDetailList); |
|
|
} |
|
|
} |
|
|
decimal amt = detailList.Sum(k => k.Amt); |
|
|
decimal amt = detailList.Sum(k => k.Amt);//金额
|
|
|
decimal txtAmt = Math.Round(detailList.Sum(k => k.Amt), 2); |
|
|
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 contractList = ls.Select(p => p.ContractDocID).Distinct(); |
|
|
var _groupList = dtos.Where(p => contractList.Contains(p.ContractDocID)).GroupBy(p => new { p.GroupNum }) |
|
|
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(); |
|
|
.Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }).Distinct(); |
|
|
//var _groupList = dtos.GroupBy(p => new { p.GroupNum })
|
|
|
//var _groupList = dtos.GroupBy(p => new { p.GroupNum })
|
|
|
// .Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }).Distinct();
|
|
|
// .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) |
|
|
//foreach (var en in _groupList)
|
|
|
{ |
|
|
//{
|
|
|
group1.Add( |
|
|
// group1.Add(
|
|
|
new INVOICE_MAP_GROUP( |
|
|
// new INVOICE_MAP_GROUP(
|
|
|
guid: GuidGenerator.Create(), |
|
|
// guid: GuidGenerator.Create(),
|
|
|
version: p_version, |
|
|
// version: p_version,
|
|
|
invbillNum: key, |
|
|
// invbillNum: key,
|
|
|
invGroupNum: p_InvGroupNum, |
|
|
// invGroupNum: p_InvGroupNum,
|
|
|
settleGroupNum: en.GroupNum, |
|
|
// settleGroupNum: en.GroupNum,
|
|
|
amt: en.Amt, |
|
|
// amt: en.Amt,
|
|
|
extend1: string.Empty, |
|
|
// extend1: string.Empty,
|
|
|
extend2: string.Empty)); |
|
|
// extend2: string.Empty));
|
|
|
} |
|
|
//}
|
|
|
if (group1.Count > 0) |
|
|
//if (group1.Count > 0)
|
|
|
{ |
|
|
//{
|
|
|
groupList.AddRange(group1); |
|
|
// groupList.AddRange(group1);
|
|
|
} |
|
|
//}
|
|
|
|
|
|
|
|
|
var invbill = new INVOICE_GRP |
|
|
var invbill = new INVOICE_GRP |
|
|
(guid: GuidGenerator.Create(), |
|
|
(guid: GuidGenerator.Create(), |
|
@ -238,26 +238,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
preTaxDiff: 0, |
|
|
preTaxDiff: 0, |
|
|
taxDiff: 0, |
|
|
taxDiff: 0, |
|
|
clientCode: string.Empty, |
|
|
clientCode: string.Empty, |
|
|
realAmt: 0 |
|
|
realAmt: readAmt |
|
|
); |
|
|
); |
|
|
invlist.Add(invbill); |
|
|
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; |
|
|
return detailList; |
|
|
|
|
|
|
|
@ -342,13 +327,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
// adjdetails.Add(detail);
|
|
|
// adjdetails.Add(detail);
|
|
|
// }
|
|
|
// }
|
|
|
//}
|
|
|
//}
|
|
|
|
|
|
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 }) |
|
|
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }) |
|
|
|
|
|
.Select(itm => new |
|
|
.Select(itm => new |
|
|
{ |
|
|
{ |
|
|
PartCode = itm.Key.PartCode, |
|
|
PartCode = itm.Key.PartCode, |
|
|
InvGroupNum = itm.Key.InvGroupNum, |
|
|
InvGroupNum = itm.Key.InvGroupNum, |
|
|
LU = itm.Key.PartCode, |
|
|
LU = itm.Key.LU, |
|
|
ContactDocID = itm.Key.ContractDocID, |
|
|
ContactDocID = itm.Key.ContractDocID, |
|
|
Price = itm.Key.Price, |
|
|
Price = itm.Key.Price, |
|
|
Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2), |
|
|
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 |
|
|
EndDate = itm.Key.EndDate |
|
|
}) |
|
|
}) |
|
|
.ToList(); |
|
|
.ToList(); |
|
|
decimal amt = detailDtos.Sum(k => k.Amt); |
|
|
decimal amt = detailDtos.Sum(k => k.Amt);//金额
|
|
|
decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); |
|
|
decimal txtAmt = detailDtos.Sum(k => k.Amt) + Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税后金额
|
|
|
var mapList = new List<INVOICE_MAP_GROUP>(); |
|
|
decimal realAmt = Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税额
|
|
|
foreach (var groupnum in ls) |
|
|
//var mapList = new List<INVOICE_MAP_GROUP>();
|
|
|
{ |
|
|
//foreach (var groupnum in ls)
|
|
|
mapList.Add(new INVOICE_MAP_GROUP( |
|
|
//{
|
|
|
guid: GuidGenerator.Create(), |
|
|
// mapList.Add(new INVOICE_MAP_GROUP(
|
|
|
version: p_version, |
|
|
// guid: GuidGenerator.Create(),
|
|
|
invbillNum: key, |
|
|
// version: p_version,
|
|
|
invGroupNum: p_InvGroupNum, |
|
|
// invbillNum: key,
|
|
|
settleGroupNum: groupnum, |
|
|
// invGroupNum: p_InvGroupNum,
|
|
|
amt: 0, |
|
|
// settleGroupNum: groupnum,
|
|
|
extend1: string.Empty, |
|
|
// amt: 0,
|
|
|
extend2: string.Empty |
|
|
// extend1: string.Empty,
|
|
|
) |
|
|
// extend2: string.Empty
|
|
|
); |
|
|
// )
|
|
|
} |
|
|
// );
|
|
|
if (mapList.Count > 0) |
|
|
//}
|
|
|
{ |
|
|
//if (mapList.Count > 0)
|
|
|
groupList.AddRange(mapList); |
|
|
//{
|
|
|
} |
|
|
// groupList.AddRange(mapList);
|
|
|
|
|
|
//}
|
|
|
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>(); |
|
|
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>(); |
|
|
foreach (var detail in detailDtos) |
|
|
foreach (var detail in detailDtos) |
|
|
{ |
|
|
{ |
|
@ -444,7 +429,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
preTaxDiff: 0, |
|
|
preTaxDiff: 0, |
|
|
taxDiff: 0, |
|
|
taxDiff: 0, |
|
|
clientCode: string.Empty, |
|
|
clientCode: string.Empty, |
|
|
realAmt: 0 |
|
|
realAmt: realAmt |
|
|
); |
|
|
); |
|
|
invlist.Add(invbill); |
|
|
invlist.Add(invbill); |
|
|
} |
|
|
} |
|
@ -635,8 +620,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
{ |
|
|
{ |
|
|
detailList.AddRange(_entityDetailList); |
|
|
detailList.AddRange(_entityDetailList); |
|
|
} |
|
|
} |
|
|
decimal amt = detailList.Sum(k => k.Amt); |
|
|
decimal amt = detailList.Sum(k => k.Amt);//金额
|
|
|
decimal txtAmt = Math.Round(detailList.Sum(k => k.Amt), 2); |
|
|
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 |
|
|
var invbill = new INVOICE_GRP |
|
|
(guid: GuidGenerator.Create(), |
|
|
(guid: GuidGenerator.Create(), |
|
@ -654,24 +640,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
preTaxDiff:0, |
|
|
preTaxDiff:0, |
|
|
taxDiff:0, |
|
|
taxDiff:0, |
|
|
clientCode:string.Empty, |
|
|
clientCode:string.Empty, |
|
|
realAmt:0 |
|
|
realAmt:realAmt |
|
|
|
|
|
|
|
|
); |
|
|
); |
|
|
invlist.Add(invbill); |
|
|
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; |
|
|
return detailList; |
|
|
} |
|
|
} |
|
@ -776,12 +750,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
adjdetails.Add(detail); |
|
|
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 |
|
|
.Select(itm => new |
|
|
{ |
|
|
{ |
|
|
PartCode=itm.Key.PartCode, |
|
|
PartCode=itm.Key.PartCode, |
|
|
InvGroupNum = itm.Key.InvGroupNum, |
|
|
InvGroupNum = itm.Key.InvGroupNum, |
|
|
LU = itm.Key.PartCode, |
|
|
LU = itm.Key.LU, |
|
|
ContactDocID = itm.Key.ContractDocID, |
|
|
ContactDocID = itm.Key.ContractDocID, |
|
|
Price = itm.Key.Price, |
|
|
Price = itm.Key.Price, |
|
|
Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2), |
|
|
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 |
|
|
EndDate = itm.Key.EndDate |
|
|
}) |
|
|
}) |
|
|
.ToList(); |
|
|
.ToList(); |
|
|
decimal amt = detailDtos.Sum(k => k.Amt); |
|
|
decimal amt = detailDtos.Sum(k => k.Amt);//金额
|
|
|
decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); |
|
|
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>(); |
|
|
var mapList = new List<INVOICE_MAP_GROUP>(); |
|
|
foreach (var groupnum in ls) |
|
|
foreach (var groupnum in ls) |
|
|
{ |
|
|
{ |
|
@ -876,27 +851,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
preTaxDiff: 0, |
|
|
preTaxDiff: 0, |
|
|
taxDiff: 0, |
|
|
taxDiff: 0, |
|
|
clientCode: string.Empty, |
|
|
clientCode: string.Empty, |
|
|
realAmt: 0 |
|
|
realAmt: realAmt |
|
|
); |
|
|
); |
|
|
invlist.Add(invbill); |
|
|
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; |
|
|
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 |
|
|
.Select(itm => new |
|
|
{ |
|
|
{ |
|
|
PartCode = itm.Key.PartCode, |
|
|
PartCode = itm.Key.PartCode, |
|
|
InvGroupNum = itm.Key.InvGroupNum, |
|
|
InvGroupNum = itm.Key.InvGroupNum, |
|
|
LU = itm.Key.PartCode, |
|
|
LU = itm.Key.LU, |
|
|
ContactDocID = itm.Key.ContractDocID, |
|
|
ContactDocID = itm.Key.ContractDocID, |
|
|
Price = itm.Key.Price, |
|
|
Price = itm.Key.Price, |
|
|
Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2), |
|
|
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", ""),//零件名称
|
|
|
PartName = inv1.GetProperty("PartName", ""),//零件名称
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
decimal amt = detailDtos.Sum(k => k.Amt); |
|
|
decimal amt = detailDtos.Sum(k => k.Amt);//金额
|
|
|
decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); |
|
|
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>(); |
|
|
var mapList = new List<INVOICE_MAP_GROUP>(); |
|
|
foreach (var groupnum in ls) |
|
|
foreach (var groupnum in ls) |
|
|
{ |
|
|
{ |
|
@ -1191,27 +1151,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
preTaxDiff: 0, |
|
|
preTaxDiff: 0, |
|
|
taxDiff: 0, |
|
|
taxDiff: 0, |
|
|
clientCode: string.Empty, |
|
|
clientCode: string.Empty, |
|
|
realAmt: 0 |
|
|
realAmt: readAmt |
|
|
); |
|
|
); |
|
|
invlist.Add(invbill); |
|
|
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; |
|
|
return detailList; |
|
|