|
|
|
@ -160,37 +160,44 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取结算单费用明细
|
|
|
|
|
/// 根据申请获取费用明细
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ids">申请单明细ID</param>
|
|
|
|
|
/// <param name="ids">申请单ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult<List<PaymentApplicationDetailDto>>> GetSettlementDetailsAsync(long[] ids)
|
|
|
|
|
public async Task<DataResult<List<PaymentApplicationDetailDto>>> GetSettlementFeeDetailsAsync(params long[] ids)
|
|
|
|
|
{
|
|
|
|
|
var details = await TenantDb.Queryable<ApplicationDetail>().Where(d => ids.Contains(d.Id))
|
|
|
|
|
.LeftJoin<FeeRecord>((d, f) => d.RecordId == f.Id)
|
|
|
|
|
.LeftJoin<BusinessFeeStatus>((d, f, b) => f.BusinessId == b.BusinessId && f.BusinessType == b.BusinessType)
|
|
|
|
|
.LeftJoin<PaymentApplication>((d, f, b, p) => d.ApplicationId == p.Id)
|
|
|
|
|
.Select((d, f, b, p) => new PaymentApplicationDetailDto
|
|
|
|
|
var details = await CreateApplicationDetailQuery((d, f, s) => ids.Contains(d.ApplicationId))
|
|
|
|
|
.LeftJoin<PaymentApplication>((d, pa) => d.ApplicationId == pa.Id)
|
|
|
|
|
.Select((d, pa) => new PaymentApplicationDetailDto
|
|
|
|
|
{
|
|
|
|
|
Id = d.Id,
|
|
|
|
|
ApplicationId = d.ApplicationId,
|
|
|
|
|
BusinessId = f.BusinessId,
|
|
|
|
|
BusinessType = f.BusinessType,
|
|
|
|
|
BusinessId = d.BusinessId,
|
|
|
|
|
BusinessType = d.BusinessType,
|
|
|
|
|
RecordId = d.RecordId,
|
|
|
|
|
FeeName = d.FeeName,
|
|
|
|
|
FeeType = d.FeeType, //收付
|
|
|
|
|
ApplyAmount = d.ApplyAmount, //结算金额
|
|
|
|
|
CustomerId = f.CustomerId,
|
|
|
|
|
FeeType = d.FeeType,
|
|
|
|
|
Amount = d.Amount, //总金额
|
|
|
|
|
ApplyAmount = d.ApplyAmount, //已结算金额
|
|
|
|
|
RestAmount = d.ApplyAmount - d.ProcessedAmount, //剩余结算金额
|
|
|
|
|
CustomerId = d.CustomerId,
|
|
|
|
|
CustomerName = d.CustomerName,
|
|
|
|
|
OriginalCurrency = d.OriginalCurrency, //原始币别
|
|
|
|
|
OriginalRate = f.ExchangeRate, //原始汇率
|
|
|
|
|
OriginalRate = d.ExchangeRate, //原始汇率
|
|
|
|
|
ExchangeRate = d.ExchangeRate, //折算汇率
|
|
|
|
|
OriginalAmount = d.OriginalAmount, //原始金额
|
|
|
|
|
InvoiceNO = p.InvoiceNO //发票号
|
|
|
|
|
CustomerNo = d.CustomerNo,
|
|
|
|
|
MBLNO = d.MBLNO,
|
|
|
|
|
HBLNO = d.HBLNO,
|
|
|
|
|
ETD = d.ETD,
|
|
|
|
|
SourceName = d.SourceName,
|
|
|
|
|
SaleName = d.SaleName,
|
|
|
|
|
AccountDate = d.AccountDate,
|
|
|
|
|
Vessel = d.Vessel,
|
|
|
|
|
Voyage = d.Voyage,
|
|
|
|
|
InvoiceNO = pa.InvoiceNO
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
await FulfillDetailsAsync(details);
|
|
|
|
|
|
|
|
|
|
return DataResult<List<PaymentApplicationDetailDto>>.Success(details);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -268,7 +275,7 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
|
public async Task<DataResult<List<PaymentApplicationDetailDto>>> GetApplicationDetailsAsync(long id)
|
|
|
|
|
{
|
|
|
|
|
var details = await TenantDb.Queryable<ApplicationDetail>().Where(d => d.ApplicationId == id && (d.ApplyAmount - d.ProcessedAmount) != 0)
|
|
|
|
|
.LeftJoin<FeeRecord>((d, f) => d.RecordId == f.Id)
|
|
|
|
|
.InnerJoin<FeeRecord>((d, f) => d.RecordId == f.Id)
|
|
|
|
|
.Select((d, f) => new PaymentApplicationDetailDto
|
|
|
|
|
{
|
|
|
|
|
Id = d.Id,
|
|
|
|
|