Exemple #1
0
 public void CollectErrInfo(ErrorInfoWithPause result)
 {
     if (result != null && result.Message != "")
     {
         _err += result.Message + " ";
     }
 }
Exemple #2
0
        private static void RemoveRetry(string source, string message)
        {
            ErrorInfoWithPause err = FindRetry(source, message);

            if (err != null)
            {
                retryList.Remove(err);
            }
        }
Exemple #3
0
 private static void RemoveRetry(string source, ErrorInfoWithPause err)
 {
     if (err.Level == ErrorLevel.Alarm)
     {
         if (err.NeedRetry && err.ErrorHandle != null)
         {
             RemoveRetry(err.Source, err.Message);
         }
     }
 }
Exemple #4
0
        public static bool CheckAlarmListStatus(string source, ErrorInfoWithPause alarmErr = null)
        {
            if (alarmErr != null)
            {
                RemoveRetry(source, alarmErr);
            }
            bool NoAlarm = retryList.Count == 0;

            if (NoAlarm)
            {
                Statistic.GetWorkFlowStatus(DateTime.Now, WorkFlowStatus.报警结束, "报警结束");
            }
            return(NoAlarm);
        }
Exemple #5
0
 private static void AddRetry(string source, ErrorInfoWithPause err)
 {
     if (err.Level == ErrorLevel.Alarm)
     {
         if (err.NeedRetry && err.ErrorHandle != null)
         {
             err.Source = source;
             if (FindRetry(source, err.Message) == null)
             {
                 retryList.Add(err);
             }
         }
     }
 }
Exemple #6
0
        public static void ShowError(string source, ErrorInfoWithPause error, ErrorReturnHandler HandleFunc = null)
        {
            if (HandleFunc != null)
            {
                error.ErrorHandle = HandleFunc;
            }
            string src = source;
            //if (isWorkFlowRunning) src = "流程:" + src;
            string err = error.Message;

            AddRetry(source, error);

            if (_errorShowPanel != null)
            {
                switch (error.Level)
                {
                case ErrorLevel.Alarm:
                    if (error.NeedRetry && error.ErrorHandle != null)
                    {
                        err += "。检查并按OK或Retry重试。";
                    }
                    if (isWorkFlowRunning && error.NeedPause)
                    {
                        err += "。流程暂停。";
                        CommonFunction.SysPublisher.notifyPauseEventSubscribers(null, new StateEventArgs("暂停", source + ": " + error.Message));
                    }
                    break;

                case ErrorLevel.Notice:
                    if (isWorkFlowRunning && error.NeedPause)
                    {
                        err += "。流程暂停。";
                        CommonFunction.SysPublisher.notifyPauseEventSubscribers(null, new StateEventArgs("暂停", source + ": " + error.Message));
                    }
                    break;

                case ErrorLevel.Error:
                case ErrorLevel.Fatal:
                    if (isWorkFlowRunning)
                    {
                        err = $"流程出错({error.Message})。流程停止。";
                        ClassCommonSetting.ProgramLog(LogFile.Level.Info, "WorkFlow", "流程因错误停止");
                        BaseStateMachine.NotifyErrorStop(null, null);
                    }
                    break;
                }
                _errPublisher.notifyShowErrorEventSubscribers(src, err, error.Level, ClassCommonSetting.Log, error.NeedRetry, error.ErrorHandle);
                Statistic.ShowErrorHandler(source, error.Message, error.Level, null, error.NeedRetry, error.NeedPause, error.ErrorHandle);
            }
        }