取消待审核列表费用状态筛选

dev
嵇文龙 3 weeks ago
parent 122d53f9a6
commit 4c95576cf4

@ -395,7 +395,7 @@ namespace DS.WMS.Core.Fee.Method
var query1 = TenantDb.Queryable<FeeRecord>().Where(f => f.BusinessId == request.Id && f.BusinessType == request.BusinessType)
.InnerJoin<SeaExport>((f, s) => f.BusinessId == s.Id)
.LeftJoin<InfoClient>((f, s, i) => f.CustomerId == i.Id)
.WhereIF(ids1.Length > 0, (f, s, i) => (ids1.Contains(f.Id) || ids2.Contains(f.BusinessId)) && AuditStatusArray.Contains(f.FeeStatus))
.WhereIF(ids1.Length > 0, (f, s, i) => ids1.Contains(f.Id) || ids2.Contains(f.BusinessId))
.Select((f, s, i) => new FeeAuditItemQuery
{
Id = f.Id,

@ -914,7 +914,7 @@ namespace DS.WMS.Core.Fee.Method
}
else if (taskType == TaskBaseTypeEnum.BILL_PAY_AUDIT)
{
if (entity.BillAuditStatus != BillAuditStatus.PaySubmitted && entity.BillAuditStatus != BillAuditStatus.PayRejected)
if (entity.BillAuditStatus != BillAuditStatus.PaySubmitted || entity.BillAuditStatus != BillAuditStatus.PayRejected)
return DataResult.Failed(string.Format(
MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BillFeeStatusError)), entity.BillAuditStatus.GetDescription()));
}

@ -140,11 +140,11 @@ namespace DS.WMS.Core.Settlement.Method
{
detail.Currency = settlement.Currency;
var doc = request.Documents.Find(x => x.Id == detail.ApplicationId);
var doc = request.Documents.Find(x => x.Id == detail.RefId);
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} 之间的汇率信息");
@ -250,14 +250,14 @@ namespace DS.WMS.Core.Settlement.Method
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.Where(x => x.Currency == FeeCurrency.RMB_CODE);
var totalRMB = rmbDetails.Sum(x => x.ApplyAmount);
var rmbDetails = details2.Where(x => x.OriginalCurrency == FeeCurrency.RMB_CODE);
var totalRMB = rmbDetails.Sum(x => x.OriginalAmount);
doc.SettlementRMB ??= totalRMB;
if (doc.SettlementRMB > totalRMB)
return DataResult<TEntity>.Failed("人民币结算金额不能大于剩余人民币金额");
if (totalRMB < doc.SettlementRMB)
if (doc.SettlementRMB < totalRMB)
{
var rest = totalRMB - doc.SettlementRMB.GetValueOrDefault();
foreach (var detail in rmbDetails)
@ -265,19 +265,29 @@ namespace DS.WMS.Core.Settlement.Method
if (rest == 0)
break;
detail.ApplyAmount = detail.ApplyAmount - rest;
rest = detail.ApplyAmount - rest;
detail.OriginalAmount = detail.OriginalAmount - rest;
if (detail.OriginalCurrency == settlement.Currency)
{
detail.ApplyAmount = detail.OriginalAmount;
}
else
{
var er = doc.ExchangeRates.Find(x => x.Currency == detail.OriginalCurrency);
detail.ApplyAmount = detail.OriginalAmount * er?.ExchangeRate ?? 1;
}
rest = detail.OriginalAmount - rest;
}
}
var usdDetails = details2.Where(x => x.Currency == FeeCurrency.USD_CODE);
var totalUSD = usdDetails.Sum(x => x.ApplyAmount);
var usdDetails = details2.Where(x => x.OriginalCurrency == FeeCurrency.USD_CODE);
var totalUSD = usdDetails.Sum(x => x.OriginalAmount);
doc.SettlementUSD ??= totalUSD;
if (doc.SettlementUSD > totalUSD)
return DataResult<TEntity>.Failed("美元结算金额不能大于剩余美元金额");
if (totalUSD < doc.SettlementUSD)
if (doc.SettlementUSD < totalUSD)
{
var rest = totalUSD - doc.SettlementUSD.GetValueOrDefault();
foreach (var detail in usdDetails)
@ -285,19 +295,28 @@ namespace DS.WMS.Core.Settlement.Method
if (rest == 0)
break;
detail.ApplyAmount = detail.ApplyAmount - rest;
rest = detail.ApplyAmount - rest;
detail.OriginalAmount = detail.OriginalAmount - rest;
if (detail.OriginalCurrency == settlement.Currency)
{
detail.ApplyAmount = detail.OriginalAmount;
}
else
{
var er = doc.ExchangeRates.Find(x => x.Currency == detail.OriginalCurrency);
detail.ApplyAmount = detail.OriginalAmount * er?.ExchangeRate ?? 1;
}
rest = detail.OriginalAmount - rest;
}
}
var otherDetails = details2.Where(x => x.Currency != FeeCurrency.RMB_CODE && x.Currency != FeeCurrency.USD_CODE);
var total = rmbDetails.Sum(x => x.ApplyAmount);
var otherDetails = details2.Where(x => x.OriginalCurrency != FeeCurrency.RMB_CODE && x.Currency != FeeCurrency.USD_CODE);
var total = otherDetails.Sum(x => x.OriginalAmount);
doc.SettlementOther ??= total;
if (doc.SettlementOther > total)
return DataResult<TEntity>.Failed("其他结算金额不能大于剩余其他金额");
if (total < doc.SettlementOther)
if (doc.SettlementOther < total)
{
var rest = total - doc.SettlementOther.GetValueOrDefault();
foreach (var detail in otherDetails)
@ -305,8 +324,17 @@ namespace DS.WMS.Core.Settlement.Method
if (rest == 0)
break;
detail.ApplyAmount = detail.ApplyAmount - rest;
rest = detail.ApplyAmount - rest;
detail.OriginalAmount = detail.OriginalAmount - rest;
if (detail.OriginalCurrency == settlement.Currency)
{
detail.ApplyAmount = detail.OriginalAmount;
}
else
{
var er = doc.ExchangeRates.Find(x => x.Currency == detail.OriginalCurrency);
detail.ApplyAmount = detail.OriginalAmount * er?.ExchangeRate ?? 1;
}
rest = detail.OriginalAmount - rest;
}
}
}

Loading…
Cancel
Save