diff --git a/FactorySystemApi/Controllers/UserController.cs b/FactorySystemApi/Controllers/UserController.cs index e06fd62..1921e9c 100644 --- a/FactorySystemApi/Controllers/UserController.cs +++ b/FactorySystemApi/Controllers/UserController.cs @@ -3,6 +3,7 @@ using FactorySystemCommon; using FactorySystemModel.BusinessModel; using FactorySystemModel.ResponseModel; using FactorySystemModel.SqlSugarModel; +using Microsoft.Ajax.Utilities; using System; using System.Collections.Generic; using System.Linq; @@ -148,7 +149,9 @@ namespace FactorySystemApi.Controllers selectData.TryGetValue("FRoleType", out object roleType); selectData.TryGetValue("FViewType", out object viewType); selectData.TryGetValue("FRoleId", out object roleId); - apiResult.Data = UserBll.GetBasicRoleList(roleId, int.Parse(roleType.ToString()), viewType != null ? viewType.ToString() : "", user.FID, wantAll); + selectData.TryGetValue("TeamId", out object teamId); + selectData.TryGetValue("Type", out object type);//判断 0协同,1物料路线,2实验号变更 + apiResult.Data = UserBll.GetBasicRoleList(roleId, int.Parse(roleType.ToString()), viewType != null ? viewType.ToString() : "", user.FID, wantAll, teamId,type); } else { @@ -176,7 +179,7 @@ namespace FactorySystemApi.Controllers menuIds = menuId.ToString().Trim(',').Split(',').ToList(); } List viewIds = null; - if (saveData.TryGetValue("FViewId", out object viewId) && viewId != null) + if (saveData.TryGetValue("FViewId", out object viewId) && viewId!=null) { viewIds = viewId.ToString().Trim(',').Split(',').ToList(); } diff --git a/FactorySystemBll/BaseBll.cs b/FactorySystemBll/BaseBll.cs index 3c88cf6..631b3f5 100644 --- a/FactorySystemBll/BaseBll.cs +++ b/FactorySystemBll/BaseBll.cs @@ -503,13 +503,14 @@ namespace FactorySystemBll List messageList = new List(); try { + if (db == null) db = AppSettingsHelper.GetSqlSugar(); + if (string.IsNullOrEmpty(factoryId)) { TFS_HalfMaterialFTeamwork team = db.Queryable().Where(t => t.FID == teamId).First(); if (team != null) factoryId = team.FCreateFactoryID.ToString(); } - if (db == null) db = AppSettingsHelper.GetSqlSugar(); List taskTypeList = taskTypes.Split(',').ToList(); diff --git a/FactorySystemBll/HalfMaterialTaskBll.cs b/FactorySystemBll/HalfMaterialTaskBll.cs index 7557c1c..60c17d9 100644 --- a/FactorySystemBll/HalfMaterialTaskBll.cs +++ b/FactorySystemBll/HalfMaterialTaskBll.cs @@ -20,12 +20,13 @@ namespace FactorySystemBll { totalNumber = 0; var db = AppSettingsHelper.GetSqlSugar(); - return db.Queryable((a, b, c,d) => new JoinQueryInfos(JoinType.Inner, a.FTeamID == b.FID, - JoinType.Inner, c.FType == 46 && a.FType == int.Parse(c.FValue), JoinType.Left,a.FEditUser==d.FID)) + return db.Queryable((a, b, c, d) => new JoinQueryInfos(JoinType.Inner, a.FTeamID == b.FID, + JoinType.Inner, c.FType == 46 && a.FType == int.Parse(c.FValue), JoinType.Left, a.FEditUser == d.FID)) // 事项状态 .WhereIF(tq.FState > 0 && tq.FState != 99, (a, b) => a.FState == tq.FState) // 事项状态 .WhereIF(tq.FState == 99, (a, b) => a.FState <= 1) + .WhereIF(tq.FTestCode != null,(a,b)=>b.FNewTestCode.Contains(tq.FTestCode)) // 销售号 .WhereIF(tq.FSaleCode != null, (a, b) => b.FSaleCode.Contains(tq.FSaleCode)) // 当前流程 diff --git a/FactorySystemBll/HalfMaterialTeamworkBll.cs b/FactorySystemBll/HalfMaterialTeamworkBll.cs index 4158486..b313b1d 100644 --- a/FactorySystemBll/HalfMaterialTeamworkBll.cs +++ b/FactorySystemBll/HalfMaterialTeamworkBll.cs @@ -107,6 +107,14 @@ namespace FactorySystemBll List paramName = new List() { "FDeleted!=1" }; List paramVal = new List(); + + List FAddDate = null; + if (inParam.ContainsKey("FAddDate")) + { + FAddDate = JsonConvert.DeserializeObject>(inParam["FAddDate"].ToString()); + } + + if (inParam != null && inParam.Count > 0) { foreach (var item in inParam) @@ -121,8 +129,12 @@ namespace FactorySystemBll } else if (item.Key == "FAddDate" || item.Key == "AddDate") { - paramName.Add("convert(varchar(10),FAddDate,120)=@FAddDate"); - paramVal.Add(new SugarParameter("@FAddDate", item.Value.ToString())); + if (!string.IsNullOrWhiteSpace(FAddDate[0].ToString())) + { + paramName.Add("convert(varchar(10),FAddDate,120)>='" + FAddDate[0].ToString() + "'"); + paramName.Add("convert(varchar(10),FAddDate,120)<='" + FAddDate[1].ToString() + "'"); + } + } else if (item.Key == "FDataType" || item.Key == "DataType") { @@ -180,6 +192,7 @@ namespace FactorySystemBll { List typeList = db.Queryable().Where(s => s.FType == (int)Constant.BasicCode.变更试验号流程 && s.FState == 1).ToList(); List taskList = new List(); + TFS_HalfMaterialFTeamwork teamwork = BaseBll.GetTempModel(teamId); foreach (var item in typeList) { TFS_HalfMaterialFTeamProcess process = new TFS_HalfMaterialFTeamProcess() @@ -205,54 +218,71 @@ namespace FactorySystemBll case (int)Constant.ProcessType.替代品确认: case (int)Constant.ProcessType.协同发起: string funcIds1 = "1,2,3";//36 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in({0}))", funcIds1, (int)Constant.RoleType.事项权限)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID + in(SELECT DISTINCT a.FRole FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID in({0}) AND a.FFactoryID={2})", + funcIds1, (int)Constant.RoleType.事项权限, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.成品视图: string funcIds2 = "1";//30 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2}))", - (int)Constant.BasicCode.物料视图编辑, (int)Constant.RoleType.物料视图编辑, funcIds2)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID + in(SELECT DISTINCT a.FRole FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID + in(select FValue from TBasicCode where FType={0} and F1={2}) AND a.FFactoryID={3})", + (int)Constant.BasicCode.物料视图编辑, (int)Constant.RoleType.物料视图编辑, funcIds2, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.新半成品中间品香基: string funcIds3 = "2,3,4";//30 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1 in({2})))", - (int)Constant.BasicCode.物料视图编辑, (int)Constant.RoleType.物料视图编辑, funcIds3)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID + in(SELECT DISTINCT a.FRole FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID + in(select FValue from TBasicCode where FType={0} and F1 in ({2})) AND a.FFactoryID={3})", + (int)Constant.BasicCode.物料视图编辑, (int)Constant.RoleType.物料视图编辑, funcIds3, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.新原料视图: string funcIds4 = "5";//30 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2}))", - (int)Constant.BasicCode.物料视图编辑, (int)Constant.RoleType.物料视图编辑, funcIds4)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID + in(SELECT DISTINCT a.FRole FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID + in(select FValue from TBasicCode where FType={0} and F1 in({2})) AND a.FFactoryID={3})", + (int)Constant.BasicCode.物料视图编辑, (int)Constant.RoleType.物料视图编辑, funcIds4, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.配方视图: string funcIds5 = "2,7";//39 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in({0}))", funcIds5, (int)Constant.RoleType.视图权限)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID + in(SELECT DISTINCT a.FRole FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID in({0}) AND a.FFactoryID={2})", + funcIds5, (int)Constant.RoleType.视图权限, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.生产工艺路线: string funcIds6 = "3,8";//39 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in({0}))", funcIds6, (int)Constant.RoleType.视图权限)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID + in(SELECT DISTINCT a.FRole FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID in({0}) AND a.FFactoryID={2})", + funcIds6, (int)Constant.RoleType.视图权限, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.生成版本: string funcIds7 = "4,9";//39 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in({0}))", funcIds7, (int)Constant.RoleType.视图权限)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID + in(SELECT DISTINCT a.FRole FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID in({0}) AND a.FFactoryID={2})", + funcIds7, (int)Constant.RoleType.视图权限, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.组装BOM包含新包材: string funcIds8 = "5,6";//36 - users = db.Queryable().Where(string.Format(@"FState=1 and (FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2})) - or FRoleID in(select distinct FRoleID from TRole_Right where FType={3} and FFunctionID in({4})) )", + users = db.Queryable().Where(string.Format(@"FState=1 and (FRoleID in(SELECT DISTINCT a.FRole FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} AND a.FFactoryID={5} and b.FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2})) + or FRoleID in(SELECT DISTINCT a.FRole FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID where b.FType={3} + AND a.FFactoryID={5} and b.FFunctionID in({4})) )", (int)Constant.BasicCode.物料视图编辑, (int)Constant.RoleType.物料视图编辑, (int)Constant.ViewType.包材视图, - (int)Constant.RoleType.事项权限, funcIds8)).ToList(); + (int)Constant.RoleType.事项权限, funcIds8, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.流程完成: string funcIds9 = "7";//36 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in({0}))", funcIds9, (int)Constant.RoleType.事项权限)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID + in(SELECT DISTINCT a.FRole FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID in({0}) AND a.FFactoryID={2})", + funcIds9, (int)Constant.RoleType.事项权限, teamwork.FCreateFactoryID)).ToList(); break; } if (users != null && users.Count > 0) diff --git a/FactorySystemBll/TeamworkBll.cs b/FactorySystemBll/TeamworkBll.cs index 68a954f..0592d00 100644 --- a/FactorySystemBll/TeamworkBll.cs +++ b/FactorySystemBll/TeamworkBll.cs @@ -110,6 +110,9 @@ namespace FactorySystemBll { List typeList = db.Queryable().Where(s => s.FType == (int)Constant.BasicCode.流程类型 && s.FState == 1).ToList(); List taskList = new List(); + TFS_FTeamwork teamwork = BaseBll.GetTempModel(teamId); + + foreach (var item in typeList) { TFS_FTeamProcess process = new TFS_FTeamProcess() @@ -134,55 +137,72 @@ namespace FactorySystemBll case (int)Constant.ProcessType.物料分类: case (int)Constant.ProcessType.替代品确认: case (int)Constant.ProcessType.协同发起: - string funcIds1 = "1,2,3";//36 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in({0}))", funcIds1, (int)Constant.RoleType.事项权限)).ToList(); + string funcIds1 = "1,2,3,10";//36 + users = db.Queryable().Where(string.Format(@"FState=1 and FID + in(SELECT DISTINCT a.FUserID FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID in({0}) AND a.FFactoryID={2})", + funcIds1, (int)Constant.RoleType.事项权限, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.成品视图: string funcIds2 = "1";//30 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2}))", - (int)Constant.BasicCode.物料视图编辑, (int)Constant.RoleType.物料视图编辑, funcIds2)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FID + in(SELECT DISTINCT a.FUserID FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID + in(select FValue from TBasicCode where FType={0} and F1={2}) AND a.FFactoryID={3})", + (int)Constant.BasicCode.物料视图编辑, (int)Constant.RoleType.物料视图编辑, funcIds2, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.新半成品中间品香基: string funcIds3 = "2,3,4";//30 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1 in({2})))", - (int)Constant.BasicCode.物料视图编辑, (int)Constant.RoleType.物料视图编辑, funcIds3)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FID + in(SELECT DISTINCT a.FUserID FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID + in(select FValue from TBasicCode where FType={0} and F1 in ({2})) AND a.FFactoryID={3})", + (int)Constant.BasicCode.物料视图编辑, (int)Constant.RoleType.物料视图编辑, funcIds3, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.新原料视图: string funcIds4 = "5";//30 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2}))", - (int)Constant.BasicCode.物料视图编辑, (int)Constant.RoleType.物料视图编辑, funcIds4)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FID + in(SELECT DISTINCT a.FUserID FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID + in(select FValue from TBasicCode where FType={0} and F1 in({2})) AND a.FFactoryID={3})", + (int)Constant.BasicCode.物料视图编辑, (int)Constant.RoleType.物料视图编辑, funcIds4, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.配方视图: string funcIds5 = "2,7";//39 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in({0}))", funcIds5, (int)Constant.RoleType.视图权限)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FID + in(SELECT DISTINCT a.FUserID FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID in({0}) AND a.FFactoryID={2})", + funcIds5, (int)Constant.RoleType.视图权限, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.生产工艺路线: string funcIds6 = "3,8";//39 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in({0}))", funcIds6, (int)Constant.RoleType.视图权限)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FID + in(SELECT DISTINCT a.FUserID FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID in({0}) AND a.FFactoryID={2})", + funcIds6, (int)Constant.RoleType.视图权限, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.生成版本: string funcIds7 = "4,9";//39 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in({0}))", funcIds7, (int)Constant.RoleType.视图权限)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FID + in(SELECT DISTINCT a.FUserID FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID in({0}) AND a.FFactoryID={2})", + funcIds7, (int)Constant.RoleType.视图权限, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.组装BOM包含新包材: string funcIds8 = "5,6";//36 - users = db.Queryable().Where(string.Format(@"FState=1 and (FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2})) - or FRoleID in(select distinct FRoleID from TRole_Right where FType={3} and FFunctionID in({4})) )", + users = db.Queryable().Where(string.Format(@"FState=1 and (FID in(SELECT DISTINCT a.FUserID FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} AND a.FFactoryID={5} and b.FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2})) + or FID in(SELECT DISTINCT a.FUserID FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID where b.FType={3} + AND a.FFactoryID={5} and b.FFunctionID in({4})) )", (int)Constant.BasicCode.物料视图编辑, (int)Constant.RoleType.物料视图编辑, (int)Constant.ViewType.包材视图, - (int)Constant.RoleType.事项权限, funcIds8)).ToList(); + (int)Constant.RoleType.事项权限, funcIds8, teamwork.FCreateFactoryID)).ToList(); break; case (int)Constant.ProcessType.流程完成: string funcIds9 = "7";//36 - users = db.Queryable().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from - TRole_Right where FType={1} and FFunctionID in({0}))", funcIds9, (int)Constant.RoleType.事项权限)).ToList(); + users = db.Queryable().Where(string.Format(@"FState=1 and FID + in(SELECT DISTINCT a.FUserID FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID + where b.FType={1} and b.FFunctionID in({0}) AND a.FFactoryID={2})", + funcIds9, (int)Constant.RoleType.事项权限, teamwork.FCreateFactoryID)).ToList(); break; } if (users != null && users.Count > 0) diff --git a/FactorySystemBll/UserBll.cs b/FactorySystemBll/UserBll.cs index ca0b7ab..0cf0cd8 100644 --- a/FactorySystemBll/UserBll.cs +++ b/FactorySystemBll/UserBll.cs @@ -143,7 +143,7 @@ namespace FactorySystemBll /// /// 获取其他权限 /// - public object GetBasicRoleList(object roleIds, int roleType, string viewType, int userId, bool returnAll) + public object GetBasicRoleList(object roleIds, int roleType, string viewType, int userId, bool returnAll,object teamId,object type) { int roleType2 = -1; if (roleType == 36) roleType2 = (int)Constant.RoleType.事项权限; @@ -158,11 +158,38 @@ namespace FactorySystemBll List roles = new List(); if (null == roleIds || string.IsNullOrEmpty(roleIds.ToString())) { - //TUser userInfo = db.Queryable().Where(s => s.FID == userId && s.FDeleted != (int)Constant.DeleteCode.已删除).First(); - //roleIds = userInfo.FRoleID; + if (teamId!=null) + { + //TUser userInfo = db.Queryable().Where(s => s.FID == userId && s.FDeleted != (int)Constant.DeleteCode.已删除).First(); + //roleIds = userInfo.FRoleID; + int factoryID = 0; - List fPower = db.Queryable().Where(s => s.FUserID == userId.ToString()).ToList(); - roleIds= string.Join(",", fPower.Select(m => m.FRole).Distinct().ToList()); + switch (int.Parse(type.ToString())) + { + case 0: + TFS_FTeamwork fTeamwork = BaseBll.GetTempModel("FID=" + teamId.ToString()); + factoryID = fTeamwork.FCreateFactoryID; + break; + case 1: + TFS_MaterialFTeamwork materialFTeamwork = BaseBll.GetTempModel("FID=" + teamId.ToString()); + factoryID = materialFTeamwork.FCreateFactoryID; + break; + case 2: + TFS_HalfMaterialFTeamwork halfMaterialFTeamwork = BaseBll.GetTempModel("FID=" + teamId.ToString()); + factoryID = halfMaterialFTeamwork.FCreateFactoryID; + break; + } + + + List fPower = db.Queryable().Where(s => s.FUserID == userId.ToString() && s.FFactoryID == factoryID.ToString()).ToList(); + roleIds = string.Join(",", fPower.Select(m => m.FRole).Distinct().ToList()); + } + else + { + List fPower = db.Queryable().Where(s => s.FUserID == userId.ToString()).ToList(); + roleIds = string.Join(",", fPower.Select(m => m.FRole).Distinct().ToList()); + } + } roles = roleIds.ToString().Trim(',').Split(',').ToList(); @@ -438,7 +465,7 @@ namespace FactorySystemBll { List ids = hasRoles.Where(ss => ss.FType == roleType).Select(sss => sss.FFunctionID).ToList(); if (ids.Count() > 0) inIds = inIds.Where(s => !ids.Contains(int.Parse(s))).ToList(); - if (inIds.Count() > 0) + if (inIds.Count() > 0 && !string.IsNullOrWhiteSpace(inIds[0])) { return inIds.Select(s => new TRole_Right() {