Example #1
0
        private void CellDoubleClick(DataGridView dGV, int iRow, EAlarmPriority priority)
        {
            try
            {
                string sbConfirm = dGV.Rows[iRow].Cells[0].Value.ToString();
                if (sbConfirm == "已确认")
                {
                    return;
                }
                string sGUID = dGV.Rows[iRow].Cells[8].Value.ToString();

                for (int i = 0; i < staAlarm.cAlarmMsg.ListAlarmMsg.Count; i++)
                {
                    if (staAlarm.cAlarmMsg.ListAlarmMsg[i].ALGuid.ToString() != sGUID)
                    {
                        continue;
                    }
                    CAlarmMsgEventArgs MsgE = staAlarm.cAlarmMsg.ListAlarmMsg[i];
                    staAlarm.SetConfirm(MsgE);

                    dGV.Rows[iRow].Cells[0].Value             = "已确认";
                    dGV.Rows[iRow].DefaultCellStyle.ForeColor = Color.Black;
                    if (staAlarm.cAlarmMsg.ListAlarmMsg[i].ConfirmTime != null)
                    {
                        dGV.Rows[iRow].Cells[6].Value = ((DateTime)MsgE.ConfirmTime).ToString("yyyy-MM-dd HH:mm:ss");
                    }
                    dGV.Rows[iRow].Cells[7].Value = staAlarm.cAlarmMsg.ListAlarmMsg[i].ConfirmName;
                }
            }
            catch (Exception ex)
            { }
        }
Example #2
0
 public bool bConfirm;           //是否需要确认      ,
 public CAlarmMsgEventArgs()
 {
     Date_Time   = DateTime.Now;
     StaName     = "";
     Recorder    = "";
     Remark      = "";
     ConfirmTime = null;
     ConfirmName = "";
     priority    = EAlarmPriority.PRIORITY_2;
     eAlarmType  = EAlarmType.NONE;
     bConfirm    = true;
 }
Example #3
0
        private void cAlarmMsgAddMsg(string text, EAlarmType AlarmType, EAlarmPriority priority)
        {
            //string sShow = "[" + staAlarm.GetAlarmTypeString(AlarmType) + "]" + text + ";等级:" + staAlarm.GetPriorityString(priority);
            //MessageBox.Show(sShow);
            CAlarmMsgEventArgs e = new CAlarmMsgEventArgs();

            e.Date_Time  = DateTime.Now;
            e.Recorder   = text;
            e.priority   = priority;
            e.eAlarmType = AlarmType;
            e.StaName    = staName;
            staAlarm.OnAlarmEvent(e);
        }
Example #4
0
        public string GetPriorityString(EAlarmPriority priority)
        {
            switch (priority)
            {
            case EAlarmPriority.PRIORITY_3:
                return("三级");

            case EAlarmPriority.PRIORITY_2:
                return("二级");

            case EAlarmPriority.PRIORITY_1:
                return("一级");

            default:
                return("未定义");
            }
        }
Example #5
0
        public void AddMsg(string StaName, string Recorder, EAlarmType eAlarmType, EAlarmPriority priority)
        {
            SAlarmMsg newMsg = new SAlarmMsg();

            newMsg.StaName    = StaName;
            newMsg.Recorder   = Recorder;
            newMsg.priority   = priority;
            newMsg.eAlarmType = eAlarmType;
            ListAlarmMsg.Add(newMsg);
            bUpdate = true;
            switch (priority)
            {
            case EAlarmPriority.PRIORITY_1:
                ListAlarmMsg1.Add(newMsg);
                while (ListAlarmMsg1.Count > CCONST.ListMax)
                {
                    ListAlarmMsg1.RemoveAt(0);
                }
                OnBoiled(newMsg);
                break;

            case EAlarmPriority.PRIORITY_2:
                ListAlarmMsg2.Add(newMsg);
                while (ListAlarmMsg2.Count > CCONST.ListMax)
                {
                    ListAlarmMsg2.RemoveAt(0);
                }
                OnBoiled(newMsg);
                break;

            case EAlarmPriority.PRIORITY_3:
                ListAlarmMsg3.Add(newMsg);
                while (ListAlarmMsg3.Count > CCONST.ListMax)
                {
                    ListAlarmMsg3.RemoveAt(0);
                }
                break;
            }
        }
Example #6
0
        public bool LoadFromNode(XmlElement VarNode)
        {
            //读取越限报警
            try
            {
                string     xpath   = "OverLimit";
                XmlElement temNode = (XmlElement)VarNode.SelectSingleNode(xpath);
                LimitDelay = int.Parse(temNode.GetAttribute("Delay"));

                for (int i = 0; i < 4; i++)
                {
                    xpath            = "OverLimit/Limit/" + LimitType[i];
                    temNode          = (XmlElement)VarNode.SelectSingleNode(xpath);
                    sLimt[i].enabled = bool.Parse(temNode.GetAttribute("enabled"));
                    if (sLimt[i].enabled)
                    {
                        sLimt[i].value    = int.Parse(temNode.GetAttribute("value"));
                        sLimt[i].text     = temNode.GetAttribute("text");
                        sLimt[i].priority = (EAlarmPriority)int.Parse(temNode.GetAttribute("priority"));
                    }
                }
                xpath           = "OverLimit/Limit/Deadband";
                temNode         = (XmlElement)VarNode.SelectSingleNode(xpath);
                Deadbandenabled = bool.Parse(temNode.GetAttribute("enabled"));
                if (Deadbandenabled)
                {
                    Deadbandvalue = int.Parse(temNode.GetAttribute("value"));
                }

                xpath       = "OverLimit/Warp";
                temNode     = (XmlElement)VarNode.SelectSingleNode(xpath);
                Warpenabled = bool.Parse(temNode.GetAttribute("enabled"));
                if (Warpenabled)
                {
                    Warpdefault  = int.Parse(temNode.GetAttribute("default"));
                    Warp         = int.Parse(temNode.GetAttribute("warp"));
                    Warppriority = (EAlarmPriority)int.Parse(temNode.GetAttribute("priority"));
                }
                xpath             = "OverLimit/ChangePercent";
                temNode           = (XmlElement)VarNode.SelectSingleNode(xpath);
                ChgPercentenabled = bool.Parse(temNode.GetAttribute("enabled"));
                if (ChgPercentenabled)
                {
                    ChgPercent     = int.Parse(temNode.GetAttribute("percent"));
                    Chgperiod      = int.Parse(temNode.GetAttribute("period"));
                    ChgPerpriority = (EAlarmPriority)int.Parse(temNode.GetAttribute("priority"));
                }
                //读取变位报警
                xpath   = "VarState";
                temNode = (XmlElement)VarNode.SelectSingleNode(xpath);
                ListVarState.Clear();
                foreach (XmlElement varstate in temNode.ChildNodes)
                {
                    CVarState objVarState = new CVarState();
                    objVarState.oldvalue = Single.Parse(varstate.GetAttribute("oldvalue"));
                    objVarState.newvalue = Single.Parse(varstate.GetAttribute("newvalue"));
                    objVarState.text     = varstate.GetAttribute("text");
                    objVarState.addition = varstate.GetAttribute("addition");
                    objVarState.Program  = varstate.GetAttribute("Program");
                    ListVarState.Add(objVarState);
                }
                VarStatepriority = (EAlarmPriority)int.Parse(temNode.GetAttribute("priority"));
                //读取变量异常报警
                xpath           = "VarError";
                temNode         = (XmlElement)VarNode.SelectSingleNode(xpath);
                VarErrorenabled = bool.Parse(temNode.GetAttribute("enabled"));
                if (VarErrorenabled)
                {
                    minvalue         = Single.Parse(temNode.GetAttribute("minvalue"));
                    mintext          = temNode.GetAttribute("mintext");
                    maxvalue         = Single.Parse(temNode.GetAttribute("maxvalue"));
                    maxtext          = temNode.GetAttribute("maxtext");
                    VarErrorpriority = (EAlarmPriority)int.Parse(temNode.GetAttribute("priority"));
                }
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }