| | |
| | | } |
| | | return sb.ToString(); |
| | | } |
| | | |
| | | //拼接sql,按车间,工作中心查询 |
| | | public static string SpliceSQL(string czymc,string ListName) |
| | | { |
| | | DataSet ds; |
| | | ClsSqlHelper oCN = new ClsSqlHelper(); |
| | | string sql = ""; |
| | | |
| | | //判断是否有查询列表所有信息权限 |
| | | if (!Security_Log("Xt_List_All", 1, false, czymc)) |
| | | { |
| | | //无 |
| | | switch (ListName) |
| | | { |
| | | case "工艺路线列表": |
| | | sql = " and HCenterID in (select HWorkCenterID from Gy_UserWorkCenterRelation where HUserID = (select Czybm from gy_czygl where czymc = '" + czymc + "'))"; |
| | | break; |
| | | case "生产订单列表": |
| | | sql = " and HDeptID in (select HDeptID from Gy_UserDeptRelation where HUserID = (select Czybm from gy_czygl where czymc = '" + czymc + "'))"; |
| | | break; |
| | | case "工序派工单列表": |
| | | sql = " and HDeptID in (select HDeptID from Gy_UserDeptRelation where HUserID = (select Czybm from gy_czygl where czymc = '" + czymc + "'))"; |
| | | break; |
| | | case "工序派工单明细列表": |
| | | sql = " and HDeptID in (select HDeptID from Gy_UserDeptRelation where HUserID = (select Czybm from gy_czygl where czymc = '" + czymc + "'))"; |
| | | break; |
| | | case "工序汇报单列表": |
| | | sql = " and HCenterID in (select HWorkCenterID from Gy_UserWorkCenterRelation where HUserID = (select Czybm from gy_czygl where czymc = '" + czymc + "'))"; |
| | | break; |
| | | case "生产车间工序报表": |
| | | sql = ",'" + czymc +"'"; |
| | | break; |
| | | case "工序在制品报表": |
| | | sql = ",'" + czymc + "'"; |
| | | break; |
| | | case "工序汇报日报表": |
| | | sql = ",'" + czymc + "'"; |
| | | break; |
| | | case "计件工资报表": |
| | | sql = ",'" + czymc + "'"; |
| | | break; |
| | | case "计件工资汇总报表": |
| | | sql = ",'" + czymc + "'"; |
| | | break; |
| | | } |
| | | return sql; |
| | | } |
| | | else |
| | | { |
| | | //有 |
| | | return sql; |
| | | } |
| | | |
| | | //ds = oCN.RunProcReturn("select * from gy_czygl where Czymc='" + czymc + "'", "gy_czygl"); |
| | | ////判断是否查询到相关用户信息 |
| | | //if (ds != null || ds.Tables[0].Rows.Count != 0) |
| | | //{ |
| | | // Int64 HManagerFlag = Convert.ToInt64(ds.Tables[0].Rows[0]["ManagerFlag"]); |
| | | // if (HManagerFlag == 1)//有管理员权限 |
| | | // { |
| | | // return sql; |
| | | // } |
| | | // else //没有管理员权限 |
| | | // { |
| | | // switch (ListName) |
| | | // { |
| | | // case "工艺路线列表": |
| | | // sql = " and HCenterID in (select HWorkCenterID from Gy_UserWorkCenterRelation where HUserID = (select Czybm from gy_czygl where czymc = '" + czymc + "'))"; |
| | | // break; |
| | | // case "生产订单列表": |
| | | // sql = " and HDeptID in (select HDeptID from Gy_UserDeptRelation where HUserID = (select Czybm from gy_czygl where czymc = '" + czymc + "'))"; |
| | | // break; |
| | | // case "工序派工单列表": |
| | | // sql = " and HDeptID in (select HDeptID from Gy_UserDeptRelation where HUserID = (select Czybm from gy_czygl where czymc = '" + czymc + "'))"; |
| | | // break; |
| | | // case "工序派工单明细列表": |
| | | // sql = " and HDeptID in (select HDeptID from Gy_UserDeptRelation where HUserID = (select Czybm from gy_czygl where czymc = '" + czymc + "'))"; |
| | | // break; |
| | | // case "工序汇报单列表": |
| | | // sql = " and HCenterID in (select HWorkCenterID from Gy_UserWorkCenterRelation where HUserID = (select Czybm from gy_czygl where czymc = '" + czymc + "'))"; |
| | | // break; |
| | | // } |
| | | // return sql; |
| | | // } |
| | | //} |
| | | //else |
| | | //{ |
| | | // sql = "没有查询到相关用户信息"; |
| | | // return sql; |
| | | //} |
| | | } |
| | | |
| | | } |
| | | } |