|
|
@ -143,7 +143,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
var priceListbj = _pricebjRepository.ToList();//价格单
|
|
|
|
foreach (var itm in priceListbj) |
|
|
|
{ |
|
|
|
priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1049" }); |
|
|
|
priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1049", ContractNo = itm.ContractNo }); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
@ -161,6 +161,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site |
|
|
|
select new TEMP_CAN_SA_DETAIL |
|
|
|
{ |
|
|
|
Id = d.Id, |
|
|
|
SettleBillNum = d.SettleBillNum, |
|
|
|
Site = d.Site, |
|
|
|
Version = d.Version, |
|
|
@ -169,15 +170,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
SettleDate = d.SettleDate, |
|
|
|
InvGroupNum = d.InvGroupNum, |
|
|
|
LU = d.LU, |
|
|
|
// MaterialDesc = d.MaterialDesc,
|
|
|
|
PN = d.PN, |
|
|
|
Qty = d.Qty, |
|
|
|
GroupNum = d.GroupNum, |
|
|
|
Amt = Math.Round(d.Qty * p.Price, 2), |
|
|
|
ContractDocID = "n", |
|
|
|
ContractDocID = (d.BusinessType != EnumBusinessType.BeiJian) ? string.Empty : p.ContractNo, |
|
|
|
BeginDate = p.BeginTime, |
|
|
|
EndDate = p.EndTime, |
|
|
|
PartCode = d.PartCode |
|
|
|
PartCode = d.PartCode,//客户零件号
|
|
|
|
LineCode = d.IndexNum |
|
|
|
|
|
|
|
}; |
|
|
|
var dtos = q.ToList(); |
|
|
@ -302,7 +303,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
var priceListbj = _pricebjRepository.ToList();//价格单
|
|
|
|
foreach (var itm in priceListbj) |
|
|
|
{ |
|
|
|
priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price,ClientCode="1049" }); |
|
|
|
priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price,ClientCode="1049", ContractNo = itm.ContractNo }); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
@ -320,6 +321,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site |
|
|
|
select new TEMP_CAN_SA_DETAIL |
|
|
|
{ |
|
|
|
Id = d.Id, |
|
|
|
SettleBillNum = d.SettleBillNum, |
|
|
|
Site = d.Site, |
|
|
|
Version = d.Version, |
|
|
@ -328,15 +330,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
SettleDate = d.SettleDate, |
|
|
|
InvGroupNum = d.InvGroupNum, |
|
|
|
LU = d.LU, |
|
|
|
// MaterialDesc = d.MaterialDesc,
|
|
|
|
PN = d.PN, |
|
|
|
Qty = d.Qty, |
|
|
|
GroupNum = d.GroupNum, |
|
|
|
Amt = Math.Round(d.Qty * p.Price, 2), |
|
|
|
ContractDocID = "n", |
|
|
|
ContractDocID = (d.BusinessType != EnumBusinessType.BeiJian) ? string.Empty : p.ContractNo, |
|
|
|
BeginDate = p.BeginTime, |
|
|
|
EndDate = p.EndTime, |
|
|
|
PartCode = d.PartCode |
|
|
|
PartCode = d.PartCode,//客户零件号
|
|
|
|
LineCode = d.IndexNum |
|
|
|
|
|
|
|
}; |
|
|
|
var dtos = q.ToList(); |
|
|
@ -426,7 +428,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); |
|
|
|
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
|
|
|
|
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
|
|
|
|
var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单
|
|
|
|
List<PriceList> priceList = new List<PriceList>(); |
|
|
|
if (inv.BusinessType == EnumBusinessType.BeiJian) |
|
|
|
{ |
|
|
|
var priceListbj = _pricebjRepository.ToList();//价格单
|
|
|
|
foreach (var itm in priceListbj) |
|
|
|
{ |
|
|
|
priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1049", ContractNo = itm.ContractNo }); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
priceList = _priceRepository.Where(p => p.IsCancel == false && p.ClientCode == inv.Site).ToList();//价格单
|
|
|
|
} |
|
|
|
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType).ConfigureAwait(false); |
|
|
|
if (errorList.Count > 0) |
|
|
|
{ |
|
|
@ -438,6 +452,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site |
|
|
|
select new TEMP_CAN_SA_DETAIL |
|
|
|
{ |
|
|
|
Id = d.Id, |
|
|
|
SettleBillNum = d.SettleBillNum, |
|
|
|
Site = d.Site, |
|
|
|
Version = d.Version, |
|
|
@ -446,15 +461,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
SettleDate = d.SettleDate, |
|
|
|
InvGroupNum = d.InvGroupNum, |
|
|
|
LU = d.LU, |
|
|
|
// MaterialDesc = d.MaterialDesc,
|
|
|
|
PN = d.PN, |
|
|
|
Qty = d.Qty, |
|
|
|
GroupNum = d.GroupNum, |
|
|
|
Amt = Math.Round(d.Qty * p.Price, 2), |
|
|
|
ContractDocID = "n", |
|
|
|
ContractDocID = (d.BusinessType != EnumBusinessType.BeiJian) ? string.Empty : p.ContractNo, |
|
|
|
BeginDate = p.BeginTime, |
|
|
|
EndDate = p.EndTime, |
|
|
|
PartCode= d.PartCode |
|
|
|
PartCode = d.PartCode,//客户零件号
|
|
|
|
LineCode = d.IndexNum |
|
|
|
|
|
|
|
}; |
|
|
|
var dtos = q.ToList(); |
|
|
@ -531,7 +546,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
&& inv.State != SettleBillState.客户已收票 |
|
|
|
) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"发票只有在财务已审核、客户已收票、已扣减、已提交QAD状态下可以报废!", "400"); |
|
|
|
throw new UserFriendlyException($"发票只有在财务已审核、红冲状态下可以报废!", "400"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -612,15 +627,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
SettleDate = d.SettleDate, |
|
|
|
InvGroupNum = d.InvGroupNum, |
|
|
|
LU = d.LU, |
|
|
|
MaterialDesc = d.MaterialDesc, |
|
|
|
PN = d.PN, |
|
|
|
Qty = d.Qty, |
|
|
|
GroupNum = d.GroupNum, |
|
|
|
Amt = Math.Round(d.Qty * p.Price, 2), |
|
|
|
ContractDocID = "N", |
|
|
|
ContractDocID = (d.BusinessType != EnumBusinessType.BeiJian) ? string.Empty : p.ContractNo, |
|
|
|
BeginDate = p.BeginTime, |
|
|
|
EndDate = p.EndTime, |
|
|
|
PartCode = d.PartCode |
|
|
|
PartCode = d.PartCode,//客户零件号
|
|
|
|
LineCode = d.IndexNum |
|
|
|
|
|
|
|
}; |
|
|
|
var dtos = q.ToList(); |
|
|
@ -732,7 +747,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
&& inv.State != SettleBillState.客户已收票 |
|
|
|
) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"发票只有在财务已审核、客户已收票、已扣减、已提交QAD状态下可以报废!", "400"); |
|
|
|
throw new UserFriendlyException($"发票只有在财务已审核、红冲状态下可以报废!", "400"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -792,12 +807,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
} |
|
|
|
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
|
|
|
|
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); |
|
|
|
var priceList = _priceRepository.ToList();//价格单
|
|
|
|
//var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
|
|
|
|
//if (errorList.Count() > 0)
|
|
|
|
//{
|
|
|
|
// return await ExportErrorReportAsync(errorList);
|
|
|
|
//}
|
|
|
|
List<PriceList> priceList = new List<PriceList>(); |
|
|
|
if (inv.BusinessType == EnumBusinessType.BeiJian) |
|
|
|
{ |
|
|
|
var priceListbj = _pricebjRepository.Where(p => p.IsCancel == false).ToList(); //价格单
|
|
|
|
foreach (var itm in priceListbj) |
|
|
|
{ |
|
|
|
priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price, ClientCode = "1049", ContractNo = itm.ContractNo }); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单
|
|
|
|
} |
|
|
|
var dto1s = ObjectMapper.Map<List<PUB_CAN_SA_DETAIL>, List<PUB_CAN_SA_DETAIL_DTO>>(entitys); |
|
|
|
var q = from d in dto1s |
|
|
|
join p in priceList on d.LU equals p.LU |
|
|
@ -813,15 +835,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
SettleDate = d.SettleDate, |
|
|
|
InvGroupNum = d.InvGroupNum, |
|
|
|
LU = d.LU, |
|
|
|
MaterialDesc = d.MaterialDesc, |
|
|
|
PN = d.PN, |
|
|
|
Qty = d.Qty, |
|
|
|
GroupNum = d.GroupNum, |
|
|
|
Amt = Math.Round(d.Qty * p.Price, 2), |
|
|
|
ContractDocID = "N", |
|
|
|
ContractDocID = (d.BusinessType != EnumBusinessType.BeiJian) ? string.Empty : p.ContractNo, |
|
|
|
BeginDate = p.BeginTime, |
|
|
|
EndDate = p.EndTime, |
|
|
|
PartCode = d.PartCode |
|
|
|
PartCode = d.PartCode,//客户零件号
|
|
|
|
LineCode = d.IndexNum |
|
|
|
|
|
|
|
}; |
|
|
|
var dtos = q.ToList(); |
|
|
|