123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- 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<WindturbineCmdInfo> allowInfoList;
- private IList<WindturbineCmdInfo> forbiddenList;
- private string describeString;
- private double? limitValue = null;//限定值(转速,功率)
- private string StationId = "";
- private ILog logger = LogManager.GetLogger("AppInfoLog");
- /// <summary>
- /// Confirm构造方法
- /// </summary>
- /// <param name="stationName">风场名</param>
- /// <param name="cmdInfoList">操作信息</param>
- /// <param name="describe">操作描述</param>
- public Confirm(string stationName, IList<WindturbineCmdInfo> 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();
- }
- }
- }
|