diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index e5a5a55e6..7dc5b7a22 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -1045,20 +1045,20 @@ namespace IRaCIS.Core.Application.Service.Allocation - // 有序 - if (trialConfig.IsReadingTaskViewInOrder) - { - // 当前访视之前 已有任务申请 - if (await _visitTaskRepository.AnyAsync(t => t.TrialId == task.TrialId && t.SubjectId == task.SubjectId && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Visit - && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.VisitTaskNum <= task.VisitTaskNum && t.Id != task.Id && t.ReReadingApplyState == ReReadingApplyState.HaveApplyed)) - { - return ResponseOutput.NotOk("当前为有序阅片,之前有访视,或其他IR的本次访视已申请重阅,还未处理,不允许申请"); - } - } - else - { + //// 有序 + //if (trialConfig.IsReadingTaskViewInOrder) + //{ + // // 当前访视之前 已有任务申请 + // if (await _visitTaskRepository.AnyAsync(t => t.TrialId == task.TrialId && t.SubjectId == task.SubjectId && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Visit + // && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.VisitTaskNum <= task.VisitTaskNum && t.Id != task.Id && t.ReReadingApplyState == ReReadingApplyState.HaveApplyed)) + // { + // return ResponseOutput.NotOk("当前为有序阅片,之前有访视,或其他IR的本次访视已申请重阅,还未处理,不允许申请"); + // } + //} + //else + //{ - } + //} } if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer) { @@ -1161,9 +1161,18 @@ namespace IRaCIS.Core.Application.Service.Allocation //origenalTask.ReReadingApplyState = agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? ReReadingApplyState.Agree : ReReadingApplyState.Reject; //origenalTask.TaskState = agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? TaskState.HaveReturned : origenalTask.TaskState; + + var origenalTask = (await _visitTaskRepository.Where(t => item.OriginalReReadingTaskId == t.Id).FirstOrDefaultAsync()).IfNullThrowException(); + // 当前访视之前 已有任务申请 + if (trialConfig.IsReadingTaskViewInOrder && await _visitTaskReReadingRepository.AnyAsync(t => t.OriginalReReadingTask.SubjectId == origenalTask.SubjectId && t.OriginalReReadingTask.TaskState == TaskState.Effect && t.OriginalReReadingTask.ReadingCategory == ReadingCategory.Visit + && t.OriginalReReadingTask.ReadingTaskState == ReadingTaskState.HaveSigned && t.OriginalReReadingTask.VisitTaskNum > origenalTask.VisitTaskNum && t.RequestReReadingResultEnum == RequestReReadingResult.Default)) + { + return ResponseOutput.NotOk("当前为有序阅片,当前访视之后,也申请了重阅 必须从后向前处理"); + } + Expression> filterExpression = t => t.TrialId == trialId && t.SubjectId == origenalTask.SubjectId && t.TaskState == TaskState.Effect; //是否是一致性分析任务