示例#1
0
        /// <summary>
        ///     加载数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Maintenance_Load(object sender, EventArgs e)
        {
            try
            {
                FiveHistoryRecordData = new DataTable();
                FiveHistoryRecordData.Columns.Add("Point");
                FiveHistoryRecordData.Columns.Add("SaveTime");
                FiveHistoryRecordData.Columns.Add("TypeName");
                FiveHistoryRecordData.Columns.Add("StateName");
                FiveHistoryRecordData.Columns.Add("Location");
                FiveHistoryRecordData.Columns.Add("DeviceTypeName");
                FiveHistoryRecordData.Columns.Add("RealData");
                FiveHistoryRecordData.Columns.Add("GradingAlarmLevel");
                FiveHistoryRecordData.Columns.Add("Voltage");
                FiveHistoryRecordData.Columns.Add("FeedBackState");
                FiveHistoryRecordData.Columns.Add("FeedState");
                gridControlFiveHisData.DataSource = FiveHistoryRecordData;

                ControlHistoryRecordData = new DataTable();
                ControlHistoryRecordData.Columns.Add("Point");
                ControlHistoryRecordData.Columns.Add("SaveTime");
                ControlHistoryRecordData.Columns.Add("TypeName");
                ControlHistoryRecordData.Columns.Add("StateName");
                ControlHistoryRecordData.Columns.Add("Location");
                ControlHistoryRecordData.Columns.Add("Value");
                ControlHistoryRecordData.Columns.Add("ControlDeviceConvert");
                gridContrlConHisData.DataSource = ControlHistoryRecordData;


                var allSubstation = ControlInterfaceFuction.GetAllSubstation(); //获取所有分站缓存数据
                RefSubstationFiveHisDataList(allSubstation);
                RefSubstationConHisDataList(allSubstation);
                if (_refThr == null)
                {
                    _ifLoop = true;
                    _refThr = new Thread(RefThrFun)
                    {
                        IsBackground = true
                    };
                    //_refThr = new Thread(RefThrFun);
                    _refThr.Start();
                }

                LoadKhAndDzh();

                StationUpdate su = new StationUpdate();
                su.Dock     = DockStyle.Fill;
                su.TopLevel = false;
                su.TopMost  = true;
                xtraTabPage2.Controls.Add(su);
                su.Show();


                devList = deviceDefineService.GetAllDeviceDefineCache().Data;
            }
            catch (Exception exc)
            {
                XtraMessageBox.Show(exc.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
示例#2
0
        /// <summary>
        /// 分站电源箱label点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SubstationLabelClick(object sender, EventArgs e)
        {
            try
            {
                var tv = (Label)sender;
                var bi = (BatteryItem)tv.Tag;
                //label2.Text = bi.BatteryAddress;
                label2.Text = bi.Channel;

                _lisDef = ControlInterfaceFuction.GetAllSubstation();//重新加载
                string     selectStationPointId = "";
                Jc_DefInfo def = _lisDef.Find(a => a.Fzh == short.Parse(selectFzhNow));
                if (def != null)
                {
                    selectStationPointId = def.PointID;
                }
                //查找分站对应的电源箱5分钟统计信息
                BatteryPowerConsumption batteryPowerConsumption = new BatteryPowerConsumption();
                if (def.BatteryPowerConsumptions != null)
                {
                    batteryPowerConsumption = def.BatteryPowerConsumptions.Find(a => a.Channel == bi.Channel);
                }
                var tempCharge = new CuCharge(bi, batteryPowerConsumption);
                //CpanelPowerPac.Controls.Clear();
                //重写释放控件的方法,直接clear会导致句柄资源一直增加  20180422
                while (CpanelPowerPac.Controls.Count > 0)
                {
                    if (CpanelPowerPac.Controls[0] != null)
                    {
                        CpanelPowerPac.Controls[0].Dispose();
                    }
                }
                CpanelPowerPac.Controls.Add(tempCharge);
                tempCharge.Dock = DockStyle.Fill;

                //var node = treeViewSubstation.SelectedNode;
                //Dictionary<string, object> dic = new Dictionary<string, object>();
                //dic.Add("GetBatteryItem", ((Label)sender).Text);
                //dic.Add("SelNode", node);
                //_refStationBattery = new Thread(GetBatteryItem);

                //_refStationBattery.Start(dic);
            }
            catch (Exception exc)
            {
                XtraMessageBox.Show(exc.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
示例#3
0
        //控制历史数据操作按钮事件
        private void buttonControlHisData_Click(object sender, EventArgs e)
        {
            try
            {
                var rowHandle = gridViewConHisTree.FocusedRowHandle;
                var fzh       = gridViewConHisTree.GetRowCellValue(rowHandle, "Fzh");
                SubstationBindDto sbd;
                lock (_locker2)
                {
                    sbd = _substationConHisDataBindDto.FirstOrDefault(a => a.Fzh == (string)fzh);
                }

                if (sbd == null)
                {
                    XtraMessageBox.Show("未能从列表数据中找到该分站。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                //发送获取数据命令
                byte conType;
                if (sbd.DataState == "0" || sbd.DataState == "3")
                {
                    conType = 1;
                }
                else
                {
                    conType = 0;
                }

                var req = new List <StationControlItem>()
                {
                    new StationControlItem()
                    {
                        controlType = conType,
                        fzh         = Convert.ToUInt16(fzh)
                    }
                };
                ControlInterfaceFuction.SendQueryHistoryControlRequest(req);

                var allSubstation = ControlInterfaceFuction.GetAllSubstation(); //获取所有分站缓存数据
                RefSubstationConHisDataList(allSubstation);
            }
            catch (Exception exc)
            {
                XtraMessageBox.Show(exc.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
示例#4
0
        private void DyxForm_Load(object sender, EventArgs e)
        {
            try
            {
                //加载分站树
                var fzs = ControlInterfaceFuction.GetDyxFz();
                //dt = fzs;
                if ((fzs != null) && (fzs.Rows.Count > 0))
                {
                    foreach (DataRow item in fzs.Rows)
                    {
                        var fzh = item["fzh"].ToString();
                        treeViewSubstation.Nodes.Add(fzh, fzh);
                        _substationUpdatetime.Add(fzh, new DateTime());
                    }
                }

                //加载交换机树
                fzs = ControlInterfaceFuction.GetDyxMac();
                //dt1 = fzs;
                if ((fzs != null) && (fzs.Rows.Count > 0))
                {
                    foreach (DataRow item in fzs.Rows)
                    {
                        var wz  = item["wz"].ToString();
                        var mac = item["mac"].ToString();
                        treeViewSwitch.Nodes.Add(mac, wz);
                        _switchUpdatetime.Add(mac, new DateTime());
                    }
                }

                //加载风电闭锁树
                //var allSubstation = ControlInterfaceFuction.GetAllSubstation();
                _lisDef = ControlInterfaceFuction.GetAllSubstation();
                foreach (var item in _lisDef)
                {
                    treeViewInterlockedCircuitBreaker.Nodes.Add(item.Fzh.ToString(), item.Fzh.ToString());
                }
            }
            catch (Exception exc)
            {
                XtraMessageBox.Show(exc.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
示例#5
0
        private void RefThrFun()
        {
            while (_ifLoop)
            {
                try
                {
                    Thread.Sleep(5000);
                    var allSubstation = ControlInterfaceFuction.GetAllSubstation(); //获取所有分站缓存数据

                    //刷新5分钟历史数据
                    if (this.InvokeRequired)
                    {
                        Action <object> act = RefSubstationFiveHisDataList;
                        BeginInvoke(act, allSubstation);
                    }

                    //var result = GetSubstationHistoryRealDataByFzhTime();
                    //if (this.InvokeRequired)
                    //{
                    //    Action<object> act2 = RefFiveHistoryRecord;
                    //    BeginInvoke(act2, result);
                    //}

                    //刷新控制历史数据
                    if (this.InvokeRequired)
                    {
                        Action <object> act3 = RefSubstationConHisDataList;
                        BeginInvoke(act3, allSubstation);
                    }

                    //var result1 = GetStaionControlHistoryDataByByFzhTime();
                    //if (this.InvokeRequired)
                    //{
                    //    Action<object> act4 = RefControlHistoryRecord;
                    //    BeginInvoke(act4, result1);
                    //}
                }
                catch (Exception exc)
                {
                    LogHelper.Error(exc);
                }
            }
        }