Exemplo n.º 1
0
        public ActionResult ExportExceptionToExcel(long vid, string vName, string VIN, string strucName, string startTime, string endTime, string invTime, string isSpeed, int exportType)
        {
            #region 求导出的数据结果
            HistorySignalAllInfoModels model = new HistorySignalAllInfoModels();
            model.VehicleID   = vid;
            model.VehicleName = vName;
            model.VIN         = VIN;
            model.StrucName   = strucName;
            model.StartTime   = startTime;
            model.EndTime     = endTime;
            model.InvTime     = invTime;
            model.IsSpeed     = isSpeed;
            var list = new List <HistorySignalShowListModel>();
            //if(exportType == 2)
            //{
            //    list = HistoricalBLL.GetHistoryExceptionInfo(model);
            //}
            if (exportType == 3)
            {
                list = HistoricalBLL.GetHistoryOverSpeedExceptionInfo(model);
            }

            model.Datas = list;
            #endregion

            ViewBag.StrucName  = strucName;
            ViewBag.ExportFlag = true;
            ViewData.Model     = model;
            string viewHtml   = RenderPartialViewToString(this, "_ExportAllExceptionSignal");
            var    reportName = vName + "(" + strucName + ")" + @DisplayText.HistoryRoute + DateTime.Now.ToString("yyyyMMddHHmmss");
            return(File(System.Text.Encoding.UTF8.GetBytes(viewHtml), "application/ms-excel", string.Format("{0}.xls", reportName + "(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ")")));
        }
Exemplo n.º 2
0
        public ActionResult SearchOverSpeedException(long vid, string vName, string VIN, string startTime, string endTime, string invTime, string isSpeed)
        {
            HistorySignalAllInfoModels model = new HistorySignalAllInfoModels();

            model.VehicleID   = vid;
            model.VehicleName = vName;
            model.VIN         = VIN;
            model.StartTime   = startTime;
            model.EndTime     = endTime;
            model.InvTime     = invTime;
            model.IsSpeed     = isSpeed;
            var list = HistoricalBLL.GetHistoryOverSpeedExceptionInfo(model);

            //理论上来说如果查出来的数据量大于int32.maxvalue,那么list也会返回null,所以又可能不是查不出数据而是数据太多,不过实际上不太可能这么多数据,所以这里暂时不处理
            if (list == null)
            {
                list = new List <HistorySignalShowListModel>();
            }
            //最好的做法是发现信号点太多直接给出提示要求缩小查询范围,否则地图也会很卡,这里就先算了
            //修正当信号过多时超出json长度的问题,理论上来说
            return(new JsonResult()
            {
                Data = list,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                MaxJsonLength = Int32.MaxValue
            });
        }