|
@ -186,7 +186,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
{ |
|
|
{ |
|
|
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
|
|
|
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//二次开票
|
|
|
else//二次开票
|
|
|
{ |
|
|
{ |
|
@ -303,12 +303,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
var priceListbj = _pricebjRepository.ToList();//价格单
|
|
|
var priceListbj = _pricebjRepository.ToList();//价格单
|
|
|
foreach (var itm in priceListbj) |
|
|
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 |
|
|
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); |
|
|
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType).ConfigureAwait(false); |
|
|
if (errorList.Count > 0) |
|
|
if (errorList.Count > 0) |
|
@ -727,13 +727,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
} |
|
|
} |
|
|
var first = p_list.FirstOrDefault(); |
|
|
var first = p_list.FirstOrDefault(); |
|
|
var invbillnum = first.InvBillNum; |
|
|
var invbillnum = first.InvBillNum; |
|
|
|
|
|
|
|
|
var count = _pdRepository.Count(p => p.BillNum == invbillnum); |
|
|
var count = _pdRepository.Count(p => p.BillNum == invbillnum); |
|
|
if (count > 0) |
|
|
if (count > 0) |
|
|
{ |
|
|
{ |
|
|
throw new UserFriendlyException($"单号{invbillnum}在待扣减单里已存在,请在待扣减单退回", "400"); |
|
|
throw new UserFriendlyException($"单号{invbillnum}在待扣减单里已存在,请在待扣减单退回", "400"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var invBilllist = new List<INVOICE_WAIT_DETAIL_DTO>(); |
|
|
var invBilllist = new List<INVOICE_WAIT_DETAIL_DTO>(); |
|
|
List<INVOICE_WAIT_DETAIL_DTO> ls = 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); |
|
|
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"); |
|
|
throw new UserFriendlyException($"发票只有在财务已审核、红冲状态下可以报废!", "400"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var settle = await _pubMng.GetMainAsync(inv.InvGroupNum).ConfigureAwait(false); |
|
|
var settle = await _pubMng.GetMainAsync(inv.InvGroupNum).ConfigureAwait(false); |
|
|
if (settle == null) |
|
|
if (settle == null) |
|
|
{ |
|
|
{ |
|
@ -787,9 +781,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
if (adjlist != null && adjlist.Count > 0) |
|
|
if (adjlist != null && adjlist.Count > 0) |
|
|
{ |
|
|
{ |
|
|
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType).ToList(); |
|
|
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 relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault()).ToList(); |
|
|
|
|
|
|
|
|
var errorList = await CheckAdJRules(adjlist, relist.ToList(), inv.BusinessType); |
|
|
var errorList = await CheckAdJRules(adjlist, relist.ToList(), inv.BusinessType); |
|
|
if (errorList.Count > 0) |
|
|
if (errorList.Count > 0) |
|
|
{ |
|
|
{ |
|
@ -891,8 +883,5 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
return new JsonResult(new { Code = 200, Message = "生成成功", Data = invlist }); |
|
|
return new JsonResult(new { Code = 200, Message = "生成成功", Data = invlist }); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|