Beispiel #1
0
        /// <summary>
        /// 用户列表
        /// </summary>
        /// <param name="pagination">分页参数</param>
        /// <param name="queryJson">查询参数</param>
        /// <returns>返回分页列表Json</returns>
        //[HandlerMonitor(3, "分页查询用户信息!")]
        public ActionResult GetPageListJsonByRsshsgType(Pagination pagination, string queryJson)
        {
            var watch = CommonHelper.TimerStart();

            pagination.p_kid         = "ID";
            pagination.p_fields      = "IsSubmit_deal,JJYYNAME,BAQZTNAME,BAQXWNAME,RSSHSGTYPENAME,CREATEUSERID ,sglevelname,SGNAME, SGTYPENAME,HAPPENTIME,AREANAME,SGKBUSERNAME,DEALID,CREATEUSERDEPTCODE as departmentcode,CREATEUSERORGCODE as  organizecode";
            pagination.p_tablename   = "V_AEM_BULLETIN_deal t";
            pagination.conditionJson = "(sgTypeName='电力生产人身伤亡事故' or sgTypeName='电力建设人身伤亡事故')";
            ERCHTMS.Code.Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
            if (user.IsSystem)
            {
                pagination.conditionJson = "(sgTypeName='电力生产人身伤亡事故' or sgTypeName='电力建设人身伤亡事故')";
            }
            else
            {
                string where = new AuthorizeBLL().GetModuleDataAuthority(ERCHTMS.Code.OperatorProvider.Provider.Current(), HttpContext.Request.Cookies["currentmoduleId"].Value, "CREATEUSERDEPTCODE", "CREATEUSERORGCODE");
                if (!string.IsNullOrEmpty(where))
                {
                    pagination.conditionJson += " and " + where;
                }
            }
            pagination.conditionJson += " and IsSubmit_Deal=1";
            var data     = bulletinbll.GetPageList(pagination, queryJson);
            var jsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));
        }
        public ActionResult GetStandard(string RiskId)
        {
            string wheresql = "";

            ERCHTMS.Code.Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
            if (user.IsSystem)
            {
                wheresql = "";
            }
            else
            {
                string where = new ERCHTMS.Busines.AuthorizeManage.AuthorizeBLL().GetModuleDataAuthority(ERCHTMS.Code.OperatorProvider.Provider.Current(), HttpContext.Request.Cookies["currentmoduleId"].Value);
                wheresql    += " and " + where;
            }

            string       Sta = hazarddetectionbll.GetStandard(RiskId, wheresql);
            ComboxEntity cmb = new ComboxEntity();

            if (Sta != null && Sta != "")
            {
                cmb.itemName  = "true";
                cmb.itemValue = Sta;
            }
            else
            {
                cmb.itemName  = "false";
                cmb.itemValue = "";
            }

            return(ToJsonResult(cmb));
        }
Beispiel #3
0
        public string GetCheckList(ERCHTMS.Code.Operator user)
        {
            string    ids   = "";
            DataTable dt    = this.BaseRepository().FindTable(string.Format(@"select * from EPG_SAFETYCOLLECT t where flowdept like'%{0}%'", user.DeptId));
            int       count = 0;

            foreach (DataRow dr in dt.Rows)
            {
                if (!string.IsNullOrWhiteSpace(dr["flowrolename"].ToString()))
                {
                    var roleArr  = user.RoleName.Split(',');      //当前人员角色
                    var roleName = dr["flowrolename"].ToString(); //审核橘色
                    for (var i = 0; i < roleArr.Length; i++)
                    {
                        //满足审核部门同当前人部门id一致,切当前人角色存在与审核角色中
                        if (roleName.IndexOf(roleArr[i]) >= 0)
                        {
                            ids += "'" + dr["id"].ToString() + "',";
                            break;
                        }
                    }
                }
            }
            return(ids);
        }
Beispiel #4
0
        /// <summary>
        /// 伤亡人数人数统计
        /// </summary>
        /// <param name="pagination">分页参数</param>
        /// <param name="queryJson">查询参数</param>
        /// <returns>返回分页列表Json</returns>
        //[HandlerMonitor(3, "分页查询用户信息!")]
        public ActionResult GetPageListJson(Pagination pagination, string queryJson)
        {
            var watch = CommonHelper.TimerStart();

            pagination.p_kid         = "ID";
            pagination.p_fields      = "IsSubmit_deal,SGNAME,SGTYPENAME,HAPPENTIME,AREANAME,CreateDate,dealid";
            pagination.p_tablename   = "V_AEM_BULLETIN_deal";
            pagination.conditionJson = "IsSubmit_Deal=1";
            ERCHTMS.Code.Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
            if (user.IsSystem)
            {
                pagination.conditionJson = "1=1";
            }
            else
            {
                string where = new AuthorizeBLL().GetModuleDataAuthority(ERCHTMS.Code.OperatorProvider.Provider.Current(), HttpContext.Request.Cookies["currentmoduleId"].Value, "CREATEUSERDEPTCODE", "CREATEUSERORGCODE");
                if (!string.IsNullOrEmpty(where))
                {
                    pagination.conditionJson += " and " + where;
                }
            }
            pagination.conditionJson += " and IsSubmit_Deal=1";
            var data     = bulletinbll.GetPageList(pagination, queryJson);
            var jsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));
        }
        /// <summary>
        /// 用户列表
        /// </summary>
        /// <param name="pagination">分页参数</param>
        /// <param name="queryJson">查询参数</param>
        /// <returns>返回分页列表Json</returns>
        //[HandlerMonitor(3, "分页查询用户信息!")]
        public ActionResult GetPageListJson(Pagination pagination, string queryJson)
        {
            var watch = CommonHelper.TimerStart();

            pagination.p_kid         = "OCCDETAILID";
            pagination.p_fields      = "USERID,USERNAME,GENDER,DEPTNAME,DUTYNAME,ISSICK,SICKTYPE,SICKTYPENAME";
            pagination.p_tablename   = "V_STAFFDETAILLIST";
            pagination.conditionJson = "ISSICK=1";
            pagination.sidx          = "INSPECTIONTIME desc ,Usernamepinyin ";
            pagination.sord          = "asc";

            ERCHTMS.Code.Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
            if (user.IsSystem)
            {
                pagination.conditionJson = " ISSICK=1";
            }
            else
            {
                string where              = new ERCHTMS.Busines.AuthorizeManage.AuthorizeBLL().GetModuleDataAuthority(ERCHTMS.Code.OperatorProvider.Provider.Current(), HttpContext.Request.Cookies["currentmoduleId"].Value);
                pagination.conditionJson += " and " + where;
            }

            var data     = occupationalstaffdetailbll.GetStaffListPage(pagination, queryJson);
            var jsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));
        }
        /// <summary>
        /// 导出到Excel
        /// </summary>
        /// <param name="queryJson"></param>
        /// <returns></returns>
        public ActionResult Excel(string queryJson)
        {
            string whereSql = "";

            ERCHTMS.Code.Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
            if (user.IsSystem)
            {
                whereSql = "";
            }
            else
            {
                string where = new ERCHTMS.Busines.AuthorizeManage.AuthorizeBLL().GetModuleDataAuthority(ERCHTMS.Code.OperatorProvider.Provider.Current(), HttpContext.Request.Cookies["currentmoduleId"].Value);
                whereSql    += " and " + where;
            }
            whereSql += " and CARDTYPE=0";
            DataTable dt = staffinformcardbll.GetTable(queryJson, whereSql);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i][0] = (i + 1).ToString();
            }
            string FileUrl = @"\Resource\ExcelTemplate\职业病危害告知卡_导出模板.xlsx";



            AsposeExcelHelper.ExecuteResult(dt, FileUrl, "职业病危害告知卡", "职业病危害告知卡");

            return(Success("导出成功。"));
        }
Beispiel #7
0
        /// <summary>
        /// 首页提醒
        /// </summary>
        /// <returns></returns>
        public int CountIndex(ERCHTMS.Code.Operator currUser)
        {
            int    num      = 0;
            string sqlwhere = "";

            sqlwhere += string.Format(" and ((flowdept ='{0}'", currUser.DeptId);

            string[] arr = currUser.RoleName.Split(',');
            if (arr.Length > 0)
            {
                sqlwhere += " and (";
                foreach (var item in arr)
                {
                    sqlwhere += string.Format(" flowrolename  like '%{0}%' or", item);
                }
                sqlwhere  = sqlwhere.Substring(0, sqlwhere.Length - 2);
                sqlwhere += " )";
            }
            sqlwhere += string.Format(") and isover='0' and issaved='1')");
            string sql = string.Format("select count(1) from epg_dailyexamine where  createuserorgcode='{0}' {1}", currUser.OrganizeCode, sqlwhere);
            object obj = this.BaseRepository().FindObject(sql);

            int.TryParse(obj.ToString(), out num);

            return(num);
        }
Beispiel #8
0
        public ActionResult GetListJson(Pagination pagination, string queryJson)
        {
            var watch = CommonHelper.TimerStart();

            pagination.p_kid         = "HID";
            pagination.p_fields      = "AREAID,AREAVALUE,RISKID,RISKVALUE,CONTACTNUMBER";//注:此处要替换成需要查询的列
            pagination.p_tablename   = "BIS_HAZARDFACTORS";
            pagination.conditionJson = "1=1";
            pagination.sidx          = "CREATEDATE";

            ERCHTMS.Code.Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
            if (user.IsSystem)
            {
                pagination.conditionJson = "1=1";
            }
            else
            {
                string where              = new ERCHTMS.Busines.AuthorizeManage.AuthorizeBLL().GetModuleDataAuthority(ERCHTMS.Code.OperatorProvider.Provider.Current(), HttpContext.Request.Cookies["currentmoduleId"].Value);
                pagination.conditionJson += " and " + where;
            }

            var data     = hazardfactorsbll.GetPageListByProc(pagination, queryJson);
            var jsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));
        }
Beispiel #9
0
        public List <SaftyCheckDataRecordEntity> GetSaftDataIndexList(ERCHTMS.Code.Operator user)
        {
            List <SaftyCheckDataRecordEntity> listAll = new List <SaftyCheckDataRecordEntity>();
            string sql  = string.Format(@"select * from   bis_saftycheckdatarecord t left join  (select recid from bis_saftycontent where CheckManAccount='{0}' group by  recid)t1
on t.id=t1.recid  where recid is not null and ((instr(solveperson,'{0}'))=0 or solveperson is null)  and belongdept like  '{1}%'", user.Account, user.OrganizeCode);
            var    list = this.BaseRepository().FindList(sql).ToList();

            listAll.AddRange(list);
            string sqlRc = string.Format(@"select * from bis_saftycheckdatarecord where checkDataType='1' and  instr(checkmanid,'{0}')>0  and ((instr(solveperson,'{0}'))=0 or solveperson is null)  and belongdept like  '{1}%' ", user.Account, user.OrganizeCode);
            var    list1 = this.BaseRepository().FindList(sqlRc).ToList();

            listAll.AddRange(list1);
            return(listAll);
        }
Beispiel #10
0
        /// <summary>
        /// 获取满足黑名单条件的人员
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public DataTable GetBlacklistUsers(ERCHTMS.Code.Operator user)
        {
            DataTable dtTemp = new DataTable();

            dtTemp.Columns.Add("userid");
            dtTemp.Columns.Add("realname");
            dtTemp.Columns.Add("deptname");
            dtTemp.Columns.Add("itemname");
            dtTemp.Columns.Add("remark");
            DataTable dtItems = BaseRepository().FindTable(string.Format("select itemvalue,itemcode,remark from BIS_BLACKSET where status=1 and deptcode='{0}'", user.OrganizeCode));

            foreach (DataRow dr in dtItems.Rows)
            {
                DataTable dt  = null;
                string    sql = "";
                //年龄判断
                if (dr[1].ToString() == "01")
                {
                    string[] arr = dr[0].ToString().Split('|');
                    sql = string.Format("select userid,realname,u.DEPTNAME,'" + dr[2].ToString() + @"' itemname,('出生日期为:' || to_char(birthday,'yyyy-MM-dd')) remark from v_userinfo u where isblack=0 and  gender='{0}' and birthday is not null and u.DEPARTMENTCODE like '{3}%'
and (round(sysdate-to_date(to_char(u.birthday,'yyyy-MM-dd'),'yyyy-MM-dd'))/365<{1} or round(sysdate-to_date(to_char(u.birthday,'yyyy-MM-dd'),'yyyy-MM-dd'))/365>{2})", "男", arr[0], arr[1], user.DeptCode);
                    dt  = BaseRepository().FindTable(sql);
                    dtTemp.Merge(dt);

                    sql = string.Format("select userid,realname,u.DEPTNAME,'" + dr[2].ToString() + @"' itemname,('出生日期为:' || to_char(birthday,'yyyy-mm-dd')) remark  from v_userinfo u where isblack=0 and gender='{0}' and birthday is not null and u.DEPARTMENTCODE like '{3}%'
and (round(sysdate-to_date(to_char(u.birthday,'yyyy-mm-dd'),'yyyy-MM-dd'))/365<to_number({1}) or round(sysdate-to_date(to_char(u.birthday,'yyyy-mm-dd'),'yyyy-MM-dd'))/365>to_number({2})) ", "女", arr[2], arr[3], user.DeptCode);
                    dt  = BaseRepository().FindTable(sql);
                    dtTemp.Merge(dt);
                }
                //一般违章
                if (dr[1].ToString() == "03")
                {
                    sql = string.Format("select t.lllegalpersonid userid,t.lllegalperson realname,'" + dr[2].ToString() + @"' itemname,LLLEGALTEAM deptname,('一般违章次数:' || count(1)) remark from V_LLLEGALBASEINFO t where t.flowstate='流程结束' and LLLEGALLEVEL='fc53ff18-b212-4763-9760-baf476eea5f3' and LLLEGALTEAMcode like '{1}%' and lllegalpersonid in(select userid from v_userinfo where isblack=0 and organizecode='{2}' ) group by 
lllegalpersonid,lllegalperson,LLLEGALTEAM having count(1)>{0}", dr[0].ToString(), user.DeptCode, user.OrganizeCode);
                    dt  = BaseRepository().FindTable(sql);
                    dtTemp.Merge(dt);
                }
                //严重违章
                if (dr[1].ToString() == "04")
                {
                    sql = string.Format(@"select t.lllegalpersonid userid,t.lllegalperson realname,'" + dr[2].ToString() + @"' itemname,LLLEGALTEAM deptname,('严重违章:' || count(1)) remark from V_LLLEGALBASEINFO t where t.flowstate='流程结束' and LLLEGALLEVEL='5aae9e88-c06d-4383-afec-6165d5c1a312' and LLLEGALTEAMcode like '{1}%' and lllegalpersonid in(select userid from v_userinfo where isblack=0 and organizecode='{2}' ) group by 
lllegalpersonid,lllegalperson,LLLEGALTEAM having count(1)>{0}", dr[0].ToString(), user.DeptCode, user.OrganizeCode);
                    dt  = BaseRepository().FindTable(sql);
                    dtTemp.Merge(dt);
                }
            }
            return(dtTemp);
        }
Beispiel #11
0
        /// <summary>
        /// 获取待审核部门工作计划
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public int GetPlanApplyBMNum(ERCHTMS.Code.Operator user)
        {
            int count = 0;

            try
            {
                count = BaseRepository().FindObject(string.Format(@"select count(0)
from hrs_planapply
where createuserorgcode='{0}' 
and (instr(checkuseraccount,'{1}')>0 or flowstate='结束') and applytype = '部门工作计划' and baseid is null
and checkuseraccount like '%{1}%'", user.OrganizeCode, user.Account)).ToInt();
            }
            catch {
                return(0);
            }
            return(count);
        }
Beispiel #12
0
        /// <summary>
        /// 根据用户Id获取未读消息数量
        /// </summary>
        /// <param name="pagination"></param>
        /// <param name="queryJson"></param>
        /// <returns></returns>
        public int GetMessCountByUserId(ERCHTMS.Code.Operator currUser)
        {
            //根据登陆用户查询用户关注的消息设置
//           var user = new UserInfoService().GetUserInfoByAccount(currUser.Account);
//            string sql = string.Format(@"select setcategory from base_messageuserset t where t.createuserid='{0}' and  t.createuserorgcode='{1}'", currUser.UserId, currUser.OrganizeCode);
//            DataTable dt = this.BaseRepository().FindTable(sql);
//            var strWhere = string.Empty;
//            if (dt.Rows.Count > 0)
//            {
//                if (!string.IsNullOrWhiteSpace(dt.Rows[0][0].ToString()))
//                {
//                    var arr = dt.Rows[0][0].ToString().Split(',');
//                    strWhere += "and (";
//                    for (int i = 0; i < arr.Length; i++)
//                    {
//                        if (string.IsNullOrWhiteSpace(arr[i])) continue;
//                        else
//                        {
//                            strWhere += string.Format(@" t.category  like '{0}%' or", arr[i]);
//                        }
//                    }
//                    //strWhere = strWhere.Substring(0, strWhere.Length - 2);
//                    strWhere += string.Format(@" t.category  like '{0}%'", "其它");
//                    strWhere += ")";
//                }
//            }
//            string Sql = string.Format(@"select count(d.id) from base_messagedetail d
//left join base_message  t on t.id=d.messageid
//where d.useraccount='{0}' and d.status=0 {1}", currUser.Account, strWhere);
            string Sql = string.Format(@"select count(d.id) from base_messagedetail d
left join base_message  t on t.id=d.messageid
where d.useraccount='{0}' and d.status=0 and (t.category like '其它%' or t.category in({1}))", currUser.Account, string.Format(@"select setcategory from base_messageuserset t where t.createuserid='{0}' and  t.createuserorgcode='{1}'", currUser.UserId, currUser.OrganizeCode));
            var    dt1 = this.BaseRepository().FindTable(Sql);

            if (dt1.Rows.Count > 0)
            {
                return(Convert.ToInt32(dt1.Rows[0][0].ToString()));
            }
            else
            {
                return(0);
            }
        }
        public string GetLyCheckList(ERCHTMS.Code.Operator user)
        {
            string    ids   = "";
            DataTable dt    = this.BaseRepository().FindTable(string.Format(@"select * from XLD_DANGEROUSCHEMICALRECEIVE t"));
            int       count = 0;

            foreach (DataRow dr in dt.Rows)
            {
                if (!string.IsNullOrWhiteSpace(dr["flowdept"].ToString()))
                {
                    if (dr["flowdept"].ToString() == user.DeptId)
                    {
                        if (!string.IsNullOrWhiteSpace(dr["flowrolename"].ToString()))
                        {
                            var roleArr  = user.RoleName.Split(',');      //当前人员角色
                            var roleName = dr["flowrolename"].ToString(); //审核橘色
                            for (var i = 0; i < roleArr.Length; i++)
                            {
                                //满足审核部门同当前人部门id一致,切当前人角色存在与审核角色中
                                if (roleName.IndexOf(roleArr[i]) >= 0)
                                {
                                    ids += "'" + dr["id"].ToString() + "',";
                                    break;
                                }
                            }
                        }
                    }
                }
                DataTable whpList = this.BaseRepository().FindTable(string.Format(@"select * from XLD_DANGEROUSCHEMICAL t where id='{0}'", dr["mainid"].ToString()));
                if (whpList != null && whpList.Rows.Count > 0)
                {
                    if (whpList.Rows[0]["grantpersonid"].ToString() == user.UserId)
                    {
                        if (dr["grantstate"].ToString() == "2")
                        {
                            ids += "'" + dr["id"].ToString() + "',";
                            continue;
                        }
                    }
                }
            }
            return(ids);
        }
        public ActionResult GetListJson(Pagination pagination, string queryJson)
        {
            var watch = CommonHelper.TimerStart();

            pagination.p_kid         = "ID";
            pagination.p_fields      = "NAME,NO,UNIT,MODEL,TYPE,TIMENUM,TIMETYPE,NOTE,LABOROPERATIONUSERNAME,LABOROPERATIONTIME,createuserid,createuserdeptcode,createuserorgcode";//注:此处要替换成需要查询的列
            pagination.p_tablename   = "BIS_LABORPROTECTION";
            pagination.conditionJson = "1=1";
            pagination.sidx          = "CREATEDATE";

            ERCHTMS.Code.Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
            if (user.IsSystem)
            {
                pagination.conditionJson = "1=1";
            }
            else
            {
                if (laborinfobll.GetPer())
                {
                    pagination.conditionJson += " and CREATEUSERORGCODE='" + user.OrganizeCode + "'";
                }
                else
                {
                    string where              = new ERCHTMS.Busines.AuthorizeManage.AuthorizeBLL().GetModuleDataAuthority(ERCHTMS.Code.OperatorProvider.Provider.Current(), HttpContext.Request.Cookies["currentmoduleId"].Value);
                    pagination.conditionJson += " and " + where;
                }
            }

            var data     = laborprotectionbll.GetPageListByProc(pagination, queryJson);
            var jsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));
        }
        public ActionResult GetListJson(Pagination pagination, string queryJson, string type)
        {
            var watch = CommonHelper.TimerStart();

            pagination.p_kid         = "ID";
            pagination.p_fields      = "INFORMCARDNAME,INFORMCARDVALUE,INFORMACARDPOSITION,SETTINGTIME,FileId,FileName,filepath";//注:此处要替换成需要查询的列
            pagination.p_tablename   = "V_STAFFINFORMCARD";
            pagination.conditionJson = "CARDTYPE=" + type;
            pagination.sidx          = "SETTINGTIME";

            if (type == "0")//告知卡库不判断权限
            {
                ERCHTMS.Code.Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
                if (user.IsSystem)
                {
                    pagination.conditionJson = "1=1";
                }
                else
                {
                    string where              = new ERCHTMS.Busines.AuthorizeManage.AuthorizeBLL().GetModuleDataAuthority(ERCHTMS.Code.OperatorProvider.Provider.Current(), HttpContext.Request.Cookies["currentmoduleId"].Value);
                    pagination.conditionJson += " and " + where;
                }
            }

            var data     = staffinformcardbll.GetPageListByProc(pagination, queryJson);
            var jsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));

            //var data = occupationalstaffdetailbll.GetList(queryJson);
            //return ToJsonResult(data);
        }
Beispiel #16
0
        /// <summary>
        /// 判断当前用户是否有审核权限
        /// </summary>
        /// <param name="nodeId">节点Id</param>
        /// <param name="user">当前用户</param>
        /// <param name="projectId">工程Id</param>
        /// <returns></returns>
        public bool HasCheckPower(string nodeId, ERCHTMS.Code.Operator user, string projectId)
        {
            bool      flag       = false;
            string    sendDeptId = BaseRepository().FindObject(string.Format("select ENGINEERLETDEPTID from epg_outsouringengineer where id='{0}'", projectId)).ToString();
            DataTable dt         = BaseRepository().FindTable(string.Format("select t.checkdeptid,t.checkroleid  from BIS_MANYPOWERCHECK t where t.id='{0}'", nodeId));
            string    deptId     = dt.Rows[0][0].ToString();
            string    roleId     = dt.Rows[0][1].ToString();

            string[] arrRole = user.RoleId.Split(',');
            if (deptId == "-1")
            {
                if (sendDeptId == user.DeptId)
                {
                    foreach (string rId in arrRole)
                    {
                        if (roleId.Contains(rId))
                        {
                            flag = true;
                            break;
                        }
                    }
                }
            }
            else
            {
                if (deptId == user.DeptId)
                {
                    foreach (string rId in arrRole)
                    {
                        if (roleId.Contains(rId))
                        {
                            flag = true;
                            break;
                        }
                    }
                }
            }
            return(flag);
        }
        public ActionResult GetListJson(Pagination pagination, string queryJson, string type)
        {
            var watch = CommonHelper.TimerStart();

            pagination.p_kid         = "HID";
            pagination.p_fields      = "AREAVALUE,RISKVALUE,LOCATION,STARTTIME,ENDTIME,STANDARD,DETECTIONUSERNAME,ISEXCESSIVE,CREATEUSERID,CREATEUSERDEPTCODE,CREATEUSERORGCODE";//注:此处要替换成需要查询的列
            pagination.p_tablename   = "BIS_HAZARDDETECTION";
            pagination.conditionJson = "1=1";
            pagination.sidx          = "ENDTIME";
            pagination.sord          = "desc";

            ERCHTMS.Code.Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
            if (user.IsSystem)
            {
                pagination.conditionJson = "1=1";
            }
            else
            {
                string where              = new ERCHTMS.Busines.AuthorizeManage.AuthorizeBLL().GetModuleDataAuthority(ERCHTMS.Code.OperatorProvider.Provider.Current(), HttpContext.Request.Cookies["currentmoduleId"].Value);
                pagination.conditionJson += " and " + where;
            }

            var data     = hazarddetectionbll.GetPageListByProc(pagination, queryJson);
            var jsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));

            //var data = occupationalstaffdetailbll.GetList(queryJson);
            //return ToJsonResult(data);
        }
Beispiel #18
0
        /// <summary>
        /// 根据人员持证率得分(特种作业人员和安全管理人员持证率)
        /// </summary>
        /// <param name="user"></param>
        /// <param name="time">月份,如2017-10-01</param>
        /// <returns></returns>
        public decimal GetIndexScoreByTime(ERCHTMS.Code.Operator user, string time = "")
        {
            string orgId     = user.OrganizeId;
            string orgCode   = user.OrganizeCode;
            string roleNames = user.RoleName;

            string sql   = string.Format("select count(1) from BIS_CLASSIFICATIONINDEX where affiliatedorganizeid=@orgId");
            int    count = this.BaseRepository().FindObject(sql, new DbParameter[] { DbParameters.CreateDbParameter("@orgId", orgId) }).ToInt();                                              //查询当前电厂是否有设置考核指标

            sql = string.Format("select t.indexscore totalscore,t.indexstandardformat descr,t.indexargsvalue val,indexcode from  BIS_CLASSIFICATIONINDEX t where t.classificationcode='10'"); //人员管理
            //没有的话就使用内置默认的数据
            if (count == 0)
            {
                sql += " and affiliatedorganizeid='0'";
            }
            else
            {
                sql += " and affiliatedorganizeid=@orgId";
            }
            //获取各项设置的指标值
            DataTable dt = this.BaseRepository().FindTable(sql, new DbParameter[] { DbParameters.CreateDbParameter("@orgId", orgId) });
            //总得分
            decimal totalScore = 0;

            foreach (DataRow dr in dt.Rows)
            {
                decimal sumScore = decimal.Parse(dr["totalscore"].ToString());
                decimal sum = 0; decimal num = 0; decimal score = 0;
                //特种作业人员持证率
                if (dr["indexcode"].ToString() == "01")
                {
                    string certType = "特种作业操作证";
                    sum = decimal.Parse(this.BaseRepository().FindObject(string.Format("select count(1) from base_user u where (isspecial='是' or isspecialequ='是') and organizecode='{0}') group by userid) t", orgCode)).ToString());
                    if (sum > 0)
                    {
                        num = decimal.Parse(this.BaseRepository().FindObject(string.Format("select case when sum(num) is null then 0 else  sum(num) end from (select  count(1) as num from BIS_CERTIFICATE t where certname='{1}' and enddate<sysdate and userid in(select userid from base_user u where (isspecial='是' or isspecialequ='是') and organizecode='{0}') group by userid) t", orgCode, certType)).ToString());
                        decimal  result = num / sum;
                        string[] arr    = dr["val"].ToString().Split('|');
                        if (result > decimal.Parse(arr[0]))
                        {
                            result = decimal.Parse(arr[0]) - result;
                            count  = int.Parse((result / decimal.Parse(arr[1])).ToString());
                            if (count > 1)
                            {
                                score = sumScore - count * decimal.Parse(arr[2]);
                                if (score > 0)
                                {
                                    totalScore += sumScore - score;
                                }
                            }
                        }
                    }
                    else
                    {
                        totalScore += sumScore;
                    }
                }
                //安全管理人员持证率
                else if (dr["indexcode"].ToString() == "02")
                {
                    sum = decimal.Parse(this.BaseRepository().FindObject(string.Format("select count(1) from base_user u where usertype='安全管理人员' and organizecode='{0}') group by userid) t", orgCode)).ToString());
                    if (sum > 0)
                    {
                        num = decimal.Parse(this.BaseRepository().FindObject(string.Format("select case when sum(num) is null then 0 else  sum(num) end from (select  count(1) as num from BIS_CERTIFICATE t where  enddate<sysdate and userid in(select userid from base_user u where usertype='安全管理人员' and organizecode='{0}') group by userid) t", orgCode)).ToString());
                        decimal  result = num / sum;
                        string[] arr    = dr["val"].ToString().Split('|');
                        if (result > decimal.Parse(arr[0]))
                        {
                            result = decimal.Parse(arr[0]) - result;
                            count  = int.Parse((result / decimal.Parse(arr[1])).ToString());
                            if (count > 1)
                            {
                                score = sumScore - count * decimal.Parse(arr[2]);
                                if (score > 0)
                                {
                                    totalScore += sumScore - score;
                                }
                            }
                        }
                    }
                    else
                    {
                        totalScore += sumScore;
                    }
                }
            }
            dt.Dispose();
            return(totalScore);
        }
Beispiel #19
0
 /// <summary>
 /// 首页待办事项
 /// </summary>
 /// <param name="user"></param>
 /// <param name="mode"></param>
 /// <returns></returns>
 public int[] GetCheckCount(ERCHTMS.Code.Operator user, int mode)
 {
     return(service.GetCheckCount(user, mode));
 }
Beispiel #20
0
 /// <summary>
 /// 获取列表
 /// </summary>
 public DataTable GetCheckStat(ERCHTMS.Code.Operator user, int category = 2)
 {
     return(service.GetCheckStat(user, category));
 }
Beispiel #21
0
        /// <summary>
        /// 安全检查统计
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public object GetCheckStatistics(ERCHTMS.Code.Operator user)
        {
            string roleNames = user.RoleName;
            var    arg       = "";
            string sql       = string.Format(@"select checkdatatype ,nvl(sum(num),0),count(1) from bis_saftycheckdatarecord a 
left join (
select safetycheckobjectid,count(1) num from bis_htbaseinfo where safetycheckobjectid is not null group by safetycheckobjectid)b
on a.id=b.safetycheckobjectid  where 1=1 and to_char(CreateDate,'yyyy')='{0}'", DateTime.Now.Year);

            if (user.RoleName.Contains("厂级") || user.RoleName.Contains("公司"))
            {
                arg  = user.DeptCode.Substring(0, 3);
                sql += string.Format("  and belongdept like '{0}%'", arg);
            }
            else
            {
                arg  = user.DeptCode;
                sql += string.Format("  and belongdept in(select encode from base_department  where encode like '{0}%')", arg, user.DeptId);
            }
            sql += " group by checkdatatype";
            DataTable dt = this.BaseRepository().FindTable(sql);
            int       count1 = 0; int count2 = 0; int count3 = 0; int count4 = 0; int count5 = 0;
            int       countyh1 = 0; int countyh2 = 0; int countyh3 = 0; int countyh4 = 0; int countyh5 = 0;

            if (dt.Select("checkdatatype='1'").Length != 0)
            {
                countyh1 = int.Parse(dt.Select("checkdatatype='1'")[0][1].ToString());
                count1   = int.Parse(dt.Select("checkdatatype='1'")[0][2].ToString());
            }
            if (dt.Select("checkdatatype='2'").Length != 0)
            {
                countyh2 = int.Parse(dt.Select("checkdatatype='2'")[0][1].ToString());
                count2   = int.Parse(dt.Select("checkdatatype='2'")[0][2].ToString());
            }
            if (dt.Select("checkdatatype='3'").Length != 0)
            {
                countyh3 = int.Parse(dt.Select("checkdatatype='3'")[0][1].ToString());
                count3   = int.Parse(dt.Select("checkdatatype='3'")[0][2].ToString());
            }
            if (dt.Select("checkdatatype='4'").Length != 0)
            {
                countyh4 = int.Parse(dt.Select("checkdatatype='4'")[0][1].ToString());
                count4   = int.Parse(dt.Select("checkdatatype='4'")[0][2].ToString());
            }
            if (dt.Select("checkdatatype='5'").Length != 0)
            {
                countyh5 = int.Parse(dt.Select("checkdatatype='5'")[0][1].ToString());
                count5   = int.Parse(dt.Select("checkdatatype='5'")[0][2].ToString());
            }
            int sum   = count1 + count2 + count3 + count4 + count5;
            int sumyh = countyh1 + countyh2 + countyh3 + countyh4 + countyh5;

            List <object> list      = new List <object>();
            decimal       percent   = sum == 0 ? 0 : decimal.Parse(count1.ToString()) / decimal.Parse(sum.ToString());
            decimal       percentyh = sumyh == 0 ? 0 : decimal.Parse(countyh1.ToString()) / decimal.Parse(sumyh.ToString());

            list.Add(new { checktype = "日常检查", checknum = count1, checkrate = Math.Round(percent, 4), problemnum = countyh1, problemrate = Math.Round(percentyh, 4) });

            percent   = sum == 0 ? 0 : decimal.Parse(count2.ToString()) / decimal.Parse(sum.ToString());
            percentyh = sumyh == 0 ? 0 : decimal.Parse(countyh2.ToString()) / decimal.Parse(sumyh.ToString());
            list.Add(new { checktype = "专项检查", checknum = count2, checkrate = Math.Round(percent, 4), problemnum = countyh2, problemrate = Math.Round(percentyh, 4) });

            percent   = sum == 0 ? 0 : decimal.Parse(count3.ToString()) / decimal.Parse(sum.ToString());
            percentyh = sumyh == 0 ? 0 : decimal.Parse(countyh3.ToString()) / decimal.Parse(sumyh.ToString());
            list.Add(new { checktype = "节假日检查", checknum = count3, checkrate = Math.Round(percent, 4), problemnum = countyh3, problemrate = Math.Round(percentyh, 4) });

            percent   = sum == 0 ? 0 : decimal.Parse(count4.ToString()) / decimal.Parse(sum.ToString());
            percentyh = sumyh == 0 ? 0 : decimal.Parse(countyh4.ToString()) / decimal.Parse(sumyh.ToString());
            list.Add(new { checktype = "季节性检查", checknum = count4, checkrate = Math.Round(percent, 4), problemnum = countyh4, problemrate = Math.Round(percentyh, 4) });

            percent   = sum == 0 ? 0 : decimal.Parse(count5.ToString()) / decimal.Parse(sum.ToString());
            percentyh = sumyh == 0 ? 0 : decimal.Parse(countyh5.ToString()) / decimal.Parse(sumyh.ToString());
            list.Add(new { checktype = "综合性检查", checknum = count5, checkrate = Math.Round(percent, 4), problemnum = countyh5, problemrate = Math.Round(percentyh, 4) });
            return(new { checktotalnum = sum, checkproblemnum = sumyh, checklist = list });
        }
Beispiel #22
0
        /// <summary>
        /// 首页待办事项
        /// </summary>
        /// <param name="user"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        public int[] GetCheckCount(ERCHTMS.Code.Operator user, int mode)
        {
            int[] countSum = new int[5];
            int   count1 = 0, count2 = 0, count3 = 0, count4 = 0, countRc = 0;

            if (mode == 0)
            {
                string    sql = string.Format(@"select checkDataType,count(1) from   bis_saftycheckdatarecord t left join  (select recid from bis_saftycontent where CheckManAccount='{0}' group by  recid)t1
on t.id=t1.recid  where recid is not null and ((instr(solveperson,'{0}'))=0 or solveperson is null)  and belongdept like  '{1}%' group by checkDataType", user.Account, user.OrganizeCode);
                DataTable dt  = this.BaseRepository().FindTable(sql);
                count1 = dt.Select("checkDataType='2'").Length == 0 ? 0 : int.Parse(dt.Select("checkDataType='2'")[0][1].ToString());
                count2 = dt.Select("checkDataType='3'").Length == 0 ? 0 : int.Parse(dt.Select("checkDataType='3'")[0][1].ToString());
                count3 = dt.Select("checkDataType='4'").Length == 0 ? 0 : int.Parse(dt.Select("checkDataType='4'")[0][1].ToString());
                count4 = dt.Select("checkDataType='5'").Length == 0 ? 0 : int.Parse(dt.Select("checkDataType='5'")[0][1].ToString());
                string sqlRc = string.Format(@"select count(1) from bis_saftycheckdatarecord where checkDataType='1' and  instr(checkmanid,'{0}')>0  and ((instr(solveperson,'{0}'))=0 or solveperson is null)  and belongdept like  '{1}%' ", user.Account, user.OrganizeCode);
                countRc = this.BaseRepository().FindObject(sqlRc).ToInt();
            }
            else if (mode == 1)
            {
                if (user.RoleName.Contains("公司"))
                {
                    string    sql = string.Format("select checkDataType,count(1) from bis_saftycheckdatarecord where solveperson is null and belongdept like '{0}%' group by checkDataType", user.DeptCode);
                    DataTable dt  = this.BaseRepository().FindTable(sql);
                    countRc = dt.Select("checkDataType='1'").Length == 0 ? 0 : int.Parse(dt.Select("checkDataType='1'")[0][1].ToString());
                    count1  = dt.Select("checkDataType='2'").Length == 0 ? 0 : int.Parse(dt.Select("checkDataType='2'")[0][1].ToString());
                    count2  = dt.Select("checkDataType='3'").Length == 0 ? 0 : int.Parse(dt.Select("checkDataType='3'")[0][1].ToString());
                    count3  = dt.Select("checkDataType='4'").Length == 0 ? 0 : int.Parse(dt.Select("checkDataType='4'")[0][1].ToString());
                    count4  = dt.Select("checkDataType='5'").Length == 0 ? 0 : int.Parse(dt.Select("checkDataType='5'")[0][1].ToString());
                }
                else
                {
                    string    sql = string.Format(@"select checkDataType,count(1) from bis_saftycheckdatarecord t right join (select * from (select id,(','||checkmanid||',') as solveperson  from  bis_saftycheckdatarecord) a 
left join (
select (','||account||',') as account from base_user where  departmentcode in(select encode from base_department  where encode= '{0}')
) b on a.solveperson  like '%'||b.account||'%' where (account is not null or solveperson=',,'))d
 on t.id=d.id  where t.id in(select id from bis_saftycheckdatarecord t left join  (select recid from (select id,(','||CheckManAccount||',') as CheckManAccount,recid  from  BIS_SAFTYCONTENT) a 
left join (select (','||account||',') as account from base_user where  departmentcode in(select encode from base_department  where encode= '{0}')
) b on a.CheckManAccount  like '%'||b.account||'%' where account is not null  group by recid)t1
on t.id=t1.recid where t1.recid is not null) group by checkDataType", user.DeptCode);
                    DataTable dt  = this.BaseRepository().FindTable(sql);
                    count1 = dt.Select("checkDataType='2'").Length == 0 ? 0 : int.Parse(dt.Select("checkDataType='2'")[0][1].ToString());
                    count2 = dt.Select("checkDataType='3'").Length == 0 ? 0 : int.Parse(dt.Select("checkDataType='3'")[0][1].ToString());
                    count3 = dt.Select("checkDataType='4'").Length == 0 ? 0 : int.Parse(dt.Select("checkDataType='4'")[0][1].ToString());
                    count4 = dt.Select("checkDataType='5'").Length == 0 ? 0 : int.Parse(dt.Select("checkDataType='5'")[0][1].ToString());
                    string sqlRc = string.Format(@"select count(1) from bis_saftycheckdatarecord t right join (select * from (select id,(','||checkmanid||',') as solveperson  from  bis_saftycheckdatarecord where  checkDataType='1') a 
left join (
select (','||account||',') as account from base_user where  departmentcode in(select encode from base_department  where encode= '{0}')
) b on a.solveperson  like '%'||b.account||'%' where (account is not null or solveperson=',,')  )d
 on t.id=d.id  where t.id in(
 select t.id from  bis_saftycheckdatarecord t left join(select id from (select id,(','||checkmanid||',') as checkmanid  from  bis_saftycheckdatarecord) a 
left join (
select (','||account||',') as account from base_user where  departmentcode in(select encode from base_department  where encode= '{0}' )
) b on a.checkmanid  like '%'||b.account||'%' where account is not null group by id)t1
on t.ID=t1.id where t1.id is not null
) ", user.DeptCode);
                    countRc = this.BaseRepository().FindObject(sqlRc).ToInt();
                }
            }
            countSum[0] = countRc;
            countSum[1] = count1;
            countSum[2] = count2;
            countSum[3] = count3;
            countSum[4] = count4;
            return(countSum);
        }
Beispiel #23
0
 public List <SaftyCheckDataRecordEntity> GetSaftDataIndexList(ERCHTMS.Code.Operator user)
 {
     return(service.GetSaftDataIndexList(user));
 }
Beispiel #24
0
 /// <summary>
 /// 获取首页安全检查考核结果数据
 /// </summary>
 /// <param name="user">当前登录人user</param>
 /// <param name="time">统计时间</param>
 /// <returns></returns>
 public object GetSafeCheckWarningByTime(ERCHTMS.Code.Operator user, string time, int mode = 0)
 {
     return(service.GetSafeCheckWarningByTime(user, time, mode));
 }
Beispiel #25
0
        /// <summary>
        /// 同步用户信息到培训平台
        /// </summary>
        /// <param name="user">用户基本信息</param>
        /// <param name="pwd">密码</param>
        /// <returns></returns>
        public string SyncUser(UserEntity user, string pwd, ERCHTMS.Code.Operator currUser = null)
        {
            string logPath  = new DataItemDetailService().GetItemValue("imgPath") + "\\logs\\";
            string fileName = "Train_" + DateTime.Now.ToString("yyyyMMdd") + ".log";

            try
            {
                string    result = "";
                DataTable dt     = BaseRepository().FindTable(string.Format("select px_deptid from xss_dept where deptid='{0}'", user.DepartmentId));
                if (dt.Rows.Count > 0)
                {
                    string deptId = dt.Rows[0][0].ToString();
                    pwd  = pwd.Replace("*", "");
                    user = DbFactory.Base().FindEntity <UserEntity>(user.UserId);
                    if (string.IsNullOrEmpty(user.NewPassword))
                    {
                        pwd = string.IsNullOrEmpty(pwd) ? "123456" : pwd;
                    }
                    else
                    {
                        pwd = DESEncrypt.Decrypt(user.NewPassword, user.Secretkey);
                    }
                    List <object> list = new List <object>();
                    list.Add(new
                    {
                        Id          = user.UserId,
                        userName    = user.RealName,
                        userAccount = user.Account,
                        pwd         = pwd,
                        IdCard      = user.IdentifyID,
                        departid    = deptId,
                        role        = "0",
                        userkind    = "一般人员",
                        telephone   = user.Mobile
                    });
                    if (user.IsTrainAdmin == 1)
                    {
                        string str  = user.IdentifyID.Substring(0, user.IdentifyID.Length - 1);
                        string last = user.IdentifyID.Substring(user.IdentifyID.Length - 1);
                        if (last.ToLower().Equals("x") || !last.Equals("0"))
                        {
                            last = "1";
                        }
                        else
                        {
                            last = "0";
                        }
                        list.Add(new
                        {
                            Id          = Guid.NewGuid().ToString(),
                            userName    = user.RealName,
                            userAccount = user.Account + "gly",
                            pwd         = pwd,
                            IdCard      = str + last,
                            departid    = deptId,
                            role        = "1",
                            userkind    = "一般人员",
                            telephone   = user.Mobile
                        });
                    }
                    WebClient wc = new WebClient();
                    wc.Credentials = CredentialCache.DefaultCredentials;
                    //wc.Headers.Add("Content-Type", "text/json; charset=utf-8");
                    wc.Encoding = Encoding.GetEncoding("GB2312");
                    System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection();
                    byte[] bytes = null;
                    //发送请求到web api并获取返回值,默认为post方式
                    string url  = new DataItemDetailService().GetItemValue("TrainServiceUrl");
                    string json = Newtonsoft.Json.JsonConvert.SerializeObject(new { business = "saverUser", UserInfo = list });
                    nc.Add("json", json);
                    bytes  = wc.UploadValues(new Uri(url), "POST", nc);
                    result = Encoding.UTF8.GetString(bytes);
                    dynamic dy = Newtonsoft.Json.JsonConvert.DeserializeObject <ExpandoObject>(result);

                    if (dy.meta.success)
                    {
                        int count = BaseRepository().FindObject(string.Format("select count(1) from xss_user where useraccount='{0}'", user.Account)).ToInt();
                        if (count == 0)
                        {
                            if (BaseRepository().ExecuteBySql(string.Format("insert into xss_user(userid,useraccount,username,deptid,deptcode,px_deptid,px_uid,px_account,idcard) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", user.UserId, user.Account, user.RealName, user.DepartmentId, user.DepartmentCode, deptId, user.UserId, user.Account, user.IdentifyID)) > 0)
                            {
                                System.IO.File.AppendAllText(logPath + fileName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " >操作用户:" + currUser.Account + "(" + currUser.UserName + "),新增用户关联信息到双控平台成功,用户信息:" + json + "\r\n");
                            }
                            else
                            {
                                System.IO.File.AppendAllText(logPath + fileName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " >操作用户:" + currUser.Account + "(" + currUser.UserName + "),新增用户关联信息到双控平台失败,用户信息:" + json + " \r\n");
                            }
                        }
                    }
                    System.IO.File.AppendAllText(logPath + fileName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " >操作用户:" + currUser.Account + "(" + currUser.UserName + "),执行动作:同步用户到培训平台,返回结果:" + result + "\r\n");
                }
                else
                {
                    System.IO.File.AppendAllText(logPath + fileName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " >操作用户:" + currUser.Account + "(" + currUser.UserName + "),执行动作:同步用户到培训平台,返回结果:\r\n");
                }
                return(result);
            }
            catch (Exception ex)
            {
                System.IO.File.AppendAllText(logPath + fileName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " >:" + currUser.Account + "(" + currUser.UserName + "),同步用户到培训平台失败,该用户所属部门在培训平台中不存在或关系未配置!\r\n");
                return(ex.Message);
            }
        }
Beispiel #26
0
 /// <summary>
 /// 首页提醒
 /// </summary>
 /// <returns></returns>
 public int CountIndex(ERCHTMS.Code.Operator user)
 {
     return(service.CountIndex(user));
 }