@ -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 )