|
|
|
@ -877,6 +877,8 @@ namespace EntrustSettle.Api.Controllers
|
|
|
|
|
throw new Exception("申请列表为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var orderList = await orderService.AsQueryable().Where(x => input.OrderIdList.Contains(x.Id)).Select(x => new
|
|
|
|
|
{
|
|
|
|
|
x.Id,
|
|
|
|
@ -886,17 +888,24 @@ namespace EntrustSettle.Api.Controllers
|
|
|
|
|
x.ContactName,
|
|
|
|
|
x.TaxCode,
|
|
|
|
|
x.IsApplyInvoice,
|
|
|
|
|
x.Status
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
if (orderList.Count != input.OrderIdList.Count)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("待申请发票的数据中存在已删除的单据,请重新查询后重新申请");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var noStatusOrderList = orderList.Where(x => x.Status != 3 && x.Status != 4);
|
|
|
|
|
if (noStatusOrderList.Any())
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("需要在订单具有【已缴费】或【已完结】状态时才能进行发票申请,下列订单状态不符合条件,请重新选择:" + string.Join("、", noStatusOrderList.Select(x => x.Mblno)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 判断是否存在申请中的发票
|
|
|
|
|
var applyingOrderList = orderList.Where(x => x.IsApplyInvoice).ToList();
|
|
|
|
|
if (applyingOrderList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("下列提单号正在申请开票中,无法重复申请,请重新选择:" + string.Join("、", applyingOrderList.Select(x => x.Mblno)));
|
|
|
|
|
throw new Exception("下列订单正在申请开票中,无法重复申请,请重新选择:" + string.Join("、", applyingOrderList.Select(x => x.Mblno)));
|
|
|
|
|
}
|
|
|
|
|
// 判断是否存在已开票的发票
|
|
|
|
|
var existsInvoiceOrderIdList = orderAnnexService.AsQueryable()
|
|
|
|
@ -906,7 +915,7 @@ namespace EntrustSettle.Api.Controllers
|
|
|
|
|
.ToList();
|
|
|
|
|
if (existsInvoiceOrderIdList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("下列提单号已存在发票,无法重复申请,请重新选择:" +
|
|
|
|
|
throw new Exception("下列订单已存在发票,无法重复申请,请重新选择:" +
|
|
|
|
|
string.Join("、", orderList.Where(x => existsInvoiceOrderIdList.Contains(x.Id)).Select(x => x.Mblno)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -990,11 +999,16 @@ namespace EntrustSettle.Api.Controllers
|
|
|
|
|
x.Id,
|
|
|
|
|
x.Mblno,
|
|
|
|
|
x.Bsno,
|
|
|
|
|
x.Status
|
|
|
|
|
}).FirstAsync();
|
|
|
|
|
if (order == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("待申请账单的数据可能已删除,请重新查询后重新申请");
|
|
|
|
|
}
|
|
|
|
|
if (order.Status != 4)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("需要在订单具有【已完结】状态时才能进行账单申请");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HydFeedbackDto feedbackDto = new()
|
|
|
|
|
{
|
|
|
|
|