|
|
|
@ -113,6 +113,55 @@ namespace DS.WMS.Core.Invoice.Method
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取发票详情
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">发票ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult<InvoiceDto>> GetAsync(long id)
|
|
|
|
|
{
|
|
|
|
|
var invoice = await TenantDb.Queryable<Entity.Invoice>().Select<InvoiceDto>().FirstAsync(x => x.Id == id);
|
|
|
|
|
if (invoice != null)
|
|
|
|
|
{
|
|
|
|
|
invoice.Details = await CreateApplicationDetailQuery((d, f, s) => d.ApplicationId == id && d.Category == DetailCategory.InvoiceIssuance)
|
|
|
|
|
.Select(x => new ApplicationDetailDto
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
ApplicationId = x.ApplicationId,
|
|
|
|
|
RecordId = x.RecordId,
|
|
|
|
|
FeeName = x.FeeName,
|
|
|
|
|
FeeType = x.FeeType,
|
|
|
|
|
ApplyAmount = x.ApplyAmount,
|
|
|
|
|
ExchangeRate = x.ExchangeRate,
|
|
|
|
|
Currency = x.Currency,
|
|
|
|
|
OriginalAmount = x.OriginalAmount,
|
|
|
|
|
OriginalCurrency = x.OriginalCurrency,
|
|
|
|
|
OriginalRate = x.OriginalRate,
|
|
|
|
|
CustomerNo = x.CustomerNo,
|
|
|
|
|
MBLNO = x.MBLNO,
|
|
|
|
|
ClientName = x.ClientName,
|
|
|
|
|
ETD = x.ETD,
|
|
|
|
|
SaleName = x.SaleName,
|
|
|
|
|
SourceName = x.SourceName,
|
|
|
|
|
LoadPort = x.LoadPort,
|
|
|
|
|
Vessel = x.Vessel,
|
|
|
|
|
Voyage = x.Voyage,
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
invoice.Summary = invoice.Details.GroupBy(x => new { x.FeeType, x.Currency }).Select(x => new SummaryItem
|
|
|
|
|
{
|
|
|
|
|
FeeType = x.Key.FeeType,
|
|
|
|
|
Currency = x.Key.Currency,
|
|
|
|
|
Amount = x.Sum(y => y.ApplyAmount)
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
invoice.InvoiceDetails = await TenantDb.Queryable<InvoiceDetail>().Where(
|
|
|
|
|
x => x.ApplicationId == id && x.Category == DetailCategory.InvoiceIssuance).ToListAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<InvoiceDto>.Success(invoice);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 提交发票开票
|
|
|
|
|
/// </summary>
|
|
|
|
|