|
|
@ -121,13 +121,33 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
FeeId = x.FeeId,
|
|
|
|
FeeId = x.FeeId,
|
|
|
|
FeeName = x.FeeName,
|
|
|
|
FeeName = x.FeeName,
|
|
|
|
FeeType = x.FeeType,
|
|
|
|
FeeType = x.FeeType,
|
|
|
|
|
|
|
|
|
|
|
|
ApplyAmount = x.ApplyAmount - x.ProcessedAmount,
|
|
|
|
ApplyAmount = x.ApplyAmount - x.ProcessedAmount,
|
|
|
|
Currency = x.Currency,
|
|
|
|
Currency = x.Currency,
|
|
|
|
ExchangeRate = x.ExchangeRate,
|
|
|
|
|
|
|
|
OriginalAmount = x.OriginalAmount - x.OriginalProcessedAmount,
|
|
|
|
OriginalAmount = x.OriginalAmount - x.OriginalProcessedAmount,
|
|
|
|
|
|
|
|
OriginalCurrency = x.OriginalCurrency,
|
|
|
|
|
|
|
|
ExchangeRate = x.ExchangeRate
|
|
|
|
}).ToListAsync();
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(settlement.Currency)) //指定结算币别
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var details2 = details1.FindAll(x => x.OriginalCurrency != settlement.Currency);
|
|
|
|
|
|
|
|
foreach (var detail in details2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
detail.Currency = settlement.Currency;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var doc = request.Documents.Find(x => x.Id == detail.ApplicationId);
|
|
|
|
|
|
|
|
if (doc == null)
|
|
|
|
|
|
|
|
return DataResult<TEntity>.Failed("结算单据与费用明细不一致");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var exchange = doc.ExchangeRates?.Find(x => x.Currency == settlement.Currency);
|
|
|
|
|
|
|
|
if (exchange == null)
|
|
|
|
|
|
|
|
return DataResult<TEntity>.Failed($"未传入结算币别 {settlement.Currency} 与费用原币别 {detail.OriginalCurrency} 之间的汇率信息");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
detail.ExchangeRate = exchange.ExchangeRate;
|
|
|
|
|
|
|
|
detail.ApplyAmount = Math.Round(exchange.ExchangeRate.GetValueOrDefault() * detail.OriginalAmount, 2, MidpointRounding.AwayFromZero);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//发票结算
|
|
|
|
//发票结算
|
|
|
|
else if (settlement.Mode == SettlementMode.InvoiceSettlement || settlement.Mode == SettlementMode.PaymentInvoiceSettlement)
|
|
|
|
else if (settlement.Mode == SettlementMode.InvoiceSettlement || settlement.Mode == SettlementMode.PaymentInvoiceSettlement)
|
|
|
@ -144,12 +164,33 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
FeeId = x.FeeId,
|
|
|
|
FeeId = x.FeeId,
|
|
|
|
FeeName = x.FeeName,
|
|
|
|
FeeName = x.FeeName,
|
|
|
|
FeeType = x.FeeType,
|
|
|
|
FeeType = x.FeeType,
|
|
|
|
|
|
|
|
|
|
|
|
ApplyAmount = x.ApplyAmount - x.ProcessedAmount,
|
|
|
|
ApplyAmount = x.ApplyAmount - x.ProcessedAmount,
|
|
|
|
Currency = x.Currency,
|
|
|
|
Currency = x.Currency,
|
|
|
|
ExchangeRate = x.ExchangeRate,
|
|
|
|
|
|
|
|
OriginalAmount = x.OriginalAmount - x.OriginalProcessedAmount,
|
|
|
|
OriginalAmount = x.OriginalAmount - x.OriginalProcessedAmount,
|
|
|
|
|
|
|
|
OriginalCurrency = x.OriginalCurrency,
|
|
|
|
|
|
|
|
ExchangeRate = x.ExchangeRate
|
|
|
|
}).ToListAsync();
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (settlement.Currency == FeeCurrency.RMB_CODE) //指定结算币别
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var details2 = details1.FindAll(x => x.OriginalCurrency != settlement.Currency);
|
|
|
|
|
|
|
|
foreach (var detail in details2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
detail.Currency = settlement.Currency;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var doc = request.Documents.Find(x => x.Id == detail.ApplicationId);
|
|
|
|
|
|
|
|
if (doc == null)
|
|
|
|
|
|
|
|
return DataResult<TEntity>.Failed("结算单据与费用明细不一致");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var exchange = doc.ExchangeRates?.Find(x => x.Currency == settlement.Currency);
|
|
|
|
|
|
|
|
if (exchange == null)
|
|
|
|
|
|
|
|
return DataResult<TEntity>.Failed($"未传入结算币别 {settlement.Currency} 与费用原币别 {detail.OriginalCurrency} 之间的汇率信息");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
detail.ExchangeRate = exchange.ExchangeRate;
|
|
|
|
|
|
|
|
detail.ApplyAmount = Math.Round(exchange.ExchangeRate.GetValueOrDefault() * detail.OriginalAmount, 2, MidpointRounding.AwayFromZero);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|