|
|
@ -246,7 +246,7 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
//执行结算费用分配
|
|
|
|
//执行结算费用分配
|
|
|
|
foreach (var doc in request.Documents)
|
|
|
|
foreach (var doc in request.Documents)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var details2 = settlement.Mode != SettlementMode.FreeSettlement ?
|
|
|
|
var details2 = settlement.Mode != SettlementMode.FreeSettlement ?
|
|
|
|
details1.Where(x => x.RefId == doc.Id).OrderBy(x => x.ApplyAmount) :
|
|
|
|
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);
|
|
|
|
details1.Where(x => x.BusinessId == doc.Id && x.BusinessType == doc.BusinessType && x.CustomerName == doc.CustomerName).OrderBy(x => x.ApplyAmount);
|
|
|
|
|
|
|
|
|
|
|
@ -625,18 +625,17 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
List<FeeRecord> list = new(fees.Count);
|
|
|
|
List<FeeRecord> list = new(fees.Count);
|
|
|
|
foreach (var item in fees)
|
|
|
|
foreach (var item in fees)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var restAmount = item.Amount - item.SettlementAmount - item.OrderAmount + item.OrderSettlementAmount;
|
|
|
|
if (item.SettlementAmount == item.Amount)
|
|
|
|
if (restAmount == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.FeeStatus = FeeStatus.SettlementCompleted;
|
|
|
|
item.FeeStatus = FeeStatus.SettlementCompleted;
|
|
|
|
list.Add(item);
|
|
|
|
list.Add(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (restAmount != item.Amount)
|
|
|
|
else if (item.Amount - item.SettlementAmount != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.FeeStatus = FeeStatus.PartialSettlement;
|
|
|
|
item.FeeStatus = FeeStatus.PartialSettlement;
|
|
|
|
list.Add(item);
|
|
|
|
list.Add(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (restAmount == item.Amount)
|
|
|
|
else if (item.SettlementAmount == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.FeeStatus = FeeStatus.AuditPassed;
|
|
|
|
item.FeeStatus = FeeStatus.AuditPassed;
|
|
|
|
list.Add(item);
|
|
|
|
list.Add(item);
|
|
|
@ -745,13 +744,13 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
/// <param name="expr1">关联条件1</param>
|
|
|
|
/// <param name="expr1">关联条件1</param>
|
|
|
|
/// <returns>查询对象</returns>
|
|
|
|
/// <returns>查询对象</returns>
|
|
|
|
protected virtual ISugarQueryable<SettlementDetailDto> CreateApplicationDetailQuery(
|
|
|
|
protected virtual ISugarQueryable<SettlementDetailDto> CreateApplicationDetailQuery(
|
|
|
|
Expression<Func<ApplicationDetail, FeeRecord, SeaExport, bool>>? expr1 = null)
|
|
|
|
Expression<Func<ApplicationDetail, FeeRecord, SeaExport, bool>>? expr1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//海运出口
|
|
|
|
//海运出口
|
|
|
|
var query1 = TenantDb.Queryable<ApplicationDetail>()
|
|
|
|
var query1 = TenantDb.Queryable<ApplicationDetail>()
|
|
|
|
.InnerJoin<FeeRecord>((d, f) => d.RecordId == f.Id)
|
|
|
|
.InnerJoin<FeeRecord>((d, f) => d.RecordId == f.Id)
|
|
|
|
.LeftJoin<SeaExport>((d, f, s) => f.BusinessId == s.Id && f.BusinessType == BusinessType.OceanShippingExport)
|
|
|
|
.LeftJoin<SeaExport>((d, f, s) => f.BusinessId == s.Id && f.BusinessType == BusinessType.OceanShippingExport)
|
|
|
|
.WhereIF(expr1 != null, expr1)
|
|
|
|
.Where(expr1)
|
|
|
|
.Select((d, f, s) => new SettlementDetailDto
|
|
|
|
.Select((d, f, s) => new SettlementDetailDto
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//---------------明细表--------------
|
|
|
|
//---------------明细表--------------
|
|
|
@ -770,6 +769,7 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
OriginalCurrency = d.OriginalCurrency,
|
|
|
|
OriginalCurrency = d.OriginalCurrency,
|
|
|
|
ProcessedAmount = d.ProcessedAmount,
|
|
|
|
ProcessedAmount = d.ProcessedAmount,
|
|
|
|
OriginalProcessedAmount = d.OriginalProcessedAmount,
|
|
|
|
OriginalProcessedAmount = d.OriginalProcessedAmount,
|
|
|
|
|
|
|
|
RestAmount = d.ProcessedAmount - d.OriginalProcessedAmount,
|
|
|
|
//---------------费用表--------------
|
|
|
|
//---------------费用表--------------
|
|
|
|
OriginalRate = f.ExchangeRate,
|
|
|
|
OriginalRate = f.ExchangeRate,
|
|
|
|
Amount = f.Amount,
|
|
|
|
Amount = f.Amount,
|
|
|
@ -790,6 +790,9 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
CustomerNo = s.CustomerNo,
|
|
|
|
CustomerNo = s.CustomerNo,
|
|
|
|
ClientName = s.CustomerName, //委托单位
|
|
|
|
ClientName = s.CustomerName, //委托单位
|
|
|
|
ETD = s.ETD,
|
|
|
|
ETD = s.ETD,
|
|
|
|
|
|
|
|
ETA = s.ETA,
|
|
|
|
|
|
|
|
Forwarder = s.Forwarder,
|
|
|
|
|
|
|
|
Operator = s.OperatorName,
|
|
|
|
MBLNO = s.MBLNO,
|
|
|
|
MBLNO = s.MBLNO,
|
|
|
|
HBLNO = s.HBLNO,
|
|
|
|
HBLNO = s.HBLNO,
|
|
|
|
LoadPort = s.LoadPort,
|
|
|
|
LoadPort = s.LoadPort,
|
|
|
|