public ActionResult AnomalousEventManagement(int currentPage = 1) { Response.Cache.SetOmitVaryStar(true); var req = new DatasQueryResultRequestBase() { CurrentPageIndex = currentPage }; var testTypes = _mtts.GetAllTestType().Datas.Count(); long resultCount = 0; for (int i = 1; i <= testTypes; i++) { var result = _anomalousEventManagementService.GetAnomalousEventManagementDatasBy(req); if (result.Succeed) { resultCount += result.TotalResultCount; } } var resp = new AnomalousEventManagementResponseViewModel(); resp.TotalResultCount = resultCount; if (resp.TotalResultCount > 0) { resp.Succeed = true; ViewData["TotalPages"] = resp.TotalPages; } else { TempData[WebConstants.MessageColor] = StyleConstants.RedColor; TempData[WebConstants.Message] = "无记录!"; } return(View()); }
/// <summary> /// 特征值下载,另存为TXT文档 /// </summary> public void EigenvalueDownloadSearchResult(MornitoringDataSearchBarBaseView conditions) { var eigenvalueDownloadService = new EigenvalueDownloadService(); if (conditions.MornitoringPointsNumberIds == null) { conditions.MornitoringPointsNumberIds = eigenvalueDownloadService.GetMonitoringPointsNumberIds(conditions.MornitoringPointsPositionId); } var req = new DatasQueryResultRequestBase { PointsNumberIds = conditions.MornitoringPointsNumberIds, StartTime = conditions.StartTime, EndTime = conditions.EndTime, PointsPositionId = conditions.MornitoringPointsPositionId, TestTypeId = conditions.MornitoringTestTypeId }; string downLoadpath = Server.MapPath(StyleConstants.MonitoringDatasDownloadPath); if (System.IO.Directory.Exists(downLoadpath) == false) { System.IO.Directory.CreateDirectory(downLoadpath); } var resp = eigenvalueDownloadService.DownloadTxt(req, downLoadpath); DownloadFile(resp.FilePath); }
/// <summary> /// 获得当天各个测试类型异常事件的数量 /// </summary> /// <returns></returns> public ActionResult GetAbnormalEventNumber() { var req = new DatasQueryResultRequestBase() { StartTime = DateTime.Now.AddDays(-1), EndTime = DateTime.Now }; //DateTime AbnormalEventSearchTime=DateTime.Now.Date; var GetAbnormalEventResult = _anomalousEventManagementService.GetAnomalousEventByTime(req); var model = new AbnormalEventNumberViewListModels(); var result = new List <AbnormalEventNumberViewModel>(); var testTypes = _mtts.GetAllTestType().Datas.Count(); for (int i = 1; i <= testTypes; i++) { var source = _mtts.GetAllTestType().Datas.Where(m => (int)m.Id == i).SingleOrDefault(); var item = new AbnormalEventNumberViewModel(); item.TestTypeName = source.Name; item.AbnormalEventNumber = GetAbnormalEventResult.Datas.Where(m => m.TestType == source.Name).Count(); result.Add(item); } model.AbnormalEventNumberViewModels = result; return(PartialView("GetAbnormalEventNumberPartial", model)); }
void DealWithEqualPointsPosition(DatasQueryResultRequestBase req, IList <Func <AnomalousEvent_AnomalousEventTable, bool> > ps) { if (req.PointsPositionId > 0) { ps.Add(m => m.PointsNumber.PointsPositionId == req.PointsPositionId); } }
void DealWithContainsPointsNumber(DatasQueryResultRequestBase req, IList <Func <T, bool> > ps) { if (req.PointsNumberIds != null && req.PointsNumberIds.Length > 0) { ps.Add(m => req.PointsNumberIds.Contains(m.PointsNumberId)); } }
public DownLoadDatasResponse DownloadTxt(DatasQueryResultRequestBase req, string path) { var resp = new DownLoadDatasResponse(); try { var ps = DealWithConditionParameter(req); switch (req.TestTypeId) { case 1: resp.FilePath = _originalDatasDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.BasicSteelArchStrain_Procedure); resp.Succeed = true; break; case 2: resp.FilePath = _originalDatasDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.BasicSteelLatticeStrain_Procedure); resp.Succeed = true; break; case 3: resp.FilePath = _originalDatasDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.BasicConcreteStrain_Procedure); resp.Succeed = true; break; case 4: resp.FilePath = _originalDatasDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.BasicDisplacement_Procedure); resp.Succeed = true; break; case 5: resp.FilePath = _originalDatasDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.BasicCableForce_Procedure); resp.Succeed = true; break; case 6: resp.FilePath = _originalDatasDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.BasicHumidity_Procedure); resp.Succeed = true; break; case 7: resp.FilePath = _originalDatasDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.BasicTemperature_Procedure); resp.Succeed = true; break; case 8: resp.FilePath = _originalDatasDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.BasicWindLoad_Procedure); resp.Succeed = true; break; default: throw new ApplicationException("No TestTypeId"); } } catch (Exception ex) { resp.Message = "无法下载数据"; Log(ex); } return(resp); }
void DealWithSearchTimeRange(DatasQueryResultRequestBase req, IList <Func <AnomalousEvent_AnomalousEventTable, bool> > ps) { if (req.StartTime.Year != 1) { ps.Add(m => m.Time >= req.StartTime); ps.Add(m => m.Time <= req.EndTime); } }
public AnomalousEventManagementResponse GetAnomalousEventByTime(DatasQueryResultRequestBase req) { var resp = new AnomalousEventManagementResponse(); IList <Func <AnomalousEvent_AnomalousEventTable, bool> > ps = new List <Func <AnomalousEvent_AnomalousEventTable, bool> >(); DealWithSearchTimeRange(req, ps); resp.Datas = _anomalousEventManagementQueryService.GetAnomalousEventSourceBy(ps); return(resp); }
private ConditionParameters DealWithConditionParameter(DatasQueryResultRequestBase req) { ConditionParameters ps = new ConditionParameters(); ps.EndTime = req.EndTime; ps.StarTime = req.StartTime; ps.PointsNumberIds = req.PointsNumberIds; return(ps); }
/// <summary> /// 报警数据下载,另存为EXCEL文档 /// </summary> /// <returns></returns> public ActionResult AlarmDatasDownloadSearchResult(AlarmDatasSearchBarView conditions) { var req = new DatasQueryResultRequestBase { PointsNumberIds = conditions.MornitoringPointsNumberIds, StartTime = conditions.StartTime, EndTime = conditions.EndTime, PointsPositionId = conditions.MornitoringPointsPositionId }; var alarmDatasQueryService = AlarmDatasManagementServiceFactory.GetQueryServiceFrom(conditions.MornitoringTestTypeId); var resp = alarmDatasQueryService.SaveAs(req); var guid = ""; guid = Guid.NewGuid().ToString(); CacheHelper.SetCache(guid, resp.FilePath); return(Json(guid, JsonRequestBehavior.AllowGet)); }
public DownLoadDatasResponse SaveAs(DatasQueryResultRequestBase req) { var resp = new DownLoadDatasResponse(); IList <Func <AnomalousEvent_AnomalousEventTable, bool> > ps = new List <Func <AnomalousEvent_AnomalousEventTable, bool> >(); try { DealWithConditions(req, ps); resp.FilePath = _fileSystemService.ConvertToDocument(ps); resp.Succeed = true; } catch (Exception ex) { resp.Message = "无法下载数据"; Log(ex); } return(resp); }
public AnomalousEventManagementResponse GetAnomalousEventManagementDatasBy(DatasQueryResultRequestBase req) { var resp = new AnomalousEventManagementResponse(); IList <Func <AnomalousEvent_AnomalousEventTable, bool> > ps = new List <Func <AnomalousEvent_AnomalousEventTable, bool> >(); try { DealWithConditions(req, ps); var numberOfResultsPrePage = ApplicationSettingsFactory.GetApplicationSettings().NumberOfResultsPrePage;//获取每页记录数 resp.Datas = _anomalousEventManagementQueryService.GetAnomalousEventManagementsSourceBy(ps, req.CurrentPageIndex, numberOfResultsPrePage); resp.TotalResultCount = _anomalousEventManagementQueryService.GetTotalResultCountBy(ps); resp.Succeed = true; } catch { resp.Message = NoRecordsMessage; } return(resp); }
protected void DealWithConditions(DatasQueryResultRequestBase req, IList <Func <AnomalousEvent_AnomalousEventTable, bool> > ps) { DealWithEqualPointsPosition(req, ps); DealWithSearchTimeRange(req, ps); }
public DownLoadDatasResponse DownloadTxt(DatasQueryResultRequestBase req, string path) { var resp = new DownLoadDatasResponse(); switch (req.TestTypeId) { case 1: try { var ps = DealWithConditionParameter(req); resp.FilePath = _monitoringDatasEigenvalueDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.SteelArchStrainDatasEigenvalueDownloadProc); resp.Succeed = true; } catch (Exception ex) { resp.Message = "无法下载数据"; Log(ex); } return(resp); case 2: try { var ps = DealWithConditionParameter(req); resp.FilePath = _monitoringDatasEigenvalueDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.SteelLatticeStrainDatasEigenvalueDownloadProc); resp.Succeed = true; } catch (Exception ex) { resp.Message = "无法下载数据"; Log(ex); } return(resp); case 3: try { var ps = DealWithConditionParameter(req); resp.FilePath = _monitoringDatasEigenvalueDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.ConcreteStrainDatasEigenvalueDownloadProc); resp.Succeed = true; } catch (Exception ex) { resp.Message = "无法下载数据"; Log(ex); } return(resp); case 4: try { var ps = DealWithConditionParameter(req); resp.FilePath = _monitoringDatasEigenvalueDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.DisplacementDatasEigenvalueDownloadProc); resp.Succeed = true; } catch (Exception ex) { resp.Message = "无法下载数据"; Log(ex); } return(resp); case 5: try { var ps = DealWithConditionParameter(req); resp.FilePath = _monitoringDatasEigenvalueDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.CableForceDatasEigenvalueDownloadProc); resp.Succeed = true; } catch (Exception ex) { resp.Message = "无法下载数据"; Log(ex); } return(resp); case 6: try { var ps = DealWithConditionParameter(req); resp.FilePath = _monitoringDatasEigenvalueDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.HumidityDatasEigenvalueDownloadProc); resp.Succeed = true; } catch (Exception ex) { resp.Message = "无法下载数据"; Log(ex); } return(resp); case 7: try { var ps = DealWithConditionParameter(req); resp.FilePath = _monitoringDatasEigenvalueDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.TemperatureDatasEigenvalueDownloadProc); resp.Succeed = true; } catch (Exception ex) { resp.Message = "无法下载数据"; Log(ex); } return(resp); case 8: try { var ps = DealWithConditionParameter(req); resp.FilePath = _monitoringDatasEigenvalueDownloadDAL.DownLoadTxtByExec(ps, path, AppConstants.WindLoadDatasEigenvalueDownloadProc); resp.Succeed = true; } catch (Exception ex) { resp.Message = "无法下载数据"; Log(ex); } return(resp); default: throw new ApplicationException("No TestTypeId"); } }
protected void DealWithConditions(DatasQueryResultRequestBase req, IList <Func <T, bool> > ps) { DealWithEqualPointsPosition(req, ps); DealWithSearchTimeRange(req, ps); DealWithContainsPointsNumber(req, ps); }
void DealWithSearchTimeRange(DatasQueryResultRequestBase req, IList <Func <T, bool> > ps) { ps.Add(m => m.Time >= req.StartTime); ps.Add(m => m.Time <= req.EndTime); }
public abstract DownLoadDatasResponse SaveAs(DatasQueryResultRequestBase req);
public override DownloadOriginalvalueDatasResponse SaveAsFile(DatasQueryResultRequestBase req) { return(_steelLatticeStrainDatasOriginalValueDownloadService.SaveAs(req)); }
public override DownloadOriginalvalueDatasResponse SaveAsFile(DatasQueryResultRequestBase req) { return(_humidityDatasOriginalValueDownloadService.SaveAs(req)); }
public abstract DownloadOriginalvalueDatasResponse SaveAsFile(DatasQueryResultRequestBase req);