예제 #1
0
        public ActionResult GetLeaveApproveList(Pagination pagination, string queryJson)
        {
            pagination.conditionJson = " 1=1 ";
            var queryParam = queryJson.ToJObject();

            //根据后台配置查看数据权限
            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;
            }
            var    watch = CommonHelper.TimerStart();
            var    dt    = leaveApproveBLL.GetLeaveApproveList(pagination, queryJson);
            string str   = string.Empty;

            foreach (DataRow row in dt.Rows)
            {
                str = manypowercheckbll.GetApproveUserAccount(row["flowid"].ToString(), row["id"].ToString(), "", "", row["LeaveDeptId"].ToString());
                //获取审核人账号
                row["approveuseraccount"] = str;
            }
            var jsonData = new
            {
                rows     = dt,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));
        }
예제 #2
0
        public ActionResult GetPageListJson(Pagination pagination, string queryJson)
        {
            try
            {
                var watch = CommonHelper.TimerStart();
                pagination.p_kid       = "t.id";
                pagination.p_fields    = @"t.createuserid,
                                           t.createdate,t.changetype,t.projectname,t.changename,t.workunittype,t.projectid,
                                           t.applyunit,t.applychangetime,t.returntime,
                                           t.applyunitid,t.applypeople,t.applypeopleid,
                                           t.applytime, t.workunit,t.workunitid,t.applyno,
                                           t.iscommit,t.isaccepover,t.isapplyover,t.acceppeople,
                                           t.flowdept,t.nodename,t.nodeid,t.isaccpcommit,t.createuserdeptcode,
                                           t.flowrole,t.flowdeptname,t.flowrolename,t.flowremark,t.specialtytype,t.accspecialtytype,'' as approveuserid,b.outtransferuseraccount,b.intransferuseraccount,'' as approveuseraccount,
                                        case 
                                                 when t.iscommit=0 then 0
                                                 when t.iscommit=1 and t.isapplyover=0  then 1
                                                 when t.iscommit=1 and t.isapplyover=2  then 2
                                                 when t.iscommit=1 and t.isapplyover=1 and isaccpcommit=0 and t.isaccepover=0 then 3
                                                 when t.iscommit=1 and t.isapplyover=1 and isaccpcommit=1 and t.isaccepover=0 then 4
                                                 when t.iscommit=1 and t.isapplyover=1 and isaccpcommit=1 and t.isaccepover=2 then 5
                                                 when t.iscommit=1 and t.isapplyover=1 and isaccpcommit=1 and t.isaccepover=1 then 6 else 7 end currstate,
                                         case 
                                                 when t.iscommit=0 then '变动申请中'
                                                 when t.iscommit=1 and t.isapplyover=0  then '变动审核(批)中'
                                                 when t.iscommit=1 and t.isapplyover=2  then '变动审核(批)未通过'
                                                 when t.iscommit=1 and t.isapplyover=1 and isaccpcommit=0 and t.isaccepover=0 then '变动审核(批)通过待验收'
                                                 when t.iscommit=1 and t.isapplyover=1 and isaccpcommit=1 and t.isaccepover=0 then '验收审核中'
                                                 when t.iscommit=1 and t.isapplyover=1 and isaccpcommit=1 and t.isaccepover=2 then '验收审核(批)未通过'
                                                 when t.iscommit=1 and t.isapplyover=1 and isaccpcommit=1 and t.isaccepover=1 then '验收审核(批)通过' else '' end resultstate";
                pagination.p_tablename = @"   bis_safetychange t left join (select recid,flowid,outtransferuseraccount,intransferuseraccount,row_number()  over(partition by recid,flowid order by createdate desc) as num from BIS_TRANSFERRECORD where disable=0) b on t.id=b.recid and t.nodeid=b.flowid and b.num=1";
                //pagination.sidx = "t.createdate";//排序字段
                //pagination.sord = "desc";//排序方式
                pagination.conditionJson = "1=1";
                Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
                if (!user.IsSystem)
                {
                    string authType = new AuthorizeBLL().GetOperAuthorzeType(user, HttpContext.Request.Cookies["currentmoduleId"].Value, "search");
                    if (!string.IsNullOrEmpty(authType))
                    {
                        string isAllDataRange = new ERCHTMS.Busines.SystemManage.DataItemDetailBLL().GetEnableItemValue("HighRiskWorkDataRange"); //特殊标记,高风险作业模块是否看全厂数据
                        if (!string.IsNullOrEmpty(isAllDataRange))
                        {
                            pagination.conditionJson += " and t.createuserorgcode='" + user.OrganizeCode + "'";
                        }
                        else
                        {
                            switch (authType)
                            {
                            case "1":
                                pagination.conditionJson += " and applypeopleid='" + user.UserId + "'";
                                break;

                            case "2":
                                pagination.conditionJson += " and workunitcode='" + user.DeptCode + "'";
                                break;

                            case "3":    //本子部门
                                pagination.conditionJson += string.Format(" and ((workunitcode in(select encode from base_department where encode like '{0}%'))  or (projectid in(select id from epg_outsouringengineer a where a.engineerletdeptid = '{1}')))", user.DeptCode, user.DeptId);
                                break;

                            case "4":
                                pagination.conditionJson += " and t.createuserorgcode='" + user.OrganizeCode + "'";
                                break;
                            }
                        }
                    }
                    else
                    {
                        pagination.conditionJson += " and 0=1";
                    }
                }
                DataTable data = safetychangebll.GetPageList(pagination, queryJson);
                for (int i = 0; i < data.Rows.Count; i++)
                {
                    string executedept = string.Empty;
                    highriskcommonapplybll.GetExecutedept(data.Rows[i]["workunittype"].ToString(), data.Rows[i]["workunitid"].ToString(), data.Rows[i]["projectid"].ToString(), out executedept);                                            //获取执行部门
                    string createdetpid           = departmentbll.GetEntityByCode(data.Rows[i]["createuserdeptcode"].ToString()).IsEmpty() ? "" : departmentbll.GetEntityByCode(data.Rows[i]["createuserdeptcode"].ToString()).DepartmentId; //获取创建部门
                    string outsouringengineerdept = string.Empty;
                    highriskcommonapplybll.GetOutsouringengineerDept(data.Rows[i]["workunitid"].ToString(), out outsouringengineerdept);
                    string str = manypowercheckbll.GetApproveUserAccount(data.Rows[i]["nodeid"].ToString(), data.Rows[i]["id"].ToString(), "", data.Rows[i]["specialtytype"].ToString(), executedept, outsouringengineerdept, createdetpid, "", "");
                    data.Rows[i]["approveuseraccount"] = str;
                }
                var jsonData = new
                {
                    rows     = data,
                    total    = pagination.total,
                    page     = pagination.page,
                    records  = pagination.records,
                    costtime = CommonHelper.TimerEnd(watch)
                };
                return(ToJsonResult(jsonData));
            }
            catch (System.Exception ex)
            {
                return(Error(ex.ToString()));
            }
        }