|
@ -4,6 +4,7 @@ using System.Linq; |
|
|
using System.Text; |
|
|
using System.Text; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using AutoMapper; |
|
|
using AutoMapper; |
|
|
|
|
|
using CodeArts.Db.Lts; |
|
|
using DocumentFormat.OpenXml.Presentation; |
|
|
using DocumentFormat.OpenXml.Presentation; |
|
|
using EFCore.BulkExtensions; |
|
|
using EFCore.BulkExtensions; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
@ -34,7 +35,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
public decimal Amt { set; get; } |
|
|
public decimal Amt { set; get; } |
|
|
public decimal TaxAmt { set; get; } |
|
|
public decimal TaxAmt { set; get; } |
|
|
|
|
|
|
|
|
public decimal Tax { set; get;} |
|
|
public decimal Tax { set; get; } |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -116,7 +117,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
} |
|
|
} |
|
|
else//二次开票
|
|
|
else//二次开票
|
|
|
{ |
|
|
{ |
|
|
var invs = SecInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType); |
|
|
var query = from b in _dbcontext.Set<BBAC_NOT_SA_DETAIL>() |
|
|
|
|
|
join a in (from d in _dbcontext.Set<BBAC_CAN_SA_DETAIL>() |
|
|
|
|
|
where d.BillNum == main.BillNum |
|
|
|
|
|
select d.GroupNum).Distinct() |
|
|
|
|
|
on b.GroupNum equals a |
|
|
|
|
|
group b by new { b.GroupNum, b.LU } into g |
|
|
|
|
|
select new TEMP_NOT_SA_DETAIL |
|
|
|
|
|
{ |
|
|
|
|
|
GroupNum = g.Key.GroupNum, |
|
|
|
|
|
LU = g.Key.LU, |
|
|
|
|
|
Qty = g.Sum(p => p.Qty), |
|
|
|
|
|
}; |
|
|
|
|
|
var invs = SecInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType, query.ToList()); |
|
|
if (invs.Count > 0) |
|
|
if (invs.Count > 0) |
|
|
{ |
|
|
{ |
|
|
main.State = SettleBillState.已开票; |
|
|
main.State = SettleBillState.已开票; |
|
@ -126,7 +139,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
_dbcontext.BulkUpdate(new List<BBAC_CAN_SA>() { main }); |
|
|
_dbcontext.BulkUpdate(new List<BBAC_CAN_SA>() { main }); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if(BussinessType== "JisHBPO") |
|
|
if (BussinessType == "JisHBPO") |
|
|
{ |
|
|
{ |
|
|
var main = _dbcontext.Set<HBPO_CAN_SA>().FirstOrDefault(p => p.InvGroupNum == billNum); |
|
|
var main = _dbcontext.Set<HBPO_CAN_SA>().FirstOrDefault(p => p.InvGroupNum == billNum); |
|
|
//var main = await _bbacMng.GetMainAsync(invbillNum);
|
|
|
//var main = await _bbacMng.GetMainAsync(invbillNum);
|
|
@ -155,7 +168,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
Qty = d.Qty, |
|
|
Qty = d.Qty, |
|
|
GroupNum = d.GroupNum, |
|
|
GroupNum = d.GroupNum, |
|
|
Amt = Math.Round(d.Qty * p.Price, 2), |
|
|
Amt = Math.Round(d.Qty * p.Price, 2), |
|
|
ContractDocID ="n", |
|
|
ContractDocID = "n", |
|
|
BeginDate = p.BeginTime, |
|
|
BeginDate = p.BeginTime, |
|
|
EndDate = p.EndTime, |
|
|
EndDate = p.EndTime, |
|
|
PartCode = d.PartCode |
|
|
PartCode = d.PartCode |
|
@ -192,7 +205,21 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
} |
|
|
} |
|
|
else//二次开票
|
|
|
else//二次开票
|
|
|
{ |
|
|
{ |
|
|
var invs = SecInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType); |
|
|
var query = from b in _dbcontext.Set<HBPO_NOT_SA_DETAIL>() |
|
|
|
|
|
join a in (from d in _dbcontext.Set<HBPO_CAN_SA_DETAIL>() |
|
|
|
|
|
where d.BillNum == main.BillNum |
|
|
|
|
|
select d.GroupNum).Distinct() |
|
|
|
|
|
on b.GroupNum equals a |
|
|
|
|
|
group b by new { b.GroupNum, b.LU } into g |
|
|
|
|
|
select new TEMP_NOT_SA_DETAIL |
|
|
|
|
|
{ |
|
|
|
|
|
GroupNum = g.Key.GroupNum, |
|
|
|
|
|
LU = g.Key.LU, |
|
|
|
|
|
Qty = g.Sum(p => p.Qty), |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var invs = SecInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType, query.ToList()); |
|
|
if (invs.Count > 0) |
|
|
if (invs.Count > 0) |
|
|
{ |
|
|
{ |
|
|
main.State = SettleBillState.已开票; |
|
|
main.State = SettleBillState.已开票; |
|
@ -204,7 +231,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
} |
|
|
} |
|
|
return id.ToString(); |
|
|
return id.ToString(); |
|
|
} |
|
|
} |
|
|
public List<string> SecInvoice<TDetail>(List<TDetail> p_list, List<PUB_ADJ_DETAIL> p_ajdlist, List<TEMP_CAN_SA_DETAIL> dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType) |
|
|
public List<string> SecInvoice<TDetail>(List<TDetail> p_list, List<PUB_ADJ_DETAIL> p_ajdlist, List<TEMP_CAN_SA_DETAIL> dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType, List<TEMP_NOT_SA_DETAIL> p_notlist = null) |
|
|
where TDetail : SA_CAN_BASE |
|
|
where TDetail : SA_CAN_BASE |
|
|
{ |
|
|
{ |
|
|
List<string> _invls = new List<string>(); |
|
|
List<string> _invls = new List<string>(); |
|
@ -252,39 +279,45 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
&& group.BeginDate == group1.BeginDate |
|
|
&& group.BeginDate == group1.BeginDate |
|
|
&& group.EndDate == group1.EndDate |
|
|
&& group.EndDate == group1.EndDate |
|
|
&& group1.ContractDocID == group.ContractDocID |
|
|
&& group1.ContractDocID == group.ContractDocID |
|
|
|
|
|
&& group1.Price == group.Price |
|
|
|
|
|
&& group1.Qty == group.Qty |
|
|
|
|
|
&& group1.Amt == group.Amt |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
tempList.Add(group1); |
|
|
tempList.Add(group1); |
|
|
partCount++;//符合条件加入到零件中
|
|
|
partCount++;//符合条件加入到零件中
|
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
//partCount++;
|
|
|
sum += group1.Amt; |
|
|
//if (partCount > 30)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// continue;
|
|
|
|
|
|
//}
|
|
|
|
|
|
if (sum > 10000000) |
|
|
if (sum > 10000000) |
|
|
{ |
|
|
{ |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
sum += group1.Amt; |
|
|
|
|
|
tempList.Add(group1); |
|
|
tempList.Add(group1); |
|
|
} |
|
|
} |
|
|
invoiceMap.Add(invoiceBillNum, tempList); |
|
|
invoiceMap.Add(invoiceBillNum, tempList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var query = from itm in groups1 //更新分组
|
|
|
var query = from itm in groups1 //更新分组
|
|
|
join itm1 in tempList |
|
|
join itm1 in tempList |
|
|
on new { itm.LU, itm.BeginDate, itm.EndDate, itm.ContractDocID, itm.PartCode } |
|
|
on |
|
|
equals new { itm1.LU, itm1.BeginDate, itm1.EndDate, itm1.ContractDocID, itm1.PartCode } into temp |
|
|
new { itm.LU, itm.BeginDate, itm.EndDate, itm.ContractDocID, itm.PartCode, itm.Qty, itm.Price, itm.Amt } |
|
|
from tm in temp |
|
|
equals |
|
|
|
|
|
new { itm1.LU, itm1.BeginDate, itm1.EndDate, itm1.ContractDocID, itm1.PartCode, itm1.Qty, itm1.Price, itm1.Amt } |
|
|
|
|
|
into temp |
|
|
|
|
|
from tm in temp.DefaultIfEmpty() |
|
|
where tm == null |
|
|
where tm == null |
|
|
select new TMEP_INV |
|
|
select new TMEP_INV |
|
|
{ |
|
|
{ |
|
|
LU = itm.LU, |
|
|
LU = itm.LU, |
|
|
Amt = itm.Amt, |
|
|
Amt = itm.Amt, |
|
|
Qty = itm.Qty, |
|
|
Qty = itm.Qty, |
|
|
|
|
|
Price = itm.Price, |
|
|
BeginDate = itm.BeginDate, |
|
|
BeginDate = itm.BeginDate, |
|
|
ContractDocID = itm.ContractDocID, |
|
|
ContractDocID = itm.ContractDocID, |
|
|
EndDate = itm.EndDate |
|
|
EndDate = itm.EndDate, |
|
|
|
|
|
PartCode = itm.PartCode, |
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
groups1 = query.ToList(); |
|
|
groups1 = query.ToList(); |
|
|
} |
|
|
} |
|
@ -297,6 +330,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
var invlist = new List<INVOICE_GRP>(); |
|
|
var invlist = new List<INVOICE_GRP>(); |
|
|
var salist = new List<TDetail>(); |
|
|
var salist = new List<TDetail>(); |
|
|
var adjlist = new List<PUB_ADJ_DETAIL>(); |
|
|
var adjlist = new List<PUB_ADJ_DETAIL>(); |
|
|
|
|
|
int count = invoiceMap.Keys.Count;//计算第几张发票计数器
|
|
|
|
|
|
int i = 1; |
|
|
foreach (var group in invoiceMap) |
|
|
foreach (var group in invoiceMap) |
|
|
{ |
|
|
{ |
|
|
var key = group.Key;//发票票号
|
|
|
var key = group.Key;//发票票号
|
|
@ -304,9 +339,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
//反向查找结算数据
|
|
|
//反向查找结算数据
|
|
|
var query = from itm in dtos |
|
|
var query = from itm in dtos |
|
|
join itm1 in ls |
|
|
join itm1 in ls |
|
|
on new { itm.LU, itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.PartCode, itm1.BeginDate, itm1.EndDate } |
|
|
on new { itm.LU, itm.PartCode, itm.BeginDate, itm.EndDate, itm.ContractDocID } equals new { itm1.LU, itm1.PartCode, itm1.BeginDate, itm1.EndDate, itm1.ContractDocID } |
|
|
join itm2 in p_list on new { itm.PartCode, itm.PN, itm.SettleDate } equals new { itm2.PartCode, itm2.PN, itm2.SettleDate } |
|
|
join itm2 in p_list on new { itm.PartCode, itm.PN, itm.SettleDate } equals new { itm2.PartCode, itm2.PN, itm2.SettleDate } |
|
|
select itm2; |
|
|
select itm2;//反向更新可计算数据
|
|
|
foreach (var itm in query) |
|
|
foreach (var itm in query) |
|
|
{ |
|
|
{ |
|
|
itm.InvbillNum = key; |
|
|
itm.InvbillNum = key; |
|
@ -351,27 +386,66 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
{ |
|
|
{ |
|
|
detailList.AddRange(_entityDetailList); |
|
|
detailList.AddRange(_entityDetailList); |
|
|
} |
|
|
} |
|
|
List<tempAmt> amtList = new List<tempAmt>(); |
|
|
#region 发票不能结算的明细
|
|
|
foreach (var itm in detailList) |
|
|
var innotls = new List<INVOICE_NOT_SETTLE>(); |
|
|
|
|
|
var sq = query.GroupBy(p => new { p.LU, p.GroupNum }) |
|
|
|
|
|
.Select(p => new { version = p_version, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty), InvBillNum = group.Key, GroupNum = p.Key.GroupNum }); |
|
|
|
|
|
foreach (var sitm in sq) |
|
|
|
|
|
{ |
|
|
|
|
|
innotls.Add(new INVOICE_NOT_SETTLE( |
|
|
|
|
|
guid: GuidGenerator.Create(), |
|
|
|
|
|
version: p_version, |
|
|
|
|
|
invGroupNum: p_InvGroupNum, |
|
|
|
|
|
settleGroupNum: sitm.GroupNum, |
|
|
|
|
|
lU: sitm.LU, |
|
|
|
|
|
lU1: sitm.LU, |
|
|
|
|
|
extend1: "可结算", |
|
|
|
|
|
extend2: string.Empty, |
|
|
|
|
|
qty: sitm.Qty, |
|
|
|
|
|
p_invbillnum: group.Key |
|
|
|
|
|
)); |
|
|
|
|
|
} |
|
|
|
|
|
if (innotls.Count > 0) |
|
|
{ |
|
|
{ |
|
|
amtList.Add(new tempAmt() { |
|
|
notDetialList.AddRange(innotls); |
|
|
Amt=itm.Amt, |
|
|
|
|
|
Tax=Math.Round(itm.Amt*0.13m,2), |
|
|
|
|
|
TaxAmt=itm.Amt+ Math.Round(itm.Amt * 0.13m, 2) |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
decimal amt = amtList.Sum(k => k.Amt);//金额
|
|
|
if (p_notlist != null && p_notlist.Count > 0) |
|
|
decimal txtAmt = amtList.Sum(k => k.TaxAmt) ;//税后金额
|
|
|
{ |
|
|
decimal readAmt = amtList.Sum(k=>k.Tax);//税额
|
|
|
var innotls1 = new List<INVOICE_NOT_SETTLE>(); |
|
|
|
|
|
|
|
|
//decimal amt = detailList.Sum(k => k.Amt);
|
|
|
var grouplist = query.Select(p => p.GroupNum).ToList(); |
|
|
//decimal txtAmt = Math.Round(detailList.Sum(k => k.Amt), 2);
|
|
|
|
|
|
|
|
|
|
|
|
var contractList = ls.Select(p => p.ContractDocID).Distinct(); |
|
|
var notlist = p_notlist.Where(p => grouplist.Contains(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(); |
|
|
foreach (var nitm in notlist) |
|
|
//var _groupList = dtos.GroupBy(p => new { p.GroupNum })
|
|
|
{ |
|
|
// .Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }).Distinct();
|
|
|
innotls1.Add(new INVOICE_NOT_SETTLE( |
|
|
|
|
|
guid: GuidGenerator.Create(), |
|
|
|
|
|
version: p_version, |
|
|
|
|
|
invGroupNum: p_InvGroupNum, |
|
|
|
|
|
settleGroupNum: nitm.GroupNum, |
|
|
|
|
|
lU: nitm.LU, |
|
|
|
|
|
lU1: nitm.LU, |
|
|
|
|
|
extend1: "不可结算", |
|
|
|
|
|
extend2: string.Empty, |
|
|
|
|
|
qty: nitm.Qty, |
|
|
|
|
|
p_invbillnum: group.Key |
|
|
|
|
|
)); |
|
|
|
|
|
} |
|
|
|
|
|
if (innotls.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
notDetialList.AddRange(innotls1); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
#endregion
|
|
|
|
|
|
decimal amt = ls.Sum(k => k.Amt);//金额
|
|
|
|
|
|
decimal txtAmt = Math.Round(amt * 0.13m, 2);//税后金额
|
|
|
|
|
|
decimal readAmt = amt + Math.Round(amt * 0.13m, 2);//税额
|
|
|
|
|
|
|
|
|
|
|
|
//var contractList = ls.Select(p => p.ContractDocID).Distinct();
|
|
|
|
|
|
var _groupList = query.GroupBy(p => new { p.GroupNum }) |
|
|
|
|
|
.Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => Math.Round(itm.Qty * itm.Price, 2)) }).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) |
|
|
{ |
|
|
{ |
|
@ -390,7 +464,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
{ |
|
|
{ |
|
|
groupList.AddRange(group1); |
|
|
groupList.AddRange(group1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var lst = dtos.Where(p => !string.IsNullOrEmpty(p.Site)).ToList(); |
|
|
var lst = dtos.Where(p => !string.IsNullOrEmpty(p.Site)).ToList(); |
|
|
string site = lst.FirstOrDefault().Site; |
|
|
string site = lst.FirstOrDefault().Site; |
|
|
string clientCode = string.Empty; |
|
|
string clientCode = string.Empty; |
|
@ -434,9 +507,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
_dbcontext.BulkInsert(invlist); |
|
|
_dbcontext.BulkInsert(invlist); |
|
|
_dbcontext.BulkInsert(groupList); |
|
|
_dbcontext.BulkInsert(groupList); |
|
|
_dbcontext.BulkInsert(detailList); |
|
|
_dbcontext.BulkInsert(detailList); |
|
|
|
|
|
_dbcontext.BulkInsert(notDetialList); |
|
|
|
|
|
|
|
|
if (salist.Count > 0) |
|
|
if (salist.Count > 0) |
|
|
{ |
|
|
{ |
|
|
_dbcontext.BulkUpdate(salist); |
|
|
_dbcontext.BulkUpdate(salist); |
|
|
} |
|
|
} |
|
|
if (adjlist.Count > 0) |
|
|
if (adjlist.Count > 0) |
|
|
{ |
|
|
{ |
|
@ -447,7 +522,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
} |
|
|
} |
|
|
return _invls; |
|
|
return _invls; |
|
|
} |
|
|
} |
|
|
public List<string> FirstInvoice<TDetail>( List<TDetail> p_list, List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType) |
|
|
public List<string> FirstInvoice<TDetail>(List<TDetail> p_list, List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType) |
|
|
where TDetail : SA_CAN_BASE |
|
|
where TDetail : SA_CAN_BASE |
|
|
{ |
|
|
{ |
|
|
List<string> _invls = new List<string>(); |
|
|
List<string> _invls = new List<string>(); |
|
@ -552,7 +627,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
lsby.AddRange(grouplist); |
|
|
lsby.AddRange(grouplist); |
|
|
var nolist = p_notlist.Where(p => !grouplist.Contains(p.GroupNum)).Select(p => p.GroupNum).ToList();//不可结分组
|
|
|
var nolist = p_notlist.Where(p => !grouplist.Contains(p.GroupNum)).Select(p => p.GroupNum).ToList();//不可结分组
|
|
|
int count = invoiceMap.Keys.Count;//计算第几张发票计数器
|
|
|
int count = invoiceMap.Keys.Count;//计算第几张发票计数器
|
|
|
|
|
|
|
|
|
int i = 1; |
|
|
int i = 1; |
|
|
foreach (var itm in invoiceMap)//分组影响和
|
|
|
foreach (var itm in invoiceMap)//分组影响和
|
|
|
{ |
|
|
{ |
|
@ -585,14 +659,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
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),//税前
|
|
|
Tax = Math.Round(Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2) * 0.13m, 2),//税
|
|
|
Tax = Math.Round(Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2) * 0.13m, 2),//税
|
|
|
TaxAmt = Math.Round(Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2) * 0.13m, 2)+ Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2),//税后进
|
|
|
TaxAmt = Math.Round(Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2) * 0.13m, 2) + Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2),//税后进
|
|
|
Qty = itm.Sum(k => k.Qty), |
|
|
Qty = itm.Sum(k => k.Qty), |
|
|
BeginDate = itm.Key.BeginDate, |
|
|
BeginDate = itm.Key.BeginDate, |
|
|
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 = detailDtos.Sum(k => k.TaxAmt);//税后金额
|
|
|
decimal txtAmt = detailDtos.Sum(k => k.TaxAmt);//税后金额
|
|
|
decimal realAmt =detailDtos.Sum(k => k.Tax);//税额
|
|
|
decimal realAmt = detailDtos.Sum(k => k.Tax);//税额
|
|
|
|
|
|
|
|
|
var mapList = new List<INVOICE_MAP_GROUP>(); |
|
|
var mapList = new List<INVOICE_MAP_GROUP>(); |
|
|
foreach (var groupnum in ls) |
|
|
foreach (var groupnum in ls) |
|
@ -738,14 +813,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
// 执行批量数据操作
|
|
|
// 执行批量数据操作
|
|
|
if (salist.Count > 0) |
|
|
if (salist.Count > 0) |
|
|
{ |
|
|
{ |
|
|
_dbcontext.BulkUpdate(salist); |
|
|
_dbcontext.BulkUpdate(salist); |
|
|
} |
|
|
} |
|
|
_dbcontext.BulkInsert(invlist); |
|
|
_dbcontext.BulkInsert(invlist); |
|
|
_dbcontext.BulkInsert(groupList); |
|
|
_dbcontext.BulkInsert(groupList); |
|
|
_dbcontext.BulkInsert(detailList); |
|
|
_dbcontext.BulkInsert(detailList); |
|
|
if (adjlist.Count > 0) |
|
|
if (adjlist.Count > 0) |
|
|
{ |
|
|
{ |
|
|
_dbcontext.BulkInsert(adjlist); |
|
|
_dbcontext.BulkInsert(adjlist); |
|
|
} |
|
|
} |
|
|
if (notDetialList.Count > 0) |
|
|
if (notDetialList.Count > 0) |
|
|
{ |
|
|
{ |
|
|