From 836ac3240079af9fe18fad655fe7f0d9eae010cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Thu, 13 Jun 2024 14:10:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=B9=E7=94=A8=E5=AE=A1=E6=A0=B8=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=A2=9E=E5=8A=A0=E6=9E=9A=E4=B8=BE=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Fee/Dtos/FeeAudit.cs | 15 +++ ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeDto.cs | 110 +++++++++++++++++- .../DS.WMS.Core/Fee/Entity/FeeApplication.cs | 2 +- .../Fee/Entity/FeeApplicationDetail.cs | 13 ++- .../Fee/Interface/IFeeApplicationService.cs | 2 +- .../Fee/Method/FeeApplicationService.cs | 19 +-- .../DS.WMS.Core/Fee/Method/FeeAuditService.cs | 4 + .../Op/Entity/BusinessFeeStatus.cs | 3 + .../Controllers/FeeApplicationController.cs | 2 +- .../DS.WMS.FeeApi/Logs/internal-nlog.txt | 7 ++ .../FolderProfile1.pubxml.user | 2 +- 11 files changed, 159 insertions(+), 20 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAudit.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAudit.cs index c9856a96..1bf0cd47 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAudit.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAudit.cs @@ -17,16 +17,31 @@ namespace DS.WMS.Core.Fee.Dtos /// public BusinessType BusinessType { get; set; } + /// + /// 业务类型描述 + /// + public string BusinessTypeText => BusinessType.GetDescription(); + /// /// 应收费用状态 /// public BillFeeStatus? ARFeeStatus { get; set; } + /// + /// 应收费用状态描述 + /// + public string ARFeeStatusText => ARFeeStatus?.GetDescription(); + /// /// 应付费用状态 /// public BillFeeStatus? APFeeStatus { get; set; } + /// + /// 应付费用状态描述 + /// + public string APFeeStatusText => APFeeStatus?.GetDescription(); + /// /// 更改单 /// diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeDto.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeDto.cs index 7c2c3ff7..b1ff26f3 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeDto.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeDto.cs @@ -1,17 +1,106 @@ using System.Runtime.Serialization; using DS.Module.Core; +using DS.WMS.Core.Op.Entity; namespace DS.WMS.Core.Fee.Dtos { + /// + /// 按业务展示的费用信息 + /// + public class FeeDto + { + readonly IEnumerable _items; + + /// + /// 费用记录项 + /// + public IEnumerable Items => _items; + + /// + /// 使用指定的数据源初始化统计。 + /// + /// 数据源 + public FeeDto(IEnumerable 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(); + } + + /// + /// 人民币应收款 + /// + public decimal ReceivableCNY { get; private set; } + + /// + /// 人民币应付款 + /// + public decimal PayableCNY { get; private set; } + + /// + /// 美元应收款 + /// + public decimal ReceivableUSD { get; private set; } + + /// + /// 美元应付款 + /// + public decimal PayableUSD { get; private set; } + + /// + /// 其他币种应收款 + /// + public decimal ReceivableOther { get; private set; } + + /// + /// 其他币种应付款 + /// + public decimal PayableOther { get; private set; } + } + /// /// 费用记录 /// public class FeeRecordDto { + /// + /// 申请单ID + /// + public long ApplicationId { get; set; } + /// /// 费用记录ID /// - public long Id { get; set; } + public long RecordId { get; set; } + + /// + /// 业务ID + /// + public long BusinessId { get; set; } + + /// + /// 业务类型 + /// + public BusinessType BusinessType { get; set; } + + /// + /// 客户名称 + /// + public string? CustomerName { get; set; } + + /// + /// 费用ID + /// + public long FeeId { get; set; } /// /// 费用名称 @@ -24,7 +113,7 @@ namespace DS.WMS.Core.Fee.Dtos public FeeType FeeType { get; set; } /// - /// 金额 + /// 费用总金额 /// public decimal? Amount { get; set; } @@ -33,21 +122,36 @@ namespace DS.WMS.Core.Fee.Dtos /// public string Currency { get; set; } + /// + /// 原始币别 + /// + public string OriginalCurrency { get; set; } + /// /// 原始汇率 /// public decimal? OriginalRate { get; set; } + /// + /// 折算汇率 + /// + public decimal? ExchangeRate { get; set; } + /// /// 未结金额 /// public decimal? RestAmount { get; set; } /// - /// 申请金额 + /// 本次申请金额 /// public decimal? ApplyAmount { get; set; } + /// + /// 本次申请原始金额 + /// + public decimal? OriginalApplyAmount { get; set; } + /// /// 开票金额 /// diff --git a/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeApplication.cs b/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeApplication.cs index 127aaf7c..6543116d 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeApplication.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeApplication.cs @@ -24,7 +24,7 @@ namespace DS.WMS.Core.Fee.Entity /// 结算方式 /// [SugarColumn(ColumnDescription = "结算方式")] - public int? Type { get; set; } + public long? SettlementType { get; set; } /// /// 结算人 diff --git a/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeApplicationDetail.cs b/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeApplicationDetail.cs index 1261c8a9..0c445464 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeApplicationDetail.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeApplicationDetail.cs @@ -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 应付 /// [SugarColumn(ColumnDescription = "收付类型(收、付)", DefaultValue = "1")] - public int FeeType { get; set; } + public FeeType FeeType { get; set; } /// /// 费用Id @@ -66,9 +67,9 @@ namespace DS.WMS.Core.Fee.Entity public FeeCategory? Category { get; set; } /// - /// 金额 + /// 申请金额 /// - [SugarColumn(ColumnDescription = "金额")] + [SugarColumn(ColumnDescription = "申请金额")] public decimal Amount { get; set; } /// @@ -96,9 +97,9 @@ namespace DS.WMS.Core.Fee.Entity public string OriginalCurrency { get; set; } /// - /// 原始金额 + /// 原始申请金额 /// - [SugarColumn(ColumnDescription = "原始金额")] + [SugarColumn(ColumnDescription = "原始申请金额")] public decimal OriginalAmount { get; set; } /// diff --git a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeApplicationService.cs b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeApplicationService.cs index 1fe82daf..b762480a 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeApplicationService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeApplicationService.cs @@ -37,7 +37,7 @@ namespace DS.WMS.Core.Fee.Interface /// 业务ID /// 业务类型 /// - Task>> GetFeesAsync(long id, BusinessType businessType); + Task> GetFeesAsync(long id, BusinessType businessType); /// /// 提交申请单 diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeApplicationService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeApplicationService.cs index 4acc17ef..9d5f08cd 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeApplicationService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeApplicationService.cs @@ -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 /// 业务ID /// 业务类型 /// - public async Task>> GetFeesAsync(long id, BusinessType businessType) + public async Task> GetFeesAsync(long id, BusinessType businessType) { var list = await TenantDb.Queryable() .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>.Success(list); + return DataResult.Success(new FeeDto(list)); } /// @@ -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().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? 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, diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs index 27744987..f32c1ef8 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs @@ -38,6 +38,10 @@ namespace DS.WMS.Core.Fee.Method readonly IClientFlowInstanceService flowService; readonly IFeeRecordService feeService; + /// + /// 初始化 + /// + /// public FeeAuditService(IServiceProvider serviceProvider) : base(serviceProvider) { flowService = serviceProvider.GetRequiredService(); diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/BusinessFeeStatus.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/BusinessFeeStatus.cs index f9f7bfe1..ec3a2263 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/BusinessFeeStatus.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/BusinessFeeStatus.cs @@ -112,16 +112,19 @@ namespace DS.WMS.Core.Op.Entity /// /// 费用更改单 /// + [Description("费用更改单")] ChangeOrder = 0, /// /// 海运出口 /// + [Description("海运出口")] OceanShippingExport = 1, /// /// 海运进口 /// + [Description("海运进口")] OceanShippingImport = 2 } } diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeApplicationController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeApplicationController.cs index 07f8e8fa..21b281c7 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeApplicationController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeApplicationController.cs @@ -64,7 +64,7 @@ namespace DS.WMS.FeeApi.Controllers /// 业务类型 /// [HttpGet, Route("GetFees")] - public async Task>> GetFeesAsync([FromQuery] long id, [FromQuery] BusinessType businessType) + public async Task> GetFeesAsync([FromQuery] long id, [FromQuery] BusinessType businessType) { return await _service.GetFeesAsync(id, businessType); } diff --git a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt index dfad1bde..43b5cccd 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt @@ -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. diff --git a/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user b/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user index 4c398b13..c068e7f3 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user +++ b/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. <_PublishTargetUrl>D:\Publish\DS8\FeeApi - 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||; + 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||; \ No newline at end of file