Пример #1
0
        /// <summary>
        /// 单站报警
        /// </summary>
        public void PostTaskAlarm(XAlarmLevel level, int Code, string category, string append = "")
        {
            switch (level)
            {
            case XAlarmLevel.STOP:
                if (m_State != XTaskState.ESTOP)
                {
                    SetState(XTaskState.ALARM);
                    HomeOK         = false;
                    InitHomingStep = 0;
                    AutoRunstep    = 0;
                    _TaskIsWorking = false;
                }
                break;

            case XAlarmLevel.PAUSE:
                SetState(XTaskState.PAUSE);
                break;

            case XAlarmLevel.RST:
                SetState(XTaskState.WAITRUN);
                break;
            }
            XAlarmReporter.Instance.PostAlarm(TaskId, level, Code, category, append);
            SetStep(Code.ToString() + ":" + category + "_" + append, (level == XAlarmLevel.RST)?Mycolor.Green:Mycolor.ErrorRed);
        }
Пример #2
0
 public int PostAlarm(int taskId, XAlarmLevel alarmlevel, int Code, string category, string append)
 {
     try
     {
         if (alarmlevel != XAlarmLevel.RST)
         {
             this.currentAlarm.TaskId      = taskId;
             this.currentAlarm.StartTime   = DateTime.Now;
             this.currentAlarm.AlarmLevel  = alarmlevel;
             this.currentAlarm.Code        = Code;
             this.currentAlarm.Category    = category;
             this.currentAlarm.Description = append;
             if (OnSaveAlarmReport != null)
             {
                 OnSaveAlarmReport(this.currentAlarm);
             }
             IsAlarming = true;
         }
         else
         {
             ClearAlarm();//clear alarm
         }
         return(0);
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex, "");
         return(-1);
     }
 }
Пример #3
0
 //PostAlarm
 public static void PostAlarmMachine(XAlarmLevel level, int Code, string category, string append = "")
 {
     XTaskManager.Instance.FindTaskById(0).PostTaskAlarm(level, Code, category, append);//for errorcode
 }