123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- using System;
- using System.Collections.Generic;
- using System.Windows.Forms;
- using EntityDataSet;
- using GDNXFD.Data;
- using IntelligentControlForsx.ChildForms;
- using IntelligentControlForsx.Service;
- using IntelligentControlForsx.Service.WindturbineControl.Domain.Cmd;
- using IntelligentControlForsx.Service.WindturbineControl.IntPtrSvc;
- using CommonMethod = IntelligentControlForsx.Common.CommonMethod;
- namespace IntelligentControlForsx
- {
- public partial class AlarmItem : UserControl
- {
- //报警确认功能暂时挂起
- public event EventHandler AlarmConfirmClick;
- private AlertServiceClient asc = null;
- //1为停机,2为复位
- private int stopOrRest = 0;
- public AlarmItem()
- {
- InitializeComponent();
- }
- private AlertSnap alertSnap;
- public AlertSnap getAlertSnap()
- {
- return alertSnap;
- }
- public void setAlertSnap(AlertSnap value)
- {
- alertSnap = value;
- if (alertSnap != null)
- {
- lblTime.Text = alertSnap.LastUpdateTime.Value.ToString("yyy-MM-dd HH:mm:ss");
- lblThingId.Text = alertSnap.ObjectName;
- lblAlarmText.Text = alertSnap.AlertText;
- btnConfirm.Visible = true;
- if (alertSnap.CategoryName == "自定义")
- {
- btnSend.Text = "停机";
- stopOrRest = 1;
- }
- else if(alertSnap.CategoryName=="风机")
- {
- btnSend.Text = "复位";
- stopOrRest = 2;
- }
-
- }
- else
- {
- lblTime.Text = "";
- lblThingId.Text = "";
- lblAlarmText.Text = "";
- btnConfirm.Visible = false;
- // this.BackColor = Color.White;
- }
- }
- //生成缺陷单方法
- private void btnConfirm_Click(object sender, EventArgs e)
- {
- if (alertSnap != null)
- {
- AlarmConfirmClick(alertSnap.Id, e);
- MessageBox.Show("缺陷单已生成");
- }
- }
- /// <summary>
- /// 发送命令方法,忽略(确认)、复位、停机
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSend_Click(object sender, EventArgs e)
- {
- user userData = null;
- try
- {
- FingerCheck2 check = new FingerCheck2();
- check.ShowDialog();
- userData = FingerCheck2.checkSuccessUser;
- }
- catch (Exception ex)
- {
- }
- if (userData == null)
- {
- return;
- }
- IList<string> sendList = new List<string>();
- sendList.Add(alertSnap.ObjectId);
- if (stopOrRest != 0)
- {
- if(stopOrRest==1)
- TaskQueueSvc.QueueAdd(sendList, alertSnap.StationId, CmdType.Stop, userData);
- else if(stopOrRest==2)
- TaskQueueSvc.QueueAdd(sendList, alertSnap.StationId, CmdType.Reset, userData);
- }
-
- //报警信息操作方法
- if (asc == null)
- asc = AlertServiceClientFactory.CreateAlertServiceClient();
- asc.ConfirmAlert(alertSnap.Id);
- MessageBox.Show(btnSend.Text+"操作已完成");
- //IList<AlertSnap> lst = asc.GetAlertSnaps();
- //ClientCache.Instance.AlertSnaps = lst;
- //MediaManager.Instance.UpdateAlertMediaStatus();
- }
- private void lblTime_DoubleClick(object sender, EventArgs e)
- {
- PageToWindturbineInfo();
- }
- private void lblThingId_DoubleClick(object sender, EventArgs e)
- {
- PageToWindturbineInfo();
- }
- private void lblAlarmText_DoubleClick(object sender, EventArgs e)
- {
- PageToWindturbineInfo();
- }
- private void PageToWindturbineInfo()
- {
- string windturbineId = alertSnap.WindturbineId;
- string powerStationId = alertSnap.StationId;
- NavService.Instance.NavForWindturbine("pictureBoxParamters", windturbineId, powerStationId);
- }
- }
- }
|