public IHttpActionResult GetPerrenial(bool selection) { PlantService plantService = CreatePlantService(); var plants = plantService.GetPerrenialPlants(selection); return(Ok(plants)); }
private void PrepareSelectLists() { using (var fpsrv = new FailPropertiesService()) { using (var plantService = new PlantService()) { using (var securityService = new SecurityService()) { ViewBag.FailProperties = new SelectList(fpsrv.GetAll(), "ID", "Code"); ViewBag.Plants = new SelectList(plantService.GetAll(), "ID", "Code"); var qcTechItems = securityService.GetAll().ToList(); var leadOpItems = securityService.GetAll().ToList(); var supervisorItems = securityService.GetAll().ToList(); var managerItems = securityService.GetAll().ToList(); ViewBag.QCTechs = new SelectList(qcTechItems, "ID", "FullName"); ViewBag.LeadOperators = new SelectList(leadOpItems, "ID", "FullName"); ViewBag.Supervisors = new SelectList(supervisorItems, "ID", "FullName"); ViewBag.Managers = new SelectList(managerItems, "ID", "FullName"); } } } }
/// <summary> /// 取得工作年份,待完善 /// /// </summary> /// <param name="list"></param> /// <returns></returns> private IList <string> getWorkYears(List <DeviceStuct> list) { IList <int> workYears = new List <int>(); IList <string> newWorkYears = new List <string>(); foreach (DeviceStuct ds in list) { if (ds.deviceType == ChartDeviceType.PLANT) { Plant plant = PlantService.GetInstance().GetPlantInfoById(int.Parse(ds.deviceId)); workYears = CollectorYearDataService.GetInstance().GetWorkYears(plant); } } if (workYears.Count > 0) { foreach (int year in workYears) { newWorkYears.Add(year.ToString()); } } else { newWorkYears.Add(DateTime.Now.Year.ToString()); } return(newWorkYears); }
/// <summary> /// 加载首页数据,抽取出来供首页加载方法和首页登录方法调用 /// author:hbqian in 2013/02/21 /// </summary> private void loadIndexData() { //取得最新加入的电站 IList <Plant> newPlants = PlantService.GetInstance().GetNewPlantInfoList(4); User userinfo = UserService.GetInstance().GetUserByName(UserUtil.demousername); if (userinfo != null) { IList <PlantUser> plant = PlantUserService.GetInstance().GetAllPlantUserByUserID(new PlantUser { userID = userinfo.id }); ViewData["examplePlant"] = plant; } ViewData["newPlants"] = newPlants; float co2Rate = ItemConfigService.GetInstance().getCO2Config(); ViewData["AllPlant"] = PlantService.GetInstance().GetPlantNum(); double alltotalenergy = DeviceRunDataService.GetInstance().GetAllTotalEnergy(); //modify by hbqian at 2013-08-02 for 同一时刻 2个值结果不一致 ,首页和内部所有电站日发电量统计值不一致 //double dayEnergy = CollectorRunDataService.GetInstance().GetAllDayEnergy(); double dayEnergy = getAllPlantTodayEnergy(); //modify by hbqian at 2013-08-02 for 同一时刻 2个值结果不一致 ,首页和内部所有电站日发电量统计值不一致 end double co2Value = alltotalenergy * co2Rate; ViewData["co2Unit"] = Util.upCo2Unit(co2Value); ViewData["energyUnit"] = Util.upEnergyUnit(alltotalenergy); ViewData["dayenergyUnit"] = Util.upEnergyUnit(dayEnergy); ViewData["AllTotalEnergy"] = StringUtil.formatDouble(Util.upDigtal(alltotalenergy)); ViewData["AlldayTotalEnergy"] = StringUtil.formatDouble(Util.upDigtal(dayEnergy)); ViewData["AllCO2"] = StringUtil.formatDouble(Util.upDigtal(co2Value)); getPPics(); getAdPics(); }
public ActionResult SavePlant(Plant plant) { string long1 = Request.Form["long1"]; string long2 = Request.Form["long2"]; string long3 = Request.Form["long3"]; double value = 0; double longValue = 0; double.TryParse(long1, out longValue); value += longValue; double.TryParse(long2, out longValue); value += (longValue / 60); double.TryParse(long3, out longValue); value += (longValue / 3600); plant.longitude = value; value = 0; longValue = 0; string lat1 = Request.Form["lat1"]; double.TryParse(lat1, out longValue); value += longValue; string lat2 = Request.Form["lat2"]; double.TryParse(lat2, out longValue); value += (longValue / 60); string lat3 = Request.Form["lat3"]; double.TryParse(lat3, out longValue); value += (longValue / 3600); plant.latitude = value; plant.longitudeString = string.Format("{0},{1},{2}", long1, long2, long3); plant.latitudeString = string.Format("{0},{1},{2}", lat1, lat2, lat3); if (string.IsNullOrEmpty(plant.pic)) { plant.pic = string.Empty; } plant.userID = UserUtil.getCurUser().id; CountryCity area = CountryCityService.GetInstance().GetCity(plant.country); plant.area = area == null ? string.Empty : area.weather_code; int plantid = plant.id; if (plant.id > 0) { PlantService.GetInstance().UpdatePlantInfo(plant); } else { plantid = PlantService.GetInstance().AddPlantInfo(plant); PlantUserService.GetInstance().AddPlantUser(new PlantUser { plantID = plantid, userID = int.Parse(plant.userID.ToString()) }); //添加电站时,向电站用户关系表中加记录 } UserUtil.ResetLogin(UserUtil.getCurUser()); return(Redirect("/newregister/addplantcontrol?plantid=" + plantid)); }
/// <summary> /// 加载逆变器比较页面 /// </summary> /// <returns></returns> public ActionResult UdeviceChart(int id) { PlantUnit unit = PlantUnitService.GetInstance().GetPlantUnitById(id); Plant plant = PlantService.GetInstance().GetPlantInfoById(unit.plantID); ViewData["plantUnit"] = unit; ViewData["hashlx"] = false; ViewData["hasinverter"] = false; foreach (Device dce in unit.devices) { if (dce.deviceTypeCode == DeviceData.HUILIUXIANG_CODE && !dce.isHidden) { ViewData["hashlx"] = true; break; } } foreach (Device dce in unit.devices) { if (dce.deviceTypeCode == DeviceData.INVERTER_CODE && !dce.isHidden) { ViewData["hasinverter"] = true; break; } } FillPlantYears(plant.id.ToString()); return(View(plant)); }
public ActionResult MonthDDChart(int plantId) { string reportCode = string.Empty; Plant plant = PlantService.GetInstance().GetPlantInfoById(plantId); if (plant != null) { string unit = "kWh"; string startYYYYMMDD = DateTime.Now.ToString("yyyyMM01"); string endYYYYMMDD = new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 1).AddDays(-1).ToString("yyyyMMdd"); //ChartData chartData = PlantChartService.GetInstance().MMDDChartBypList(new List<Plant> { plant }, startYYYYMMDD, endYYYYMMDD, "column", unit); ChartData chartData = PlantChartService.GetInstance().MonthDDChartBypList(new List <Plant> { plant }, 1.0F, LanguageUtil.getDesc("CHART_TITLE_MONTH_ENERGY"), null, startYYYYMMDD, endYYYYMMDD, ChartType.column, unit, false); foreach (YData yd in chartData.series) { if (yd.max == 0) { yd.max = 10; } } reportCode = JsonUtil.convertToJson(chartData, typeof(ChartData)); } else { return(Content("error:" + Resources.SunResource.NODATA)); } return(Content(reportCode)); }
public IHttpActionResult GetZones() { PlantService plantService = CreatePlantService(); var zones = plantService.GetPlantZones(); return(Ok(zones)); }
public IHttpActionResult GetRootStructures() { PlantService plantService = CreatePlantService(); var rootStructures = plantService.GetRootStructure(); return(Ok(rootStructures)); }
public IHttpActionResult GetSeasons() { PlantService plantService = CreatePlantService(); var seasons = plantService.GetPlantSeasons(); return(Ok(seasons)); }
public IHttpActionResult GetTypes() { PlantService plantService = CreatePlantService(); var types = plantService.GetPlantTypes(); return(Ok(types)); }
public IHttpActionResult GetDaysToGerminate(int minDays, int maxDays) { PlantService plantService = CreatePlantService(); var plants = plantService.GetPlantByDaysToGerminate(minDays, maxDays); return(Ok(plants)); }
private PlantService CreatePlantService() { var userID = Guid.Parse(User.Identity.GetUserId()); var plantService = new PlantService(userID); return(plantService); }
public IHttpActionResult GetZoneAndSeason(int zoneId, int seasonID) { PlantService plantService = CreatePlantService(); var plants = plantService.GetPlantByZoneAndSeason(zoneId, seasonID); return(Ok(plants)); }
public IHttpActionResult GetWaterNeed(int waterNeedID) { PlantService plantService = CreatePlantService(); var plants = plantService.GetPlantsByWaterNeed(waterNeedID); return(Ok(plants)); }
public IHttpActionResult GetSunExposure() { PlantService plantService = CreatePlantService(); var sunExposures = plantService.GetSunExposure(); return(Ok(sunExposures)); }
/// <summary> /// 加载图表页面 /// </summary> /// <returns></returns> public ActionResult Chart(int pId, int dId) { Plant plant = PlantService.GetInstance().GetPlantInfoById(pId); Device device = DeviceService.GetInstance().get(dId); ViewData["device"] = device; ViewData["Plant"] = plant; FillPlantYears(pId.ToString()); if (device.deviceTypeCode == DeviceData.INVERTER_CODE) { return(View(@"InverterChart", plant)); } else if (device.deviceTypeCode == DeviceData.HUILIUXIANG_CODE) { return(View(@"HlxChart", plant)); } else if (device.deviceTypeCode == DeviceData.CABINET_CODE) { return(View(@"CabinetChart", plant)); } else if (device.deviceTypeCode == DeviceData.AMMETER_CODE) { return(View(@"AmmeterChart", plant)); } else { return(View(@"DetectorChart", plant)); } }
public IHttpActionResult GetWaterNeeds() { PlantService plantService = CreatePlantService(); var waterNeeds = plantService.GetWaterNeeds(); return(Ok(waterNeeds)); }
public ActionResult PlantData(int plantId) { Plant plant = PlantService.GetInstance().GetPlantInfoById(plantId); Cn.Loosoft.Zhisou.SunPower.Common.vo.PlantVO plantVO = new Cn.Loosoft.Zhisou.SunPower.Common.vo.PlantVO(); User user = UserService.GetInstance().Get((int)plant.userID); plantVO.plantName = plant.name; plantVO.CQ2reduce = plant.Reductiong.ToString(); plantVO.CQ2reduceUnit = plant.ReductiongUnit; plantVO.curPower = plant.DisplayTodayTotalPower; plantVO.curPowerUnit = plant.TodayTotalPowerUnit; plantVO.dayEnergy = plant.DisplayTotalDayEnergy; plantVO.dayEnergyUnit = plant.TotalDayEnergyUnit; plantVO.solarIntensity = plant.Sunstrength == null ? "" : plant.Sunstrength.ToString(); plantVO.solarIntensityUnit = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_LINGT_CODE).unit; //add by qhb in 20120106 for 增加逆变器数量 IList <Device> inverterDevices = plant.typeDevices(DeviceData.INVERTER_CODE); plantVO.inverterCount = inverterDevices.Count.ToString(); plantVO.inverterTypeStr = getMainType(inverterDevices, 3); plantVO.installDate = plant.installdate.ToString("yyyy-MM-dd"); plantVO.DesignPower = plant.design_power + " kWp"; plantVO.Country = plant.country; plantVO.City = plant.city; plantVO.organize = user.organize; plantVO.totalEnergy = plant.DisplayTotalEnergy; plantVO.totalEnergyUnit = plant.TotalEnergyUnit; plantVO.imageArray = "http://" + Request.Url.Authority + (string.IsNullOrEmpty(plant.onePic) ? "/bigscreen/images/plant_img.jpg":"/ufile/" + plant.onePic); plantVO.temprature = getPlantTemp(plant).ToString(); plantVO.tempratureUnit = user.TemperatureType.ToUpper(); return(Json(plantVO, JsonRequestBehavior.AllowGet)); }
public IHttpActionResult GetPlantByMedicianlResistanceAndToxicity(GetSpecialDetailsModel model) { PlantService plantService = CreatePlantService(); var specialDetails = plantService.GetPlantByMedicinalResistanceAndToxicity(model); return(Ok(specialDetails)); }
public ActionResult YearMMChart(int plantId) { string reportCode = string.Empty; if (plantId > 0) { string unit = "kWh"; Plant plant = PlantService.GetInstance().GetPlantInfoById(plantId); //ChartData chartData = PlantChartService.GetInstance().YearMMChartByPlant(plant, DateTime.Now.Year, ChartType.column, unit); string chartName = LanguageUtil.getDesc("CHART_TITLE_YEARLYENERGYCHART"); //if (startYearMM.Substring(0, 4).Equals(endYearMM.Substring(0, 4)) && startYearMM.Substring(4, 2).Equals("01") && endYearMM.Substring(4, 2).Equals("12")) { //chartName = startYearMM.Substring(0, 4) + chartName; //} string startYearMM = DateTime.Now.Year + "01"; string endYearMM = DateTime.Now.Year + "12"; ChartData chartData = PlantChartService.GetInstance().YearMMChartBypList(new List <Plant> { plant }, 1.0F, chartName, null, startYearMM, endYearMM, ChartType.column, unit, true); foreach (YData yd in chartData.series) { if (yd.max == 0) { yd.max = 10; } } reportCode = JsonUtil.convertToJson(chartData, typeof(ChartData)); } else { return(Content("error:" + Resources.SunResource.NODATA)); } return(Content(reportCode)); }
public IHttpActionResult Get() { PlantService plantService = CreatePlantService(); var plant = plantService.GetAllPlants(); return(Ok(plant)); }
public ActionResult RunData(int id) { Device device = DeviceService.GetInstance().get(id); IList <IList <KeyValuePair <MonitorType, string> > > rundatas = device.runData.convertRunstrToList(true, device.deviceTypeCode); ViewData["rundatas"] = rundatas; ViewData["device"] = device; PlantUnit plantUnit = PlantUnitService.GetInstance().GetPlantUnitByCollectorId(device.collectorID); Plant plant = PlantService.GetInstance().GetPlantInfoById(plantUnit.plantID); ViewData["plant"] = plant; //add by qhb in 20120825 for显示测点详细 int displayHxlroute = 0; try { displayHxlroute = int.Parse(device.getMonitorValue(MonitorType.MIC_BUSBAR_MAXLINE).ToString()); }catch (Exception e) { displayHxlroute = 0; } if (displayHxlroute == 0) { displayHxlroute = 16; //如果未传路数则默认用16路 } ViewData["displayHxlroute"] = displayHxlroute; ViewData["digitalinputdetail"] = getDetails(device, MonitorType.MIC_BUSBAR_DIGITALINPUT, displayHxlroute); ViewData["workstatusdetail"] = getDetails(device, MonitorType.MIC_BUSBAR_STATUS, displayHxlroute); return(View()); }
public IHttpActionResult GetType(int plantTypeID) { PlantService plantService = CreatePlantService(); var plant = plantService.GetPlantByType(plantTypeID); return(Ok(plant)); }
public ActionResult Device() { String pid = Request.QueryString["pid"]; Plant plant = PlantService.GetInstance().GetPlantInfoById(Convert.ToInt32(pid)); return(View(plant)); }
public IHttpActionResult GetWidth(double min, double max) { PlantService plantService = CreatePlantService(); var plants = plantService.GetPlantsByWidth(min, max); return(Ok(plants)); }
public PlantService CreatePlantService() { var UserId = Guid.Parse(User.Identity.GetUserId()); var service = new PlantService(UserId); return(service); }
public IHttpActionResult GetSunExposure(int sunExposureID) { PlantService plantService = CreatePlantService(); var plants = plantService.GetPlantsBySunExposure(sunExposureID); return(Ok(plants)); }
public ActionResult DefinedPlantChartList(int id, string cid) { int temp = 0; int.TryParse(cid, out temp); Plant plant = PlantService.GetInstance().GetPlantInfoById(id); SetDeviceList(plant); SetMI(null); CustomChart cus = null; if (string.IsNullOrEmpty(cid)) { cus = new CustomChart(); cus.groupId = 0; cus.plantId = plant.id; } else { cus = CustomChartService.GetInstance().Get(new CustomChart() { id = temp }); Analysis(ref cus); } ViewData["charts"] = CustomChartService.GetInstance().GetListByPlant(cus.plantId); return(View("CustomChartList", cus)); }
public IHttpActionResult GetHeightMax(double plantHeightMax) { PlantService plantService = CreatePlantService(); var plants = plantService.GetPlantsByHeightMax(plantHeightMax); return(Ok(plants)); }