培训通知 判断培训开始时间 如果已开始 提示后直接关闭待办 如果是请假 处理签到待办 并处理人员状态为请假
This commit is contained in:
parent
fa4ec8750f
commit
826d34a31f
@ -359,22 +359,43 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
{
|
||||
return SafeExecute(() =>
|
||||
{
|
||||
var orgId = APT.Infrastructure.Api.AppContext.CurrentSession.OrgId;
|
||||
//var orgId = APT.Infrastructure.Api.AppContext.CurrentSession.OrgId;
|
||||
T_FM_NOTIFICATION_TASK finishTask = null;
|
||||
T_FM_NOTIFICATION_TASK finishTaskSign = null;
|
||||
T_SE_TRAIN_NOTIFY model = null;
|
||||
var allUsers = GetEntities<T_SE_TRAIN_NOTIFY_PERSONS>(t => t.NOTIFY_ID == entity.NOTIFY_ID, new BaseFilter(orgId));
|
||||
T_SE_TRAIN_RECORD_USER modelRU = null;
|
||||
var allUsers = GetEntities<T_SE_TRAIN_NOTIFY_PERSONS>(t => t.NOTIFY_ID == entity.NOTIFY_ID, null, "Nav_Notify");
|
||||
if (allUsers == null || allUsers.Count() < 1)
|
||||
{
|
||||
throw new Exception("获取培训通知信息失败,请刷新页面后重试!");
|
||||
}
|
||||
model = allUsers.First(e => true).Nav_Notify;
|
||||
if (model.TRAIN_START_TIME.HasValue && model.TRAIN_START_TIME.Value < DateTime.Now)
|
||||
{
|
||||
if (entity.TaskID != Guid.Empty)
|
||||
{
|
||||
finishTask = NotificationTaskService.GetTaskFinishModel(entity.TaskID);
|
||||
UnifiedCommit(() =>
|
||||
{
|
||||
if (finishTask != null)
|
||||
UpdateEntityNoCommit(finishTask);
|
||||
});
|
||||
}
|
||||
throw new Exception("操作失败,该培训已开始!");
|
||||
}
|
||||
var updateUsers = allUsers.Where(t => t.USER_ID == entity.USER_ID);
|
||||
foreach (var updateUser in updateUsers)
|
||||
{
|
||||
updateUser.IS_LEAVE = entity.IS_LEAVE;
|
||||
updateUser.LEAVE_REASON = entity.LEAVE_REASON;
|
||||
updateUser.MODIFY_TIME = DateTime.Now;
|
||||
updateUser.Nav_Notify = null;
|
||||
}
|
||||
finishTask = NotificationTaskService.GetTaskFinishModel(entity.TaskID);
|
||||
var todoCount = allUsers.Count(t => t.IS_LEAVE == SETrainYesNoEnum.未签到);
|
||||
if (todoCount == 0)
|
||||
{
|
||||
model = GetEntity<T_SE_TRAIN_NOTIFY>(entity.NOTIFY_ID);
|
||||
//model = GetEntity<T_SE_TRAIN_NOTIFY>(entity.NOTIFY_ID);
|
||||
if (model.CREATE_NOTIFY_RECORD && model.STATUS != SETrainNotifyStatus.归档)
|
||||
{
|
||||
model.STATUS = SETrainNotifyStatus.签到完成;
|
||||
@ -386,6 +407,29 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
model.MODIFY_TIME = DateTime.Now;
|
||||
}
|
||||
|
||||
if (entity.IS_LEAVE == SETrainYesNoEnum.请假 && model.ISSENDSIGN)
|
||||
{
|
||||
//查看是否有培训签到单子 如果有 处理掉
|
||||
var recordModel = GetEntity<T_SE_TRAIN_RECORD>(e => e.NOTIFY_ID == entity.NOTIFY_ID);
|
||||
if (recordModel != null && !recordModel.ISSTOPSIGN)
|
||||
{
|
||||
//已发送签到 但是未 停止签到
|
||||
finishTaskSign = GetEntity<T_FM_NOTIFICATION_TASK>(e => e.SOURCE_DATA_ID.HasValue && e.SOURCE_DATA_ID.Value == recordModel.ID && e.NOTICE_STATUS == 0 && e.USER_ID == entity.USER_ID && e.SOURCE_FORMCODE == "SE017_SHOWPRINT");
|
||||
if (finishTaskSign != null)
|
||||
{
|
||||
finishTaskSign.NOTICE_STATUS = 4;
|
||||
finishTaskSign.MODIFY_TIME = DateTime.Now;
|
||||
|
||||
modelRU = GetEntity<T_SE_TRAIN_RECORD_USER>(e => e.USER_ID == entity.USER_ID && e.RECORD_ID == recordModel.ID);
|
||||
if (modelRU != null)
|
||||
{
|
||||
modelRU.STATUS = SETrainRecordUserStatusEnum.请假;
|
||||
modelRU.MODIFY_TIME = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UnifiedCommit(() =>
|
||||
{
|
||||
if (updateUsers != null)
|
||||
@ -394,6 +438,10 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
UpdateEntityNoCommit(model, "STATUS", "MODIFY_TIME");
|
||||
if (finishTask != null)
|
||||
UpdateEntityNoCommit(finishTask);
|
||||
if (finishTaskSign != null)
|
||||
UpdateEntityNoCommit(finishTaskSign);
|
||||
if (modelRU != null)
|
||||
UpdateEntityNoCommit(modelRU);
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user