Example #1
0
 /// <summary>
 /// 取得用户的所有故障列表
 /// </summary>
 /// <param name="pagecount">第几页</param>
 /// <param name="pagesize">每页显示数量</param>
 /// <param name="app_key">第三方应用唯一key</param>
 /// <param name="call_id">请求序号</param>
 /// <param name="sig">签名</param>
 /// <param name="v">api版本</param>
 /// <param name="format">返回结果格式,暂时值支持json</param>
 /// <param name="lan">语言环境,暂时只支持中英文</param>
 /// <returns></returns>
 public ActionResult PlantTimezoneList(int pagecount, int pagesize, string app_key, string call_id, string sig, string v, string format, string lan)
 {
     setlan(lan);
     string reportData = string.Empty;
     if (pagecount == 0) pagecount = 1;
     if (pagesize == 0) pagesize = 10;
     Pager page = new Pager() { PageIndex = pagecount, PageSize = pagesize };
     IList<Plant> plants = PlantService.GetInstance().GetPlantByPage(page);
     if (plants.Count > 0)
     {
         PlantTimezonePageVo plantTimezonePageVo = new PlantTimezonePageVo();
         IList<PlantTimezoneVo> timezonevos = new List<PlantTimezoneVo>();
         PlantTimezoneVo plantTimezoneVo = null;
         foreach (Plant plant in plants) {
             plantTimezoneVo = new PlantTimezoneVo();
             plantTimezoneVo.plantId = plant.id.ToString();
             plantTimezoneVo.plantName = plant.name;
             plantTimezoneVo.timezoneCode = plant.timezone.ToString();
             plantTimezoneVo.timezoneName = Cn.Loosoft.Zhisou.SunPower.Common.TimeZone.GetText(plant.timezone);
             timezonevos.Add(plantTimezoneVo);
         }
         plantTimezonePageVo.timezones = timezonevos;
         plantTimezonePageVo.totalpagecount = page.PageCount;
         reportData = JsonUtil.convertToJson(plantTimezonePageVo, typeof(PlantTimezonePageVo));
     }
     else
     {
         ApiError appError = new ApiError(ApiError.plantnoexist, Resources.SunResource.CHART_PLANT_DONT_EXISTED);
         reportData = JsonUtil.convertToJson(appError, typeof(ApiError));
     }
     return Content(reportData);
 }
Example #2
0
        /// <summary>
        /// 按照sn取得对应时区
        /// add by qhb in 20120831 
        /// </summary>
        /// <param name="sn">sn</param>
        /// <param name="app_key">第三方应用唯一key</param>
        /// <param name="call_id">请求序号</param>
        /// <param name="sig">签名</param>
        /// <param name="v">api版本</param>
        /// <param name="format">返回结果格式,暂时值支持json</param>
        /// <param name="lan">语言环境,暂时只支持中英文</param>
        /// <returns></returns>
        public ActionResult SnTimezone(string sn, string app_key, string call_id, string sig, string v, string format, string lan)
        {
            setlan(lan);

            int collectorId = CollectorInfoService.GetInstance().getCollectorIdbyCode(sn);
            PlantUnit plantUnit = PlantUnitService.GetInstance().GetPlantUnitByCollectorId(collectorId);
            string reportData = string.Empty;
            if (plantUnit != null)
            {
                Plant plant = PlantService.GetInstance().GetPlantInfoById(plantUnit.plantID);
                if (plant == null)
                {
                    ApiError appError = new ApiError(ApiError.plantnoexist, Resources.SunResource.CHART_PLANT_DONT_EXISTED);
                    reportData = JsonUtil.convertToJson(appError, typeof(ApiError));
                }
                else
                {
                    PlantTimezoneVo plantTimezoneVo = new PlantTimezoneVo();
                    plantTimezoneVo.plantId = plant.id.ToString();
                    plantTimezoneVo.plantName = plant.name;
                    plantTimezoneVo.timezoneCode = plant.timezone.ToString();
                    plantTimezoneVo.timezoneName = Cn.Loosoft.Zhisou.SunPower.Common.TimeZone.GetText(plant.timezone);
                    reportData = JsonUtil.convertToJson(plantTimezoneVo, typeof(PlantTimezoneVo));
                }
            }
            else
            {
                ApiError appError = new ApiError(ApiError.plantnoexist, Resources.SunResource.CHART_PLANT_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(ApiError));
            }
            return Content(reportData);
        }
Example #3
0
        /// <summary>
        /// 电站月天数据
        /// </summary>
        /// <param name="pId">电站id</param>
        /// <param name="startTime">开始时间,格式:yyyyMMdd 20111112</param>
        /// <param name="endTime">截止时间,格式:yyyyMMdd 20111212</param>
        /// <param name="app_key">第三方应用唯一key</param>
        /// <param name="call_id">请求序号</param>
        /// <param name="sig">签名</param>
        /// <param name="v">api版本</param>
        /// <param name="format">返回结果格式,暂时值支持json</param>
        /// <param name="lan">语言环境,暂时只支持中英文</param>
        /// <returns>图表封装的数据</returns>
        public ActionResult PlantMonthDayChart(int pId, string startDate, string endDate, string app_key, string call_id, string sig, string v, string format, string lan)
        {
            setlan(lan);

            string chartType = ChartType.column;
            Plant plant = PlantService.GetInstance().GetPlantInfoById(pId);
            string reportData = string.Empty;
            if (plant != null)
            {
                MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE);
                string unit = energyMt.unit;
                Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = PlantChartService.GetInstance().MMDDChartBypList(new List<Plant> { plant }, startDate, endDate, chartType, unit);
                reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData));
            }
            else
            {
                ApiError appError = new ApiError(ApiError.plantnoexist, Resources.SunResource.CHART_PLANT_DONT_EXISTED);
                reportData = JsonUtil.convertToJson(appError, typeof(ApiError));
            }
            return Content(reportData);
        }