Uat_Study
he 2022-08-29 16:19:36 +08:00
parent 361b98c7e0
commit 53db0fefa6
1 changed files with 5 additions and 2 deletions

View File

@ -1511,9 +1511,12 @@ namespace IRaCIS.Application.Services
foreach (var item in questions)
{
var answer = inDto.AnswerList.Where(x => x.TableQuestionId == item.Id).Select(x => x.Answer).FirstOrDefault();
if ((await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.TableQuestionId == item.Id && x.Answer == answer).CountAsync()) < item.MaxRowCount.Value - 1)
var rowCount = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.TableQuestionId == item.Id && x.Answer == answer).CountAsync();
if (rowCount > item.MaxRowCount.Value - 1)
{
throw new BusinessValidationFailedException($"问题{item.QuestionName}最大相同问题数为{item.MaxRowCount.Value},当前已超过!");
throw new BusinessValidationFailedException($"问题{item.QuestionName}最大相同问题数为{item.MaxRowCount.Value},当前已存在{rowCount}条");
}
}