using System; using System.Collections.Generic; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using EntityDataSet; using IntelligentControlForsx.ChildForms; using IntelligentControlForsx.Service.WindturbineControl.Domain.Cmd; using IntelligentControlForsx.Service.WindturbineControl.IntPtrSvc; using Gyee_Control.Svc.Cache; using log4net; namespace Gyee_Control.View { public partial class Confirm : Form { private IList allowInfoList; private IList forbiddenList; private string describeString; private double? limitValue = null;//限定值(转速,功率) private string StationId = ""; private ILog logger = LogManager.GetLogger("AppInfoLog"); /// /// Confirm构造方法 /// /// 风场名 /// 操作信息 /// 操作描述 public Confirm(string stationName, IList cmdInfoList, string describe, double? limitValue = null) { try { InitializeComponent(); StationId = stationName; string name = ""; if (stationName == "SBQ_FDC") name = "石板泉风电场"; else if (stationName == "MHS_FDC") name = "麻黄山风电场"; else if (stationName == "NSS_FDC") name = "牛首山风电场"; else if (stationName == "XS_FDC") name = "香山风电场"; this.groupBox1.Text = name + " ---- " + this.groupBox1.Text; this.groupBox2.Text = name + " ---- " + this.groupBox2.Text; describeString = describe; //获取要控制的风机数据 CmdInfoScreenSvc screenSvc = CmdInfoScreenSvc.GetCmdInfoScreenSvc(); DataTable allowTable;//可操作风机 DataTable forbiddenTable;//不可操作风机DataTable //筛选出可以进行操作的风机 allowInfoList = screenSvc.GetAllowInfo(cmdInfoList, out allowTable, out forbiddenList, out forbiddenTable); this.limitValue = limitValue; this.gvAllow.DataSource = allowTable; this.gvAllow.ClearSelection(); this.gvForbidden.DataSource = forbiddenTable; if (this.gvForbidden.Columns.Count > 0) { this.gvForbidden.Columns[0].FillWeight = 20; this.gvForbidden.Columns[1].FillWeight = 90; this.gvForbidden.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; } this.gvForbidden.ClearSelection(); if (this.gvAllow.Rows.Count == 0) { this.btnConfirm.Enabled = false; } else { this.btnConfirm.Enabled = true; } } catch (Exception ex) { Console.WriteLine(ex); } } private void gvAllow_DataError(object sender, DataGridViewDataErrorEventArgs e) { } private void gvForbidden_DataError(object sender, DataGridViewDataErrorEventArgs e) { } private void btnConfirm_Click(object sender, EventArgs e) { try { user userData = null; FingerCheck2 check = new FingerCheck2(); check.ShowDialog(); userData = FingerCheck2.checkSuccessUser; //userData = new user(); //userData.id = 1; //userData.user_name = "wanghs"; //userData.name = "wanghs"; if (userData != null) { if (limitValue.HasValue) TaskQueueSvc.QueueAdd(allowInfoList.Select(s => s.WindturbineId).ToList(), StationId, allowInfoList[0].CmdType, userData, limitValue); else TaskQueueSvc.QueueAdd(allowInfoList.Select(s => s.WindturbineId).ToList(), StationId, allowInfoList[0].CmdType, userData); } this.Close(); } catch (Exception ex) { } } private void btnCancel_Click(object sender, EventArgs e) { this.Close(); } } }