添加发票重复申请的限制

master
zhangxiaofeng 5 months ago
parent 9db8fa9ef3
commit aa795b3ce0

@ -884,13 +884,33 @@ namespace EntrustSettle.Api.Controllers
x.CompanyName,
x.ContactTel,
x.ContactName,
x.TaxCode
x.TaxCode,
x.IsApplyInvoice,
}).ToListAsync();
if (orderList.Count != input.OrderIdList.Count)
{
throw new Exception("待申请发票的数据中存在已删除的单据,请重新查询后重新申请");
}
// 判断是否存在申请中的发票
var applyingOrderList = orderList.Where(x => x.IsApplyInvoice).ToList();
if (applyingOrderList.Count > 0)
{
throw new Exception("下列提单号正在申请开票中,无法重复申请,请重新选择:" + string.Join("、", applyingOrderList.Select(x => x.Mblno)));
}
// 判断是否存在已开票的发票
var existsInvoiceOrderIdList = orderAnnexService.AsQueryable()
.LeftJoin<Annex>((o, a) => o.AnnexId == a.Id)
.Where((o, a) => input.OrderIdList.Contains(o.OrderId) && a.Type == (int)FileTypeEnum.)
.Select((o, a) => o.OrderId)
.ToList();
if (existsInvoiceOrderIdList.Count > 0)
{
throw new Exception("下列提单号已存在发票,无法重复申请,请重新选择:" +
string.Join("、", orderList.Where(x => existsInvoiceOrderIdList.Contains(x.Id)).Select(x => x.Mblno)));
}
List<string> mblnoList = orderList.Select(x => x.Mblno).ToList();
StringBuilder builder = new();

Loading…
Cancel
Save