public void AddRtuNewData(Wlst.client.TmlNewData tmlNewData) { // IsNewdata = true; this.RtuNewData = new RtuNewDataInfo(tmlNewData); RtuOcStates = tmlNewData.IsAllSwitchOpen; //if(tmlNewData.IsAllSwitchOpen==RtuOcStates) //{ // RtuOcStatesChangedtime = RtuNewData.DateCreate.Ticks; //} //else if(RtuNewData.IsAllSwitchOpen != 3) //{ // RtuOcStatesChangedtime = RtuNewData.DateCreate.Ticks; // var args = new PublishEventArgs() // { // EventType = PublishEventType.Core, // EventId = EventIdAssign.MapNeedChangeIcon , // }; // var rtus = RtuNewData.RtuId; // args.AddParams(rtus); // EventPublish.PublishEvent(args); //} ////RtuOcStates = 3; ////bool allOpen = true; ////var currentSum = RtuNewData.RtuCurrentSumA + RtuNewData.RtuCurrentSumB + RtuNewData.RtuCurrentSumC; ////if (currentSum == 0) ////{ //// RtuOcStates = 1; //// RtuOcStatesChangedtime = RtuNewData.DateCreate.Ticks; ////} ////var switchOutOnOff = RtuNewData.IsSwitchOutAttraction; ////var areaId = Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuBelongArea(RtuId); ////for (int i = 1; i < 9; i++) ////{ //// var timeTable = //// Wlst.Sr.TimeTableSystem.Services.WeekTimeTableInfoService. //// GetTmlLoopBandTimeTableTodayOpenCloseTimex(areaId, //// RtuId, i); //// if (timeTable != null) //// { //// if (switchOutOnOff.Count > i) //// { //// if (!switchOutOnOff[i - 1]) allOpen = false; //// } //// } ////} ////if (allOpen == true)//判断 绑定时间表的输出开启 并有电流 ////{ //// RtuOcStates = 2; //// RtuOcStatesChangedtime = RtuNewData.DateCreate.Ticks; ////} }
///// <summary> ///// 构造函数;需要知道终端地址 ///// </summary> //public RtuNewDataInfo() //{ // RtuId = 0; // LstNewLoopsData = new List<RtuNewDataLoopItem>(); // IsSwitchOutAttraction = new List<bool>(); // Alarms = new Dictionary<int, bool>(); //} public RtuNewDataInfo(Wlst.client.TmlNewData tmlNewData) { this.DateCreate = new DateTime(tmlNewData.DateCreate); this.RtuCurrentSumA = tmlNewData.RtuCurrentSumA; this.RtuCurrentSumB = tmlNewData.RtuCurrentSumB; this.RtuCurrentSumC = tmlNewData.RtuCurrentSumC; this.RtuId = tmlNewData.RtuId; this.RtuVoltageA = tmlNewData.RtuVoltageA; this.RtuVoltageB = tmlNewData.RtuVoltageB; this.RtuVoltageC = tmlNewData.RtuVoltageC; this.RtuTemperature = tmlNewData.RtuTemperature; this.TimesBackPartolIn24Hour = tmlNewData.TimesBackPartolIn24Hour; this.TimesPartolIn24Hour = tmlNewData.TimesPartolIn24Hour; this.IsAllSwitchOpen = tmlNewData.IsAllSwitchOpen; LstNewLoopsData = new List <RtuNewDataLoopItem>(); IsSwitchOutAttraction = new List <bool>(); this.Alarms = new Dictionary <int, bool>(); if (tmlNewData.IsSwitchOutAttraction != null) { foreach (var t in tmlNewData.IsSwitchOutAttraction) { this.IsSwitchOutAttraction.Add(t); } } if (tmlNewData.Alarms != null) { foreach (var t in tmlNewData.Alarms) { if (!this.Alarms.ContainsKey(t)) { this.Alarms.Add(t, true); } } this.AlarmCount = tmlNewData.Alarms.Count; } if (tmlNewData.LstNewLoopsData.Count == 0) { return; } var data = Services.EquipmentDataInfoHold.GetInfoById(RtuId); if (data == null) { return; } var amps = data as Wj3005Rtu; if (amps == null) { return; } UpdateLoopsInfo(amps, tmlNewData.LstNewLoopsData); }