fix 优化排班
This commit is contained in:
@@ -42,6 +42,10 @@ public class WorkGridScheduleService : IWorkGridScheduleService
|
|||||||
var workGrid = await _dbContext.Queryable<WorkGridEntity>().SingleAsync(x => x.Code == request.WorkGridCode);
|
var workGrid = await _dbContext.Queryable<WorkGridEntity>().SingleAsync(x => x.Code == request.WorkGridCode);
|
||||||
workGrid.ThrowIfNull("工作网格不存在");
|
workGrid.ThrowIfNull("工作网格不存在");
|
||||||
|
|
||||||
|
var timeSetting = await _dbContext.Queryable<WorkGridTimePeriodEntity>().Where(x => x.Type == request.PeriodType).Select(x => new { x.Start, x.Before }).SingleAsync();
|
||||||
|
var currentLimit = request.Date.ToDateTime(timeSetting.Start.Add(-TimeSpan.FromSeconds(timeSetting.Before)));
|
||||||
|
(DateTime.Now >= currentLimit).ThrowIfTrue("当前时间不可修改排班信息");
|
||||||
|
|
||||||
var workGridUserCodes = await _dbContext.Queryable<WorkGridUserEntity>()
|
var workGridUserCodes = await _dbContext.Queryable<WorkGridUserEntity>()
|
||||||
.Where(x => x.WorkGridCode == workGrid.Code && request.UserCodes.Contains(x.UserCode))
|
.Where(x => x.WorkGridCode == workGrid.Code && request.UserCodes.Contains(x.UserCode))
|
||||||
.Select(x => x.UserCode)
|
.Select(x => x.UserCode)
|
||||||
|
|||||||
@@ -229,6 +229,12 @@ public class DeviceUploadLogService : IDeviceUploadLogService
|
|||||||
Content = $"{workGridInfo.WorkGrid.WorkGridName}的网格长,你好,检测到你网格中 {currentGainfo.Name}({currentGainfo.Code})今日未排班,但是有考勤记录,请前往系统处理!",
|
Content = $"{workGridInfo.WorkGrid.WorkGridName}的网格长,你好,检测到你网格中 {currentGainfo.Name}({currentGainfo.Code})今日未排班,但是有考勤记录,请前往系统处理!",
|
||||||
WorkCodes = new List<string> { workGridInfo.WorkGrid.LeaderUserCode }
|
WorkCodes = new List<string> { workGridInfo.WorkGrid.LeaderUserCode }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await _dingTalkApi.SendWorkMessageAsync(new JinkoSendWorkMessageRequest
|
||||||
|
{
|
||||||
|
Content = $"{currentGainfo.Name}({currentGainfo.Code},检测到你在{workGridInfo.WorkGrid.WorkGridName}网格中,当日未排班,考勤记录不生效,请立即联系网格长",
|
||||||
|
WorkCodes = new List<string> { currentGainfo.Code }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user