diff --git a/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridScheduleService.cs b/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridScheduleService.cs index fb44e1ab..c34ea385 100644 --- a/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridScheduleService.cs +++ b/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridScheduleService.cs @@ -58,6 +58,9 @@ public class WorkGridScheduleService : IWorkGridScheduleService exists.ThrowIfTrue("当天已经存在排班人员"); + var maximumConsecutiveDtos = await MaximumConsecutiveUserCodesAsync(request.UserCodes, 10, request.Date); + maximumConsecutiveDtos.ThrowIfExists(maximumConsecutiveDtos.Select(x => $"{x.UserCode}已经连续排班10天({x.Start}-{x.End}),不可继续排班").Join("\r\n")); + var toInserts = request.UserCodes.Select(x => new WorkGridScheduleEntity { WorkGridCode = request.WorkGridCode, @@ -67,10 +70,6 @@ public class WorkGridScheduleService : IWorkGridScheduleService }).ToList(); await _dbContext.InsertAsync(toInserts); - - var maximumConsecutiveDtos = await MaximumConsecutiveUserCodesAsync(request.UserCodes, 11, request.Date); - maximumConsecutiveDtos.ThrowIfExists(maximumConsecutiveDtos.Select(x => $"{x.UserCode}已经连续排班10天({x.Start}-{x.End}),不可继续排班").Join("\r\n")); - await _operateLog.LogAsync(OperateLogType.WorkGrid, $"新增网格({workGrid.Name}){request.Date.ToString("yyyy-M-d")}的{request.PeriodType.GetDescription()}人员:{request.UserCodes.Join(",")}"); }