|
|
@ -186,7 +186,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
{ |
|
|
|
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
|
|
|
|
{ |
|
|
|
await ReissueFirstInvoice(publist,new List<PUB_ADJ_DETAIL>(), dtos, version, invbillnum).ConfigureAwait(false); |
|
|
|
await ReissueFirstInvoice(publist, new List<PUB_ADJ_DETAIL>(), dtos, version, invbillnum).ConfigureAwait(false); |
|
|
|
} |
|
|
|
else//二次开票
|
|
|
|
{ |
|
|
@ -303,12 +303,12 @@ 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", ContractNo = itm.ContractNo }); |
|
|
|
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();//价格单
|
|
|
|
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) |
|
|
@ -446,32 +446,32 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
{ |
|
|
|
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorList).ConfigureAwait(false) }); |
|
|
|
} |
|
|
|
// var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
|
|
|
|
var q = from d in entitys |
|
|
|
join p in priceList on d.LU equals p.LU |
|
|
|
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, |
|
|
|
Price = p.Price, |
|
|
|
BillNum = d.BillNum, |
|
|
|
SettleDate = d.SettleDate, |
|
|
|
InvGroupNum = d.InvGroupNum, |
|
|
|
LU = d.LU, |
|
|
|
PN = d.PN, |
|
|
|
Qty = d.Qty, |
|
|
|
GroupNum = d.GroupNum, |
|
|
|
Amt = Math.Round(d.Qty * p.Price, 2), |
|
|
|
ContractDocID = (d.BusinessType != EnumBusinessType.BeiJian) ? string.Empty : p.ContractNo, |
|
|
|
BeginDate = p.BeginTime, |
|
|
|
EndDate = p.EndTime, |
|
|
|
PartCode = d.PartCode,//客户零件号
|
|
|
|
LineCode = d.IndexNum |
|
|
|
|
|
|
|
}; |
|
|
|
// var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
|
|
|
|
var q = from d in entitys |
|
|
|
join p in priceList on d.LU equals p.LU |
|
|
|
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, |
|
|
|
Price = p.Price, |
|
|
|
BillNum = d.BillNum, |
|
|
|
SettleDate = d.SettleDate, |
|
|
|
InvGroupNum = d.InvGroupNum, |
|
|
|
LU = d.LU, |
|
|
|
PN = d.PN, |
|
|
|
Qty = d.Qty, |
|
|
|
GroupNum = d.GroupNum, |
|
|
|
Amt = Math.Round(d.Qty * p.Price, 2), |
|
|
|
ContractDocID = (d.BusinessType != EnumBusinessType.BeiJian) ? string.Empty : p.ContractNo, |
|
|
|
BeginDate = p.BeginTime, |
|
|
|
EndDate = p.EndTime, |
|
|
|
PartCode = d.PartCode,//客户零件号
|
|
|
|
LineCode = d.IndexNum |
|
|
|
|
|
|
|
}; |
|
|
|
var dtos = q.ToList(); |
|
|
|
if (dtos != null && dtos.Count > 0) |
|
|
|
{ |
|
|
@ -571,7 +571,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!", "400"); |
|
|
|
} |
|
|
|
var bbaclist = await _pubMng.GetContainsAsync(inv.InvbillNum).ConfigureAwait(false);//结算分组对应结算零件
|
|
|
|
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
|
|
|
|
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
|
|
|
|
if (adjlist != null && adjlist.Count > 0) |
|
|
|
{ |
|
|
|
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType).ToList(); |
|
|
@ -727,13 +727,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
} |
|
|
|
var first = p_list.FirstOrDefault(); |
|
|
|
var invbillnum = first.InvBillNum; |
|
|
|
|
|
|
|
var count = _pdRepository.Count(p => p.BillNum == invbillnum); |
|
|
|
if (count > 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"单号{invbillnum}在待扣减单里已存在,请在待扣减单退回", "400"); |
|
|
|
} |
|
|
|
|
|
|
|
var invBilllist = new List<INVOICE_WAIT_DETAIL_DTO>(); |
|
|
|
List<INVOICE_WAIT_DETAIL_DTO> ls = new List<INVOICE_WAIT_DETAIL_DTO>(); |
|
|
|
var adjlist = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list); |
|
|
@ -763,10 +761,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"发票只有在财务已审核、红冲状态下可以报废!", "400"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var settle = await _pubMng.GetMainAsync(inv.InvGroupNum).ConfigureAwait(false); |
|
|
|
if (settle == null) |
|
|
|
{ |
|
|
@ -787,9 +781,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
if (adjlist != null && adjlist.Count > 0) |
|
|
|
{ |
|
|
|
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType).ToList(); |
|
|
|
|
|
|
|
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault()).ToList(); |
|
|
|
|
|
|
|
var errorList = await CheckAdJRules(adjlist, relist.ToList(), inv.BusinessType); |
|
|
|
if (errorList.Count > 0) |
|
|
|
{ |
|
|
@ -891,8 +883,5 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
return new JsonResult(new { Code = 200, Message = "生成成功", Data = invlist }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|