/// <summary> /// 取得用户所有电站跨小时的功率图表 /// </summary> /// <param name="userId"></param> /// <param name="startYYYYMMDDHH"></param> /// <param name="endYYYYMMDDHH"></param> /// <param name="chartType"></param> /// <returns></returns> public ActionResult AllPlantDayChart(int userId, string startYYYYMMDDHH, string endYYYYMMDDHH, string chartType, string lan) { setlan(lan); if (string.IsNullOrEmpty(chartType)) chartType = ChartType.column; User user = UserService.GetInstance().Get(userId); //获得报表业务逻辑类 PlantChartService reportService = PlantChartService.GetAppInstance(); //获得报表js代码 int monitorCode = MonitorType.PLANT_MONITORITEM_POWER_CODE;//发电量测点 MonitorType Mt = MonitorType.getMonitorTypeByCode(monitorCode); string unit = Mt.unit; string chartName = LanguageUtil.getDesc("CHART_DAY_POWER_CHART"); string reportData = string.Empty; if (user != null && user.plants != null) { Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = reportService.PlantDayChart(user.plants, chartName, startYYYYMMDDHH, endYYYYMMDDHH, chartType, unit, monitorCode, intervalTime); reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData)); } else { AppError appError = new AppError(AppError.useridnoexist, Resources.SunResource.CHART_USER_DONT_EXISTED); reportData = JsonUtil.convertToJson(appError, typeof(AppError)); } return Content(reportData); }
/// <summary> /// 取得单元简要数据和设备列表 /// </summary> /// <param name="uid"></param> /// <returns></returns> public ActionResult UnitDevices(int uid, string lan, string app_key, string sig, string v) { setlan(lan); string data; PlantUnit unit = PlantUnitService.GetInstance().GetPlantUnitById(uid); if (unit == null) { AppError appError = new AppError(AppError.plantnoexist, Resources.SunResource.CHART_PLANT_DONT_EXISTED); data = JsonUtil.convertToJson(appError, typeof(AppError)); } else { Plant plant = PlantService.GetInstance().GetPlantInfoById(unit.plantID); UnitDeviceVO userPlantVO = new UnitDeviceVO(); userPlantVO.unitId = unit.id; userPlantVO.name = unit.displayname; userPlantVO.units = convertToSDeviceVOs(unit.displayDevices, plant); data = JsonUtil.convertToJson(userPlantVO, typeof(UnitDeviceVO)); } return Content(data); }
/// <summary> /// 取得电站简要数据和单元列表 /// </summary> /// <param name="pid"></param> /// <param name="lan"></param> /// <param name="app_key"></param> /// <param name="sig"></param> /// <param name="v"></param> /// <returns></returns> public ActionResult PlantUnits(int pid, string lan, string app_key, string sig, string v) { setlan(lan); string data; Plant plant = PlantService.GetInstance().GetPlantInfoById(pid); if (plant == null) { AppError appError = new AppError(AppError.plantnoexist, Resources.SunResource.CHART_PLANT_DONT_EXISTED); data = JsonUtil.convertToJson(appError, typeof(AppError)); } else { User user = UserService.GetInstance().Get((int)plant.userID); Plant2UnitVO userPlantVO = new Plant2UnitVO(); userPlantVO.totalEnergy = plant.upTotalEnergy; userPlantVO.todayEnergy = plant.upTotalDayEnergy; userPlantVO.plantId = plant.id; userPlantVO.name = plant.name; userPlantVO.co2Reduction = this.getCO2Rate() * plant.TotalEnergy; userPlantVO.revenue = user.revenueRate * plant.TotalEnergy; userPlantVO.power = plant.TodayTotalPower; userPlantVO.powerUnit = "kW"; userPlantVO.revenueUnit = plant.currencies; userPlantVO.totalEnergyUnit = plant.TotalEnergyUnit; userPlantVO.todayEnergyUnit = plant.TotalDayEnergyUnit; userPlantVO.co2ReductionUnit = plant.ReductiongUnit; IList<int> workYears = CollectorYearDataService.GetInstance().GetWorkYears(new List<Plant>() { plant }); userPlantVO.errorcount = FaultService.GetInstance().getNewLogNums(new List<Plant>() { plant }, workYears); userPlantVO.pic = base.getCurWebContext() + "/ufile/small/" + plant.onePic; userPlantVO.city = plant.city; userPlantVO.country = plant.country; userPlantVO.units = convertToSUnitVOs(plant.plantUnits); data = JsonUtil.convertToJson(userPlantVO, typeof(Plant2UnitVO)); } return Content(data); }
/// <summary> /// 登录验证 /// </summary> /// <param name="username"></param> /// <param name="password"></param> /// <param name="lan"></param> /// <param name="app_key"></param> /// <param name="sig"></param> /// <param name="v"></param> /// <returns></returns> public ActionResult loginvalid(string username, string password, string lan, string app_key, string sig, string v) { //FileLogUtil.info("username:"******"Username don`t existed"); //data = JsonUtil.convertToJson(appError, typeof(AppError)); } if (user != null) { if (!user.depassword.Equals(password)) { AppError appError = new AppError(AppError.usernameOrpasswordError, "Username or password error"); data = JsonUtil.convertToJson(appError, typeof(AppError)); } else { MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE); MonitorType powerMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_POWER_CODE); Cn.Loosoft.Zhisou.SunPower.Service.vo.UserPlantVO userPlantVO = new Cn.Loosoft.Zhisou.SunPower.Service.vo.UserPlantVO(); userPlantVO.totalEnergy = user.upTotalEnergy; userPlantVO.totalEnergyUnit = user.TotalEnergyUnit; userPlantVO.todayEnergy = user.upTotalDayEnergy; userPlantVO.todayEnergyUnit = user.TotalDayEnergyUnit; userPlantVO.userId = user.id; userPlantVO.username = user.username; userPlantVO.co2Reduction = user.TotalReductiong; userPlantVO.co2ReductionUnit = user.TotalReductiongUnit; userPlantVO.revenue = Math.Round(user.revenue, 2); userPlantVO.revenueUnit = user.currencies; userPlantVO.power = user.upTotalPower; userPlantVO.powerUnit = user.TotalPowerUnit; userPlantVO.families = user.TotalFamilies.ToString(); IList<int> workYears = CollectorYearDataService.GetInstance().GetWorkYears(user.relatedPlants); userPlantVO.warnNums = FaultService.GetInstance().getNewLogNums(user.relatedPlants, workYears); userPlantVO.plants = convertToSPlantVOs(user.relatedPlants); data = JsonUtil.convertToJson(userPlantVO, typeof(Cn.Loosoft.Zhisou.SunPower.Service.vo.UserPlantVO)); } } else { return Content("error: username or password is error."); } return Content(data); }
/// <summary> /// 单个电站的年月发电量图表数据 /// </summary> /// <param name="userId">用户id</param> /// <param name="startYM">开始年月</param> /// <param name="endYM">截止年月</param> /// <param name="chartType">图表类型</param> /// <returns></returns> public ActionResult PlantYearMMChart(int pId, string startYM, string endYM, string chartType, string lan) { setlan(lan); string reportData = string.Empty; if (string.IsNullOrEmpty(chartType)) chartType = ChartType.column; Plant plant = PlantService.GetInstance().GetPlantInfoById(pId); if (plant != null) { MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE); string unit = energyMt.unit; //取得用户年度发电量图表数据 Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = PlantChartService.GetAppInstance().YearMMChartBypList(new List<Plant>() { plant }, startYM, endYM, chartType, unit); reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData)); } else { AppError appError = new AppError(AppError.plantnoexist, Resources.SunResource.CHART_PLANT_DONT_EXISTED); reportData = JsonUtil.convertToJson(appError, typeof(AppError)); } return Content(reportData); }
/// <summary> /// 用户所要电站的月天图标数据 /// </summary> /// <param name="userId"></param> /// <returns></returns> public ActionResult AllPlantMonthDayChart(int userId, string startYYYYMMDD, string endYYYYMMDD, string chartType, string lan) { setlan(lan); if (string.IsNullOrEmpty(chartType)) chartType = ChartType.column; string reportData = string.Empty; User user = UserService.GetInstance().Get(userId); if (user != null && user.plants != null) { MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE); string unit = energyMt.unit; //取得用户年度发电量图表数据 Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = PlantChartService.GetAppInstance().MMDDChartBypList(user.plants, startYYYYMMDD, endYYYYMMDD, chartType, unit); //if (chartData.series.Length > 0) //{ //if (chartData.series[0].data.Length>3) //chartData.series[0].data[3] = -566; //chartData.series[0].min = -600; //} reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData)); } else { AppError appError = new AppError(AppError.useridnoexist, Resources.SunResource.CHART_USER_DONT_EXISTED); reportData = JsonUtil.convertToJson(appError, typeof(AppError)); } return Content(reportData); }
/// <summary> /// 取得电站详细信息 /// </summary> /// <param name="pid"></param> /// <returns></returns> public ActionResult Plantinfo(int pid, string lan) { setlan(lan); string data; Plant plant = PlantService.GetInstance().GetPlantInfoById(pid); if (plant == null) { AppError appError = new AppError(AppError.plantnoexist, Resources.SunResource.CHART_PLANT_DONT_EXISTED); data = JsonUtil.convertToJson(appError, typeof(AppError)); } else { User user = UserService.GetInstance().Get((int)plant.userID); MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE); MonitorType powerMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_POWER_CODE); PlantInfoVO plantvo = new PlantInfoVO(); plantvo.totalEnergy = plant.upTotalEnergy; plantvo.todayEnergy = plant.upTotalDayEnergy; plantvo.pId = plant.id; plantvo.name = plant.name; plantvo.co2Reduction = plant.Reductiong; plantvo.revenue = user.revenue * plantvo.totalEnergy; plantvo.designPower = Math.Round(plant.design_power,2); plantvo.powerUnit = "KWp"; plantvo.revenueUnit = plant.currencies; plantvo.totalEnergyUnit = plant.TotalEnergyUnit; plantvo.todayEnergyUnit = plant.TotalDayEnergyUnit; plantvo.co2ReductionUnit = plant.ReductiongUnit; plantvo.pic = base.getCurWebContext() + "/ufile/small/" + plant.onePic; plantvo.country = plant.country; plantvo.city = plant.city; plantvo.direction = plant.direction; plantvo.installdate = plant.installdate.ToString("yyyy-MM-dd"); plantvo.angle = plant.angle; plantvo.latitude = plant.latitudeString; plantvo.location = plant.location; plantvo.longitude = plant.longitudeString; plantvo.street = plant.street; plantvo.sunlight = plant.Sunstrength.ToString(); plantvo.temperature = plant.Temperature.ToString(); plantvo.weather = "Sundy"; plantvo.moduleType = plant.module_type; plantvo.email = plant.email; plantvo.manufacturer = plant.manufacturer; plantvo.operatorPerson = plant.operater; plantvo.phone = plant.phone; plantvo.revenueRate = plant.revenueRate.ToString(); plantvo.timeZone = Cn.Loosoft.Zhisou.SunPower.Common.TimeZone.GetText(plant.timezone); plantvo.zipCode = plant.postcode; data = JsonUtil.convertToJson(plantvo, typeof(PlantInfoVO)); } return Content(data); }
/// <summary> /// 取得某个设备跨小时的某测点图表 /// </summary> /// <param name="pid"></param> /// <param name="startYYYYMMDD"></param> /// <param name="endYYYYMMDD"></param> /// <returns></returns> public ActionResult MonitorDayChart(int dId, string startYYYYMMDDHH, string endYYYYMMDDHH, string chartType, int monitorCode, string lan) { setlan(lan); if (string.IsNullOrEmpty(chartType)) chartType = ChartType.column; Device device = DeviceService.GetInstance().get(dId); //获得报表js代码 MonitorType energyMt = MonitorType.getMonitorTypeByCode(monitorCode); string unit = energyMt.unit; string chartName = device.fullName + " " + LanguageUtil.getDesc("CHART_DAY_CHART"); string reportData = string.Empty; if (device != null) { Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = DeviceChartService.GetAppInstance().DayChart(device, chartName, startYYYYMMDDHH, endYYYYMMDDHH, chartType, unit, monitorCode, intervalTime); reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData)); } else { AppError appError = new AppError(AppError.devicenoexist, Resources.SunResource.CHART_DEVICE_DONT_EXISTED); reportData = JsonUtil.convertToJson(appError, typeof(AppError)); } return Content(reportData); }
/// <summary> /// 单个设备的年月发电量图表数据 /// </summary> /// <param name="userId">用户id</param> /// <param name="startYM">开始年月</param> /// <param name="endYM">截止年月</param> /// <param name="chartType">图表类型</param> /// <returns></returns> public ActionResult DeviceYearMMChart(int dId, string startYM, string endYM, string chartType, string lan) { setlan(lan); string reportData = string.Empty; if (string.IsNullOrEmpty(chartType)) chartType = ChartType.column; Device device = DeviceService.GetInstance().get(dId); if (device != null) { MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE); string unit = energyMt.unit; //取得用户年度发电量图表数据 Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = DeviceChartService.GetAppInstance().YearMMChartByDevice(device, 1.0F, string.Format(LanguageUtil.getDesc("DEVICEYEAR_CHART_NAME"), device.fullName), startYM, endYM, chartType, unit); reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData)); } else { AppError appError = new AppError(AppError.devicenoexist, Resources.SunResource.CHART_DEVICE_DONT_EXISTED); reportData = JsonUtil.convertToJson(appError, typeof(AppError)); } return Content(reportData); }
/// <summary> /// 逆变器设备的月天数据 /// </summary> /// <param name="pid"></param> /// <param name="startYYYYMMDD"></param> /// <param name="endYYYYMMDD"></param> /// <param name="chartType"></param> /// <returns></returns> public ActionResult DeviceMonthDayChart(int dId, string startYYYYMMDD, string endYYYYMMDD, string chartType, string lan) { setlan(lan); if (string.IsNullOrEmpty(chartType)) chartType = ChartType.column; Device device = DeviceService.GetInstance().get(dId); string reportData = string.Empty; if (device != null) { MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.MIC_INVERTER_TODAYENERGY); string unit = energyMt.unit; Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = DeviceChartService.GetAppInstance().MonthDDChartByDevice(device, 1.0F, string.Format(LanguageUtil.getDesc("DEVICEMONTHCHART_NAME"), device.fullName), startYYYYMMDD, endYYYYMMDD, chartType, unit); reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData)); } else { AppError appError = new AppError(AppError.devicenoexist, Resources.SunResource.CHART_DEVICE_DONT_EXISTED); reportData = JsonUtil.convertToJson(appError, typeof(AppError)); } return Content(reportData); }
/// <summary> /// 取得设备详细信息 /// </summary> /// <param name="pid"></param> /// <returns></returns> public ActionResult Deviceinfo(int did, string lan) { setlan(lan); string data; Device device = DeviceService.GetInstance().get(did); int timezone = 0; try { PlantUnit plantUnit = PlantUnitService.GetInstance().GetPlantUnitByCollectorId(device.collectorID); Plant plant = PlantService.GetInstance().GetPlantInfoById(plantUnit.plantID); timezone = plant.timezone; } catch (Exception ee) { LogUtil.error(ee.Message); } if (device == null) { AppError appError = new AppError(AppError.devicenoexist, Resources.SunResource.CHART_DEVICE_DONT_EXISTED); data = JsonUtil.convertToJson(appError, typeof(AppError)); } else { ADeviceInfoVO vo = new ADeviceInfoVO(); vo.deviceId = device.id; vo.deviceModel = device.xinhaoName; vo.deviceName = device.fullName; vo.deviceType = device.typeName; vo.deviceTypeCode = device.deviceTypeCode.ToString(); vo.address = device.deviceAddress; if (device.deviceTypeCode == DeviceData.ENVRIOMENTMONITOR_CODE) { MonitorType mt = MonitorType.getMonitorTypeByCode(MonitorType.MIC_DETECTOR_SUNLINGHT); string str = mt.name + " :" + device.Sunlight + " " + mt.unit; mt = MonitorType.getMonitorTypeByCode(MonitorType.MIC_DETECTOR_ENRIONMENTTEMPRATURE); float tempr = device.runData == null ? 0 : device.runData.getMonitorValue(MonitorType.MIC_DETECTOR_ENRIONMENTTEMPRATURE); str += "," + mt.name + " :" + tempr + " " + mt.unit; mt = MonitorType.getMonitorTypeByCode(MonitorType.MIC_DETECTOR_WINDSPEED); string windspeed = device.getMonitorValueWithStatus(MonitorType.MIC_DETECTOR_WINDSPEED); str += "," + mt.name + " :" + windspeed + " " + mt.unit; vo.displayField = str; } else if (device.deviceTypeCode == DeviceData.HUILIUXIANG_CODE || device.deviceTypeCode == DeviceData.CABINET_CODE) { MonitorType mt = MonitorType.getMonitorTypeByCode(MonitorType.MIC_BUSBAR_TOTALCURRENT); float totalCurrent = device.runData == null ? 0 : device.runData.getMonitorValue(mt.code); string str = mt.name + " :" + totalCurrent + " " + mt.unit; mt = MonitorType.getMonitorTypeByCode(MonitorType.MIC_BUSBAR_JNTEMPRATURE); float tempr = device.runData == null ? 0 : device.runData.getMonitorValue(mt.code); str += "," + mt.name + " :" + tempr + " " + mt.unit; vo.displayField = str; } else if (device.deviceTypeCode == DeviceData.AMMETER_CODE) { MonitorType mt = MonitorType.getMonitorTypeByCode(MonitorType.MIC_AMMETER_POSITIVEACTIVEPOWERDEGREE); float totalCurrent = device.runData == null ? 0 : device.runData.getMonitorValue(mt.code); string str = mt.name + " :" + totalCurrent + " " + mt.unit; //mt = MonitorType.getMonitorTypeByCode(MonitorType.MIC_BUSBAR_JNTEMPRATURE); //float tempr = device.runData == null ? 0 : float.Parse(device.runData.getMonitorValue(mt.code)); //str += "," + mt.name + " :" + tempr + " " + mt.unit; vo.displayField = str; } else { MonitorType TotalEmt = MonitorType.getMonitorTypeByCode(MonitorType.MIC_INVERTER_TOTALENERGY); MonitorType TodayEmt = MonitorType.getMonitorTypeByCode(MonitorType.MIC_INVERTER_TODAYENERGY); MonitorType mt = MonitorType.getMonitorTypeByCode(MonitorType.MIC_INVERTER_TOTALYGPOWER); string str = TodayEmt.name + " : " + device.TodayEnergy(timezone) + TodayEmt.unit; str += "," + TotalEmt.name + " : " + device.TotalEnergy + TotalEmt.unit; str += "," + mt.name + " : " + device.TotalPower + mt.unit; vo.displayField = str; } vo.workStatus = device.status; vo.lastUpdateTime = CalenderUtil.formatDate(device.runData.updateTime, "yyyy-MM-dd HH:mm:ss"); vo.hasChart = (device.deviceTypeCode == DeviceData.INVERTER_CODE || device.deviceTypeCode == DeviceData.ENVRIOMENTMONITOR_CODE || device.deviceTypeCode == DeviceData.HUILIUXIANG_CODE || device.deviceTypeCode == DeviceData.AMMETER_CODE || device.deviceTypeCode == DeviceData.CABINET_CODE) ? "true" : "false"; vo.datas = convertToSPlantVOs(device.runData.convertRunstrToList(true, device.deviceTypeCode)); data = JsonUtil.convertToJson(vo, typeof(ADeviceInfoVO)); } return Content(data); }
/// <summary> /// 取得某个设备跨小时的功率图表 /// </summary> /// <param name="pid"></param> /// <param name="startYYYYMMDD"></param> /// <param name="endYYYYMMDD"></param> /// <returns></returns> public ActionResult DeviceDayChart(int dId, string startYYYYMMDDHH, string endYYYYMMDDHH, string chartType, string lan) { setlan(lan); if (string.IsNullOrEmpty(chartType)) chartType = ChartType.column; Device device = DeviceService.GetInstance().get(dId); int monitorCode = MonitorType.MIC_INVERTER_TOTALYGPOWER;//功率 switch (device.deviceTypeCode) { case DeviceData.HUILIUXIANG_CODE: monitorCode = MonitorType.MIC_BUSBAR_TOTALCURRENT; break; case DeviceData.CABINET_CODE: monitorCode = MonitorType.MIC_BUSBAR_TOTALCURRENT; break; case DeviceData.ENVRIOMENTMONITOR_CODE: monitorCode = MonitorType.MIC_DETECTOR_SUNLINGHT; break; case DeviceData.AMMETER_CODE: monitorCode = MonitorType.MIC_AMMETER_POSITIVEACTIVEPOWERDEGREE; break; default: monitorCode = MonitorType.MIC_INVERTER_TOTALYGPOWER;//功率 break; } MonitorType Mt = MonitorType.getMonitorTypeByCode(monitorCode); string unit = Mt.unit; string chartName = device.fullName + " " + LanguageUtil.getDesc("CHART_DAY_CHART"); string reportData = string.Empty; if (device != null) { Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = DeviceChartService.GetAppInstance().DayChart(device, chartName, startYYYYMMDDHH, endYYYYMMDDHH, chartType, unit, monitorCode, intervalTime); reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData)); } else { AppError appError = new AppError(AppError.devicenoexist, Resources.SunResource.CHART_DEVICE_DONT_EXISTED); reportData = JsonUtil.convertToJson(appError, typeof(AppError)); } return Content(reportData); }
/// <summary> /// 用户所有电站的年月发电量图表数据 /// </summary> /// <param name="userId">用户id</param> /// <param name="startYM">开始年月</param> /// <param name="endYM">截止年月</param> /// <param name="chartType">图表类型</param> /// <returns></returns> public ActionResult AllPlantYearMMChart(int userId, string startYM, string endYM, string chartType, string lan) { setlan(lan); string reportData = string.Empty; User user = UserService.GetInstance().Get(userId); if (user != null && user.plants != null) { MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE); string unit = energyMt.unit; //取得用户年度发电量图表数据 Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = PlantChartService.GetAppInstance().YearMMChartBypList(user.plants, startYM, endYM, chartType, unit); reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData)); } else { AppError appError = new AppError(AppError.useridnoexist, Resources.SunResource.CHART_USER_DONT_EXISTED); reportData = JsonUtil.convertToJson(appError, typeof(AppError)); } return Content(reportData); }
/// <summary> /// 用户所要电站的月天图标数据, /// </summary> /// <param name="userId"></param> /// <param name="startYYYYMMDD"></param> /// <param name="endYYYYMMDD"></param> /// <param name="chartType"></param> /// <param name="num">正数向前,负数向后</param> /// <returns></returns> public ActionResult AllPlantMonthDayChartBatch(int userId, int curYear, int curMonth, string chartType, int num, string lan) { setlan(lan); if (string.IsNullOrEmpty(chartType)) chartType = ChartType.column; string reportData = string.Empty; User user = UserService.GetInstance().Get(userId); string liststr = ""; if (user != null && user.plants != null) { MonitorType energyMt = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE); string unit = energyMt.unit; string startYYYYMMDD = "", endYYYYMMDD = ""; for (int i = 0; i < num + 1; i++) { if (curMonth + i > 12) { curMonth = 0; curYear = curYear + 1; } startYYYYMMDD = curYear + (curMonth + i).ToString("00") + "01"; endYYYYMMDD = curYear + (curMonth + i).ToString("00") + CalenderUtil.getMonthDays(curYear, (curMonth + i)); //取得用户年度发电量图表数据 Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = PlantChartService.GetAppInstance().MMDDChartBypList(user.plants, startYYYYMMDD, endYYYYMMDD, chartType, unit); reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData)); liststr += reportData + "▲"; } num = -1 * num; for (int i = -1; i > num - 1; i--) { if (curMonth + i < 1) { curMonth = 13; curYear = curYear - 1; } startYYYYMMDD = curYear + (curMonth + i).ToString("00") + "01"; endYYYYMMDD = curYear + (curMonth + i).ToString("00") + CalenderUtil.getMonthDays(curYear, (curMonth + i)); //取得用户年度发电量图表数据 Cn.Loosoft.Zhisou.SunPower.Common.ChartData chartData = PlantChartService.GetAppInstance().MMDDChartBypList(user.plants, startYYYYMMDD, endYYYYMMDD, chartType, unit); reportData = JsonUtil.convertToJson(chartData, typeof(Cn.Loosoft.Zhisou.SunPower.Common.ChartData)); liststr = reportData + "▲" + liststr; } if (!liststr.Equals("")) { liststr = liststr.Substring(0, liststr.Length - 1); } reportData = liststr; } else { AppError appError = new AppError(AppError.useridnoexist, Resources.SunResource.CHART_USER_DONT_EXISTED); reportData = JsonUtil.convertToJson(appError, typeof(AppError)); } return Content(reportData); }