From bd8123af59aceb00d699967e06ad0bdf0ec1c884 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 18 Aug 2023 08:56:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B0=83=E7=A0=94=E8=A1=A8?= =?UTF-8?q?=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SiteSurvey/TrialSiteEquipmentSurveyService.cs | 15 +++++++-------- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 2 +- .../SiteSurvey/TrialSiteUserSurveyService.cs | 10 ++++++---- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs index 5a1de2dff..16486d477 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs @@ -17,10 +17,12 @@ namespace IRaCIS.Core.Application.Contracts public class TrialSiteEquipmentSurveyService : BaseService, ITrialSiteEquipmentSurveyService { private readonly IRepository _trialSiteEquipmentSurveyRepository; + private readonly IRepository _trialSiteSurveyRepository; - public TrialSiteEquipmentSurveyService(IRepository trialSiteEquipmentSurveyRepository) + public TrialSiteEquipmentSurveyService(IRepository trialSiteEquipmentSurveyRepository, IRepository trialSiteSurveyRepository) { _trialSiteEquipmentSurveyRepository = trialSiteEquipmentSurveyRepository; + _trialSiteSurveyRepository = trialSiteSurveyRepository; } @@ -38,17 +40,14 @@ namespace IRaCIS.Core.Application.Contracts [HttpPost("{trialId:guid}")] public async Task AddOrUpdateTrialSiteEquipmentSurvey(TrialSiteEquipmentSurveyAddOrEdit addOrEditTrialSiteEquipmentSurvey) { - - if (addOrEditTrialSiteEquipmentSurvey.Id != null) + + if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteEquipmentSurvey.TrialSiteSurveyId && (t.IsDeleted == true ||t.State==TrialSiteSurveyEnum.PMCreatedAndLock), true)) { - if (await _trialSiteEquipmentSurveyRepository.Where(t => t.Id == addOrEditTrialSiteEquipmentSurvey.Id).AnyAsync(t => t.TrialSiteSurvey.State==TrialSiteSurveyEnum.PMCreatedAndLock)) - { - //---已锁定,不允许操作 - return ResponseOutput.NotOk(_localizer["TrialSiteEquipment_Locked"]); - } + return ResponseOutput.NotOk("当前调研表已废除,或者调研表状态已锁定,不允许操作"); } + var entity = await _trialSiteEquipmentSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteEquipmentSurvey, true); return ResponseOutput.Ok(entity.Id.ToString()); diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index a42337612..6c6df23da 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -703,7 +703,7 @@ namespace IRaCIS.Core.Application.Contracts if (trialSiteSurvey.IsDeleted == true || trialSiteSurvey.State==TrialSiteSurveyEnum.PMCreatedAndLock) { - throw new BusinessValidationFailedException("当前调研表已废除,或者调研表状态已锁定,不允许提交"); + throw new BusinessValidationFailedException("当前调研表已废除,或者调研表状态已锁定,不允许操作"); } var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == trialId && t.TrialSiteSurvey.SiteId == trialSiteSurvey.SiteId && t.TrialSiteSurvey.IsDeleted == false).Select(t => diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index 131ba5efa..a518b0ff5 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -43,12 +43,14 @@ namespace IRaCIS.Core.Application.Contracts public async Task AddOrUpdateTrialSiteUserSurvey(TrialSiteUserSurveyAddOrEdit addOrEditTrialSiteUserSurvey) { - if (await _trialSiteUserSurveyRepository.Where(t => t.Id == addOrEditTrialSiteUserSurvey.Id).AnyAsync(t => t.TrialSiteSurvey.State == TrialSiteSurveyEnum.PMCreatedAndLock)) + + + if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId && (t.IsDeleted == true || t.State == TrialSiteSurveyEnum.PMCreatedAndLock), true)) { - //---已锁定,不允许操作 - return ResponseOutput.NotOk(_localizer["TrialSiteUser_Locked"]); + //当前调研表已废除,或者调研表状态已锁定,不允许操作 + return ResponseOutput.NotOk("当前调研表已废除,或者调研表状态已锁定,不允许操作"); } - + if (addOrEditTrialSiteUserSurvey.IsGenerateAccount ) {