Пример #1
0
        public ActionResult GetSelectChangeWorkJson(Pagination pagination, string queryJson)
        {
            pagination.p_kid         = "Id as workid";
            pagination.p_fields      = "workunit,workunitid,workunitcode,case when workunittype='0'  then '电厂内部'  when  workunittype='1' then '外包单位' end workunittypename,workunittype,changereason,workplace,applychangetime,returntime,projectid,projectname";
            pagination.p_tablename   = " bis_Safetychange t";
            pagination.conditionJson = "iscommit=1 and isapplyover=1 and isaccpcommit in (0,1) and isaccepover=0";
            Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();

            if (!user.IsSystem)
            {
                pagination.conditionJson += string.Format(" and workunitcode in(select encode from base_department  where encode like '{0}%' or senddeptid='{1}')", user.DeptCode, user.DeptId);
            }
            var data     = safetychangebll.GetPageList(pagination, queryJson);
            var watch    = CommonHelper.TimerStart();
            var jsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));
        }
Пример #2
0
 public ActionResult GetSelectChangeWorkJson(Pagination pagination, string queryJson)
 {
     try
     {
         pagination.p_kid         = "Id as workid";
         pagination.p_fields      = "workunit,workunitid,workunitcode,case when workunittype='0'  then '单位内部'  when  workunittype='1' then '外包单位' end workunittypename,workunittype,changereason,workplace,applychangetime,returntime,projectid,projectname,workarea";
         pagination.p_tablename   = " bis_Safetychange t";
         pagination.conditionJson = "iscommit=1 and isapplyover=1";
         Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
         if (!user.IsSystem)
         {
             if (user.RoleName.Contains("厂级") || user.RoleName.Contains("公司"))
             {
                 pagination.conditionJson += " and createuserorgcode='" + user.OrganizeCode + "'";
             }
             else
             {
                 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);
             }
             pagination.conditionJson += " and ((t.id not in(select id from bis_safetychange where ((isaccpcommit=0 and isaccepover=0  and  RealityChangeTime is null) or (isaccpcommit=1 and isaccepover=1))))  or (isaccpcommit=0 and isaccepover=0 and  RealityChangeTime is null))";
         }
         var data     = safetychangebll.GetPageList(pagination, queryJson);
         var watch    = CommonHelper.TimerStart();
         var jsonData = new
         {
             rows     = data,
             total    = pagination.total,
             page     = pagination.page,
             records  = pagination.records,
             costtime = CommonHelper.TimerEnd(watch)
         };
         return(ToJsonResult(jsonData));
     }
     catch (Exception ex)
     {
         return(Error(ex.Message));
     }
 }
Пример #3
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()));
            }
        }