|
|
|
@ -11,7 +11,6 @@ using DS.WMS.Core.Flow.Interface;
|
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
|
|
using LanguageExt.Common;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
|
|
|
|
@ -136,17 +135,22 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
/// <param name="id">业务ID</param>
|
|
|
|
|
/// <param name="businessType">业务类型</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult<List<FeeRecordDto>>> GetFeesAsync(long id, BusinessType businessType)
|
|
|
|
|
public async Task<DataResult<FeeDto>> GetFeesAsync(long id, BusinessType businessType)
|
|
|
|
|
{
|
|
|
|
|
var list = await TenantDb.Queryable<FeeRecord>()
|
|
|
|
|
.Where(f => f.BusinessId == id && f.BusinessType == businessType && f.FeeStatus == FeeStatus.AuditPassed)
|
|
|
|
|
.Select(f => new FeeRecordDto
|
|
|
|
|
{
|
|
|
|
|
Id = f.Id,
|
|
|
|
|
RecordId = f.Id,
|
|
|
|
|
BusinessId = id,
|
|
|
|
|
BusinessType = businessType,
|
|
|
|
|
CustomerName = f.CustomerName,
|
|
|
|
|
FeeId = f.FeeId,
|
|
|
|
|
FeeName = f.FeeName,
|
|
|
|
|
FeeType = f.FeeType,
|
|
|
|
|
Amount = f.Amount,
|
|
|
|
|
Currency = f.Currency,
|
|
|
|
|
OriginalCurrency = f.Currency,
|
|
|
|
|
OriginalRate = f.ExchangeRate,
|
|
|
|
|
RestAmount = f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount,
|
|
|
|
|
InvoiceAmount = f.InvoiceAmount,
|
|
|
|
@ -167,7 +171,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<List<FeeRecordDto>>.Success(list);
|
|
|
|
|
return DataResult<FeeDto>.Success(new FeeDto(list));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -228,10 +232,10 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
var gList = dto.Details.GroupBy(x => x.BusinessType).ToList();
|
|
|
|
|
foreach (var g in gList)
|
|
|
|
|
{
|
|
|
|
|
var ids = g.Select(x => x.BusinessId).ToList();
|
|
|
|
|
switch (g.Key)
|
|
|
|
|
{
|
|
|
|
|
case BusinessType.OceanShippingExport:
|
|
|
|
|
var ids = g.Select(x => x.BusinessId).ToList();
|
|
|
|
|
var list1 = await TenantDb.Queryable<SeaExport>().Where(x => ids.Contains(x.Id)).Select(x => new
|
|
|
|
|
{
|
|
|
|
|
x.Id,
|
|
|
|
@ -294,7 +298,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
return DataResult.Failed("只能修改状态为:未提交/审核驳回的申请单");
|
|
|
|
|
|
|
|
|
|
if (application.Details.Count > 0 && !string.Equals(model.Currency, application.Currency, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
return DataResult.Failed("提交币别需与原申请单币别一致");
|
|
|
|
|
return DataResult.Failed("提交申请单币别需与原申请单币别一致");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<FeeRecord>? fees = null;
|
|
|
|
@ -304,7 +308,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
return DataResult.Failed("申请单的结算对象有且只能有一个");
|
|
|
|
|
|
|
|
|
|
if (!application.Currency.IsNullOrEmpty() && application.Details.Any(x => x.Currency != application.Currency))
|
|
|
|
|
return DataResult.Failed($"申请单的所有明细币别必须为 {application.Currency}");
|
|
|
|
|
return DataResult.Failed($"申请单不是原币申请,所有明细币别必须为 {application.Currency}");
|
|
|
|
|
|
|
|
|
|
//仅处理新增的明细
|
|
|
|
|
var ids = application.Details.FindAll(x => x.Id == 0).Select(x => x.RecordId).ToList();
|
|
|
|
@ -385,6 +389,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
await TenantDb.Updateable(application).IgnoreColumns(x => new
|
|
|
|
|
{
|
|
|
|
|
x.ApplicationNO,
|
|
|
|
|
//x.Currency,
|
|
|
|
|
x.CreateBy,
|
|
|
|
|
x.CreateTime,
|
|
|
|
|
x.Deleted,
|
|
|
|
|