修改权限

master
Yang 3 years ago
parent cc7d09212e
commit 0c28819501

@ -3,6 +3,7 @@ using FactorySystemCommon;
using FactorySystemModel.BusinessModel; using FactorySystemModel.BusinessModel;
using FactorySystemModel.ResponseModel; using FactorySystemModel.ResponseModel;
using FactorySystemModel.SqlSugarModel; using FactorySystemModel.SqlSugarModel;
using Microsoft.Ajax.Utilities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -148,7 +149,9 @@ namespace FactorySystemApi.Controllers
selectData.TryGetValue("FRoleType", out object roleType); selectData.TryGetValue("FRoleType", out object roleType);
selectData.TryGetValue("FViewType", out object viewType); selectData.TryGetValue("FViewType", out object viewType);
selectData.TryGetValue("FRoleId", out object roleId); 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 else
{ {
@ -176,7 +179,7 @@ namespace FactorySystemApi.Controllers
menuIds = menuId.ToString().Trim(',').Split(',').ToList(); menuIds = menuId.ToString().Trim(',').Split(',').ToList();
} }
List<string> viewIds = null; List<string> 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(); viewIds = viewId.ToString().Trim(',').Split(',').ToList();
} }

@ -503,13 +503,14 @@ namespace FactorySystemBll
List<MessageDto> messageList = new List<MessageDto>(); List<MessageDto> messageList = new List<MessageDto>();
try try
{ {
if (db == null) db = AppSettingsHelper.GetSqlSugar();
if (string.IsNullOrEmpty(factoryId)) if (string.IsNullOrEmpty(factoryId))
{ {
TFS_HalfMaterialFTeamwork team = db.Queryable<TFS_HalfMaterialFTeamwork>().Where(t => t.FID == teamId).First(); TFS_HalfMaterialFTeamwork team = db.Queryable<TFS_HalfMaterialFTeamwork>().Where(t => t.FID == teamId).First();
if (team != null) factoryId = team.FCreateFactoryID.ToString(); if (team != null) factoryId = team.FCreateFactoryID.ToString();
} }
if (db == null) db = AppSettingsHelper.GetSqlSugar();
List<string> taskTypeList = taskTypes.Split(',').ToList(); List<string> taskTypeList = taskTypes.Split(',').ToList();

@ -20,12 +20,13 @@ namespace FactorySystemBll
{ {
totalNumber = 0; totalNumber = 0;
var db = AppSettingsHelper.GetSqlSugar(); var db = AppSettingsHelper.GetSqlSugar();
return db.Queryable<TFS_HalfMaterialTask, TFS_HalfMaterialFTeamwork, TBasicCode,TUser>((a, b, c,d) => new JoinQueryInfos(JoinType.Inner, a.FTeamID == b.FID, return db.Queryable<TFS_HalfMaterialTask, TFS_HalfMaterialFTeamwork, TBasicCode, TUser>((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)) 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 > 0 && tq.FState != 99, (a, b) => a.FState == tq.FState)
// 事项状态 // 事项状态
.WhereIF(tq.FState == 99, (a, b) => a.FState <= 1) .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)) .WhereIF(tq.FSaleCode != null, (a, b) => b.FSaleCode.Contains(tq.FSaleCode))
// 当前流程 // 当前流程

@ -107,6 +107,14 @@ namespace FactorySystemBll
List<string> paramName = new List<string>() { "FDeleted!=1" }; List<string> paramName = new List<string>() { "FDeleted!=1" };
List<SugarParameter> paramVal = new List<SugarParameter>(); List<SugarParameter> paramVal = new List<SugarParameter>();
List<string> FAddDate = null;
if (inParam.ContainsKey("FAddDate"))
{
FAddDate = JsonConvert.DeserializeObject<List<string>>(inParam["FAddDate"].ToString());
}
if (inParam != null && inParam.Count > 0) if (inParam != null && inParam.Count > 0)
{ {
foreach (var item in inParam) foreach (var item in inParam)
@ -121,8 +129,12 @@ namespace FactorySystemBll
} }
else if (item.Key == "FAddDate" || item.Key == "AddDate") else if (item.Key == "FAddDate" || item.Key == "AddDate")
{ {
paramName.Add("convert(varchar(10),FAddDate,120)=@FAddDate"); if (!string.IsNullOrWhiteSpace(FAddDate[0].ToString()))
paramVal.Add(new SugarParameter("@FAddDate", item.Value.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") else if (item.Key == "FDataType" || item.Key == "DataType")
{ {
@ -180,6 +192,7 @@ namespace FactorySystemBll
{ {
List<TBasicCode> typeList = db.Queryable<TBasicCode>().Where(s => s.FType == (int)Constant.BasicCode. && s.FState == 1).ToList(); List<TBasicCode> typeList = db.Queryable<TBasicCode>().Where(s => s.FType == (int)Constant.BasicCode. && s.FState == 1).ToList();
List<TFS_HalfMaterialFTeamProcess> taskList = new List<TFS_HalfMaterialFTeamProcess>(); List<TFS_HalfMaterialFTeamProcess> taskList = new List<TFS_HalfMaterialFTeamProcess>();
TFS_HalfMaterialFTeamwork teamwork = BaseBll.GetTempModel<TFS_HalfMaterialFTeamwork>(teamId);
foreach (var item in typeList) foreach (var item in typeList)
{ {
TFS_HalfMaterialFTeamProcess process = new TFS_HalfMaterialFTeamProcess() TFS_HalfMaterialFTeamProcess process = new TFS_HalfMaterialFTeamProcess()
@ -205,54 +218,71 @@ namespace FactorySystemBll
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
string funcIds1 = "1,2,3";//36 string funcIds1 = "1,2,3";//36
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds1, (int)Constant.RoleType.事项权限)).ToList(); 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; break;
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
string funcIds2 = "1";//30 string funcIds2 = "1";//30
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID
TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2}))", in(SELECT DISTINCT a.FRole FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID
(int)Constant.BasicCode., (int)Constant.RoleType., funcIds2)).ToList(); 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; break;
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
string funcIds3 = "2,3,4";//30 string funcIds3 = "2,3,4";//30
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID
TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1 in({2})))", in(SELECT DISTINCT a.FRole FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID
(int)Constant.BasicCode., (int)Constant.RoleType., funcIds3)).ToList(); 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; break;
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
string funcIds4 = "5";//30 string funcIds4 = "5";//30
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID
TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2}))", in(SELECT DISTINCT a.FRole FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID
(int)Constant.BasicCode., (int)Constant.RoleType., funcIds4)).ToList(); 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; break;
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
string funcIds5 = "2,7";//39 string funcIds5 = "2,7";//39
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds5, (int)Constant.RoleType.视图权限)).ToList(); 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; break;
case (int)Constant.ProcessType.线: case (int)Constant.ProcessType.线:
string funcIds6 = "3,8";//39 string funcIds6 = "3,8";//39
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds6, (int)Constant.RoleType.视图权限)).ToList(); 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; break;
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
string funcIds7 = "4,9";//39 string funcIds7 = "4,9";//39
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds7, (int)Constant.RoleType.视图权限)).ToList(); 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; break;
case (int)Constant.ProcessType.BOM: case (int)Constant.ProcessType.BOM:
string funcIds8 = "5,6";//36 string funcIds8 = "5,6";//36
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and (FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().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
TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2})) 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 FRoleID from TRole_Right where FType={3} and FFunctionID in({4})) )", 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.BasicCode., (int)Constant.RoleType., (int)Constant.ViewType.,
(int)Constant.RoleType., funcIds8)).ToList(); (int)Constant.RoleType., funcIds8, teamwork.FCreateFactoryID)).ToList();
break; break;
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
string funcIds9 = "7";//36 string funcIds9 = "7";//36
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds9, (int)Constant.RoleType.事项权限)).ToList(); 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; break;
} }
if (users != null && users.Count > 0) if (users != null && users.Count > 0)

@ -110,6 +110,9 @@ namespace FactorySystemBll
{ {
List<TBasicCode> typeList = db.Queryable<TBasicCode>().Where(s => s.FType == (int)Constant.BasicCode. && s.FState == 1).ToList(); List<TBasicCode> typeList = db.Queryable<TBasicCode>().Where(s => s.FType == (int)Constant.BasicCode. && s.FState == 1).ToList();
List<TFS_FTeamProcess> taskList = new List<TFS_FTeamProcess>(); List<TFS_FTeamProcess> taskList = new List<TFS_FTeamProcess>();
TFS_FTeamwork teamwork = BaseBll.GetTempModel<TFS_FTeamwork>(teamId);
foreach (var item in typeList) foreach (var item in typeList)
{ {
TFS_FTeamProcess process = new TFS_FTeamProcess() TFS_FTeamProcess process = new TFS_FTeamProcess()
@ -134,55 +137,72 @@ namespace FactorySystemBll
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
string funcIds1 = "1,2,3";//36 string funcIds1 = "1,2,3,10";//36
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FID
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds1, (int)Constant.RoleType.事项权限)).ToList(); 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; break;
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
string funcIds2 = "1";//30 string funcIds2 = "1";//30
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FID
TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2}))", in(SELECT DISTINCT a.FUserID FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID
(int)Constant.BasicCode., (int)Constant.RoleType., funcIds2)).ToList(); 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; break;
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
string funcIds3 = "2,3,4";//30 string funcIds3 = "2,3,4";//30
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FID
TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1 in({2})))", in(SELECT DISTINCT a.FUserID FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID
(int)Constant.BasicCode., (int)Constant.RoleType., funcIds3)).ToList(); 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; break;
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
string funcIds4 = "5";//30 string funcIds4 = "5";//30
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FID
TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2}))", in(SELECT DISTINCT a.FUserID FROM FPower AS a LEFT JOIN TRole_Right AS b ON a.FRole=b.FRoleID
(int)Constant.BasicCode., (int)Constant.RoleType., funcIds4)).ToList(); 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; break;
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
string funcIds5 = "2,7";//39 string funcIds5 = "2,7";//39
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FID
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds5, (int)Constant.RoleType.视图权限)).ToList(); 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; break;
case (int)Constant.ProcessType.线: case (int)Constant.ProcessType.线:
string funcIds6 = "3,8";//39 string funcIds6 = "3,8";//39
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FID
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds6, (int)Constant.RoleType.视图权限)).ToList(); 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; break;
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
string funcIds7 = "4,9";//39 string funcIds7 = "4,9";//39
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FID
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds7, (int)Constant.RoleType.视图权限)).ToList(); 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; break;
case (int)Constant.ProcessType.BOM: case (int)Constant.ProcessType.BOM:
string funcIds8 = "5,6";//36 string funcIds8 = "5,6";//36
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and (FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().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
TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2})) 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 FRoleID from TRole_Right where FType={3} and FFunctionID in({4})) )", 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.BasicCode., (int)Constant.RoleType., (int)Constant.ViewType.,
(int)Constant.RoleType., funcIds8)).ToList(); (int)Constant.RoleType., funcIds8, teamwork.FCreateFactoryID)).ToList();
break; break;
case (int)Constant.ProcessType.: case (int)Constant.ProcessType.:
string funcIds9 = "7";//36 string funcIds9 = "7";//36
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FID
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds9, (int)Constant.RoleType.事项权限)).ToList(); 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; break;
} }
if (users != null && users.Count > 0) if (users != null && users.Count > 0)

@ -143,7 +143,7 @@ namespace FactorySystemBll
/// <summary> /// <summary>
/// 获取其他权限 /// 获取其他权限
/// </summary> /// </summary>
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; int roleType2 = -1;
if (roleType == 36) roleType2 = (int)Constant.RoleType.; if (roleType == 36) roleType2 = (int)Constant.RoleType.;
@ -158,11 +158,38 @@ namespace FactorySystemBll
List<string> roles = new List<string>(); List<string> roles = new List<string>();
if (null == roleIds || string.IsNullOrEmpty(roleIds.ToString())) if (null == roleIds || string.IsNullOrEmpty(roleIds.ToString()))
{ {
//TUser userInfo = db.Queryable<TUser>().Where(s => s.FID == userId && s.FDeleted != (int)Constant.DeleteCode.已删除).First(); if (teamId!=null)
//roleIds = userInfo.FRoleID; {
//TUser userInfo = db.Queryable<TUser>().Where(s => s.FID == userId && s.FDeleted != (int)Constant.DeleteCode.已删除).First();
//roleIds = userInfo.FRoleID;
int factoryID = 0;
List<FPower> fPower = db.Queryable<FPower>().Where(s => s.FUserID == userId.ToString()).ToList(); switch (int.Parse(type.ToString()))
roleIds= string.Join(",", fPower.Select(m => m.FRole).Distinct().ToList()); {
case 0:
TFS_FTeamwork fTeamwork = BaseBll.GetTempModel<TFS_FTeamwork>("FID=" + teamId.ToString());
factoryID = fTeamwork.FCreateFactoryID;
break;
case 1:
TFS_MaterialFTeamwork materialFTeamwork = BaseBll.GetTempModel<TFS_MaterialFTeamwork>("FID=" + teamId.ToString());
factoryID = materialFTeamwork.FCreateFactoryID;
break;
case 2:
TFS_HalfMaterialFTeamwork halfMaterialFTeamwork = BaseBll.GetTempModel<TFS_HalfMaterialFTeamwork>("FID=" + teamId.ToString());
factoryID = halfMaterialFTeamwork.FCreateFactoryID;
break;
}
List<FPower> fPower = db.Queryable<FPower>().Where(s => s.FUserID == userId.ToString() && s.FFactoryID == factoryID.ToString()).ToList();
roleIds = string.Join(",", fPower.Select(m => m.FRole).Distinct().ToList());
}
else
{
List<FPower> fPower = db.Queryable<FPower>().Where(s => s.FUserID == userId.ToString()).ToList();
roleIds = string.Join(",", fPower.Select(m => m.FRole).Distinct().ToList());
}
} }
roles = roleIds.ToString().Trim(',').Split(',').ToList(); roles = roleIds.ToString().Trim(',').Split(',').ToList();
@ -438,7 +465,7 @@ namespace FactorySystemBll
{ {
List<int> ids = hasRoles.Where(ss => ss.FType == roleType).Select(sss => sss.FFunctionID).ToList(); List<int> 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 (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() return inIds.Select(s => new TRole_Right()
{ {

Loading…
Cancel
Save