diff --git a/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/SENewUsers.cs b/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/SENewUsers.cs index af8abeb..4363e82 100644 --- a/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/SENewUsers.cs +++ b/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/SENewUsers.cs @@ -31,9 +31,11 @@ namespace APT.SC.WebApi.Controllers.Api.SE public class SENewUsersController : AuthorizeApiController { IFMNotificationTaskService NotificationTaskService { get; set; } - public SENewUsersController(IFMNotificationTaskService notificationTaskService) + IFMUserService UserService { get; set; } + public SENewUsersController(IFMNotificationTaskService notificationTaskService, IFMUserService userService) { NotificationTaskService = notificationTaskService; + UserService = userService; } /// /// 更新 @@ -81,8 +83,9 @@ namespace APT.SC.WebApi.Controllers.Api.SE foreach (var item in Nav_NewUserDetail) { index++; - if (!item.NEXT_DEPARTMENT_ID.HasValue) + if (!item.NEXT_DEPARTMENT_ID.HasValue || entity.TRAIN_STATUS == SEThreeLevelSafeTrainType.班组级) { + // 下个部门没填 就是最后一级了 或者 班组级培训 if (string.IsNullOrEmpty(item.CODE)) { throw new Exception("请填写行:" + index + "的工号!"); @@ -726,7 +729,20 @@ namespace APT.SC.WebApi.Controllers.Api.SE } else if (eduCard.TRAIN_STATUS == SEThreeLevelSafeTrainType.部门级) { + //找班组级培训 的 + + //找对应班组 sendUser = GetEntity(t => t.DEPARTMENT_ID == currDetailT.NEXT_DEPARTMENT_ID && t.Nav_ApproveRole.NAME == "班组负责人" && t.IS_DELETED == false && t.ENABLE_STATUS == 0); + if (sendUser == null) + { + //班组级培训 可能也是部门或者车间 + sendUser = GetEntity(t => t.DEPARTMENT_ID == currDetailT.NEXT_DEPARTMENT_ID && t.Nav_ApproveRole.NAME.Contains("安全员") && t.IS_DELETED == false && t.ENABLE_STATUS == 0); + } + if (sendUser == null) + { + //找不到人 找安环人 省得单据没了 + sendUser = UserService.GetSafeApproveUser(eduCard.ORG_ID.Value); + } if (sendUser != null) { currSattus = SEThreeLevelSafeTrainType.班组级; @@ -765,7 +781,7 @@ namespace APT.SC.WebApi.Controllers.Api.SE #region NEXT_DEPARTMENT_ID - if (user.USER_DEPARTMENT_ID.HasValue) + if (user.USER_DEPARTMENT_ID.HasValue && currSattus != SEThreeLevelSafeTrainType.班组级) { //userDetail.NEXT_DEPARTMENT_ID= modelDep = listDeps.FirstOrDefault(e => e.ID == user.USER_DEPARTMENT_ID.Value);