/// <summary> /// 获取通行岗唯一标示(即车库) /// </summary> /// <param name="name"></param> /// <param name="type"></param> /// <returns></returns> public string GetTrafficPost(string currentid, int type) { string res = string.Empty; try { switch (type) { case 1: //私家车 res = currentid; break; case 6: //临时通行车辆 res = currentid; break; default: DataItemDetailService itembll = new DataItemDetailService(); IEnumerable <DataItemModel> list = itembll.GetDataItemListByItemCode("KmCarType"); var entity = list.Where(a => a.ItemValue == type.ToString()).FirstOrDefault(); if (entity != null && entity.Description != null) { //编码管理中设置 res = entity.Description.Replace("<p>", "").Replace("</p>", "").Trim();; } break; } } catch (Exception) { throw; } return(res); }
/// <summary> /// 获取车辆群组信息 /// </summary> /// <returns></returns> public string GetGroupInfo(int type) { string res = string.Empty; try { DataItemDetailService itembll = new DataItemDetailService(); IEnumerable <DataItemModel> list = itembll.GetDataItemListByItemCode("KmCarType"); var entity = list.Where(a => a.ItemValue == type.ToString()).FirstOrDefault(); if (entity != null) {//编码管理中设置 res = entity.ItemCode; } } catch (Exception) { throw; } return(res); }
/// <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 = "t.id"; pagination.p_fields = @"t.createuserid,t.createdate,t.createusername,t.modifyuserid,t.modifydate,t.modifyusername,t.createuserdeptcode,t.createuserorgcode,t.dangerjobname,t.numberofpeoplename, t.deptids, t.deptnames,t.jobfrequency,t.dangerfactors,t.accidentcategories,t.safetymeasures,t.joblevelname,t.principalnames"; pagination.p_tablename = @"BIS_DANGERJOBLIST t "; if (pagination.sidx == null) { pagination.sidx = "t.createdate"; } if (pagination.sord == null) { pagination.sord = "desc"; } #endregion //关键字 if (!queryParam["keyword"].IsEmpty()) { pagination.conditionJson += string.Format(" and (t.dangerjobname like '%{0}%' or t.deptnames like '%{0}%' or t.dangerfactors like '%{0}%' or t.accidentcategories like '%{0}%') ", queryParam["keyword"].ToString()); } DepartmentService departmentDll = new DepartmentService(); DataItemDetailService dataItemDetail = new DataItemDetailService(); string codes = user.OrganizeCode; var spdepart = dataItemDetail.GetDataItemListByItemCode("spdepart").Select(p => p.ItemValue).FirstOrDefault(); //树节点code var deptCode = !queryParam["code"].IsEmpty() ? queryParam["code"].ToString() : user.DeptCode; if (deptCode == user.OrganizeCode || ((!string.IsNullOrEmpty(spdepart) && spdepart.Contains(deptCode)) && queryParam["code"].IsEmpty())) { if (!string.IsNullOrEmpty(spdepart) && spdepart.Contains(deptCode)) { List <string> deptCodes = spdepart.Split(',').ToList(); deptCodes.Add(user.OrganizeCode); codes = string.Join("','", deptCodes); } pagination.conditionJson += string.Format(" and (t.createuserdeptcode in ('{0}') ) ", codes); } else { pagination.conditionJson += string.Format(" and t.createuserdeptcode='{0}' ", deptCode); } //危险作业级别 if (!queryParam["joblevel"].IsEmpty()) { var joblevel = queryParam["joblevel"].ToString(); pagination.conditionJson += string.Format(" and t.joblevel='{0}' ", joblevel); } //作业人数 if (!queryParam["numberofpeople"].IsEmpty()) { var numberofpeople = queryParam["numberofpeople"].ToString(); pagination.conditionJson += string.Format(" and t.numberofpeople='{0}' ", numberofpeople); } DataTable data = this.BaseRepository().FindTableByProcPager(pagination, dataType); foreach (DataRow dr in data.Rows) { string deptNames = ""; var deptids = dr["deptids"].ToString().Split(','); for (int i = 0; i < deptids.Length; i++) { var dept = departmentDll.GetEntity(deptids[i]); if (dept != null) { if (dept.Nature == "专业" || dept.Nature == "班组") { DataTable dt = departmentDll.GetDataTable(string.Format( "select fullname from BASE_DEPARTMENT where encode=(select encode from BASE_DEPARTMENT t where instr('{0}',encode)=1 and nature='{1}' and organizeid='{2}') or encode='{0}' order by deptcode", dept.EnCode, "部门", dept.OrganizeId)); if (dt.Rows.Count > 0) { string name = ""; foreach (DataRow dr1 in dt.Rows) { name += dr1["fullname"].ToString() + "/"; } deptNames += name.TrimEnd('/') + ","; } } else { deptNames += dept.FullName + ","; } } } if (!string.IsNullOrEmpty(deptNames) && deptNames.Length > 1) { dr["deptNames"] = deptNames.TrimEnd(','); } } return(data); }