diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index e22899d6a..d6db539f5 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -763,6 +763,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, .WhereIf(inQuery.BeginSignTime != null, t => t.SignTime > inQuery.BeginSignTime) .WhereIf(inQuery.EndSignTime != null, t => t.SignTime < inQuery.EndSignTime) .WhereIf(inQuery.RandomOrder != null, t => t.RandomOrder == inQuery.RandomOrder) + .WhereIf(inQuery.IsRandomOrderList == true, t => t.ReadingTaskState==ReadingTaskState.WaitReading && t.TaskAllocationState==TaskAllocationState.Allocated) .ProjectTo(_mapper.ConfigurationProvider); var defalutSortArray = new string[] { nameof(ReadingTaskView.IsUrgent) + " desc", nameof(ReadingTaskView.SubjectCode), nameof(ReadingTaskView.VisitTaskNum) }; @@ -2977,7 +2978,7 @@ public class VisitTaskService(IRepository _visitTaskRepository, var order = 11 + 5 * (randomIndex - 1); - await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.Id == id, t => new VisitTask() { RandomOrder = randomIndex }); + await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.Id == id, t => new VisitTask() { RandomOrder = order }); availableNumbers.RemoveAt(randomIndex); }