费用审核列表增加枚举描述

usertest
嵇文龙 6 months ago
parent 6567708e5f
commit 836ac32400

@ -17,16 +17,31 @@ namespace DS.WMS.Core.Fee.Dtos
/// </summary>
public BusinessType BusinessType { get; set; }
/// <summary>
/// 业务类型描述
/// </summary>
public string BusinessTypeText => BusinessType.GetDescription();
/// <summary>
/// 应收费用状态
/// </summary>
public BillFeeStatus? ARFeeStatus { get; set; }
/// <summary>
/// 应收费用状态描述
/// </summary>
public string ARFeeStatusText => ARFeeStatus?.GetDescription();
/// <summary>
/// 应付费用状态
/// </summary>
public BillFeeStatus? APFeeStatus { get; set; }
/// <summary>
/// 应付费用状态描述
/// </summary>
public string APFeeStatusText => APFeeStatus?.GetDescription();
/// <summary>
/// 更改单
/// </summary>

@ -1,17 +1,106 @@
using System.Runtime.Serialization;
using DS.Module.Core;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Fee.Dtos
{
/// <summary>
/// 按业务展示的费用信息
/// </summary>
public class FeeDto
{
readonly IEnumerable<FeeRecordDto> _items;
/// <summary>
/// 费用记录项
/// </summary>
public IEnumerable<FeeRecordDto> Items => _items;
/// <summary>
/// 使用指定的数据源初始化统计。
/// </summary>
/// <param name="source">数据源</param>
public FeeDto(IEnumerable<FeeRecordDto> source)
{
_items = source;
//人民币
ReceivableCNY = _items.Where(x => x.FeeType == FeeType.Receivable && x.Currency == "CNY").Sum(x => x.Amount).GetValueOrDefault();
PayableCNY = _items.Where(x => x.FeeType == FeeType.Payable && x.Currency == "CNY").Sum(x => x.Amount).GetValueOrDefault();
//美元
ReceivableUSD = _items.Where(x => x.FeeType == FeeType.Receivable && x.Currency == "USD").Sum(x => x.Amount).GetValueOrDefault();
PayableUSD = _items.Where(x => x.FeeType == FeeType.Payable && x.Currency == "USD").Sum(x => x.Amount).GetValueOrDefault();
//其他
ReceivableOther = _items.Where(x => x.FeeType == FeeType.Receivable && x.Currency != "USD" && x.Currency != "CNY").Sum(x => x.Amount).GetValueOrDefault();
PayableOther = _items.Where(x => x.FeeType == FeeType.Payable && x.Currency == "USD" && x.Currency != "CNY").Sum(x => x.Amount).GetValueOrDefault();
}
/// <summary>
/// 人民币应收款
/// </summary>
public decimal ReceivableCNY { get; private set; }
/// <summary>
/// 人民币应付款
/// </summary>
public decimal PayableCNY { get; private set; }
/// <summary>
/// 美元应收款
/// </summary>
public decimal ReceivableUSD { get; private set; }
/// <summary>
/// 美元应付款
/// </summary>
public decimal PayableUSD { get; private set; }
/// <summary>
/// 其他币种应收款
/// </summary>
public decimal ReceivableOther { get; private set; }
/// <summary>
/// 其他币种应付款
/// </summary>
public decimal PayableOther { get; private set; }
}
/// <summary>
/// 费用记录
/// </summary>
public class FeeRecordDto
{
/// <summary>
/// 申请单ID
/// </summary>
public long ApplicationId { get; set; }
/// <summary>
/// 费用记录ID
/// </summary>
public long Id { get; set; }
public long RecordId { get; set; }
/// <summary>
/// 业务ID
/// </summary>
public long BusinessId { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public BusinessType BusinessType { get; set; }
/// <summary>
/// 客户名称
/// </summary>
public string? CustomerName { get; set; }
/// <summary>
/// 费用ID
/// </summary>
public long FeeId { get; set; }
/// <summary>
/// 费用名称
@ -24,7 +113,7 @@ namespace DS.WMS.Core.Fee.Dtos
public FeeType FeeType { get; set; }
/// <summary>
/// 金额
/// 费用总金额
/// </summary>
public decimal? Amount { get; set; }
@ -33,21 +122,36 @@ namespace DS.WMS.Core.Fee.Dtos
/// </summary>
public string Currency { get; set; }
/// <summary>
/// 原始币别
/// </summary>
public string OriginalCurrency { get; set; }
/// <summary>
/// 原始汇率
/// </summary>
public decimal? OriginalRate { get; set; }
/// <summary>
/// 折算汇率
/// </summary>
public decimal? ExchangeRate { get; set; }
/// <summary>
/// 未结金额
/// </summary>
public decimal? RestAmount { get; set; }
/// <summary>
/// 申请金额
/// 本次申请金额
/// </summary>
public decimal? ApplyAmount { get; set; }
/// <summary>
/// 本次申请原始金额
/// </summary>
public decimal? OriginalApplyAmount { get; set; }
/// <summary>
/// 开票金额
/// </summary>

@ -24,7 +24,7 @@ namespace DS.WMS.Core.Fee.Entity
/// 结算方式
/// </summary>
[SugarColumn(ColumnDescription = "结算方式")]
public int? Type { get; set; }
public long? SettlementType { get; set; }
/// <summary>
/// 结算人

@ -1,4 +1,5 @@
using DS.Module.Core.Data;
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Enums;
using DS.WMS.Core.Op.Entity;
using SqlSugar;
@ -45,7 +46,7 @@ namespace DS.WMS.Core.Fee.Entity
/// 收付类型(收、付) 1应收 2 应付
/// </summary>
[SugarColumn(ColumnDescription = "收付类型(收、付)", DefaultValue = "1")]
public int FeeType { get; set; }
public FeeType FeeType { get; set; }
/// <summary>
/// 费用Id
@ -66,9 +67,9 @@ namespace DS.WMS.Core.Fee.Entity
public FeeCategory? Category { get; set; }
/// <summary>
/// 金额
/// 申请金额
/// </summary>
[SugarColumn(ColumnDescription = "金额")]
[SugarColumn(ColumnDescription = "申请金额")]
public decimal Amount { get; set; }
/// <summary>
@ -96,9 +97,9 @@ namespace DS.WMS.Core.Fee.Entity
public string OriginalCurrency { get; set; }
/// <summary>
/// 原始金额
/// 原始申请金额
/// </summary>
[SugarColumn(ColumnDescription = "原始金额")]
[SugarColumn(ColumnDescription = "原始申请金额")]
public decimal OriginalAmount { get; set; }
/// <summary>

@ -37,7 +37,7 @@ namespace DS.WMS.Core.Fee.Interface
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <returns></returns>
Task<DataResult<List<FeeRecordDto>>> GetFeesAsync(long id, BusinessType businessType);
Task<DataResult<FeeDto>> GetFeesAsync(long id, BusinessType businessType);
/// <summary>
/// 提交申请单

@ -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,

@ -38,6 +38,10 @@ namespace DS.WMS.Core.Fee.Method
readonly IClientFlowInstanceService flowService;
readonly IFeeRecordService feeService;
/// <summary>
/// 初始化
/// </summary>
/// <param name="serviceProvider"></param>
public FeeAuditService(IServiceProvider serviceProvider) : base(serviceProvider)
{
flowService = serviceProvider.GetRequiredService<IClientFlowInstanceService>();

@ -112,16 +112,19 @@ namespace DS.WMS.Core.Op.Entity
/// <summary>
/// 费用更改单
/// </summary>
[Description("费用更改单")]
ChangeOrder = 0,
/// <summary>
/// 海运出口
/// </summary>
[Description("海运出口")]
OceanShippingExport = 1,
/// <summary>
/// 海运进口
/// </summary>
[Description("海运进口")]
OceanShippingImport = 2
}
}

@ -64,7 +64,7 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="businessType">业务类型</param>
/// <returns></returns>
[HttpGet, Route("GetFees")]
public async Task<DataResult<List<FeeRecordDto>>> GetFeesAsync([FromQuery] long id, [FromQuery] BusinessType businessType)
public async Task<DataResult<FeeDto>> GetFeesAsync([FromQuery] long id, [FromQuery] BusinessType businessType)
{
return await _service.GetFeesAsync(id, businessType);
}

@ -1251,3 +1251,10 @@
2024-06-12 16:55:30.4490 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-12 16:55:30.4490 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-12 16:55:30.4490 Info Configuration initialized.
2024-06-13 13:54:29.3425 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-13 13:54:29.3966 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-13 13:54:29.3966 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-13 13:54:29.4254 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-06-13 13:54:29.4405 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-13 13:54:29.4405 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-13 13:54:29.4577 Info Configuration initialized.

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\Publish\DS8\FeeApi</_PublishTargetUrl>
<History>True|2024-06-11T09:03:44.8328978Z||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;True|2024-05-22T09:48:40.8753914+08:00||;True|2024-05-22T09:25:06.2068137+08:00||;True|2024-05-22T09:18:53.0759815+08:00||;True|2024-05-21T17:13:36.4091775+08:00||;True|2024-05-21T14:41:18.8486299+08:00||;True|2024-05-21T11:04:27.3649637+08:00||;</History>
<History>True|2024-06-13T02:46:52.6971321Z||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;True|2024-05-22T09:48:40.8753914+08:00||;True|2024-05-22T09:25:06.2068137+08:00||;True|2024-05-22T09:18:53.0759815+08:00||;True|2024-05-21T17:13:36.4091775+08:00||;True|2024-05-21T14:41:18.8486299+08:00||;True|2024-05-21T11:04:27.3649637+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
Loading…
Cancel
Save