public ActionResult DetailsSearch(DetailQualifyFiveSearchModel model) { int pos = model.posStart.HasValue ? model.posStart.Value : 0; int count = model.count.HasValue ? model.count.Value : 30; PagingOptions <t_D_UserTableFive> pagingOption = new PagingOptions <t_D_UserTableFive>(pos, count, t => new { t.id }); DhtmlxGrid grid = new DhtmlxGrid(); var userTableFive = repFive.GetByConditonPage(r => r.pid == model.pid, pagingOption); grid.AddPaging(pagingOption.TotalItems, pos); int index = pos + 1; foreach (var item in userTableFive) { var zczshpath = string.Empty; var sgzshpath = string.Empty; var zcpath = string.Empty; var xlpath = string.Empty; var data = JsonConvert.DeserializeObject <DetailQualifyFiveSearchViewModel>(item.gzjl); DhtmlxGridRow row = new DhtmlxGridRow(item.id); row.AddCell(index); row.AddCell(data.jclb); row.AddCell(data.jclr); row.AddCell(data.name); row.AddCell(data.zgzsh); row.AddCell(data.sgzsh); row.AddCell(data.zcdwmc); row.AddCell(data.zc); row.AddCell(data.zy); row.AddCell(data.xl); row.AddCell(data.jcnx); row.AddCell(data.detectnumstartdate + "至" + data.detectnumenddate); row.AddCell(data.bz); row.AddLinkJsCell("注册证书附件查看", "uploadFile(\"{0}\")".Fmt(data.zgzshpath + "+" + "注册证书附件")); row.AddLinkJsCell("上岗证书附件查看", "uploadFile(\"{0}\")".Fmt(data.sgzshpath + "+" + "上岗证书附件")); row.AddLinkJsCell("职称附件查看", "uploadFile(\"{0}\")".Fmt(data.zcpath + "+" + "职称附件")); row.AddLinkJsCell("学历附件查看", "uploadFile(\"{0}\")".Fmt(data.xlpath + "+" + "学历附件")); index++; grid.AddGridRow(row); } string str = grid.BuildRowXml().ToString(System.Xml.Linq.SaveOptions.DisableFormatting); return(Content(str, "text/xml")); }
public ActionResult Search(SysLogViewModels searchModel) { var predicate = PredicateBuilder.True <SysLog>(); if (!string.IsNullOrWhiteSpace(searchModel.LogUserName)) { predicate = predicate.And(p => p.UerName.Contains(searchModel.LogUserName)); } if (!string.IsNullOrWhiteSpace(searchModel.LogType)) { predicate = predicate.And(p => p.LogEvent.Contains(searchModel.LogType)); } if (searchModel.LogStartDt.HasValue) { predicate = predicate.And(p => p.LogTime >= searchModel.LogStartDt.Value); } if (searchModel.LogEndDt.HasValue) { predicate = predicate.And(p => p.LogTime <= searchModel.LogEndDt.Value.AddDays(1)); } int pos = searchModel.posStart.HasValue ? searchModel.posStart.Value : 0; int count = searchModel.count.HasValue ? searchModel.count.Value : 30; PagingOptions <SysLog> pagingOption = new PagingOptions <SysLog>(pos, count, u => new { u.LogTime }, true); var logs = rep.GetByConditonPage(predicate, pagingOption); DhtmlxGrid grid = new DhtmlxGrid(); grid.AddPaging(pagingOption.TotalItems, pos); for (int i = 0; i < logs.Count; i++) { var log = logs[i]; DhtmlxGridRow row = new DhtmlxGridRow(log.Id.ToString()); row.AddCell((pos + i + 1).ToString()); row.AddCell(log.UerName); row.AddCell(log.IpAddress); row.AddCell(log.LogEvent); row.AddCell(log.LogType); row.AddCell(log.LogTime.ToString("yyyy-MM-dd HH:mm:ss")); grid.AddGridRow(row); } string str = grid.BuildRowXml().ToString(System.Xml.Linq.SaveOptions.DisableFormatting); return(Content(str, "text/xml")); }
public ActionResult SearchImport(ApplyQualifyFiveSearchModel model) { DhtmlxGrid grid = new DhtmlxGrid(); var precadite = PredicateBuilder.True <t_bp_People>(); if (!model.CustomId.IsNullOrEmpty()) { precadite = precadite.And(tt => tt.Customid == model.CustomId.Trim()); } int pos = model.posStart.HasValue ? model.posStart.Value : 0; int count = model.count.HasValue ? model.count.Value : 30; var paging = new PagingOptions <t_bp_People>(pos, count, t => t.id); var datas = peopleRep.GetByConditonPage(precadite, paging); var totalCount = (int)paging.TotalItems; var PersonnelTitles = sysDictServcie.GetDictsByKey("personnelTitles"); grid.AddPaging(totalCount, pos); var index = 1; foreach (var item in datas) { DhtmlxGridRow row = new DhtmlxGridRow(item.id); row.AddCell(string.Empty); row.AddCell(index++); row.AddCell(item.Name); row.AddCell(string.Empty); row.AddCell(string.Empty); row.AddCell(string.Empty); row.AddCell(SysDictUtility.GetKeyFromDic(PersonnelTitles, item.Title)); row.AddCell(item.Professional); row.AddCell(item.Education); row.AddCell(string.Empty); row.AddCell(new DhtmlxGridCell("查看", false).AddCellAttribute("title", "查看")); row.AddCell(string.Empty); row.AddCell(string.Empty); row.AddCell(item.titlepath); row.AddCell(item.educationpath); grid.AddGridRow(row); } string str = grid.BuildRowXml().ToString(System.Xml.Linq.SaveOptions.DisableFormatting); return(Content(str, "text/xml")); }
private SearchResult <STCheckUIModel> GetSearchResult(STCheckEquipModels model) { var predicate = PredicateBuilder.True <t_bp_Equipment_ST>(); //过滤已经删除的机构 predicate = predicate.And(tp => tp.data_status == null || tp.data_status != "-1"); if (!model.EquName.IsNullOrEmpty()) { predicate = predicate.And(t => t.EquName.Contains(model.EquName)); } if (!model.EquType.IsNullOrEmpty()) { predicate = predicate.And(t => t.equtype.Contains(model.EquType)); } if (!model.Status.IsNullOrEmpty()) { predicate = predicate.And(t => t.equtype == model.Status); } if (!model.CheckUnitName.IsNullOrEmpty()) { predicate = predicate.And(t => t.customid == model.CheckUnitName); } int pos = model.posStart.HasValue ? model.posStart.Value : 0; int count = model.count.HasValue ? model.count.Value : 30; PagingOptions <t_bp_Equipment_ST> pagingOption = new PagingOptions <t_bp_Equipment_ST>(pos, count, t => new { t.Id }); var equips = rep.GetByConditonPage <STCheckUIModel>(predicate, r => new { r.Id, r.customid, r.EquName, r.equtype, r.equspec, r.timestart, r.timeend, r.approvalstatus }, pagingOption); return(new SearchResult <STCheckUIModel>(pagingOption.TotalItems, equips)); }
public ActionResult Search(SysViewSearchModels searchModel) { var predicate = PredicateBuilder.True <UserAsRole>(); var predicateRole = PredicateBuilder.True <UserInRole>(); if (!string.IsNullOrWhiteSpace(searchModel.CheckUnitName)) { predicate = predicate.And(t => t.CustomId == searchModel.CheckUnitName); } if (!string.IsNullOrWhiteSpace(searchModel.UserDisplayName)) { predicate = predicate.And(t => t.UserDisplayName.Contains(searchModel.UserDisplayName)); } if (!string.IsNullOrWhiteSpace(searchModel.UserName)) { predicate = predicate.And(t => t.UserName == searchModel.UserName); } if (!string.IsNullOrWhiteSpace(searchModel.CheckStatus)) { predicate = predicate.And(t => t.CheckStatus == searchModel.CheckStatus); } if (!string.IsNullOrEmpty(searchModel.RoleNames)) { var allRoles = roleRep.GetByCondition(r => searchModel.RoleNames.Split(',').ToList().Contains(r.Name)).Select(s => s.Id).ToList(); predicate = predicate.And(t => allRoles.Contains(t.RoleId)); } else { var allRoles = roleRep.GetByCondition(t => t.Code != "QYY" && t.Code != "JYY").Select(s => s.Id).ToList(); predicate = predicate.And(t => allRoles.Contains(t.RoleId)); } //if(string.IsNullOrWhiteSpace(searchModel.Valie)) //{ // predicate = predicate.And(t => t.Valie == searchModel.Valie); //} int pos = searchModel.posStart.HasValue ? searchModel.posStart.Value : 0; int count = searchModel.count.HasValue ? searchModel.count.Value : 30; PagingOptions <UserAsRole> pagingOption = new PagingOptions <UserAsRole>(pos, count, u => new { u.Id }); var users = userAsRoleRep.GetByConditonPage(predicate, pagingOption); var userTypes = sysDictService.GetDictsByKey("UserType"); var userStatus = sysDictService.GetDictsByKey("UserStatus"); var allInsts = checkUnitService.GetAllCheckUnit(); var userValie = sysDictService.GetDictsByKey("Valid"); var allRole = roleRep.GetByCondition(u => true); DhtmlxGrid grid = new DhtmlxGrid(); grid.AddPaging(pagingOption.TotalItems, pos); for (int i = 0; i < users.Count; i++) { var oneUser = users[i]; DhtmlxGridRow row = new DhtmlxGridRow(oneUser.Id); row.AddCell((pos + i + 1).ToString()); row.AddCell(oneUser.UserDisplayName); if (oneUser.RoleId == 3 || oneUser.RoleId == 5) { row.AddCell(oneUser.UnitName); } else if (string.IsNullOrWhiteSpace(oneUser.CustomId) || !allInsts.ContainsKey(oneUser.CustomId.ToUpper())) { row.AddCell("系统用户"); } else { row.AddCell(allInsts[oneUser.CustomId]); } row.AddCell(oneUser.UserName); row.AddCell(SysDictUtility.GetKeyFromDic(userValie, oneUser.Valie)); row.AddCell(SysDictUtility.GetKeyFromDic(userStatus, oneUser.Status, "禁止")); var a = allRole.Where(u => u.Id == oneUser.RoleId); row.AddCell(allRole.Where(u => u.Id == oneUser.RoleId).Select(u => u.Name).FirstOrDefault().ToString()); //row.AddCell(oneUser.CheckStatus == "1" ? "已审核" : "未审核"); row.AddLinkJsCell("自定义模块", "personModule({0})".Fmt(oneUser.Id)); row.AddLinkJsCell("自定义按钮", "personAction({0})".Fmt(oneUser.Id)); if (superVisorRoleCode.Contains(userService.GetUserRole(oneUser.Id).Code)) { row.AddLinkJsCell("自定义机构", "personInst({0},\"{1}\")".Fmt(oneUser.Id, oneUser.UserDisplayName)); } else { row.AddCell(string.Empty); } row.AddLinkJsCell("密码重置", "PaswordRest({0})".Fmt(oneUser.Id)); row.AddLinkJsCells(GetOpDicts(oneUser)); grid.AddGridRow(row); } string str = grid.BuildRowXml().ToString(System.Xml.Linq.SaveOptions.DisableFormatting); return(Content(str, "text/xml")); }
public ActionResult SearchImport(ApplyQualifySevenSearchModel model) { DhtmlxGrid grid = new DhtmlxGrid(); var precadite = PredicateBuilder.True <t_bp_Equipment>(); precadite = precadite.And(r => r.approvalstatus == "3"); if (!model.CustomId.IsNullOrEmpty()) { precadite = precadite.And(tt => tt.customid == model.CustomId.Trim()); } int pos = model.posStart.HasValue ? model.posStart.Value : 0; int count = model.count.HasValue ? model.count.Value : 30; var paging = new PagingOptions <t_bp_Equipment>(pos, count, t => t.id); var datas = equipRep.GetByConditonPage(precadite, paging); var totalCount = (int)paging.TotalItems; grid.AddPaging(totalCount, pos); var index = 1; var allcustom = checkUnitService.GetAllCheckUnit(); foreach (var item in datas) { string dateStr = string.Empty; if (item.checkenddate.HasValue && item.checkstartdate.HasValue) { dateStr = GetUIDtString(item.checkstartdate, "yyyy-MM-dd") + "~" + GetUIDtString(item.checkenddate, "yyyy-MM-dd"); } if (item.repairstartdate.HasValue && item.repairenddate.HasValue) { dateStr = GetUIDtString(item.repairstartdate, "yyyy-MM-dd") + "~" + GetUIDtString(item.repairenddate, "yyyy-MM-dd"); } DhtmlxGridRow row = new DhtmlxGridRow(item.id); row.AddCell(string.Empty); row.AddCell(index++); row.AddCell(item.equnum); row.AddCell(item.EquName + "/" + item.equtype + "/" + item.equspec); row.AddCell(item.testrange); row.AddCell(item.degree + "/" + item.uncertainty); row.AddCell(checkUnitService.GetCheckUnitByIdFromAll(allcustom, item.customid)); row.AddCell(item.checkunit.IsNullOrEmpty() ? item.repairunit : item.checkunit); row.AddCell(dateStr); if (item.repairenddate.HasValue || item.checkenddate.HasValue) { var datee = item.repairenddate.HasValue ? item.repairenddate : item.checkenddate; var dateDiff = datee.Value - DateTime.Now; var totalDay = (int)dateDiff.TotalDays; if (totalDay < 0) { row.AddCell(new DhtmlxGridCell("已经超期{0}天".Fmt(0 - totalDay), false).AddCellAttribute("style", "color:red")); } else { row.AddCell("{0}天".Fmt(totalDay)); } } else { row.AddCell(string.Empty); } row.AddCell(item.checkcerfnumpath.IsNullOrEmpty()?item.repaircerfnumpath:item.checkcerfnumpath); row.AddCell(string.Empty); grid.AddGridRow(row); } string str = grid.BuildRowXml().ToString(System.Xml.Linq.SaveOptions.DisableFormatting); return(Content(str, "text/xml")); }
public ActionResult Search(ApplyQualifySevenSearchModel model) { DhtmlxGrid grid = new DhtmlxGrid(); var precadite = PredicateBuilder.True <t_D_UserTableSeven>(); if (!model.PId.IsNullOrEmpty()) { precadite = precadite.And(tt => tt.pid == model.PId.Trim()); } if (!model.CustomId.IsNullOrEmpty()) { precadite = precadite.And(tt => tt.unitcode == model.CustomId.Trim()); } int pos = model.posStart.HasValue ? model.posStart.Value : 0; int count = model.count.HasValue ? model.count.Value : 30; var pagine = new PagingOptions <t_D_UserTableSeven>(pos, count, tt => tt.id); var datas = repSeven.GetByConditonPage(precadite, pagine); var totalCount = (int)pagine.TotalItems; grid.AddPaging(totalCount, pos); int index = 1; var currentUserRole = GetCurrentUserRole(); List <int?> equipIds = new List <int?>(); foreach (var item in datas) { equipIds.Add(item.EquipId); } Dictionary <int, string> fileUrls = new Dictionary <int, string>(); using (var db = dbFactory.Open()) { fileUrls = db.Dictionary <int, string>(db.From <t_bp_Equipment>().Where(t => equipIds.Contains(t.id)).Select(t => new { t.id, t.repaircerfnumpath })); } foreach (var item in datas) { var equip = JsonConvert.DeserializeObject <ApplyQualifySevenEquipModel>(item.gzjl); if (equip != null) { DhtmlxGridRow row = new DhtmlxGridRow(item.id); var fileUrl = string.Empty; if (item.EquipId.HasValue) { fileUrls.TryGetValue(item.EquipId.Value, out fileUrl); } row.AddCell(index++); row.AddCell(equip.jcxm); row.AddCell(equip.zyyqsb); row.AddCell(equip.clfw); row.AddCell(equip.zqddj); row.AddCell(equip.jdxzjg); row.AddCell(GetUIDtString(equip.yxrq)); row.AddCell(equip.zjxxm); row.AddCell(equip.zjxgfmcjbh); row.AddCell(equip.bz); row.AddLinkJsCell("检定/校准文件查看", "uploadFile(\"{0}\")".Fmt(fileUrl)); grid.AddGridRow(row); } } string str = grid.BuildRowXml().ToString(System.Xml.Linq.SaveOptions.DisableFormatting); return(Content(str, "text/xml")); }
public SearchResult <STCheckPeopleUIModel> GetSearchResult(STCheckPeopleSearchModel model) { var predicate = PredicateBuilder.True <t_bp_People_ST>(); //过滤已经删除的机构 predicate = predicate.And(tp => tp.data_status == null || tp.data_status != "-1"); if (!model.Name.IsNullOrEmpty()) { predicate = predicate.And(t => t.Name.Contains(model.Name)); } if (!model.CheckUnitName.IsNullOrEmpty()) { predicate = predicate.And(t => t.Customid == model.CheckUnitName); } if (!model.Status.IsNullOrEmpty()) { predicate = predicate.And(t => t.Approvalstatus == model.Status); } if (model.AgeStart.HasValue) { var ageStarDateTime = DateTime.Now.AddYears(0 - model.AgeStart.Value); predicate = predicate.And(t => t.Birthday.HasValue && t.Birthday.Value <= ageStarDateTime); } if (model.AgeEnd.HasValue) { var ageEndDateTime = DateTime.Now.AddYears(0 - model.AgeEnd.Value); predicate = predicate.And(t => t.Birthday.HasValue && t.Birthday.Value >= ageEndDateTime); } //if (!model.AgeStart.IsNullOrEmpty())// string.IsNullOrEmpty(model.AgeStart.ToString())) // !model.AgeStart.IsNullOrEmpty()) //{ // predicate = predicate.And(t => t.Birthday >=DateTime.Parse(model.AgeStart)); //} //if (!model.AgeEnd.IsNullOrEmpty())// string.IsNullOrEmpty(model.AgeEnd.ToString())) // !model.AgeStart.IsNullOrEmpty()) //{ // predicate = predicate.And(t => t.Birthday <=DateTime.Parse(model.AgeEnd)); //} if (!model.PositionCategory.IsNullOrEmpty()) { predicate = predicate.And(t => t.PostType.Contains(model.PositionCategory));// model.PositionCategory.Contains(t.PostType)); } if (!model.PostCertNum.IsNullOrEmpty()) { predicate = predicate.And(t => t.PostNum.Contains(model.PostCertNum)); } if (!model.TechTitle.IsNullOrEmpty()) { predicate = predicate.And(t => t.postname.Contains(model.TechTitle)); } if (!model.IDnum.IsNullOrEmpty()) { predicate = predicate.And(t => t.SelfNum.Contains(model.IDnum)); } #region 设备查看人员新增此部分 if (model.IsAdmin) { predicate = predicate.And(testc => testc.ismanager == "1"); } if (model.IsCheck) { predicate = predicate.And(t => t.issy == "1"); } if (model.IsTitle) { predicate = predicate.And(t => t.isjs == "1"); } #endregion int pos = model.posStart.HasValue ? model.posStart.Value : 0; int count = model.count.HasValue ? model.count.Value : 30; PagingOptions <t_bp_People_ST> pagingOption = new PagingOptions <t_bp_People_ST>(pos, count, t => new { t.Id }); var people = rep.GetByConditonPage <STCheckPeopleUIModel>(predicate, r => new { r.Id, r.Name, r.Customid, r.SelfNum, r.PostNum, r.Tel, r.Approvalstatus }, pagingOption); return(new SearchResult <STCheckPeopleUIModel>(pagingOption.TotalItems, people)); }
// GET: Welcome public ActionResult Index() { var measnumEndDate = new PagingOptions <t_bp_custom>(0, 7, t => t.measnumEndDate); var measnumDate = customRep.GetByConditonPage <MeasnumDateModel>(t => t.measnumEndDate != null, t => new { t.ID, t.NAME, t.measnumEndDate }, measnumEndDate);//检测资质有效期日期 var detectnumEndDate = new PagingOptions <t_bp_custom>(0, 7, t => t.detectnumEndDate); var detectnumDate = customRep.GetByConditonPage <DetectnumDateModel>(t => t.detectnumEndDate != null, t => new { t.ID, t.NAME, t.detectnumEndDate }, detectnumEndDate);//计量认证有效期日期 var checkenddate = new PagingOptions <t_bp_Equipment>(0, 7, t => t.checkenddate); var checkdate = equipmentRep.GetByConditonPage <CheckdateModel>(t => t.checkenddate != null, t => new { t.id, t.EquName, t.checkenddate, t.customid }, checkenddate);//设备有效期 var allUnitByArea = checkUnitService.GetAllCustomInArea(); WelcomeViewMoel viewmodel = new WelcomeViewMoel() { EchartUnqualifyReportsCount = new List <EchartNameValue>(), EchartTotalReportsCount = new List <EchartNameValue>(), EcharModifyReportsCount = new List <EchartNameValue>(), MeasnumDate = new List <DueRemindModel>(), DetectnumDate = new List <DueRemindModel>(), Checkdate = new List <DueRemindModel>() }; int i = 1; foreach (var item in measnumDate) { DueRemindModel dueRemind = new DueRemindModel(); var dateTime = Convert.ToDateTime(DateTime.Now); var time = dateTime - Convert.ToDateTime(item.measnumEndDate); if (time.Days >= 0) { dueRemind.Type = item.Name + "单位检测资质证书已经过期" + time.Days + "天"; } else { dueRemind.Type = item.Name + "单位检测资质证书有效期剩余" + time.Days * (-1) + "天"; } dueRemind.Date = item.measnumEndDate.HasValue ? item.measnumEndDate.Value.ToString("yyyy-MM-dd") : string.Empty; dueRemind.Num = i; i++; dueRemind.Id = item.Id; viewmodel.MeasnumDate.Add(dueRemind); } i = 1; foreach (var item in detectnumDate) { DueRemindModel dueRemind = new DueRemindModel(); var dateTime = Convert.ToDateTime(DateTime.Now); var time = dateTime - Convert.ToDateTime(item.detectnumEndDate); if (time.Days >= 0) { dueRemind.Type = item.Name + "单位计量认证证书已经过期" + time.Days + "天"; } else { dueRemind.Type = item.Name + "单位计量认证证书有效期剩余" + time.Days * (-1) + "天"; } dueRemind.Num = i; i++; dueRemind.Date = item.detectnumEndDate.HasValue ? item.detectnumEndDate.Value.ToString("yyyy-MM-dd") : string.Empty; dueRemind.Id = item.Id; viewmodel.DetectnumDate.Add(dueRemind); } i = 1; foreach (var item in checkdate) { DueRemindModel dueRemind = new DueRemindModel(); var dateTime = Convert.ToDateTime(DateTime.Now); var time = dateTime - Convert.ToDateTime(item.checkenddate); var checkName = checkUnitService.GetCheckUnitById(item.customid); if (time.Days >= 0) { dueRemind.Type = checkName + "单位仪器设备检定已经过期" + time.Days + "天"; } else { dueRemind.Type = checkName + "单位仪器设备检定有效期剩余" + time.Days * (-1) + "天"; } dueRemind.Num = i; i++; dueRemind.Id = item.id; dueRemind.Date = item.checkenddate.HasValue ? item.checkenddate.Value.ToString("yyyy-MM-dd") : string.Empty; viewmodel.Checkdate.Add(dueRemind); } DateTime DtNow = DateTime.Now; string dtFormatStr = "yyyy-MM-dd'T'HH:mm:ss"; string endDtStr = DtNow.AddDays(1).ToString(dtFormatStr); //string endDt = endDtStr DateTime DtStart = DtNow.AddDays(-7); string startDtStr = DtStart.ToString(dtFormatStr); #region 获得首页上部统计信息 var instFilter = GetCurrentInstFilter(); Func <Nest.QueryContainerDescriptor <es_t_bp_item>, QueryContainer> qcd = q => { var qc = q.DateRange(qdr => qdr.Field(qdrf => qdrf.PRINTDATE).GreaterThanOrEquals(DateMath.FromString(startDtStr))) && q.DateRange(qddr => qddr.Field(qddrf => qddrf.PRINTDATE).LessThanOrEquals(DateMath.FromString(endDtStr))); if (instFilter.NeedFilter && instFilter.FilterInstIds.Count() > 0) { qc = qc && +q.Terms(qtm => qtm.Field(qtmf => qtmf.CUSTOMID).Terms(instFilter.FilterInstIds)); } return(qc); }; var response = tbpitemESRep.Search(s => s.Size(0).Query(qcd).Aggregations(af => af.Terms(UnQualiKey, adn => adn.Field(aaa => aaa.CONCLUSIONCODE)) .Terms(ModifyKey, adm => adm.Field(aadm => aadm.HAVELOG)) .Terms(ReportKey, ada => ada.Field(adaa => adaa.HAVREPORT)))); if (response.IsValid) { viewmodel.TotalReports = (int)response.Total; var unQualiBuckets = response.Aggs.Terms(UnQualiKey).Buckets; foreach (var buctet in unQualiBuckets) { if (buctet.Key == "N") { viewmodel.UnqualifyReports = (int)buctet.DocCount; } } var modifyBuckets = response.Aggs.Terms(ModifyKey).Buckets; foreach (var buctet in modifyBuckets) { if (buctet.Key == "1") { viewmodel.ModifyReports = (int)buctet.DocCount; } } var reportBuckets = response.Aggs.Terms(ReportKey).Buckets; foreach (var buctet in reportBuckets) { if (buctet.Key == "1") { viewmodel.PKRReports = (int)buctet.DocCount; } } } if (viewmodel.TotalReports == 0) { viewmodel.UnqualifyPercentage = "0"; viewmodel.ModifyPercentage = "0"; viewmodel.PKRPercentage = "0"; } else { viewmodel.UnqualifyPercentage = (viewmodel.UnqualifyReports * 100 / viewmodel.TotalReports).ToString(); viewmodel.ModifyPercentage = (viewmodel.ModifyReports * 100 / viewmodel.TotalReports).ToString(); viewmodel.PKRPercentage = (viewmodel.PKRReports * 100 / viewmodel.TotalReports).ToString(); } #endregion #region 获得首页中间部分地图信息数据 var countByArea = new Dictionary <string, int>(); var unQualifyCount = new Dictionary <string, int>(); var ModifyCount = new Dictionary <string, int>(); var EchartTotalReportsCount = new Dictionary <string, int>(); var EchartUnqualifyReportsCount = new Dictionary <string, int>(); var EcharModifyReportsCount = new Dictionary <string, int>(); var allArea = areaService.GetAllArea(); var userItems = userItemrep.GetDictByCondition <string, string>(r => r.UserId == GetCurrentUserId() && r.UserItemType == UserItemType.UnQualifiedReport, r => new { r.Id, r.ItemTableName }); var userInstIds = userCustomrep.GetDictByCondition <string, string>(r => r.UserId == GetCurrentUserId() && r.UserCustomType == UserCustomType.UnQualifiedCount, r => new { r.Id, r.CustomId }); SysSearchModel model = new SysSearchModel() { StartDt = DateTime.Today.AddDays(-7), EndDt = DateTime.Today.AddDays(1) }; var filterQuery = GetFilterQuery(checkUnitService, itemNameService, model, userInstIds, userItems); var mapResponse = tbpitemESRep.Search(s => s.Size(0).Query(filterQuery) .Aggregations(af => af.Terms(aggeKey, item => item.Field(iif => iif.CUSTOMID).Size(1000) .Aggregations(aaaf => aaaf.Terms("Conclution", aaa => aaa.Field(aac => aac.CONCLUSIONCODE)).Terms("Havelog", aab => aab.Field(aad => aad.HAVELOG)) )))); if (mapResponse.IsValid) { var bucks = mapResponse.Aggs.Terms(aggeKey).Buckets; foreach (var item in bucks) { var unqualiBucks = item.Terms("Conclution").Buckets; var modifyBucks = item.Terms("Havelog").Buckets; var customId = item.Key; var unitArea = string.Empty; var areaBool = allUnitByArea.TryGetValue(item.Key, out unitArea); if (areaBool) { GetDictResult(countByArea, item, unitArea); } else { unitArea = "其他"; GetDictResult(countByArea, item, unitArea); } foreach (var unqualifyItem in unqualiBucks) { if (unqualifyItem.Key == "N" || unqualifyItem.Key == "n") { GetDictResult(unQualifyCount, unqualifyItem, unitArea); } } foreach (var modifyItem in modifyBucks) { if (modifyItem.Key == "1") { GetDictResult(ModifyCount, modifyItem, unitArea); } } } foreach (var item in countByArea) { GetEchartValue(EchartTotalReportsCount, allArea, item); } foreach (var item in unQualifyCount) { GetEchartValue(EchartUnqualifyReportsCount, allArea, item); } foreach (var item in ModifyCount) { GetEchartValue(EcharModifyReportsCount, allArea, item); } foreach (var item in EchartTotalReportsCount) { EchartNameValue echart = new EchartNameValue() { name = item.Key, value = item.Value }; viewmodel.EchartTotalReportsCount.Add(echart); } foreach (var item in EchartUnqualifyReportsCount) { EchartNameValue echart = new EchartNameValue() { name = item.Key, value = item.Value }; viewmodel.EchartUnqualifyReportsCount.Add(echart); } foreach (var item in EcharModifyReportsCount) { EchartNameValue echart = new EchartNameValue() { name = item.Key, value = item.Value }; viewmodel.EcharModifyReportsCount.Add(echart); } viewmodel.EchartTotalReportsCount = viewmodel.EchartTotalReportsCount.OrderBy(s => s.name).ToList(); viewmodel.EchartUnqualifyReportsCount = viewmodel.EchartUnqualifyReportsCount.OrderBy(s => s.name).ToList(); viewmodel.EcharModifyReportsCount = viewmodel.EcharModifyReportsCount.OrderBy(s => s.name).ToList(); } #endregion #region 获得首页下部到期提醒数据 #endregion return(View(viewmodel)); }
public ActionResult Search(HTYSerchViewModel searchModel) { var predicate = PredicateBuilder.True <tab_hty_programme>(); if (!string.IsNullOrEmpty(searchModel.CheckUnitName)) { predicate = predicate.And(t => t.unitcode == searchModel.CheckUnitName); } if (!string.IsNullOrEmpty(searchModel.CheckProject)) { predicate = predicate.And(t => t.projectname.Contains(searchModel.CheckProject)); } int pos = searchModel.posStart.HasValue ? searchModel.posStart.Value : 0; int count = searchModel.count.HasValue ? searchModel.count.Value : 30; PagingOptions <tab_hty_programme> pagingOption = new PagingOptions <tab_hty_programme>(pos, count, u => new { u.id }); var piles = HTYRep.GetByConditonPage(predicate, pagingOption); DhtmlxGrid grid = new DhtmlxGrid(); string customname = string.Empty; grid.AddPaging(pagingOption.TotalItems, pos); var allCustoms = checkUnitServce.GetAllCheckUnit(); // var allunit= for (int i = 0; i < piles.Count; i++) { var pile = piles[i]; DhtmlxGridRow row = new DhtmlxGridRow(pile.id.ToString()); row.AddCell((pos + i + 1).ToString()); string customName = checkUnitServce.GetCheckUnitByIdFromAll(allCustoms, pile.unitcode);// string.Empty; row.AddCell(customName); row.AddCell(pile.projectname); var peopleNames = string.Empty; var peopleIds = pile.testingpeople; if (!peopleIds.IsNullOrEmpty()) { var peoIds = peopleIds.Split(',').ToList(); var peoples = peopleRep.GetByCondition(w => peoIds.Contains(w.id.ToString())); peopleNames = peoples.Select(s => s.Name).Join("、"); } row.AddCell(peopleNames); var equipNames = string.Empty; var equipIds = pile.testingequipment; if (!equipIds.IsNullOrEmpty()) { var equIds = equipIds.Split(',').ToList(); var equips = equipRep.GetByCondition(w => equIds.Contains(w.id.ToString())); equipNames = equips.Select(s => s.EquName).Join("、"); } row.AddCell(equipNames); row.AddCell(pile.checknum); row.AddCell(new DhtmlxGridCell("查看", false).AddCellAttribute("title", "查看")); grid.AddGridRow(row); } string str = grid.BuildRowXml().ToString(System.Xml.Linq.SaveOptions.DisableFormatting); return(Content(str, "text/xml")); }