yangle
2023-06-25 6585cda35b87eb1a3a05a948faf7dc5d08ef8ff7
Pub_Class/CustomerCls/ClsPub.cs
@@ -930,7 +930,7 @@
                if (LogTF == 1 || LogTF == 3)//需要判断权限
                {
                    //根据用户名称判断权限
                    DsUser = oCn.RunProcReturn("select * from gy_czygl where czymc='" + UserID.Trim() + "'", "gy_czygl");
                    DsUser = oCn.RunProcReturn("select ManagerFlag,isnull(AuthorityID,'') AuthorityID,Czybm from gy_czygl where czymc='" + UserID.Trim() + "'", "gy_czygl");
                    if (DsUser.Tables[0].Rows.Count == 0)
                    {
                        if (Msg == true)
@@ -946,7 +946,8 @@
                    }
                    else
                    {
                        if (DsUser.Tables[0].Rows[0]["AuthorityID"].ToString().Trim().Substring((int)ModID - 1, 1) == "1")
                        if (ClsPub.isStrNull(DsUser.Tables[0].Rows[0]["AuthorityID"]).Length > ModID
                            && DsUser.Tables[0].Rows[0]["AuthorityID"].ToString().Trim().Substring((int)ModID - 1, 1) == "1")
                        {
                            HavRight = true;
                        }
@@ -955,7 +956,7 @@
                            //获取用户组  并循环判断权限
                            //判断角色是否有权限
                            DsJS = oCn.RunProcReturn("select isnull(AuthorityID,'') AuthorityID from System_UserGroupinfo a inner join System_UserGroup b on a.GroupID=b.GroupID " + 
                                " Where a.USERID='" + UserID.Trim() + "'", "gy_czygl");
                                " Where a.USERID='" + DsUser.Tables[0].Rows[0]["Czybm"].ToString().Trim() + "'", "gy_czygl");
                            if (DsJS == null)
                            {
                                HavRight = false;
@@ -2502,5 +2503,97 @@
            }
            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;
            //}
        }
    }
}