AlarmItem.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Windows.Forms;
  4. using EntityDataSet;
  5. using GDNXFD.Data;
  6. using IntelligentControlForsx.ChildForms;
  7. using IntelligentControlForsx.Service;
  8. using IntelligentControlForsx.Service.WindturbineControl.Domain.Cmd;
  9. using IntelligentControlForsx.Service.WindturbineControl.IntPtrSvc;
  10. using CommonMethod = IntelligentControlForsx.Common.CommonMethod;
  11. namespace IntelligentControlForsx
  12. {
  13. public partial class AlarmItem : UserControl
  14. {
  15. //报警确认功能暂时挂起
  16. public event EventHandler AlarmConfirmClick;
  17. private AlertServiceClient asc = null;
  18. //1为停机,2为复位
  19. private int stopOrRest = 0;
  20. public AlarmItem()
  21. {
  22. InitializeComponent();
  23. }
  24. private AlertSnap alertSnap;
  25. public AlertSnap getAlertSnap()
  26. {
  27. return alertSnap;
  28. }
  29. public void setAlertSnap(AlertSnap value)
  30. {
  31. alertSnap = value;
  32. if (alertSnap != null)
  33. {
  34. lblTime.Text = alertSnap.LastUpdateTime.Value.ToString("yyy-MM-dd HH:mm:ss");
  35. lblThingId.Text = alertSnap.ObjectName;
  36. lblAlarmText.Text = alertSnap.AlertText;
  37. btnConfirm.Visible = true;
  38. if (alertSnap.CategoryName == "自定义")
  39. {
  40. btnSend.Text = "停机";
  41. stopOrRest = 1;
  42. }
  43. else if(alertSnap.CategoryName=="风机")
  44. {
  45. btnSend.Text = "复位";
  46. stopOrRest = 2;
  47. }
  48. }
  49. else
  50. {
  51. lblTime.Text = "";
  52. lblThingId.Text = "";
  53. lblAlarmText.Text = "";
  54. btnConfirm.Visible = false;
  55. // this.BackColor = Color.White;
  56. }
  57. }
  58. //生成缺陷单方法
  59. private void btnConfirm_Click(object sender, EventArgs e)
  60. {
  61. if (alertSnap != null)
  62. {
  63. AlarmConfirmClick(alertSnap.Id, e);
  64. MessageBox.Show("缺陷单已生成");
  65. }
  66. }
  67. /// <summary>
  68. /// 发送命令方法,忽略(确认)、复位、停机
  69. /// </summary>
  70. /// <param name="sender"></param>
  71. /// <param name="e"></param>
  72. private void btnSend_Click(object sender, EventArgs e)
  73. {
  74. user userData = null;
  75. try
  76. {
  77. FingerCheck2 check = new FingerCheck2();
  78. check.ShowDialog();
  79. userData = FingerCheck2.checkSuccessUser;
  80. }
  81. catch (Exception ex)
  82. {
  83. }
  84. if (userData == null)
  85. {
  86. return;
  87. }
  88. IList<string> sendList = new List<string>();
  89. sendList.Add(alertSnap.ObjectId);
  90. if (stopOrRest != 0)
  91. {
  92. if(stopOrRest==1)
  93. TaskQueueSvc.QueueAdd(sendList, alertSnap.StationId, CmdType.Stop, userData);
  94. else if(stopOrRest==2)
  95. TaskQueueSvc.QueueAdd(sendList, alertSnap.StationId, CmdType.Reset, userData);
  96. }
  97. //报警信息操作方法
  98. if (asc == null)
  99. asc = AlertServiceClientFactory.CreateAlertServiceClient();
  100. asc.ConfirmAlert(alertSnap.Id);
  101. MessageBox.Show(btnSend.Text+"操作已完成");
  102. //IList<AlertSnap> lst = asc.GetAlertSnaps();
  103. //ClientCache.Instance.AlertSnaps = lst;
  104. //MediaManager.Instance.UpdateAlertMediaStatus();
  105. }
  106. private void lblTime_DoubleClick(object sender, EventArgs e)
  107. {
  108. PageToWindturbineInfo();
  109. }
  110. private void lblThingId_DoubleClick(object sender, EventArgs e)
  111. {
  112. PageToWindturbineInfo();
  113. }
  114. private void lblAlarmText_DoubleClick(object sender, EventArgs e)
  115. {
  116. PageToWindturbineInfo();
  117. }
  118. private void PageToWindturbineInfo()
  119. {
  120. string windturbineId = alertSnap.WindturbineId;
  121. string powerStationId = alertSnap.StationId;
  122. NavService.Instance.NavForWindturbine("pictureBoxParamters", windturbineId, powerStationId);
  123. }
  124. }
  125. }