From b71732c623aa3ab03b0470294a6306b8e4118b54 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 26 Jul 2022 16:16:50 +0800 Subject: [PATCH] x --- .../Allocation/TaskAllocationRuleService.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs index 320e051b..ba9812dc 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs @@ -56,18 +56,25 @@ namespace IRaCIS.Core.Application.Service public async Task AddOrUpdateTaskAllocationRule(TaskAllocationRuleAddOrEdit addOrEditTaskAllocationRule) { - var verifyExp1 = new EntityVerifyExp() - { - VerifyExp = t => t.DoctorUserId == addOrEditTaskAllocationRule.DoctorUserId && t.TrialId == addOrEditTaskAllocationRule.TrialId, - VerifyMsg = "已有该医生配置,不允许继续增加" - }; + //冗余 存 var enrollId = _repository.Where(t => t.TrialId == addOrEditTaskAllocationRule.TrialId && t.DoctorUserId == addOrEditTaskAllocationRule.DoctorUserId).Select(t => t.Id).FirstOrDefault(); + if (enrollId == Guid.Empty) + { + return ResponseOutput.NotOk("错误,未在入组表中找到该医生得账号Id"); + } + addOrEditTaskAllocationRule.EnrollId = enrollId; + var verifyExp1 = new EntityVerifyExp() + { + VerifyExp = t => t.DoctorUserId == addOrEditTaskAllocationRule.DoctorUserId && t.TrialId == addOrEditTaskAllocationRule.TrialId, + VerifyMsg = "已有该医生配置,不允许继续增加" + }; + var entity = await _taskAllocationRuleRepository.InsertOrUpdateAsync(addOrEditTaskAllocationRule, true, verifyExp1); return ResponseOutput.Ok(entity.Id.ToString());