|
|
|
@ -8,7 +8,6 @@ using DS.WMS.Core.Application.Interface;
|
|
|
|
|
using DS.WMS.Core.Fee.Dtos;
|
|
|
|
|
using DS.WMS.Core.Fee.Entity;
|
|
|
|
|
using DS.WMS.Core.Info.Entity;
|
|
|
|
|
using DS.WMS.Core.Invoice.Dtos;
|
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
|
using SqlSugar;
|
|
|
|
@ -123,15 +122,11 @@ namespace DS.WMS.Core.Application.Method
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult<List<BizPaymentApplication>>> GetBizListAsync(PageRequest request)
|
|
|
|
|
{
|
|
|
|
|
var queryList = CreateBizQuery();
|
|
|
|
|
var query = CreateBizQuery();
|
|
|
|
|
var whereList = request.GetConditionalModels(Db);
|
|
|
|
|
query = query.Where(whereList);
|
|
|
|
|
|
|
|
|
|
if (!request.QueryCondition.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
|
|
|
|
queryList = queryList.Where(whereList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var result = await queryList.ToQueryPageAsync(request.PageCondition);
|
|
|
|
|
var result = await query.ToQueryPageAsync(request.PageCondition);
|
|
|
|
|
|
|
|
|
|
if (result.Data.Count > 0)
|
|
|
|
|
{
|
|
|
|
@ -164,17 +159,17 @@ 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)
|
|
|
|
|
.GroupBy((s, f) => s.Id)
|
|
|
|
|
.GroupBy((s, f) => new { s.Id, f.CustomerId })
|
|
|
|
|
.Select((s, f) => new BizPaymentApplication
|
|
|
|
|
{
|
|
|
|
|
Id = s.Id,
|
|
|
|
|
BusinessType = BusinessType.OceanShippingExport,
|
|
|
|
|
CustomerNo = s.CustomerNo, //委托编号
|
|
|
|
|
ClientName = s.CustomerName, //委托单位
|
|
|
|
|
MBLNO = s.MBLNO,
|
|
|
|
|
HBLNO = s.HBLNO,
|
|
|
|
|
CustomerId = s.CustomerId,
|
|
|
|
|
CustomerName = s.CustomerName,//结费单位
|
|
|
|
|
ClientName = s.CustomerName, //委托单位
|
|
|
|
|
CustomerId = f.CustomerId,
|
|
|
|
|
CustomerName = f.CustomerName, //结费单位
|
|
|
|
|
AccountDate = s.AccountDate,
|
|
|
|
|
BookingNO = s.BookingNo, //订舱编号
|
|
|
|
|
CntrTotal = s.CntrTotal,
|
|
|
|
@ -196,12 +191,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 &&
|
|
|
|
@ -219,13 +216,15 @@ namespace DS.WMS.Core.Application.Method
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">业务ID与业务类型</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult<PaymentApplicaitonBiz>> GetFeesAsync(params BizItem[] items)
|
|
|
|
|
public async Task<DataResult<PaymentApplicaitonBiz>> GetFeesAsync(IEnumerable<FeeClient> items)
|
|
|
|
|
{
|
|
|
|
|
var bizIds = items.Select(x => x.Id).ToList();
|
|
|
|
|
var types = items.Select(x => x.BusinessType).ToList();
|
|
|
|
|
var ids = items.Select(x => x.Id).Distinct();
|
|
|
|
|
var types = items.Select(x => x.BusinessType).Distinct();
|
|
|
|
|
var cIds = items.Select(x => x.CustomerId).Distinct();
|
|
|
|
|
|
|
|
|
|
var list = await TenantDb.Queryable<FeeRecord>()
|
|
|
|
|
.Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && f.FeeStatus == FeeStatus.AuditPassed)
|
|
|
|
|
.Where(f => ids.Contains(f.BusinessId) && types.Contains(f.BusinessType) &&
|
|
|
|
|
cIds.Contains(f.CustomerId) && f.FeeStatus == FeeStatus.AuditPassed)
|
|
|
|
|
.Select(f => new FeePaymentDto
|
|
|
|
|
{
|
|
|
|
|
RecordId = f.Id,
|
|
|
|
@ -381,11 +380,12 @@ namespace DS.WMS.Core.Application.Method
|
|
|
|
|
|
|
|
|
|
protected override async Task<List<ApplicationDetail>> GetDetailsAsync(ApplicationRequest<PaymentApplication> request)
|
|
|
|
|
{
|
|
|
|
|
var ids1 = request.Items.Select(x => x.Id);
|
|
|
|
|
var ids2 = request.Items.Select(x => x.BusinessType);
|
|
|
|
|
var ids1 = request.Items.Select(x => x.Id).Distinct();
|
|
|
|
|
var ids2 = request.Items.Select(x => x.BusinessType).Distinct();
|
|
|
|
|
var ids3 = request.Items.Select(x => x.CustomerId).Distinct();
|
|
|
|
|
|
|
|
|
|
var list = await TenantDb.Queryable<FeeRecord>().Where(x =>
|
|
|
|
|
ids1.Contains(x.BusinessId) && ids2.Contains(x.BusinessType) && x.FeeStatus == FeeStatus.AuditPassed)
|
|
|
|
|
var list = await TenantDb.Queryable<FeeRecord>().Where(x => x.FeeStatus == FeeStatus.AuditPassed &&
|
|
|
|
|
ids1.Contains(x.BusinessId) && ids2.Contains(x.BusinessType) && ids3.Contains(x.CustomerId))
|
|
|
|
|
.Where(request.GetQueryConditions(Db))
|
|
|
|
|
.Select(x => new ApplicationDetail
|
|
|
|
|
{
|
|
|
|
@ -563,7 +563,7 @@ namespace DS.WMS.Core.Application.Method
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override DataResult PreSubmitApproval(List<PaymentApplication> applications)
|
|
|
|
|