/// <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); }
public ActionResult Units_Output(int id) { Plant plant = FindPlant(id); IList <PlantUnit> plantUnits = PlantUnitService.GetInstance().GetAllPlantUnitsByPlantId(id); CsvStreamWriter writer = new CsvStreamWriter(); IList <string> listData = new List <string>(); listData.Add(string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},", Resources.SunResource.PLANT_UNIT_LIST_STATUS, Resources.SunResource.PLANT_UNIT_DATA_SOURCE_CODE , Resources.SunResource.PLANT_UNIT_LIST_UNIT_NAME, Resources.SunResource.PLANT_UNIT_LIST_POWER + "(kW)", Resources.SunResource.PLANT_UNIT_LIST_YEAR_ENERGY + "(kWh)", Resources.SunResource.PLANT_UNIT_LIST_ENERGY + "(kWh)", Resources.SunResource.PLANT_UNIT_LIST_MONTH_ENERGY + "(kWh)", Resources.SunResource.PLANT_UNIT_LIST_MONTH_ENERGY_KWP + "(kWh/kWp)", Resources.SunResource.PLANT_UNIT_LIST_YEAR_ENERGY_KWP + "(kWh/kWp)" )); CollectorMonthDayData cmData = null; CollectorYearData cyData = null; foreach (PlantUnit unit in plantUnits) { float currentMonthEnergy = 0; float currentYearEnergy = 0; cmData = CollectorMonthDayDataService.GetInstance().GetCollectorMonthDayData(DateTime.Now.Year, unit.collector.id, DateTime.Now.Month); currentMonthEnergy = cmData == null ? 0 : cmData.count(); cyData = CollectorYearDataService.GetInstance().GetCollectorYearData(unit.collector.id, DateTime.Now.Year); currentYearEnergy = cyData == null ? 0 : cyData.dataValue; listData.Add(string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},", unit.isWork(plant.timezone) ? Resources.SunResource.MONITORITEM_WORKING : Resources.SunResource.MONITORITEM_STOPPED, string.Format("\t{0}", unit.collector.code) , string.Format("\t{0}", unit.displayname), unit.TodayPower(plant.timezone).ToString(), currentYearEnergy.ToString(), unit.displayTotalEnergy.ToString(), currentMonthEnergy.ToString(), Math.Round(currentMonthEnergy / unit.chartPower, 2).Equals(double.NaN) ? "0" : Math.Round(currentMonthEnergy / unit.chartPower, 2).ToString(), Math.Round(currentYearEnergy / unit.chartPower, 2).Equals(double.NaN) ? "0" : Math.Round(currentYearEnergy / unit.chartPower, 2).ToString() )); } writer.AddStrDataList(listData); string fullFile = Server.MapPath("/") + "tempexportfile\\" + Resources.SunResource.PLANT_UNIT_LIST_FILENAME + ".csv"; writer.Save(fullFile); //转化为csv格式的字符串 ActionResult tmp = File(fullFile, "text/csv; charset=UTF-8", urlcode(Resources.SunResource.PLANT_UNIT_LIST_FILENAME) + ".csv"); return(tmp); }
/// <summary> /// 取得电站简要数据和单元列表 /// </summary> /// <param name="pid"></param> /// <returns></returns> public ActionResult PlantUnits(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); 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="tcpmessage"></param> private static void CacheCollectorEnergyData(IDictionary <string, double?> collectorEnergyMap) { int collectorID; string[] keyArr; int year; int month; int day; float? data; Collector collector = null; //string[] keys = collectorEnergyMap.Keys.ToArray(); foreach (string ekey in collectorEnergyMap.Keys) { try { keyArr = ekey.Split(':'); collectorID = int.Parse(keyArr[0]); //原来是通过消息头部取得,现在改为 data = collectorEnergyMap[ekey] == null ? 0 : float.Parse(collectorEnergyMap[ekey].ToString()); if (data == 0)//如果头部未传或者为0则再从设备累计下看看 { //现在改为通过采集器的设备的今日电量来累加 collector = CollectorInfoService.GetInstance().Get(collectorID); if (keyArr.Length < 4 || (string.IsNullOrEmpty(keyArr[1]) || string.IsNullOrEmpty(keyArr[2]) || string.IsNullOrEmpty(keyArr[3]))) { continue; } data = collector.deviceTodayEnergy(keyArr[1] + keyArr[2] + keyArr[3]); } year = int.Parse(keyArr[1]); month = int.Parse(keyArr[2]); day = int.Parse(keyArr[3]); string d_column = "d_" + day; //取得月天数据对象 CollectorMonthDayData collectorMonthDayData = CollectorMonthDayDataService.GetInstance().GetCollectorMonthDayData(year, collectorID, month); collectorMonthDayData.curDay = day; //给相应属性赋值 if (collectorMonthDayData != null) { object ovalue = ReflectionUtil.getProperty(collectorMonthDayData, d_column); if (ovalue == null || float.Parse(ovalue.ToString()) < data) { ReflectionUtil.setProperty(collectorMonthDayData, d_column, data); } } CollectorMonthDayDataService.GetInstance().Cache(collectorMonthDayData); //更新年月发电量数据 //统计年月 string m_column = "m_" + month; float? m_value = collectorMonthDayData.count(); CollectorYearMonthData ymdData = CollectorYearMonthDataService.GetInstance().GetCollectorYearMonthData(collectorID, year);; ymdData.curMonth = month; //给年月数据对象相应属性赋值 if (ymdData != null) { object ovalue = ReflectionUtil.getProperty(ymdData, m_column); if (ovalue == null || float.Parse(ovalue.ToString()) < m_value) { ReflectionUtil.setProperty(ymdData, m_column, m_value); } } CollectorYearMonthDataService.GetInstance().Cache(ymdData); //统计总体发电量 float? y_value = ymdData.count(); CollectorYearData yd = CollectorYearDataService.GetInstance().GetCollectorYearData(collectorID, year); if (yd == null) { yd = new CollectorYearData() { dataValue = 0, collectorID = collectorID, year = year } } ; yd.localAcceptTime = DateTime.Now; //给年月数据对象相应属性赋值 if (yd != null) { object ovalue = yd.dataValue; if (ovalue == null || float.Parse(ovalue.ToString()) < y_value) { yd.dataValue = y_value == null ? 0 : float.Parse(y_value.ToString()); } } CollectorYearDataService.GetInstance().Cache(yd); } catch (Exception onee) {//捕获单个异常,保证一个错误不影响其他采集器数据处理 LogUtil.error("Cache collectorEnergyMap of ekey is " + ekey + " error:" + onee.Message); } } }
public static void peristentData() { Console.WriteLine("开始持久化"); //持久化设备天数据 try { DeviceDayDataService.GetInstance().batchSave(BaseMessage.devicedayDataMapList); } catch (Exception ee) { LogUtil.error("持久化设备天数据异常:" + ee.Message); } //持久化采集器天数据 try { CollectorDayDataService.GetInstance().batchSave(BaseMessage.collectordayDataMap); } catch (Exception ee) { LogUtil.error("持久化采集器天数据异常:" + ee.Message); } //持久化设备实时数据 try{ DeviceRunDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化设备实时数据数据异常:" + ee.Message); } //持久化采集器实时数据 try { LogUtil.writeline("start 持久化采集器实时数据"); CollectorRunDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化采集器实时数据异常:" + ee.Message); } //持久化最大值统计 try{ DeviceDataCountService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化最大值统计异常:" + ee.Message); } //持久化设备月天数据 try{ DeviceMonthDayDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化设备月天数据异常:" + ee.Message); } //持久化采集器月天数据 try{ CollectorMonthDayDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化采集器月天数据异常:" + ee.Message); } //持久化设备年月数据 try{ DeviceYearMonthDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化设备年月数据异常:" + ee.Message); //DeviceYearMonthDataService.GetInstance().batchSave(); } //持久化采集器年月数据 try{ CollectorYearMonthDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化采集器年月数据异常:" + ee.Message); } //持久化设备总体数据 try{ DeviceYearDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化采集器年月数据异常:" + ee.Message); } //持久化采集器总体数据 try { CollectorYearDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化采集器总体数据异常:" + ee.Message); } //add by qhb in 20120415 for 2.0协议持久化电站信息,持久化后不删除, try { PlantService.GetInstance().batchSave(BaseMessage.plantInfoMap); } catch (Exception ee) { LogUtil.error("持久化电站信息数据异常:" + ee.Message); } //add by qhb in 20120715 for 2.0协议持久化设备信息,持久化后不删除, try { DeviceService.GetInstance().batchSave(BaseMessage.deviceInfoMap); } catch (Exception ee) { LogUtil.error("持久化设备信息数据异常:" + ee.Message); } }
/// <summary> /// 获取电站信息 /// </summary> /// <param name="pid">电站id</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 plantinfo(int pid, string app_key, string call_id, string sig, string v, string format, string lan) { setlan(lan); Plant plant = PlantService.GetInstance().GetPlantInfoById(pid); PlantVO vo = new PlantVO(); if (plant != null) { vo.CQ2reduce = plant.Reductiong.ToString(); vo.CQ2reduceUnit = plant.ReductiongUnit; vo.curPower = plant.TodayTotalPower.ToString(); vo.curPowerUnit = "kW"; vo.dayEnergy = plant.DisplayTotalDayEnergy; vo.dayEnergyUnit = plant.TotalDayEnergyUnit; IList <int> workYears = CollectorYearDataService.GetInstance().GetWorkYears(new List <Plant>() { plant }); vo.logCount = FaultService.GetInstance().getNewLogNums(new List <Plant>() { plant }, workYears); vo.plantId = pid; vo.plantName = plant.name; vo.solarIntensity = plant.Sunstrength.ToString(); vo.solarIntensityUnit = MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_LINGT_CODE).unit; //add by qhb in 20120106 for 增加逆变器数量 IList <Device> inverterDevices = plant.typeDevices(DeviceData.INVERTER_CODE); vo.inverterCount = inverterDevices.Count.ToString(); vo.inverterTypeStr = getMainType(inverterDevices, 3); string ts = ""; double t = plant.Temperature; User user = UserService.GetInstance().Get((int)plant.userID); if (t == 0) { CityCodeService codeService = CityCodeService.GetInstance(); t = codeService.GetTemperature(plant.city); if (!double.IsNaN(t)) { ts = t.ToString("0.0"); } } else { ts = t.ToString("0.0"); } if (user != null && !user.TemperatureType.ToLower().Equals("c")) { t = (32 + (t * 1.8)); ts = t.ToString("0.0"); } vo.temprature = ts; vo.tempratureUnit = user.TemperatureType.ToUpper(); vo.totalEnergy = plant.DisplayTotalEnergy; vo.totalEnergyUnit = plant.TotalEnergyUnit; vo.imageArray = "http://" + Request.Url.Authority + "/ufile/" + (string.IsNullOrEmpty(plant.onePic) ? "Nopic/nopico02.gif" : plant.onePic); vo.DesignPower = plant.design_power + " kWp"; vo.Country = plant.country; vo.City = plant.city; vo.organize = user.organize; vo.installDate = plant.installdate.ToString("yyyy-MM-dd"); } string data = JsonUtil.convertToJson(vo, typeof(PlantVO)); return(Content(data)); }
/// <summary> /// 取得用户的所有故障列表 /// </summary> /// <param name="userId">用户id</param> /// <param name="pagecount">第几页</param> /// <param name="pagesize">每页显示数量</param> /// <param name="errortype">告警类型:all是所有,error:错误,warning:警告,fault:故障,inf:信息</param> /// <param name="errorby">排序字段</param> /// <returns></returns> public ActionResult ErrorList(int userId, string pagecount, string pagesize, string errortype, string errorby, string lan) { setlan(lan); User user = UserService.GetInstance().Get(userId); IList <int> years = CollectorYearDataService.GetInstance().GetWorkYears(user.plants); int manyear = years.Count > 0 ? years[0] : DateTime.Now.Year; DateTime startTime = Convert.ToDateTime(string.Format("{0}-{1}", manyear, "01-01")); DateTime endTime = DateTime.Now; int psize = 0; int.TryParse(pagesize, out psize); FaultService service = FaultService.GetInstance(); string inforank = ""; if (errortype.Equals("all")) { inforank = ErrorType.ERROR_TYPE_ERROR + "," + ErrorType.ERROR_TYPE_FAULT + "," + ErrorType.ERROR_TYPE_INFORMATRION + "," + ErrorType.ERROR_TYPE_WARN; } if (errortype.Equals("error")) { inforank = ErrorType.ERROR_TYPE_ERROR.ToString(); } if (errortype.Equals("warning")) { inforank = ErrorType.ERROR_TYPE_WARN.ToString(); } if (errortype.Equals("fault")) { inforank = ErrorType.ERROR_TYPE_FAULT.ToString(); } if (errortype.Equals("info")) { inforank = ErrorType.ERROR_TYPE_INFORMATRION.ToString(); } Hashtable table = new Hashtable(); Pager page = new Pager() { PageIndex = int.Parse(pagecount), PageSize = psize }; table.Add("page", page); table.Add("user", user); table.Add("startTime", startTime); table.Add("endTime", endTime); table.Add("items", inforank); table.Add("state", "0"); service.GetAllLogs(table); IList <Fault> faultList = (IList <Fault>)table["source"]; FaultVoResult faultResult = new FaultVoResult(); faultResult.totalpagecount = page.PageCount; IList <FaultVO> faults = new List <FaultVO>(); FaultVO faultVO = null; PlantUnit tmpunit; foreach (Fault fault in faultList) { faultVO = new FaultVO(); //faultVO.deviceAddress = fault.address; faultVO.deviceAddress = fault.device.xinhaoName + "#" + fault.address; //临时方案,设备地址字段放设备设备型号名称+地址,这样不用修改app //faultVO.deviceModel = fault.device.xinhaoName; faultVO.deviceModel = fault.device.typeName;; //临时方案,设备型号字段放设备类型,这样不用修改app //faultVO.deviceType = fault.device.typeName; tmpunit = PlantUnitService.GetInstance().GetPlantUnitByCollectorId(fault.collectorID); faultVO.deviceType = tmpunit.displayname;//临时方案,设备类型字段放单元名称,这样不用修改app faultVO.faultDesc = fault.content; faultVO.faultId = fault.id; faultVO.isConfirmed = fault.confirm ? "true" : "false"; faultVO.datetime = fault.sendTime.ToString("yyyy-MM-dd HH:mm:ss"); faultVO.errorType = getAppErrorType(fault.errorTypeCode); faults.Add(faultVO); } faultResult.faults = faults; string data = JsonUtil.convertToJson(faultResult, typeof(FaultVoResult)); return(Content(data)); }
/// <summary> /// 登录验证 /// </summary> /// <param name="username"></param> /// <param name="password"></param> /// <returns></returns> public ActionResult loginvalid(string username, string password, string lan) { //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); UserPlantVO userPlantVO = new 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.plants); userPlantVO.warnNums = FaultService.GetInstance().getNewLogNums(user.plants, workYears); userPlantVO.plants = convertToSPlantVOs(user.plants); data = JsonUtil.convertToJson(userPlantVO, typeof(UserPlantVO)); } } else { AppError appError = new AppError(AppError.usernameOrpasswordError, "Username don`t existed"); data = JsonUtil.convertToJson(appError, typeof(AppError)); } return(Content(data)); }
public void peristentData() { Console.WriteLine("开始持久化"); //持久化设备天数据 try { DeviceDayDataService.GetInstance().batchSave(BaseMessage.devicedayDataMapList); } catch (Exception ee) { LogUtil.error("持久化设备天数据异常:" + ee.Message); } //持久化采集器天数据 try { CollectorDayDataService.GetInstance().batchSave(BaseMessage.collectordayDataMap); } catch (Exception ee) { LogUtil.error("持久化采集器天数据异常:" + ee.Message); } //持久化设备实时数据 try{ DeviceRunDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化设备实时数据数据异常:" + ee.Message); } //持久化采集器实时数据 try { LogUtil.writeline("start 持久化采集器实时数据"); CollectorRunDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化采集器实时数据异常:" + ee.Message); } //持久化最大值统计 try{ DeviceDataCountService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化最大值统计异常:" + ee.Message); } //持久化设备月天数据 try{ DeviceMonthDayDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化设备月天数据异常:" + ee.Message); } //持久化采集器月天数据 try{ CollectorMonthDayDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化采集器月天数据异常:" + ee.Message); } //持久化设备年月数据 try{ DeviceYearMonthDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化设备年月数据异常:" + ee.Message); DeviceYearMonthDataService.GetInstance().batchSave(); } //持久化采集器年月数据 try{ CollectorYearMonthDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化采集器年月数据异常:" + ee.Message); } //持久化设备总体数据 try{ DeviceYearDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化采集器年月数据异常:" + ee.Message); } //持久化采集器总体数据 try { CollectorYearDataService.GetInstance().batchSave(); } catch (Exception ee) { LogUtil.error("持久化采集器总体数据异常:" + ee.Message); } }
/// <summary> /// 缓存采集器发电量统计 /// 要进行修正缓存丢失 /// /// </summary> /// <param name="tcpmessage"></param> private static void CacheCollectorEnergyData(IDictionary <string, double> collectorEnergyMap) { int collectorID; string[] keyArr; int year; int month; int day; float? data; Collector collector = null; //string[] keys = collectorEnergyMap.Keys.ToArray(); foreach (string ekey in collectorEnergyMap.Keys) { //原来是通过消息头部取得,现在改为 //data = float.Parse(collectorEnergyMap[ekey].ToString()); //现在改为通过采集器的设备的今日电量来累加 keyArr = ekey.Split(':'); collectorID = int.Parse(keyArr[0]); collector = CollectorInfoService.GetInstance().Get(collectorID); data = collector.TodayEnergy(keyArr[1] + keyArr[2] + keyArr[3]); //改为通过所含设备的 year = int.Parse(keyArr[1]); month = int.Parse(keyArr[2]); day = int.Parse(keyArr[3]); string d_column = "d_" + day; //取得月天数据对象 CollectorMonthDayData collectorMonthDayData = CollectorMonthDayDataService.GetInstance().GetCollectorMonthDayData(year, collectorID, month); collectorMonthDayData.curDay = day; //给相应属性赋值 if (collectorMonthDayData != null) { object ovalue = ReflectionUtil.getProperty(collectorMonthDayData, d_column); //if (ovalue == null || float.Parse(ovalue.ToString()) < data) //{ ReflectionUtil.setProperty(collectorMonthDayData, d_column, data); //} } CollectorMonthDayDataService.GetInstance().Cache(collectorMonthDayData); //更新年月发电量数据 //统计年月 string m_column = "m_" + month; float? m_value = collectorMonthDayData.count(); CollectorYearMonthData ymdData = CollectorYearMonthDataService.GetInstance().GetCollectorYearMonthData(collectorID, year);; ymdData.curMonth = month; //给年月数据对象相应属性赋值 if (ymdData != null) { object ovalue = ReflectionUtil.getProperty(ymdData, m_column); if (ovalue == null || float.Parse(ovalue.ToString()) < m_value) { ReflectionUtil.setProperty(ymdData, m_column, m_value); } } CollectorYearMonthDataService.GetInstance().Cache(ymdData); //统计总体发电量 float? y_value = ymdData.count(); CollectorYearData yd = CollectorYearDataService.GetInstance().GetCollectorYearData(collectorID, year); if (yd == null) { yd = new CollectorYearData() { dataValue = 0, collectorID = collectorID, year = year } } ; yd.localAcceptTime = DateTime.Now; //给年月数据对象相应属性赋值 if (yd != null) { object ovalue = yd.dataValue; if (ovalue == null || float.Parse(ovalue.ToString()) < y_value) { yd.dataValue = y_value == null ? 0 : float.Parse(y_value.ToString()); } } CollectorYearDataService.GetInstance().Cache(yd); } } }