|
|
|
@ -34,18 +34,18 @@ namespace DS.WMS.Core.Application.Method
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult<List<PaymentApplicationDto>>> GetListAsync(PageRequest request)
|
|
|
|
|
public async Task<DataResult<PaymentApplicationModel>> GetListAsync(PageRequest request)
|
|
|
|
|
{
|
|
|
|
|
var query = CreateListQuery();
|
|
|
|
|
|
|
|
|
|
if (!request.QueryCondition.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
|
|
|
|
var whereList = request.GetConditionalModels(Db);
|
|
|
|
|
query = query.Where(whereList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var result = await query.GroupBy(x => x.Id).ToQueryPageAsync(request.PageCondition);
|
|
|
|
|
if (result.Data.Count > 0)
|
|
|
|
|
if (result.Data?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
//关联用户名称
|
|
|
|
|
var userIds = result.Data.Select(x => x.CreateBy).Distinct();
|
|
|
|
@ -61,7 +61,30 @@ namespace DS.WMS.Core.Application.Method
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
var ids = result.Data.Select(x => x.Id);
|
|
|
|
|
var details = await TenantDb.Queryable<ApplicationDetail>().Where(x => ids.Contains(x.ApplicationId))
|
|
|
|
|
.Select(x => new
|
|
|
|
|
{
|
|
|
|
|
x.Currency,
|
|
|
|
|
x.ApplyAmount,
|
|
|
|
|
x.SettlementAmount,
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
PaymentApplicationModel model = new()
|
|
|
|
|
{
|
|
|
|
|
List = result.Data,
|
|
|
|
|
|
|
|
|
|
TotalCNY = details.Where(x => x.Currency == FeeCurrency.RMB_CODE).Sum(x => x.ApplyAmount),
|
|
|
|
|
TotalUSD = details.Where(x => x.Currency == FeeCurrency.USD_CODE).Sum(x => x.ApplyAmount),
|
|
|
|
|
TotalOther = details.Where(x => x.Currency != FeeCurrency.RMB_CODE && x.Currency != FeeCurrency.USD_CODE).Sum(x => x.ApplyAmount),
|
|
|
|
|
|
|
|
|
|
SettlementCNY = details.Where(x => x.Currency == FeeCurrency.RMB_CODE).Sum(x => x.SettlementAmount),
|
|
|
|
|
SettlementUSD = details.Where(x => x.Currency == FeeCurrency.USD_CODE).Sum(x => x.SettlementAmount),
|
|
|
|
|
SettlementOther = details.Where(x => x.Currency != FeeCurrency.RMB_CODE && x.Currency != FeeCurrency.USD_CODE).Sum(x => x.SettlementAmount)
|
|
|
|
|
};
|
|
|
|
|
var result2 = DataResult<PaymentApplicationModel>.Success(model);
|
|
|
|
|
result2.Count = result.Count;
|
|
|
|
|
return result2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal ISugarQueryable<PaymentApplicationDto> CreateListQuery()
|
|
|
|
@ -115,6 +138,7 @@ namespace DS.WMS.Core.Application.Method
|
|
|
|
|
return TenantDb.UnionAll(new List<ISugarQueryable<PaymentApplicationDto>> { query1 });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取待付费的业务列表(编辑用)
|
|
|
|
|
/// </summary>
|
|
|
|
@ -158,7 +182,7 @@ namespace DS.WMS.Core.Application.Method
|
|
|
|
|
//海运出口
|
|
|
|
|
var query1 = TenantDb.Queryable<SeaExport>()
|
|
|
|
|
.InnerJoin<FeeRecord>((s, f) => s.Id == f.BusinessId && f.BusinessType == BusinessType.OceanShippingExport)
|
|
|
|
|
.Where((s, f) => f.FeeStatus == FeeStatus.AuditPassed)
|
|
|
|
|
.Where((s, f) => f.FeeStatus == FeeStatus.AuditPassed && f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount != 0)
|
|
|
|
|
.GroupBy((s, f) => new { s.Id, f.CustomerId })
|
|
|
|
|
.Select((s, f) => new BizPaymentApplication
|
|
|
|
|
{
|
|
|
|
@ -191,14 +215,14 @@ namespace DS.WMS.Core.Application.Method
|
|
|
|
|
f.FeeType == FeeType.Payable && f.Currency == FeeCurrency.USD_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
|
|
|
|
|
UnpaidOther = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
|
|
|
|
|
f.FeeType == FeeType.Payable && f.Currency != FeeCurrency.USD_CODE && f.Currency != FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UnreceivedRMB = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
|
|
|
|
|
f.FeeType == FeeType.Receivable && f.Currency == FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
|
|
|
|
|
UnreceivedUSD = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
|
|
|
|
|
f.FeeType == FeeType.Receivable && f.Currency == FeeCurrency.USD_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
|
|
|
|
|
UnreceivedOther = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
|
|
|
|
|
f.FeeType == FeeType.Receivable && f.Currency != FeeCurrency.USD_CODE && f.Currency != FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UnpaidRMBInv = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
|
|
|
|
|
f.FeeType == FeeType.Payable && f.Currency == FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount + f.OrderInvSettlementAmount)),
|
|
|
|
|
UnpaidUSDInv = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
|
|
|
|
|