123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using EntityDataSet;
- using IntelligentControlForsx.Service.Control.FormInfo;
- using IntelligentControlForsx.Service.WindturbineControl.Domain;
- using IntelligentControlForsx.Service.WindturbineControl.Domain.Cmd;
- using IntelligentControlForsx.Service.WindturbineControl.Domain.FormInfo;
- using IntelligentControlForsx.Service.WindturbineControl.FormInfoSvc;
- using IntelligentControlForsx.Service.WindturbineControl.IntPtrSvc;
- using IntelligentControlForsx.Template;
- using Gyee_Control.Svc.Cache;
- using Gyee_Control.View;
- using log4net;
- using log4net.Util;
- namespace IntelligentControlForsx.ChildForms
- {
- public partial class ControlForm : TemplateForm
- {
- private ILog logger = LogManager.GetLogger("AppInfoLog");
- public bool firstLoad = true;//第一次加载
- public bool IsNeedCheckColumn = true;
- public static bool isUpdateOverData = true;
- private static bool isUpdateOverGv = true;
- private static bool isUpdateOverSuccessCheck = true;
- private int selectRow = 0;
- GridViewDataSvc gvSvc = null;
- private WindturbinePointDataSvc pointSvc = null;
- private string stationCode = "SBQ_FDC";
- //期次
- private string project = "SBQ01_GC";
- private static BindingList<WindturbineFormData> formDataList = new BindingList<WindturbineFormData>();
- private BindingSource formBindingSource = new BindingSource();
- private Dictionary<string, WindturbineStatus> statusDic = new Dictionary<string, WindturbineStatus>();
- private string changeStatusWindturbineId = "";
- private Color backColor;
- public ControlForm()
- {
- InitializeComponent();
- WindturbinePointDataSvc.UpdatePointData(stationCode);
- }
- public override void Active()
- {
- this.Show();
- timer1.Enabled = true;
- WindturbinePointDataSvc.UpdatePointData(stationCode);
- Console.WriteLine("数据访问完毕");
- //InfoRefresh();
- Console.WriteLine("数据绑定完毕");
- }
- public override void DeActive()
- {
- this.Hide();
- timer1.Enabled = false;
- }
- private delegate void UpdateGridViewDelegate();
- private void btnStart_Click(object sender, EventArgs e)
- {
- string cmdDescribe = null;
- cmdDescribe = "正常启动";
- IList<WindturbineCmdInfo> cmdInfoList = new List<WindturbineCmdInfo>();
- for (int i = 0; i < CacheInfo.CacheWindturbineDataList.Count; i++)
- {
- if (CacheInfo.CacheWindturbineDataList[i].IsCheck)
- {
- WindturbineCmdInfo info = new WindturbineCmdInfo();
- info.WindturbineId = CacheInfo.CacheWindturbineDataList[i].WindturbineName;
- info.CmdType = CmdType.Start;
- cmdInfoList.Add(info);
- }
- }
- Confirm confirm = new Confirm(stationCode, cmdInfoList, cmdDescribe);
- for (int i = 0; i < CacheInfo.CacheWindturbineDataList.Count; i++)
- {
- CacheInfo.CacheWindturbineDataList[i].IsCheck = false;
- }
- confirm.ShowDialog();
- ClearCheck();
- }
- private void btnStop_Click(object sender, EventArgs e)
- {
- string cmdDescribe = null;
- try
- {
- cmdDescribe = "正常停机";
- IList<WindturbineCmdInfo> cmdInfoList = new List<WindturbineCmdInfo>();
- IList<WindturbinePointData> list = CacheInfo.CacheWindturbineDataList;
- for (int i = 0; i < list.Count; i++)
- {
- if (list[i].IsCheck)
- {
- WindturbineCmdInfo info = new WindturbineCmdInfo();
- info.WindturbineId = list[i].WindturbineName;
- info.CmdType = CmdType.Stop;
- cmdInfoList.Add(info);
- }
- }
- Confirm confirm = new Confirm(stationCode, cmdInfoList, cmdDescribe);
- for (int i = 0; i < CacheInfo.CacheWindturbineDataList.Count; i++)
- {
- CacheInfo.CacheWindturbineDataList[i].IsCheck = false;
- }
- confirm.ShowDialog();
- ClearCheck();
- }
- catch (Exception ex)
- {
- }
- }
- private void btnRest_Click(object sender, EventArgs e)
- {
- string cmdDescribe = null;
- cmdDescribe = "复位";
- IList<WindturbineCmdInfo> cmdInfoList = new List<WindturbineCmdInfo>();
- for (int i = 0; i < CacheInfo.CacheWindturbineDataList.Count; i++)
- {
- if (CacheInfo.CacheWindturbineDataList[i].IsCheck)
- {
- WindturbineCmdInfo info = new WindturbineCmdInfo();
- info.WindturbineId = CacheInfo.CacheWindturbineDataList[i].WindturbineName;
- info.CmdType = CmdType.Reset;
- cmdInfoList.Add(info);
- }
- }
- Confirm confirm = new Confirm(stationCode, cmdInfoList, cmdDescribe);
- for (int i = 0; i < CacheInfo.CacheWindturbineDataList.Count; i++)
- {
- CacheInfo.CacheWindturbineDataList[i].IsCheck = false;
- }
- confirm.ShowDialog();
- ClearCheck();
- }
- private void gvWindturbine_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
- {
- if (e.RowIndex != -1)
- {
- if (e.ColumnIndex == 0)
- {
- string isCheck = gvWindturbine.Rows[e.RowIndex].Cells["Select"].Value == null ? "0" : gvWindturbine.Rows[e.RowIndex].Cells["Select"].Value.ToString();
- if (isCheck == "1")
- gvWindturbine.Rows[e.RowIndex].Cells["Select"].Value = 0;
- else
- gvWindturbine.Rows[e.RowIndex].Cells["Select"].Value = 1;
- string windturbineId = this.gvWindturbine.Rows[e.RowIndex].Cells[1].Value.ToString();
- int nullCount = CacheInfo.CacheWindturbineDataList.Where(s => s == null).ToList().Count;
- if (nullCount == 0)
- {
- var data = CacheInfo.CacheWindturbineDataList.Where(s => s.WindturbineName == windturbineId).FirstOrDefault();
- if (data != null)
- {
- var newData = data;
- if (data.IsCheck)
- newData.IsCheck = false;
- else
- newData.IsCheck = true;
- CacheInfo.CacheWindturbineDataList.Remove(data);
- CacheInfo.CacheWindturbineDataList.Add(newData);
- }
- }
- }
- selectRow = e.RowIndex;
- string[] SBQ_UP105 = { "SG01_67", "SG01_68", "SG01_69", "SG01_70", "SG01_71", "SG01_72", "SG01_73", "SG01_74", "SG01_75", "SG01_76", "SG01_77", "SG01_78", "SG01_79", "SG01_80", "SG01_81", "SG01_82", "SG01_83", "SG01_84", "SG01_85", "SG01_86", "SG01_87", "SG01_88", "SG01_89", "SG01_90", "SG01_91", "SG01_100", "SG01_101", "SG01_102", "SG01_103", "SG01_104", "SG01_105", "SG01_106", "SG01_107", "SG01_108", "SG01_109", "SG01_110", "SG01_111", "SG01_112", "SG01_113", "SG01_114", "SG01_115", "SG01_116", "SG01_92", "SG01_93", "SG01_94", "SG01_95", "SG01_96", "SG01_97", "SG01_98", "SG01_99" };
- IList<string> enbleMaintainList = SBQ_UP105.ToList();
- IList<string> cacheWindturbineIdList =
- CacheInfo.CacheWindturbineDataList.Where(k => k.IsCheck == true).Select(s => s.WindturbineName).ToList();
- if (enbleMaintainList.Intersect(cacheWindturbineIdList).ToList().Count > 0)
- {
- btnMaintain.Enabled = false;
- btnRegister.Enabled = false;
- btnUnMaintain.Enabled = false;
- }
- else
- {
- btnMaintain.Enabled = true;
- btnRegister.Enabled = true;
- btnUnMaintain.Enabled = true;
- }
- }
- else
- {
- if (e.ColumnIndex == 0)
- {
- for (int i = 0; i < gvWindturbine.RowCount; i++)
- {
- string isCheck = gvWindturbine.Rows[i].Cells["Select"].Value == null
- ? "0"
- : gvWindturbine.Rows[i].Cells["Select"].Value.ToString();
- if (isCheck == "1")
- gvWindturbine.Rows[i].Cells["Select"].Value = 0;
- else
- gvWindturbine.Rows[i].Cells["Select"].Value = 1;
- string windturbineId = this.gvWindturbine.Rows[i].Cells[1].Value.ToString();
- var data =
- CacheInfo.CacheWindturbineDataList.Where(s => s.WindturbineName == windturbineId)
- .FirstOrDefault();
- if (data != null)
- {
- var newData = data;
- if (data.IsCheck)
- newData.IsCheck = false;
- else
- newData.IsCheck = true;
- CacheInfo.CacheWindturbineDataList.Remove(data);
- CacheInfo.CacheWindturbineDataList.Add(newData);
- }
- }
- }
- }
- }
- private void ControlForm_Load(object sender, EventArgs e)
- {
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- if (firstLoad)
- {
- firstLoad = false;
- using (wisdom_cs_entity ctx = new wisdom_cs_entity())
- {
- IList<windturbine> windturbineList =
- ctx.windturbine.Where(s => s.WINDPOWERSTATIONID == "SBQ_FDC" && s.PROJECTID == project).ToList();
- formDataList = new BindingList<WindturbineFormData>();
- IList<WindturbinePointData> list = CacheInfo.CacheWindturbineDataList.Where(s => s.StationId == stationCode && s.ProjectId == project).ToList().OrderBy(s => Convert.ToInt32(Regex.Replace(s.WindturbineName, "[a-zA-Z]", "").Replace("_", ""))).ToList();
- ;
- statusDic.Clear();
- for (int i = 0; i < list.Count; i++)
- {
- string statusString = "";
- #region 状态转化字符串
- switch (list[i].Status)
- {
- case WindturbineStatus.Standby:
- statusString = "待机";
- break;
- case WindturbineStatus.OnPower:
- statusString = "上电";
- break;
- case WindturbineStatus.Maintain:
- statusString = "维护";
- break;
- case WindturbineStatus.Fault:
- statusString = "故障";
- break;
- case WindturbineStatus.Start:
- statusString = "启动";
- break;
- case WindturbineStatus.Online:
- statusString = "并网";
- break;
- case WindturbineStatus.Stop:
- statusString = "停机";
- break;
- case WindturbineStatus.Offline:
- statusString = "离线";
- break;
- }
- #endregion
- string hungTypeString = "";
- switch (list[i].HungType)
- {
- case HungType.UnLock:
- hungTypeString = "正常";
- break;
- case HungType.StationCheckLock:
- hungTypeString = "场内受累检修";
- break;
- case HungType.StationFaulLockt:
- hungTypeString = "场内受累故障";
- break;
- case HungType.StationPowerLineLock:
- hungTypeString = "场外受累电网";
- break;
- case HungType.StationWeatherLock:
- hungTypeString = "场外受累天气";
- break;
- case HungType.FaultLock:
- hungTypeString = "故障检修";
- break;
- case HungType.CheckLock:
- hungTypeString = "检修";
- break;
- }
- WindturbineFormData data = new WindturbineFormData(list[i].WindturbineName,
- list[i].WindSpeed.ToString("f2"),
- list[i].Power.ToString("f2"),
- statusString,
- hungTypeString,
- list[i].AlternatorSpeed.ToString("f2"),
- list[i].LaminaSpeed.ToString("f2"),
- list[i].LimitSpeed.ToString("f2"),
- list[i].LaminaAngle1.ToString("f2"),
- list[i].LaminaAngle2.ToString("f2"),
- list[i].LaminaAngle3.ToString("f2"),
- list[i].WindAngle.ToString("f2"),
- list[i].YawPosition.ToString("f2")
- );
- formDataList.Add(data);
- if (!statusDic.ContainsKey(windturbineList[i].ID))
- statusDic.Add(windturbineList[i].ID, list[i].Status);
- }
- formBindingSource.DataSource = formDataList;
- this.gvWindturbine.DataSource = formBindingSource;
- if (IsNeedCheckColumn)
- {
- DataGridViewCheckBoxColumn checkColum = new DataGridViewCheckBoxColumn();
- checkColum.HeaderText = "";
- checkColum.Name = "Select";
- checkColum.DataPropertyName = "Select";
- checkColum.ReadOnly = false;
- checkColum.TrueValue = true;
- checkColum.FalseValue = false;
- gvWindturbine.Columns.Insert(0, checkColum);
- IsNeedCheckColumn = false;
- }
- gvWindturbine.Columns[0].Width = 50;
- gvWindturbine.Columns[1].Width = 110;
- }
- #region 修改风机状态背景色
- for (int i = 0; i < gvWindturbine.RowCount; i++)
- {
- string statusString = gvWindturbine.Rows[i].Cells[4].Value.ToString();
- DataGridViewRow row = gvWindturbine.Rows[i];
- switch (statusString)
- {
- case "待机":
- row.Cells[1].Style.BackColor = Color.FromArgb(15, 141, 106);
- break;
- case "上电":
- row.Cells[1].Style.BackColor = Color.FromArgb(177, 14, 126);
- break;
- case "维护":
- row.Cells[1].Style.BackColor = Color.FromArgb(204, 83, 51);
- break;
- case "故障":
- row.Cells[1].Style.BackColor = Color.FromArgb(170, 15, 59);
- break;
- case "启动":
- row.Cells[1].Style.BackColor = Color.FromArgb(14, 72, 91);
- break;
- case "并网":
- row.Cells[1].Style.BackColor = Color.FromArgb(15, 135, 170);
- break;
- case "停机":
- row.Cells[1].Style.BackColor = Color.FromArgb(176, 151, 63);
- break;
- case "离线":
- row.Cells[1].Style.BackColor = Color.FromArgb(134, 150, 165);
- break;
- }
- }
- #endregion
- #region 修改表头
- gvWindturbine.Columns[1].HeaderText = "风机编号";
- gvWindturbine.Columns[2].HeaderText = "风速 m/s";
- gvWindturbine.Columns[3].HeaderText = "功率 kwh";
- gvWindturbine.Columns[4].HeaderText = "状态";
- gvWindturbine.Columns[5].HeaderText = "发电机转速";
- gvWindturbine.Columns[6].HeaderText = "限速值";
- gvWindturbine.Columns[7].HeaderText = "叶轮转速";
- gvWindturbine.Columns[8].HeaderText = "桨叶角度1";
- gvWindturbine.Columns[9].HeaderText = "桨叶角度2";
- gvWindturbine.Columns[10].HeaderText = "桨叶角度3";
- gvWindturbine.Columns[11].HeaderText = "对风角度";
- gvWindturbine.Columns[12].HeaderText = "偏航位置";
- #endregion
- }
- if (isUpdateOverData)
- {
- isUpdateOverData = false;
- Thread getDataThread = new Thread(new ParameterizedThreadStart(WindturbinePointDataSvc.UpdatePointData));//创建数据更新线程
- getDataThread.Start(stationCode);
- }
- if (isUpdateOverGv)
- {
- isUpdateOverGv = false;
- Thread t = new Thread(ThreadInfo);
- t.IsBackground = true;
- t.Start();
- }
- }
- public void ThreadInfo()
- {
- UpdateGridViewDelegate del = new UpdateGridViewDelegate(FormDataBind);
- if (gvWindturbine.InvokeRequired)
- {
- gvWindturbine.BeginInvoke(del, new object[] { });
- }
- else
- {
- FormDataBind();
- }
- }
- public void FormDataBind()
- {
- IList<WindturbinePointData> pointDataList = CacheInfo.CacheWindturbineDataList.Where(s => s.StationId == stationCode && s.ProjectId == project).ToList().OrderBy(k => k.WindturbineName).ToList();
- BindingList<WindturbineFormData> dataList = this.formBindingSource.DataSource as BindingList<WindturbineFormData>;
- DateTime stime = DateTime.Now;
- for (int i = 0; i < pointDataList.Count; i++)
- {
- var data =
- dataList.Where(s => s.WindturbineId == pointDataList[i].WindturbineName).FirstOrDefault();
- if (data != null)
- {
- data.WindSpeed = pointDataList[i].WindSpeed.ToString("f2");
- data.Power = pointDataList[i].Power.ToString("f2");
- switch (pointDataList[i].Status)
- {
- case WindturbineStatus.Standby:
- data.StatusString = "待机";
- break;
- case WindturbineStatus.OnPower:
- data.StatusString = "上电";
- break;
- case WindturbineStatus.Maintain:
- data.StatusString = "维护";
- break;
- case WindturbineStatus.Fault:
- data.StatusString = "故障";
- break;
- case WindturbineStatus.Start:
- data.StatusString = "启动";
- break;
- case WindturbineStatus.Online:
- data.StatusString = "并网";
- break;
- case WindturbineStatus.Stop:
- data.StatusString = "停机";
- break;
- case WindturbineStatus.Offline:
- data.StatusString = "离线";
- break;
- }
- data.AlternatorSpeed = pointDataList[i].AlternatorSpeed.ToString("f2");
- data.LaminaSpeed = pointDataList[i].LaminaSpeed.ToString("f2");
- data.LimitSpeed = pointDataList[i].LimitSpeed.ToString("f2");
- data.LaminaAngle1 = pointDataList[i].LaminaAngle1.ToString("f2");
- data.LaminaAngle2 = pointDataList[i].LaminaAngle2.ToString("f2");
- data.LaminaAngle3 = pointDataList[i].LaminaAngle3.ToString("f2");
- data.WindAngle = pointDataList[i].WindAngle.ToString("f2");
- data.YawPosition = pointDataList[i].YawPosition.ToString("f2");
- StatusStyleThread(data.WindturbineId, pointDataList[i].Status);
- }
- }
- UpdateStatInfo("SBQ_FDC");
- isUpdateOverGv = true;
- DateTime etime = DateTime.Now;
- TimeSpan span = etime - stime;
- Console.WriteLine("绑定页面时间:" + span.TotalMilliseconds);
- }
- private void btnRegister_Click(object sender, EventArgs e)
- {
- MessageBox.Show("管理员验证指纹");
- FingerCheck check = new FingerCheck();
- check.ShowDialog();
- user adminUser = FingerCheck.checkSuccessUser;
- if (adminUser != null && adminUser.user_name == "admin")
- {
- Register register = new Register();
- register.ShowDialog();
- }
- else
- {
- MessageBox.Show("管理员验证失败");
- }
- }
- private void btnMaintain_Click(object sender, EventArgs e)
- {
- string cmdDescribe = null;
- cmdDescribe = "正常维护";
- IList<WindturbineCmdInfo> cmdInfoList = new List<WindturbineCmdInfo>();
- for (int i = 0; i < CacheInfo.CacheWindturbineDataList.Count; i++)
- {
- if (CacheInfo.CacheWindturbineDataList[i].IsCheck)
- {
- WindturbineCmdInfo info = new WindturbineCmdInfo();
- info.WindturbineId = CacheInfo.CacheWindturbineDataList[i].WindturbineName;
- info.CmdType = CmdType.Maintain;
- cmdInfoList.Add(info);
- }
- }
- Confirm confirm = new Confirm(stationCode, cmdInfoList, cmdDescribe);
- for (int i = 0; i < CacheInfo.CacheWindturbineDataList.Count; i++)
- {
- CacheInfo.CacheWindturbineDataList[i].IsCheck = false;
- }
- confirm.ShowDialog();
- ClearCheck();
- }
- private void btnUnMaintain_Click(object sender, EventArgs e)
- {
- string cmdDescribe = null;
- cmdDescribe = "正常取消维护";
- IList<WindturbineCmdInfo> cmdInfoList = new List<WindturbineCmdInfo>();
- for (int i = 0; i < CacheInfo.CacheWindturbineDataList.Count; i++)
- {
- if (CacheInfo.CacheWindturbineDataList[i].IsCheck)
- {
- WindturbineCmdInfo info = new WindturbineCmdInfo();
- info.WindturbineId = CacheInfo.CacheWindturbineDataList[i].WindturbineName;
- info.CmdType = CmdType.UnMaintain;
- cmdInfoList.Add(info);
- }
- }
- Confirm confirm = new Confirm(stationCode, cmdInfoList, cmdDescribe);
- for (int i = 0; i < CacheInfo.CacheWindturbineDataList.Count; i++)
- {
- CacheInfo.CacheWindturbineDataList[i].IsCheck = false;
- }
- confirm.ShowDialog();
- ClearCheck();
- }
- private void lblProject1_Click(object sender, EventArgs e)
- {
- project = "SBQ01_GC";
- firstLoad = true;
- ThreadInfo();
- lblProject1.BackColor = Color.FromArgb(15, 141, 106);
- lblProject2.BackColor = Color.FromArgb(3, 24, 48);
- lblProject3.BackColor = Color.FromArgb(3, 24, 48);
- lblProject4.BackColor = Color.FromArgb(3, 24, 48);
- btnMaintain.Enabled = true;
- btnUnMaintain.Enabled = true;
- btnRest.Enabled = true;
- }
- private void lblProject2_Click(object sender, EventArgs e)
- {
- project = "SBQ02_GC";
- firstLoad = true;
- ThreadInfo();
- lblProject1.BackColor = Color.FromArgb(3, 24, 48);
- lblProject2.BackColor = Color.FromArgb(15, 141, 106);
- lblProject3.BackColor = Color.FromArgb(3, 24, 48);
- lblProject4.BackColor = Color.FromArgb(3, 24, 48);
- btnMaintain.Enabled = true;
- btnUnMaintain.Enabled = true;
- btnRest.Enabled = true;
- }
- private void lblProject3_Click(object sender, EventArgs e)
- {
- project = "SBQ03_GC";
- firstLoad = true;
- ThreadInfo();
- lblProject1.BackColor = Color.FromArgb(3, 24, 48);
- lblProject2.BackColor = Color.FromArgb(3, 24, 48);
- lblProject3.BackColor = Color.FromArgb(15, 141, 106);
- lblProject4.BackColor = Color.FromArgb(3, 24, 48);
- btnMaintain.Enabled = false;
- btnUnMaintain.Enabled = false;
- btnRest.Enabled = false;
- }
- private void lblProject4_Click(object sender, EventArgs e)
- {
- project = "SBQ04_GC";
- firstLoad = true;
- ThreadInfo();
- lblProject1.BackColor = Color.FromArgb(3, 24, 48);
- lblProject2.BackColor = Color.FromArgb(3, 24, 48);
- lblProject3.BackColor = Color.FromArgb(3, 24, 48);
- lblProject4.BackColor = Color.FromArgb(15, 141, 106);
- btnMaintain.Enabled = false;
- btnUnMaintain.Enabled = false;
- btnRest.Enabled = false;
- }
- private void StatusStyleThread(string windturbineId, WindturbineStatus status)
- {
- WindturbineStatus oldStatus = statusDic[windturbineId];
- if (oldStatus != status)
- {
- statusDic[windturbineId] = status;
- switch (status)
- {
- case WindturbineStatus.Offline:
- backColor = Color.FromArgb(134, 150, 165);
- break;
- case WindturbineStatus.Start:
- backColor = Color.FromArgb(14, 72, 91);
- break;
- case WindturbineStatus.Fault:
- backColor = Color.FromArgb(170, 15, 59);
- break;
- case WindturbineStatus.Maintain:
- backColor = Color.FromArgb(204, 83, 51);
- break;
- case WindturbineStatus.Stop:
- backColor = Color.FromArgb(176, 151, 63);
- break;
- case WindturbineStatus.Online:
- backColor = Color.FromArgb(15, 135, 170);
- break;
- case WindturbineStatus.OnPower:
- backColor = Color.FromArgb(177, 14, 126);
- break;
- case WindturbineStatus.Standby:
- backColor = Color.FromArgb(15, 141, 106);
- break;
- default: break;
- }
- changeStatusWindturbineId = windturbineId;
- UpdateStatus();
- }
- }
- public void UpdateStatus()
- {
- UpdateGridViewDelegate del = new UpdateGridViewDelegate(BackStyleColor);
- if (gvWindturbine.InvokeRequired)
- {
- gvWindturbine.BeginInvoke(del, new object[] { });
- }
- else
- {
- BackStyleColor();
- }
- }
- private void BackStyleColor()
- {
- for (int i = 0; i < gvWindturbine.RowCount; i++)
- {
- if (gvWindturbine.Rows[i].Cells[1].Value == changeStatusWindturbineId)
- {
- gvWindturbine.Rows[i].Cells[1].Style.BackColor = backColor;
- }
- }
- }
- private void ClearCheck()
- {
- for (int i = 0; i < gvWindturbine.RowCount; i++)
- {
- gvWindturbine.Rows[i].Cells["Select"].Value = 0;
- }
- }
- /// <summary>
- /// 更新统计类信息
- /// </summary>
- private void UpdateStatInfo(string station)
- {
- if (station == "")
- station = "SBQ_FDC";
- StatInfo info1 = StatInfoSvc.Instance.GetStatInfoByStation(station);
- StatInfo info2 = StatInfoSvc.Instance.GeStatInfo();
- controlFormTop.BindStationInfo(info1);
- controlFormTop.BindAllStationInfo(info2);
- }
- public override void SelectedStationChanged(string stationId)
- {
- MessageBox.Show("风场切换");
- }
- }
- }
|