|
|
@ -1,5 +1,6 @@
|
|
|
|
using DS.Module.Core;
|
|
|
|
using DS.Module.Core;
|
|
|
|
using DS.Module.Core.Enums;
|
|
|
|
using DS.Module.Core.Enums;
|
|
|
|
|
|
|
|
using DS.WMS.Core.Code.Entity;
|
|
|
|
using DS.WMS.Core.Fee.Dtos;
|
|
|
|
using DS.WMS.Core.Fee.Dtos;
|
|
|
|
using DS.WMS.Core.Fee.Entity;
|
|
|
|
using DS.WMS.Core.Fee.Entity;
|
|
|
|
using DS.WMS.Core.Fee.Interface;
|
|
|
|
using DS.WMS.Core.Fee.Interface;
|
|
|
@ -7,6 +8,7 @@ using DS.WMS.Core.Flow.Dtos;
|
|
|
|
using DS.WMS.Core.Flow.Entity;
|
|
|
|
using DS.WMS.Core.Flow.Entity;
|
|
|
|
using DS.WMS.Core.Flow.Interface;
|
|
|
|
using DS.WMS.Core.Flow.Interface;
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Fee.Method
|
|
|
|
namespace DS.WMS.Core.Fee.Method
|
|
|
@ -149,6 +151,89 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
return DataResult<FeeBiz>.Success(model);
|
|
|
|
return DataResult<FeeBiz>.Success(model);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 获取按票统计
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="id">业务ID</param>
|
|
|
|
|
|
|
|
/// <param name="businessType">业务类型</param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
public async Task<DataResult<BizFeeStat>> GetStatAsync(long id, BusinessType businessType)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BizFeeStat? stat = null;
|
|
|
|
|
|
|
|
switch (businessType)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case BusinessType.OceanShippingExport:
|
|
|
|
|
|
|
|
stat = await TenantDb.Queryable<BusinessFeeStatus>()
|
|
|
|
|
|
|
|
.InnerJoin<SeaExport>((b, s) => b.BusinessId == s.Id)
|
|
|
|
|
|
|
|
.LeftJoin<CodeSource>((b, s, cs) => s.SourceId == cs.Id)
|
|
|
|
|
|
|
|
.LeftJoin<CodeSourceDetail>((b, s, cs, csd) => s.SourceDetailId == csd.Id)
|
|
|
|
|
|
|
|
.Select((b, s, cs, csd) => new BizFeeStat
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IsBusinessLocking = b.IsBusinessLocking,
|
|
|
|
|
|
|
|
IsFeeLocking = b.IsFeeLocking,
|
|
|
|
|
|
|
|
HBLNO = s.HBLNO,
|
|
|
|
|
|
|
|
MBLNO = s.MBLNO,
|
|
|
|
|
|
|
|
CustomerNo = s.CustomerNo,
|
|
|
|
|
|
|
|
CustomerName = s.CustomerName,
|
|
|
|
|
|
|
|
ETD = s.ETD,
|
|
|
|
|
|
|
|
ETA = s.ETA,
|
|
|
|
|
|
|
|
CntrTotal = s.CntrTotal,
|
|
|
|
|
|
|
|
AccountDate = s.AccountDate,
|
|
|
|
|
|
|
|
OperatorId = s.OperatorId,
|
|
|
|
|
|
|
|
Vessel = s.Vessel,
|
|
|
|
|
|
|
|
Voyage = s.Voyno,
|
|
|
|
|
|
|
|
Carrier = s.Carrier,
|
|
|
|
|
|
|
|
Forwarder = s.Forwarder,
|
|
|
|
|
|
|
|
BookingNo = s.BookingNo,
|
|
|
|
|
|
|
|
CustomsDate = s.CustomDate,
|
|
|
|
|
|
|
|
LoadPort = s.LoadPort,
|
|
|
|
|
|
|
|
DischargePort = s.DischargePort,
|
|
|
|
|
|
|
|
Destination = s.Destination,
|
|
|
|
|
|
|
|
Yard = s.Yard,
|
|
|
|
|
|
|
|
Agent = s.Agent,
|
|
|
|
|
|
|
|
TEU = s.TEU,
|
|
|
|
|
|
|
|
GoodsName = s.GoodsName,
|
|
|
|
|
|
|
|
IssueType = s.IssueType,
|
|
|
|
|
|
|
|
SourceName = cs.SourceName,
|
|
|
|
|
|
|
|
SourceDetailName = csd.DetailName
|
|
|
|
|
|
|
|
}).FirstAsync();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BusinessType.OceanShippingImport:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (stat == null)
|
|
|
|
|
|
|
|
return DataResult<BizFeeStat>.Success(stat);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fees = await TenantDb.Queryable<FeeRecord>().Where(f =>
|
|
|
|
|
|
|
|
f.BusinessId == id && f.BusinessType == businessType && f.FeeStatus == FeeStatus.AuditPassed)
|
|
|
|
|
|
|
|
.Select(x => new
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
x.FeeType,
|
|
|
|
|
|
|
|
x.Currency,
|
|
|
|
|
|
|
|
x.Amount
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stat.ReceivableTotal = fees.FindAll(x => x.FeeType == FeeType.Receivable).Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
|
|
|
stat.ReceivableCNY = fees.FindAll(x => x.FeeType == FeeType.Receivable && x.Currency == RMB_CODE).Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
|
|
|
stat.ReceivableUSD = fees.FindAll(x => x.FeeType == FeeType.Receivable && x.Currency == USD_CODE).Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
|
|
|
stat.ReceivableOther = fees.FindAll(x => x.FeeType == FeeType.Receivable && (x.Currency != USD_CODE && x.Currency != RMB_CODE)).Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stat.PayableTotal = fees.FindAll(x => x.FeeType == FeeType.Payable).Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
|
|
|
stat.PayableCNY = fees.FindAll(x => x.FeeType == FeeType.Payable && x.Currency == RMB_CODE).Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
|
|
|
stat.PayableUSD = fees.FindAll(x => x.FeeType == FeeType.Payable && x.Currency == USD_CODE).Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
|
|
|
stat.PayableOther = fees.FindAll(x => x.FeeType == FeeType.Payable && (x.Currency != USD_CODE && x.Currency != RMB_CODE)).Sum(x => x.Amount).GetValueOrDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long?[] usersId = [stat.OperatorId];
|
|
|
|
|
|
|
|
if (Array.Exists(usersId, x => x.HasValue))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var users = await Db.Queryable<SysUser>().Where(x => usersId.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToListAsync();
|
|
|
|
|
|
|
|
stat.Operator = users.Find(x => x.Id == stat.OperatorId)?.UserName;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult<BizFeeStat>.Success(stat);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 一键审核当前登录用户的所有待审核项
|
|
|
|
/// 一键审核当前登录用户的所有待审核项
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|