/// <summary> /// 获取审查数据 /// </summary> /// <param name="pagination"></param> /// <param name="queryJson"></param> /// <returns></returns> public DataTable GetIntromissionPageList(Pagination pagination, string queryJson) { DatabaseType dataType = DbHelper.DbType; Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current(); if (!string.IsNullOrEmpty(queryJson)) { var queryParam = queryJson.ToJObject(); //时间范围 if (!queryParam["sTime"].IsEmpty() || !queryParam["eTime"].IsEmpty()) { string startTime = queryParam["sTime"].ToString(); string endTime = queryParam["eTime"].ToString(); if (queryParam["sTime"].IsEmpty()) { startTime = "1899-01-01"; } if (queryParam["eTime"].IsEmpty()) { endTime = DateTime.Now.ToString("yyyy-MM-dd"); } pagination.conditionJson += string.Format(" and to_date(to_char(a.applytime,'yyyy-MM-dd'),'yyyy-MM-dd') between to_date('{0}','yyyy-MM-dd') and to_date('{1}','yyyy-MM-dd')", startTime, endTime); } //查询条件 if (!queryParam["condition"].IsEmpty() && !queryParam["txtSearch"].IsEmpty()) { pagination.conditionJson += string.Format(" and {0} like '%{1}%'", queryParam["condition"].ToString(), queryParam["txtSearch"].ToString()); } if (!queryParam["indexState"].IsEmpty())//首页代办 { string strCondition = ""; strCondition = string.Format(" and a.createuserorgcode='{0}' and a.investigatestate !='3'", user.OrganizeCode); DataTable data = BaseRepository().FindTable("select " + pagination.p_kid + "," + pagination.p_fields + " from " + pagination.p_tablename + " where " + pagination.conditionJson + strCondition); for (int i = 0; i < data.Rows.Count; i++) { var engineerEntity = outsouringengineerservice.GetEntity(data.Rows[i]["outengineerid"].ToString()); var excutdept = departmentservice.GetEntity(engineerEntity.ENGINEERLETDEPTID).DepartmentId; var outengineerdept = departmentservice.GetEntity(engineerEntity.OUTPROJECTID).DepartmentId; var supervisordept = string.IsNullOrEmpty(engineerEntity.SupervisorId) ? "" : departmentservice.GetEntity(engineerEntity.SupervisorId).DepartmentId; //获取下一步审核人 string str = powerCheck.GetApproveUserId(data.Rows[i]["flowid"].ToString(), data.Rows[i]["id"].ToString(), "", "", excutdept, outengineerdept, "", "", "", supervisordept, data.Rows[i]["outengineerid"].ToString()); data.Rows[i]["approveuserids"] = str; } string[] applyids = data.Select(" approveuserids like '%" + user.UserId + "%'").AsEnumerable().Select(d => d.Field <string>("id")).ToArray(); pagination.conditionJson += string.Format(" and a.id in ('{0}') {1}", string.Join("','", applyids), strCondition); } if (!queryParam["projectid"].IsEmpty()) { pagination.conditionJson += string.Format(" and b.id ='{0}'", queryParam["projectid"].ToString()); } } var dt = this.BaseRepository().FindTableByProcPager(pagination, dataType); return(dt); }
/// <summary> /// 获取分页数据 /// </summary> /// <param name="keyValue">主键值</param> /// <returns>返回对象Json</returns> public DataTable GetPageList(Pagination pagination, string queryJson) { DatabaseType dataType = DbHelper.DbType; Operator currUser = OperatorProvider.Provider.Current(); var queryParam = queryJson.ToJObject(); if (!queryParam["name"].IsEmpty()) { pagination.conditionJson += string.Format(" and (e.engineername like'%{0}%' or b.fullname like'%{1}%') ", queryParam["name"].ToString(), queryParam["name"].ToString()); } if (!queryParam["orgCode"].IsEmpty()) { pagination.conditionJson += string.Format(" and s.createuserorgcode='{0}' ", queryParam["orgCode"].ToString()); } if (!queryParam["StartTime"].IsEmpty()) { pagination.conditionJson += string.Format(" and s.applyreturntime>= to_date('{0}','yyyy-MM-dd hh24:mi:ss') ", queryParam["StartTime"].ToString()); } if (!queryParam["EndTime"].IsEmpty()) { pagination.conditionJson += string.Format(" and s.applyreturntime<= to_date('{0}','yyyy-MM-dd hh24:mi:ss') ", Convert.ToDateTime(queryParam["EndTime"]).AddDays(1).ToString("yyyy-MM-dd")); } //外包工程Id if (!queryParam["ProjectId"].IsEmpty()) { pagination.conditionJson += string.Format(" and s.OUTENGINEERID='{0}'", queryParam["ProjectId"].ToString()); } //外包单位Id if (!queryParam["UnitId"].IsEmpty()) { pagination.conditionJson += string.Format(" and s.OUTPROJECTID='{0}'", queryParam["UnitId"].ToString()); } //发包部门Id if (!queryParam["DeptId"].IsEmpty()) { pagination.conditionJson += string.Format(" and e.engineerletdeptid='{0}'", queryParam["DeptId"].ToString()); } if (!queryParam["indexState"].IsEmpty())//首页代办 { string strCondition = ""; strCondition = string.Format(" and s.createuserorgcode='{0}' and s.iscommit ='1' and s.isover='0'", currUser.OrganizeCode); DataTable data = BaseRepository().FindTable("select " + pagination.p_kid + "," + pagination.p_fields + " from " + pagination.p_tablename + " where " + pagination.conditionJson + strCondition); for (int i = 0; i < data.Rows.Count; i++) { var engineerEntity = outsouringengineerservice.GetEntity(data.Rows[i]["outengineerid"].ToString()); var excutdept = departmentservice.GetEntity(engineerEntity.ENGINEERLETDEPTID).DepartmentId; var outengineerdept = departmentservice.GetEntity(engineerEntity.OUTPROJECTID).DepartmentId; var supervisordept = string.IsNullOrEmpty(engineerEntity.SupervisorId) ? "" : departmentservice.GetEntity(engineerEntity.SupervisorId).DepartmentId; //获取下一步审核人 string str = powerCheck.GetApproveUserId(data.Rows[i]["nodeid"].ToString(), data.Rows[i]["id"].ToString(), "", "", excutdept, outengineerdept, "", "", "", supervisordept, data.Rows[i]["outengineerid"].ToString()); data.Rows[i]["approveuserids"] = str; } string[] applyids = data.Select(" approveuserids like '%" + currUser.UserId + "%'").AsEnumerable().Select(d => d.Field <string>("id")).ToArray(); pagination.conditionJson += string.Format(" and s.id in ('{0}') {1}", string.Join("','", applyids), strCondition); } if (!queryParam["projectid"].IsEmpty()) { pagination.conditionJson += string.Format(" and e.id ='{0}'", queryParam["projectid"].ToString()); } DataTable dt = this.BaseRepository().FindTableByProcPager(pagination, dataType); return(dt); }
/// <summary> /// 获取列表 /// </summary> /// <param name="pagination">分页</param> /// <param name="queryJson">查询参数</param> /// <returns>返回分页列表</returns> public DataTable GetPageList(Pagination pagination, string queryJson) { DatabaseType dataType = DbHelper.DbType; Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current(); string role = user.RoleName; var queryParam = queryJson.ToJObject(); #region 查表 pagination.p_kid = "a.id"; pagination.p_fields = string.IsNullOrWhiteSpace(pagination.p_fields) ? @"a.createuserid,a.createuserdeptcode,a.createuserorgcode,a.issubmit,a.status,c.suppliesname,a.applyperson,a.applydept,to_char(a.applydate,'yyyy-MM-dd') as applydate,a.flowid,'' as approveuserids" : pagination.p_fields; pagination.p_tablename = @"MAE_SUPPLIESACCEPT a left join ( select wm_concat(b.suppliesname) as suppliesname,recid from MAE_SUPPLIESACCEPT_DETAIL b group by recid) c on a.id=c.recid"; if (pagination.sidx == null) { pagination.sidx = "a.createdate"; } if (pagination.sord == null) { pagination.sord = "desc"; } #endregion //申请人 if (!queryParam["applyperson"].IsEmpty()) { pagination.conditionJson += string.Format(" and a.applyperson like '{0}%' ", queryParam["applyperson"].ToString()); } //物质名称 if (!queryParam["suppliesname"].IsEmpty()) { pagination.conditionJson += string.Format(" and c.suppliesname like '%{0}%' ", queryParam["suppliesname"].ToString()); } //待办 if (!queryParam["dbsx"].IsEmpty()) { var dbsx = queryParam["dbsx"].ToString(); switch (dbsx) { case "0": pagination.conditionJson += " and a.status=1"; DataTable dt = BaseRepository().FindTable("select " + pagination.p_kid + "," + pagination.p_fields + " from " + pagination.p_tablename + " where " + pagination.conditionJson); for (int i = 0; i < dt.Rows.Count; i++) { string createdetpid = departmentservice.GetEntityByCode(dt.Rows[i]["createuserdeptcode"].ToString()).IsEmpty() ? "" : departmentservice.GetEntityByCode(dt.Rows[i]["createuserdeptcode"].ToString()).DepartmentId; //获取下一步审核人 string str = manypowercheckservice.GetApproveUserId(dt.Rows[i]["flowid"].ToString(), dt.Rows[i]["id"].ToString(), "", "", "", "", createdetpid, "", "", "", ""); dt.Rows[i]["approveuserids"] = str; } string[] applyids = dt.Select(" approveuserids like '%" + user.UserId + "%'").AsEnumerable().Select(d => d.Field <string>("id")).ToArray(); pagination.conditionJson += string.Format(" and a.id in ('{0}') ", string.Join("','", applyids)); break; default: break; } } //作业单位 if (!queryParam["code"].IsEmpty()) { pagination.conditionJson += string.Format(" and a.applydeptcode like '{0}%'", queryParam["code"].ToString()); } DataTable data = this.BaseRepository().FindTableByProcPager(pagination, dataType); if (data != null && data.Rows.Count > 0) { for (int i = 0; i < data.Rows.Count; i++) { string createdetpid = departmentservice.GetEntityByCode(data.Rows[i]["createuserdeptcode"].ToString()).IsEmpty() ? "" : departmentservice.GetEntityByCode(data.Rows[i]["createuserdeptcode"].ToString()).DepartmentId; //获取下一步审核人 string str = manypowercheckservice.GetApproveUserId(data.Rows[i]["flowid"].ToString(), data.Rows[i]["id"].ToString(), "", "", "", "", createdetpid, "", "", "", ""); data.Rows[i]["approveuserids"] = str; } } return(data); }