From ab6ec064fa961413dffdbd98475f1ee0e8de3bb2 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 10 Mar 2025 17:40:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=8D=E5=A4=8D=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Document/TrialFinalRecordService.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/TrialFinalRecordService.cs b/IRaCIS.Core.Application/Service/Document/TrialFinalRecordService.cs index d73089bc5..0bca53c1c 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialFinalRecordService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialFinalRecordService.cs @@ -11,6 +11,7 @@ using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Infrastructure.Extention; using System.Threading.Tasks; using IRaCIS.Core.Infra.EFCore; +using IRaCIS.Core.Infrastructure; namespace IRaCIS.Core.Application.Service; /// @@ -58,17 +59,12 @@ public class TrialFinalRecordService(IRepository _trialFinalRe if (inDto.SignFileRecord != null) inDto.SignFileRecord.TrialFileTypeId = inDto.TrialFileTypeId; if (inDto.HistoryFileRecord != null) inDto.HistoryFileRecord.TrialFileTypeId = inDto.TrialFileTypeId; - - - var verifyExp = new EntityVerifyExp() + if (await _trialFinalRecordRepository.AnyAsync(x => x.Id != inDto.Id && x.TrialFileTypeId == inDto.TrialFileTypeId && x.Name == inDto.Name && x.Version == inDto.Version)) { - VerifyExp = u => u.Name == inDto.Name, + throw new BusinessValidationFailedException(_localizer["TrialFinalRecord_NameRepeat"]); + } - // "当前类型启用的文件类型名称重复" - VerifyMsg = _localizer["TrialFileType_NameRepeat"], - - }; if (inDto.Id != null) { var trialFinalRecord = await _trialFinalRecordRepository.Where(x => x.Id == inDto.Id.Value).FirstNotNullAsync();