From ab08ceba84ff9b4c53b2f2fd4fe854ca5a88c804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Mon, 27 May 2024 08:45:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=B9=E7=94=A8=E6=A8=A1=E6=9D=BFdto?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.AdminApi/Logs/internal-nlog.txt | 7 +++++ .../Fee/Dtos/FeeTemplateDetailReq.cs | 2 +- .../Fee/Dtos/FeeTemplateDetailRes.cs | 7 ++--- .../Fee/Entity/FeeTemplateDetail.cs | 4 +-- .../Fee/Method/FeeRecordService.cs | 29 +++++++++++++++++-- .../Controllers/FeeRecordController.cs | 1 - .../DS.WMS.FeeApi/Logs/internal-nlog.txt | 21 ++++++++++++++ 7 files changed, 60 insertions(+), 11 deletions(-) diff --git a/ds-wms-service/DS.WMS.AdminApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.AdminApi/Logs/internal-nlog.txt index aec3aee7..3b43c91e 100644 --- a/ds-wms-service/DS.WMS.AdminApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.AdminApi/Logs/internal-nlog.txt @@ -712,3 +712,10 @@ 2024-05-24 15:37:13.1685 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config 2024-05-24 15:37:13.1790 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-05-24 15:37:13.1790 Info Configuration initialized. +2024-05-24 17:08:49.9919 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-05-24 17:08:50.0274 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-05-24 17:08:50.0274 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-05-24 17:08:50.0497 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-05-24 17:08:50.0582 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config +2024-05-24 17:08:50.0582 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-05-24 17:08:50.0712 Info Configuration initialized. diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeTemplateDetailReq.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeTemplateDetailReq.cs index a10fcfb3..8d252ba6 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeTemplateDetailReq.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeTemplateDetailReq.cs @@ -40,7 +40,7 @@ public class FeeTemplateDetailReq /// /// 结算对象类型 /// - public CustomerTypeEnum? CustomerType { get; set; } + public string CustomerType { get; set; } /// /// 收付类型(收、付) /// diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeTemplateDetailRes.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeTemplateDetailRes.cs index 38b989d8..84ff68e6 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeTemplateDetailRes.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeTemplateDetailRes.cs @@ -1,6 +1,4 @@ using DS.Module.Core; -using Masuit.Tools.Systems; -using SqlSugar; namespace DS.WMS.Core.Fee.Dtos; @@ -41,9 +39,8 @@ public class FeeTemplateDetailRes /// /// 客户类型 /// - public CustomerTypeEnum? CustomerType { get; set; } - - public string CustomerTypeText { get { return CustomerType.HasValue ? CustomerType.Value.GetDescription() : string.Empty; } } + public string CustomerType { get; set; } + /// /// 收付类型(收、付) /// diff --git a/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeTemplateDetail.cs b/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeTemplateDetail.cs index 597dc23c..8848f77e 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeTemplateDetail.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeTemplateDetail.cs @@ -43,8 +43,8 @@ namespace DS.WMS.Core.Fee.Entity /// /// 客户类型 /// - [SugarColumn(ColumnDescription = "客户类型", IsNullable = true)] - public CustomerTypeEnum? CustomerType { get; set; } + [SugarColumn(ColumnDescription = "客户类型", IsNullable = true, Length = 50)] + public string CustomerType { get; set; } /// /// 收付类型(收、付) /// diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs index f842f44a..19b50e60 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs @@ -9,6 +9,7 @@ using DS.WMS.Core.Fee.Interface; using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Flow.Entity; using DS.WMS.Core.Flow.Interface; +using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Sys.Entity; using Mapster; using Microsoft.Extensions.DependencyInjection; @@ -87,6 +88,18 @@ namespace DS.WMS.Core.Fee.Method return new DataResult>(ResultCode.Success) { Data = data }; } + /// + /// 检查业务是否已费用锁定 + /// + /// 业务ID + /// + bool IsFeeLocked(long bid) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var entity = tenantDb.Queryable().Where(x => x.Id == bid).Select(x => new { x.IsFeeLocking }).First(); + return entity == null ? false : entity.IsFeeLocking.GetValueOrDefault(); + } + /// /// 提交 /// @@ -96,6 +109,10 @@ namespace DS.WMS.Core.Fee.Method public DataResult InsertOrUpdate(long bid, IEnumerable items) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + + if (IsFeeLocked(bid)) + return DataResult.Failed("当前业务已费用锁定,禁止修改", MultiLanguageConst.Operation_Failed); + try { tenantDb.Ado.BeginTran(); @@ -264,6 +281,10 @@ namespace DS.WMS.Core.Fee.Method { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var bid = tenantDb.Queryable().Where(x => ids.Contains(x.Id)).Select(x => x.BusinessId).First(); + if (IsFeeLocked(bid)) + return DataResult.Failed("当前业务已费用锁定,禁止修改", MultiLanguageConst.Operation_Failed); + if (tenantDb.Queryable().Any(x => ids.Contains(x.Id) && (x.FeeStatus != FeeStatus.Entering || x.FeeStatus != FeeStatus.AuditPassed))) return DataResult.Failed("只能删除状态为‘录入’或‘审核通过’的费用", MultiLanguageConst.FeeRecordDelete); @@ -285,11 +306,15 @@ namespace DS.WMS.Core.Fee.Method Id = x.Id, FeeName = x.FeeName, FeeStatus = x.FeeStatus, - FlowId = x.FlowId + FlowId = x.FlowId, + BusinessId = x.BusinessId }).ToList(); if (fees.IsNullOrEmpty()) return DataResult.Failed($"未能获取费用信息,提交失败", MultiLanguageConst.Operation_Failed); + if (IsFeeLocked(fees[0].BusinessId)) + return DataResult.Failed("当前业务已费用锁定,禁止修改", MultiLanguageConst.Operation_Failed); + if (fees.Any(x => x.FlowId.HasValue)) return DataResult.Failed($"当前费用包含正在审批中的费用,无法提交", MultiLanguageConst.Operation_Failed); @@ -506,7 +531,7 @@ namespace DS.WMS.Core.Fee.Method /// /// 审批类型 /// - public FlowTemplateTenant FindTemplate(string auditType) + FlowTemplateTenant FindTemplate(string auditType) { return db.Queryable().Where(x => x.Status == StatusEnum.Enable && diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs index 54320f0e..2336db2d 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs @@ -16,7 +16,6 @@ namespace DS.WMS.FeeApi.Controllers /// public class FeeRecordController : ApiController { - readonly IFeeRecordService _feeService; readonly IClientFlowInstanceService _flowService; 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 14290822..34b01b3e 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt @@ -404,3 +404,24 @@ 2024-05-24 15:37:13.5670 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-05-24 15:37:13.5670 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-05-24 15:37:13.5670 Info Configuration initialized. +2024-05-24 17:08:50.3229 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-05-24 17:08:50.3535 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-05-24 17:08:50.3535 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-05-24 17:08:50.3749 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-05-24 17:08:50.3841 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-05-24 17:08:50.3841 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-05-24 17:08:50.3977 Info Configuration initialized. +2024-05-24 17:48:39.5150 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-05-24 17:48:39.5301 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-05-24 17:48:39.5301 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-05-24 17:48:39.5470 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-05-24 17:48:39.5531 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-05-24 17:48:39.5531 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-05-24 17:48:39.5531 Info Configuration initialized. +2024-05-24 17:54:30.1932 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-05-24 17:54:30.1932 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-05-24 17:54:30.2068 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-05-24 17:54:30.2068 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-05-24 17:54:30.2256 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-05-24 17:54:30.2256 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-05-24 17:54:30.2256 Info Configuration initialized.