|
|
|
@ -230,7 +230,7 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
|
if (doc == null)
|
|
|
|
|
return DataResult<TEntity>.Failed("结算单据与费用明细不一致");
|
|
|
|
|
|
|
|
|
|
var exchange = doc.ExchangeRates?.Find(x => x.Currency == settlement.Currency);
|
|
|
|
|
var exchange = doc.ExchangeRates?.Find(x => x.Currency == detail.OriginalCurrency);
|
|
|
|
|
if (exchange == null)
|
|
|
|
|
return DataResult<TEntity>.Failed($"未传入结算币别 {settlement.Currency} 与费用原币别 {detail.OriginalCurrency} 之间的汇率信息");
|
|
|
|
|
|
|
|
|
@ -243,9 +243,11 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
|
//执行结算费用分配
|
|
|
|
|
foreach (var doc in request.Documents)
|
|
|
|
|
{
|
|
|
|
|
var details2 = details1.Where(x => x.RefId == doc.Id).OrderBy(x => x.ApplyAmount).ToList();
|
|
|
|
|
var details2 = settlement.Mode != SettlementMode.FreeSettlement ?
|
|
|
|
|
details1.Where(x => x.RefId == doc.Id).OrderBy(x => x.ApplyAmount) :
|
|
|
|
|
details1.Where(x => x.BusinessId == doc.Id && x.BusinessType == doc.BusinessType && x.CustomerName == doc.CustomerName).OrderBy(x => x.ApplyAmount);
|
|
|
|
|
|
|
|
|
|
var rmbDetails = details2.FindAll(x => x.Currency == FeeCurrency.RMB_CODE);
|
|
|
|
|
var rmbDetails = details2.Where(x => x.Currency == FeeCurrency.RMB_CODE);
|
|
|
|
|
var totalRMB = rmbDetails.Sum(x => x.ApplyAmount);
|
|
|
|
|
doc.SettlementRMB ??= totalRMB;
|
|
|
|
|
|
|
|
|
@ -265,7 +267,7 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var usdDetails = details2.FindAll(x => x.Currency == FeeCurrency.USD_CODE);
|
|
|
|
|
var usdDetails = details2.Where(x => x.Currency == FeeCurrency.USD_CODE);
|
|
|
|
|
var totalUSD = usdDetails.Sum(x => x.ApplyAmount);
|
|
|
|
|
doc.SettlementUSD ??= totalUSD;
|
|
|
|
|
|
|
|
|
@ -285,7 +287,7 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var otherDetails = details2.FindAll(x => x.Currency != FeeCurrency.RMB_CODE && x.Currency != FeeCurrency.USD_CODE);
|
|
|
|
|
var otherDetails = details2.Where(x => x.Currency != FeeCurrency.RMB_CODE && x.Currency != FeeCurrency.USD_CODE);
|
|
|
|
|
var total = rmbDetails.Sum(x => x.ApplyAmount);
|
|
|
|
|
doc.SettlementOther ??= total;
|
|
|
|
|
|
|
|
|
|