From 3fc746f65e2558d9998288c5b1b757d3f388984f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=BE=8E=E8=8D=A3?= <991152047@qq.com> Date: Sun, 18 Feb 2024 11:45:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E6=B5=8B=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/FM/FMFlowPermitService.cs | 164 +++++---------- .../CrucialLicenseJobController.cs | 187 ++++++++---------- .../CrucialLicenseJobOutsourceController.cs | 85 +++++++- .../Api/OperationLinkController.cs | 2 +- 4 files changed, 215 insertions(+), 223 deletions(-) diff --git a/APT.BaseData.Services/Services/FM/FMFlowPermitService.cs b/APT.BaseData.Services/Services/FM/FMFlowPermitService.cs index 02c2a2f..0638f8a 100644 --- a/APT.BaseData.Services/Services/FM/FMFlowPermitService.cs +++ b/APT.BaseData.Services/Services/FM/FMFlowPermitService.cs @@ -445,15 +445,17 @@ namespace APT.BaseData.Services.Services.FM }); var loginUser = users.FirstOrDefault(t => t.ID == loginUserId); var departUser = this.GetEntity(t => (t.USER_ID == loginUserId || t.CHARGEUSER_ID == loginUserId) && (t.NAME.Contains("安全环保") || t.NAME.Contains("安环部"))); - if (departUser != null || (loginUser.Nav_ApproveRole!=null &&loginUser.Nav_ApproveRole.NAME.Contains("安环部负责人"))) + if (departUser != null || (loginUser.Nav_ApproveRole != null && loginUser.Nav_ApproveRole.NAME.Contains("安环部负责人")) || (loginUser.Nav_ApproveRole != null && loginUser.Nav_ApproveRole.NAME.Contains("安环部安全员"))) { - var tempSafe = appdetails.FirstOrDefault(m => m.Nav_ApproveRole!=null && m.Nav_ApproveRole.NAME.Contains("安环部安全员")); - if (tempSafe != null) + var tempSafeD = appdetails.FirstOrDefault(m => m.Nav_ApproveRole != null && m.Nav_ApproveRole.NAME.Contains("部门安全员")); + var tempSafe = appdetails.FirstOrDefault(m => m.Nav_ApproveRole != null && m.Nav_ApproveRole.NAME.Contains("安环部安全员")); + if (tempSafe != null && tempSafeD != null && appdetails.Count() > 1 && tempSafeD.APPROVE_USER_ID == tempSafe.APPROVE_USER_ID) { appdetails.Remove(tempSafe); } + var tempChargeD = appdetails.FirstOrDefault(m => m.Nav_ApproveRole != null && m.Nav_ApproveRole.NAME.Contains("部门负责人")); var tempCharge = appdetails.FirstOrDefault(m => m.Nav_ApproveRole != null && m.Nav_ApproveRole.NAME.Contains("安环部负责人")); - if (tempCharge != null) + if (tempCharge != null && tempChargeD != null && appdetails.Count() > 1 && tempChargeD.APPROVE_USER_ID == tempCharge.APPROVE_USER_ID) { appdetails.Remove(tempCharge); } @@ -1437,12 +1439,12 @@ namespace APT.BaseData.Services.Services.FM Guid? approveId = null; if (approveTempDetail.DEPARTMENT_TYPE == (int)FMDepartmentType.公司) { - var approveIds= users.Where(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID).Select(t=>t.ID).ToList(); + var approveIds = users.Where(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID).Select(t => t.ID).ToList(); if (approveIds.Count() == 0) { if (approveTempDetail.Nav_ApproveRole.NAME == "安环部负责人") { - var dep = GetEntity(t=>(t.NAME.Contains("安全环保")|| t.NAME.Contains("安环部")) && t.DEPARTMENT_TYPE == 0 && t.ENABLE_STATUS == 0); + var dep = GetEntity(t => (t.NAME.Contains("安全环保") || t.NAME.Contains("安环部")) && t.DEPARTMENT_TYPE == 0 && t.ENABLE_STATUS == 0); if (dep != null) { if (dep.USER_ID.HasValue) @@ -1465,8 +1467,8 @@ namespace APT.BaseData.Services.Services.FM GetDepartmentId((Guid)user.DEPARTMENT_ID, ref departmentIds); if (departmentIds.Any()) { - var dep = GetEntity(t=> departmentIds.Contains(t.ID) && t.DEPARTMENT_TYPE != 3 && approveIds.Contains((Guid)t.CHARGEUSER_ID)); - if(dep !=null) + var dep = GetEntity(t => departmentIds.Contains(t.ID) && t.DEPARTMENT_TYPE != 3 && approveIds.Contains((Guid)t.CHARGEUSER_ID)); + if (dep != null) approveId = dep.CHARGEUSER_ID; } } @@ -1481,6 +1483,8 @@ namespace APT.BaseData.Services.Services.FM GetDepartmentId((Guid)user.DEPARTMENT_ID, ref departmentIds); if (departmentIds.Any()) { + var charge = this.GetEntity(t => t.NAME == "安环部负责人"); + var chargeSafe = this.GetEntity(t => t.NAME == "安环部安全员"); foreach (var item in departmentIds) { var userTemp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID && x.DEPARTMENT_ID == item); @@ -1488,13 +1492,12 @@ namespace APT.BaseData.Services.Services.FM { if (approveTempDetail.DEPARTMENT_TYPE == (int)FMDepartmentType.部门 && approveTempDetail.Nav_ApproveRole != null && approveTempDetail.Nav_ApproveRole.NAME == "部门负责人") { - var charge = this.GetEntity(t => t.NAME == "安环部负责人"); if (charge != null) { - var temp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == charge.ID && departmentIds.Contains((Guid)x.DEPARTMENT_ID)); + var temp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == charge.ID && x.DEPARTMENT_ID == item); if (temp == null) { - var temp2 = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID && departmentIds.Contains((Guid)x.DEPARTMENT_ID)); + var temp2 = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID && x.DEPARTMENT_ID == item); if (temp2 != null) { approveId = temp2.ID; @@ -1502,20 +1505,15 @@ namespace APT.BaseData.Services.Services.FM } else { - if (user.DEPARTMENT_ID.HasValue) + var dep = GetEntity(user.DEPARTMENT_ID.Value); + if (dep != null) { - var dep = GetEntity(user.DEPARTMENT_ID.Value); - if (dep != null) - { - if (dep.USER_ID.HasValue) - { approveId = dep.USER_ID.Value; } - else if (dep.CHARGEUSER_ID.HasValue) - { approveId = dep.CHARGEUSER_ID.Value; } - break; - } + if (dep.USER_ID.HasValue) + { approveId = dep.USER_ID.Value; } + else if (dep.CHARGEUSER_ID.HasValue) + { approveId = dep.CHARGEUSER_ID.Value; } + break; } - else - continue; } } else @@ -1525,96 +1523,43 @@ namespace APT.BaseData.Services.Services.FM } } else - { - var departInfo=this.GetEntity(t => t.ID == user.DEPARTMENT_ID); - if (departInfo != null) - { - if (departInfo.USER_ID != null) - { approveId = departInfo.USER_ID; } - else if (departInfo.CHARGEUSER_ID != null) - { approveId = departInfo.CHARGEUSER_ID; } - else - { continue; } - } - else - { - continue; - } - } - } - else if (approveTempDetail.DEPARTMENT_TYPE == (int)FMDepartmentType.部门 && approveTempDetail.Nav_ApproveRole != null && approveTempDetail.Nav_ApproveRole.NAME == "部门安全员") - { - var charge = this.GetEntity(t => t.NAME == "安环部安全员"); - if (charge != null) - { - var temp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == charge.ID && departmentIds.Contains((Guid)x.DEPARTMENT_ID)); - if (temp == null) - { - var temp2 = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID && departmentIds.Contains((Guid)x.DEPARTMENT_ID)); - if (temp2 != null) - { - approveId = temp2.ID; - break; - } - else - { - if (user.DEPARTMENT_ID.HasValue) - { - var dep = GetEntity(user.DEPARTMENT_ID.Value); - if (dep != null) - { - if (dep.USER_ID.HasValue) - { approveId = dep.USER_ID.Value; } - else if (dep.CHARGEUSER_ID.HasValue) - { approveId = dep.CHARGEUSER_ID.Value; } - break; - } - } - else - continue; - } - } - else - { - approveId = temp?.ID; - break; - } - } - else - { - var departInfo = this.GetEntity(t => t.ID == user.DEPARTMENT_ID); - if (departInfo != null) - { - if (departInfo.USER_ID != null) - { approveId = departInfo.USER_ID; } - else if (departInfo.CHARGEUSER_ID != null) - { approveId = departInfo.CHARGEUSER_ID; } - else - { continue; } - } - else - { - continue; - } - } - } - else - { - var departInfo = this.GetEntity(t => t.ID == user.DEPARTMENT_ID); - if (departInfo != null) - { - if (departInfo.USER_ID != null) - { approveId = departInfo.USER_ID; } - else if (departInfo.CHARGEUSER_ID != null) - { approveId = departInfo.CHARGEUSER_ID; } - else - { continue; } - } - else { continue; } } + else if (approveTempDetail.DEPARTMENT_TYPE == (int)FMDepartmentType.部门 && approveTempDetail.Nav_ApproveRole != null && approveTempDetail.Nav_ApproveRole.NAME == "部门安全员") + { + if (chargeSafe != null) + { + var temp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == chargeSafe.ID && x.DEPARTMENT_ID == item); + if (temp == null) + { + var temp2 = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID && x.DEPARTMENT_ID == item); + if (temp2 != null) + { + approveId = temp2.ID; + break; + } + else + { + continue; + } + } + else + { + approveId = temp?.ID; + break; + } + } + else + { + continue; + } + } + else + { + continue; + } } else { @@ -1627,7 +1572,6 @@ namespace APT.BaseData.Services.Services.FM } return approveId; } - /// /// 根据部门树查找审核人 /// diff --git a/APT.MicroApi/APT.FO.WebApi/Controllers/CrucialLicenseJobController.cs b/APT.MicroApi/APT.FO.WebApi/Controllers/CrucialLicenseJobController.cs index 28741dd..4ee0199 100644 --- a/APT.MicroApi/APT.FO.WebApi/Controllers/CrucialLicenseJobController.cs +++ b/APT.MicroApi/APT.FO.WebApi/Controllers/CrucialLicenseJobController.cs @@ -591,7 +591,18 @@ namespace APT.FO.WebApi.Controllers var mineType = APT.Infrastructure.Api.AppContext.CurrentSession.MineType; var tempList = mineType.Split(",").ToList(); Expression> expressionStep = e => !e.IS_DELETED && e.STATUS == STATUSEnum.启用; - Expression> expressionLink = t => !t.IS_DELETED && t.STATUS == (int)STATUSEnum.启用 && tempList.Contains(t.MineType.ToString()); + Expression> expressionLink = t => !t.IS_DELETED && t.STATUS == (int)STATUSEnum.启用; + if (tempList != null && tempList.Any()) + { + bool isExsis = false; + foreach (var temp in tempList) + { + if (!string.IsNullOrEmpty(temp)) + isExsis = true; + } + if (isExsis) + expressionLink = expressionLink.And(t => tempList.Contains(t.MineType.ToString())); + } var operationLink = this.GetEntities(expressionLink, new BaseFilter(pageFilter.OrgId)).Select(t => t.OPERATION_STEP_ID).Distinct().ToList(); expressionStep = expressionStep.And(e => operationLink.Contains(e.ID)); var info = this.GetOrderEntities(expressionStep, pageFilter, null); @@ -613,7 +624,18 @@ namespace APT.FO.WebApi.Controllers var mineType = APT.Infrastructure.Api.AppContext.CurrentSession.MineType; var tempList = mineType.Split(",").ToList(); Expression> expressionStep = e => !e.IS_DELETED && e.STATUS == STATUSEnum.启用; - Expression> expressionLink = t => !t.IS_DELETED && t.STATUS == (int)STATUSEnum.启用 && tempList.Contains(t.MineType.ToString()); + Expression> expressionLink = t => !t.IS_DELETED && t.STATUS == (int)STATUSEnum.启用; + if (tempList != null && tempList.Any()) + { + bool isExsis = false; + foreach (var temp in tempList) + { + if (!string.IsNullOrEmpty(temp)) + isExsis = true; + } + if(isExsis) + expressionLink = expressionLink.And(t => tempList.Contains(t.MineType.ToString())); + } var operationLink = this.GetEntities(expressionLink, new BaseFilter(pageFilter.OrgId)).Select(t=>t.OPERATION_STEP_ID).Distinct().ToList(); expressionStep = expressionStep.And(e => operationLink.Contains(e.ID)); var info = this.GetOrderPageEntities(expressionStep, pageFilter, null); @@ -881,7 +903,21 @@ namespace APT.FO.WebApi.Controllers if (approveTempDetail.DEPARTMENT_TYPE == (int)FMDepartmentType.公司) { var approveIds = users.Where(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID).Select(t => t.ID).ToList(); - if (approveIds.Count() == 1) + if (approveIds.Count() == 0) + { + if (approveTempDetail.Nav_ApproveRole.NAME == "安环部负责人") + { + var dep = GetEntity(t => (t.NAME.Contains("安全环保") || t.NAME.Contains("安环部")) && t.DEPARTMENT_TYPE == 0 && t.ENABLE_STATUS == 0); + if (dep != null) + { + if (dep.USER_ID.HasValue) + { approveId = dep.USER_ID.Value; } + else if (dep.CHARGEUSER_ID.HasValue) + { approveId = dep.CHARGEUSER_ID.Value; } + } + } + } + else if (approveIds.Count() == 1) { approveId = approveIds.FirstOrDefault(); } @@ -910,6 +946,8 @@ namespace APT.FO.WebApi.Controllers GetDepartmentId((Guid)user.DEPARTMENT_ID, ref departmentIds); if (departmentIds.Any()) { + var charge = this.GetEntity(t => t.NAME == "安环部负责人"); + var chargeSafe = this.GetEntity(t => t.NAME == "安环部安全员"); foreach (var item in departmentIds) { var userTemp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID && x.DEPARTMENT_ID == item); @@ -917,13 +955,12 @@ namespace APT.FO.WebApi.Controllers { if (approveTempDetail.DEPARTMENT_TYPE == (int)FMDepartmentType.部门 && approveTempDetail.Nav_ApproveRole != null && approveTempDetail.Nav_ApproveRole.NAME == "部门负责人") { - var charge = this.GetEntity(t => t.NAME == "安环部负责人"); if (charge != null) { - var temp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == charge.ID && departmentIds.Contains((Guid)x.DEPARTMENT_ID)); + var temp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == charge.ID && x.DEPARTMENT_ID == item); if (temp == null) { - var temp2 = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID && departmentIds.Contains((Guid)x.DEPARTMENT_ID)); + var temp2 = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID && x.DEPARTMENT_ID == item); if (temp2 != null) { approveId = temp2.ID; @@ -931,20 +968,15 @@ namespace APT.FO.WebApi.Controllers } else { - if (user.DEPARTMENT_ID.HasValue) + var dep = GetEntity(user.DEPARTMENT_ID.Value); + if (dep != null) { - var dep = GetEntity(user.DEPARTMENT_ID.Value); - if (dep != null) - { - if (dep.USER_ID.HasValue) - { approveId = dep.USER_ID.Value; } - else if (dep.CHARGEUSER_ID.HasValue) - { approveId = dep.CHARGEUSER_ID.Value; } - break; - } + if (dep.USER_ID.HasValue) + { approveId = dep.USER_ID.Value; } + else if (dep.CHARGEUSER_ID.HasValue) + { approveId = dep.CHARGEUSER_ID.Value; } + break; } - else - continue; } } else @@ -954,96 +986,43 @@ namespace APT.FO.WebApi.Controllers } } else - { - var departInfo = this.GetEntity(t => t.ID == user.DEPARTMENT_ID); - if (departInfo != null) - { - if (departInfo.USER_ID != null) - { approveId = departInfo.USER_ID; } - else if (departInfo.CHARGEUSER_ID != null) - { approveId = departInfo.CHARGEUSER_ID; } - else - { continue; } - } - else - { - continue; - } - } - } - else if (approveTempDetail.DEPARTMENT_TYPE == (int)FMDepartmentType.部门 && approveTempDetail.Nav_ApproveRole != null && approveTempDetail.Nav_ApproveRole.NAME == "部门安全员") - { - var charge = this.GetEntity(t => t.NAME == "安环部安全员"); - if (charge != null) - { - var temp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == charge.ID && departmentIds.Contains((Guid)x.DEPARTMENT_ID)); - if (temp == null) - { - var temp2 = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID && departmentIds.Contains((Guid)x.DEPARTMENT_ID)); - if (temp2 != null) - { - approveId = temp2.ID; - break; - } - else - { - if (user.DEPARTMENT_ID.HasValue) - { - var dep = GetEntity(user.DEPARTMENT_ID.Value); - if (dep != null) - { - if (dep.USER_ID.HasValue) - { approveId = dep.USER_ID.Value; } - else if (dep.CHARGEUSER_ID.HasValue) - { approveId = dep.CHARGEUSER_ID.Value; } - break; - } - } - else - continue; - } - } - else - { - approveId = temp?.ID; - break; - } - } - else - { - var departInfo = this.GetEntity(t => t.ID == user.DEPARTMENT_ID); - if (departInfo != null) - { - if (departInfo.USER_ID != null) - { approveId = departInfo.USER_ID; } - else if (departInfo.CHARGEUSER_ID != null) - { approveId = departInfo.CHARGEUSER_ID; } - else - { continue; } - } - else - { - continue; - } - } - } - else - { - var departInfo = this.GetEntity(t => t.ID == user.DEPARTMENT_ID); - if (departInfo != null) - { - if (departInfo.USER_ID != null) - { approveId = departInfo.USER_ID; } - else if (departInfo.CHARGEUSER_ID != null) - { approveId = departInfo.CHARGEUSER_ID; } - else - { continue; } - } - else { continue; } } + else if (approveTempDetail.DEPARTMENT_TYPE == (int)FMDepartmentType.部门 && approveTempDetail.Nav_ApproveRole != null && approveTempDetail.Nav_ApproveRole.NAME == "部门安全员") + { + if (chargeSafe != null) + { + var temp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == chargeSafe.ID && x.DEPARTMENT_ID == item); + if (temp == null) + { + var temp2 = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID && x.DEPARTMENT_ID == item); + if (temp2 != null) + { + approveId = temp2.ID; + break; + } + else + { + continue; + } + } + else + { + approveId = temp?.ID; + break; + } + } + else + { + continue; + } + } + else + { + continue; + } } else { diff --git a/APT.MicroApi/APT.FO.WebApi/Controllers/CrucialLicenseJobOutsourceController.cs b/APT.MicroApi/APT.FO.WebApi/Controllers/CrucialLicenseJobOutsourceController.cs index 7cc4171..0626dc8 100644 --- a/APT.MicroApi/APT.FO.WebApi/Controllers/CrucialLicenseJobOutsourceController.cs +++ b/APT.MicroApi/APT.FO.WebApi/Controllers/CrucialLicenseJobOutsourceController.cs @@ -389,7 +389,42 @@ namespace APT.FO.WebApi.Controllers { Guid? approveId = null; if (approveTempDetail.DEPARTMENT_TYPE == (int)FMDepartmentType.公司) - approveId = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID)?.ID; + { + var approveIds = users.Where(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID).Select(t => t.ID).ToList(); + if (approveIds.Count() == 0) + { + if (approveTempDetail.Nav_ApproveRole.NAME == "安环部负责人") + { + var dep = GetEntity(t => (t.NAME.Contains("安全环保") || t.NAME.Contains("安环部")) && t.DEPARTMENT_TYPE == 0 && t.ENABLE_STATUS == 0); + if (dep != null) + { + if (dep.USER_ID.HasValue) + { approveId = dep.USER_ID.Value; } + else if (dep.CHARGEUSER_ID.HasValue) + { approveId = dep.CHARGEUSER_ID.Value; } + } + } + } + else if (approveIds.Count() == 1) + { + approveId = approveIds.FirstOrDefault(); + } + else + { + var user = users.FirstOrDefault(t => t.ID == loginUserId); + if (user.DEPARTMENT_ID != null) + { + List departmentIds = new List(); + GetDepartmentId((Guid)user.DEPARTMENT_ID, ref departmentIds); + if (departmentIds.Any()) + { + var dep = GetEntity(t => departmentIds.Contains(t.ID) && t.DEPARTMENT_TYPE != 3 && approveIds.Contains((Guid)t.CHARGEUSER_ID)); + if (dep != null) + approveId = dep.CHARGEUSER_ID; + } + } + } + } else { var user = users.FirstOrDefault(t => t.ID == loginUserId); @@ -399,6 +434,8 @@ namespace APT.FO.WebApi.Controllers GetDepartmentId((Guid)user.DEPARTMENT_ID, ref departmentIds); if (departmentIds.Any()) { + var charge = this.GetEntity(t => t.NAME == "安环部负责人"); + var chargeSafe = this.GetEntity(t => t.NAME == "安环部安全员"); foreach (var item in departmentIds) { var userTemp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID && x.DEPARTMENT_ID == item); @@ -406,12 +443,30 @@ namespace APT.FO.WebApi.Controllers { if (approveTempDetail.DEPARTMENT_TYPE == (int)FMDepartmentType.部门 && approveTempDetail.Nav_ApproveRole != null && approveTempDetail.Nav_ApproveRole.NAME == "部门负责人") { - var charge = this.GetEntity(t => t.NAME == "安环部负责人"); if (charge != null) { - var temp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == charge.ID && departmentIds.Contains((Guid)x.DEPARTMENT_ID)); + var temp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == charge.ID && x.DEPARTMENT_ID == item); if (temp == null) - continue; + { + var temp2 = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID && x.DEPARTMENT_ID == item); + if (temp2 != null) + { + approveId = temp2.ID; + break; + } + else + { + var dep = GetEntity(user.DEPARTMENT_ID.Value); + if (dep != null) + { + if (dep.USER_ID.HasValue) + { approveId = dep.USER_ID.Value; } + else if (dep.CHARGEUSER_ID.HasValue) + { approveId = dep.CHARGEUSER_ID.Value; } + break; + } + } + } else { approveId = temp?.ID; @@ -419,16 +474,28 @@ namespace APT.FO.WebApi.Controllers } } else + { continue; + } } else if (approveTempDetail.DEPARTMENT_TYPE == (int)FMDepartmentType.部门 && approveTempDetail.Nav_ApproveRole != null && approveTempDetail.Nav_ApproveRole.NAME == "部门安全员") { - var charge = this.GetEntity(t => t.NAME == "安环部安全员"); - if (charge != null) + if (chargeSafe != null) { - var temp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == charge.ID && departmentIds.Contains((Guid)x.DEPARTMENT_ID)); + var temp = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == chargeSafe.ID && x.DEPARTMENT_ID == item); if (temp == null) - continue; + { + var temp2 = users.FirstOrDefault(x => x.APPROVE_ROLE_ID == approveTempDetail.APPROVE_ROLE_ID && x.DEPARTMENT_ID == item); + if (temp2 != null) + { + approveId = temp2.ID; + break; + } + else + { + continue; + } + } else { approveId = temp?.ID; @@ -436,7 +503,9 @@ namespace APT.FO.WebApi.Controllers } } else + { continue; + } } else { diff --git a/APT.MicroApi/APT.HM.WebApi/Controllers/Api/OperationLinkController.cs b/APT.MicroApi/APT.HM.WebApi/Controllers/Api/OperationLinkController.cs index 71b60f7..a2bf328 100644 --- a/APT.MicroApi/APT.HM.WebApi/Controllers/Api/OperationLinkController.cs +++ b/APT.MicroApi/APT.HM.WebApi/Controllers/Api/OperationLinkController.cs @@ -31,7 +31,7 @@ namespace APT.HM.WebApi.Controllers.Api { return SafeExecute(() => { - var history = this.GetEntity(t => t.OPERATION_STEP_ID == entity.OPERATION_STEP_ID, "Nav_OperationStep"); + var history = this.GetEntity(t => t.OPERATION_STEP_ID == entity.OPERATION_STEP_ID && t.ID != entity.ID, "Nav_OperationStep"); if (history != null) throw new Exception("已存在名为"+ history.Nav_OperationStep.NAME+"的数据,请修改作业名称"); var details = entity.Nav_LinkPost;