예제 #1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (CardPaymentRecord != null)
            {
                AlarmInfo alarm = new AlarmInfo();
                alarm.AlarmDateTime = DateTime.Now;
                alarm.AlarmType     = AlarmType.ModifyCardPayment;
                alarm.OperatorID    = OperatorInfo.CurrentOperator.OperatorName;
                alarm.AlarmDescr    = string.Format(Resources.Resource1.FrmCardPaymentRecordDetail_ModifyPayment,
                                                    CardPaymentRecord.CardID,
                                                    CardPaymentRecord.ChargeDateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                                                    CardPaymentRecord.EnterDateTime.Value.ToString("yyyy-MM-dd HH;mm:ss"),
                                                    CardPaymentRecord.Accounts,
                                                    CardPaymentRecord.Paid,
                                                    CardPaymentRecord.Memo,
                                                    txtChargedMoney.DecimalValue,
                                                    txtMemo.Text);

                CommandResult ret = (new AlarmBll(AppSettings.CurrentSetting.ParkConnect)).Insert(alarm);
                if (ret.Result == ResultCode.Successful)
                {
                    CardPaymentRecord.Paid = this.txtChargedMoney.DecimalValue;
                    CardPaymentRecord.Memo = this.txtMemo.Text;
                    ret = (new CardPaymentRecordBll(AppSettings.CurrentSetting.ParkConnect)).Update(CardPaymentRecord);
                    if (ret.Result == ResultCode.Successful)
                    {
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        MessageBox.Show(ret.Message);
                    }
                }
            }
        }
예제 #2
0
        private void FrmCardOut_FormClosing(object sender, FormClosingEventArgs e)
        {
            CardReaderManager.GetInstance(UserSetting.Current.WegenType).PopCardReadRequest(CardReadHandler);

            if (_OutCardsWitPark.Keys.Count > 0)
            {
                MessageBox.Show(Resource1.FrmCardOut_UpdateVacant);

                this.Cursor = Cursors.WaitCursor;
                foreach (ParkInfo park in _OutCardsWitPark.Keys)
                {
                    bool            ret = false;
                    IParkingAdapter pad = ParkingAdapterManager.Instance[park.ParkID];
                    if (pad != null)
                    {
                        ret = pad.ModifiedVacant(_OutCardsWitPark[park]);
                    }
                    //插入卡片直接出场报警记录,记录增加车位数
                    AlarmInfo alarm = new AlarmInfo();
                    alarm.AlarmDateTime = DateTime.Now;
                    alarm.AlarmType     = AlarmType.CardOutAnomaly;
                    alarm.OperatorID    = OperatorInfo.CurrentOperator.OperatorName;
                    alarm.AlarmDescr    = string.Format("[{0}] " + Resource1.FrmCardOut_OutCount + ":[{1}]," + Resource1.FrmCardOut_VacantCount + "[{2}]", park.ParkName, _OutCardsWitPark[park].ToString(), ret ? Resource1.Form_Success : Resource1.Form_Fail);
                    new AlarmBll(AppSettings.CurrentSetting.ParkConnect).Insert(alarm);
                    if (!ret)
                    {
                        this.Cursor = Cursors.Arrow;
                        MessageBox.Show(string.Format("{0} ,{1}", alarm.AlarmDescr, Resource1.FrmCardOut_VacantManual));
                        this.Cursor = Cursors.WaitCursor;
                    }
                }
                this.Cursor = Cursors.Arrow;
            }
        }
예제 #3
0
파일: FormMain.cs 프로젝트: bookorz/Lilith
        public void On_Connection_Error(string DIOName, string ErrorMsg)
        {
            //斷線 發ALARM
            logger.Debug("On_Error_Occurred");
            AlarmInfo CurrentAlarm = new AlarmInfo();

            CurrentAlarm.NodeName  = DIOName;
            CurrentAlarm.AlarmCode = "00200001";
            CurrentAlarm.NeedReset = false;
            try
            {
                AlarmMessage Detail = AlmMapping.Get("DIO", CurrentAlarm.AlarmCode);

                CurrentAlarm.SystemAlarmCode = Detail.CodeID;
                CurrentAlarm.Desc            = Detail.Code_Cause;
                CurrentAlarm.EngDesc         = Detail.Code_Cause_English;
                CurrentAlarm.Type            = Detail.Code_Type;
                CurrentAlarm.IsStop          = Detail.IsStop;
                if (CurrentAlarm.IsStop)
                {
                    //RouteCtrl.Stop();
                }
            }
            catch (Exception e)
            {
                CurrentAlarm.Desc = "未定義";
                logger.Error(DIOName + "(GetAlarmMessage)" + e.Message + "\n" + e.StackTrace);
            }
            CurrentAlarm.TimeStamp = DateTime.Now;
            AlarmManagement.Add(CurrentAlarm);
            AlarmUpdate.UpdateAlarmList(AlarmManagement.GetAll());
            AlarmUpdate.UpdateAlarmHistory(AlarmManagement.GetHistory());
        }
        public async void WriteAlarmListToDB(AlarmListInfo alarmListInfo)
        {
            string insertSQL = $"Insert into `{_alarmTableName}` values ";

            for (int i = 0; i < alarmListInfo.AlarmList.Count(); i++)
            {
                AlarmInfo temiAlarmItem = alarmListInfo.AlarmList[i];
                string    alarmSql;

                alarmSql  = $"(null,'{temiAlarmItem.AlarmDate}','{temiAlarmItem.RecoveryDate}',";
                alarmSql += $"'{temiAlarmItem.AlarmName}',{temiAlarmItem.AlarmLevel},";
                alarmSql += $"{temiAlarmItem.AlarmLevel},{temiAlarmItem.AlarmType},";
                alarmSql += $"'{temiAlarmItem.DeviceType}','{temiAlarmItem.DeviceName}',";
                alarmSql += $"'{temiAlarmItem.AlarmCondition}','{temiAlarmItem.AlarmHelp}',";
                alarmSql += $"'{temiAlarmItem.Reserved1}','{temiAlarmItem.Reserved2}',";
                alarmSql += $"'{temiAlarmItem.Reserved3}','{temiAlarmItem.Reserved4}',";
                alarmSql += $"'{temiAlarmItem.Reserved5}'),";

                insertSQL += alarmSql;
            }

            insertSQL.Remove(insertSQL.Length - 1, 1);

            try
            {
                Common.Helper.MySqlHelper.ExecuteNonQuery(Conn, CommandType.Text, insertSQL, null);
            }
            catch (Exception ex)
            {
                LoggerManager.Log.Error("向数据库写故障失败!");
            }
        }
예제 #5
0
        /// <summary>
        /// アラーム設定を取得する
        /// </summary>
        /// <param name="alarmInfo">アラーム情報</param>
        /// <param name="equipment">機器データ</param>
        /// <param name="alarmConfig">アラーム設定</param>
        /// <returns>成功した場合true、失敗した場合falseを返す</returns>
        public bool ReadDtAlarmConfig(AlarmInfo alarmInfo, out DtEquipment equipment, out DtAlarmConfig alarmConfig)
        {
            equipment   = null;
            alarmConfig = null;

            try
            {
                _logger.EnterJson("{0}", alarmInfo);

                // Sq1.1.2: アラーム設定を取得する
                // Sq1.1.3: メール送信先を取得する
                equipment   = _dtEquipmentRepository.ReadDtEquipment(alarmInfo.SourceEquipmentUid, false);
                alarmConfig = _dtAlarmConfigRepository.ReadDtAlarmConfig(alarmInfo.AlarmLevel, false);

                return(true);
            }
            catch (RmsException e)
            {
                // アラーム設定取得失敗(基本設計書 5.3.4 エラー処理)
                _logger.Error(e, nameof(Resources.OP_ALR_ALR_005), new object[] { alarmInfo?.MessageId });
                return(false);
            }
            finally
            {
                _logger.LeaveJson("{0}", new { equipment, alarmConfig });
            }
        }
예제 #6
0
        public List <AlarmInfo> GetAlarmInfoConfigration()
        {
            List <AlarmInfo> ret = new List <AlarmInfo>();

            AlarmInfo info1 = new AlarmInfo
            {
                ID        = 1,
                Name      = "test",
                Level     = 1,
                Treatment = "test"
            };

            AlarmInfo info2 = new AlarmInfo
            {
                ID        = 2,
                Name      = "test2",
                Level     = 2,
                Treatment = "test2"
            };

            ret.Add(info1);
            ret.Add(info2);

            return(ret);
        }
예제 #7
0
파일: FormMain.cs 프로젝트: bookorz/Lilith
        public void On_Command_TimeOut(Node Node, Transaction Txn)
        {
            logger.Debug("On_Command_TimeOut");
            AlarmInfo CurrentAlarm = new AlarmInfo();

            CurrentAlarm.NodeName  = Node.Name;
            CurrentAlarm.AlarmCode = "00200002";
            CurrentAlarm.NeedReset = false;
            try
            {
                AlarmMessage Detail = AlmMapping.Get("SYSTEM", CurrentAlarm.AlarmCode);

                CurrentAlarm.SystemAlarmCode = Detail.CodeID;
                CurrentAlarm.Desc            = Detail.Code_Cause;
                CurrentAlarm.EngDesc         = Detail.Code_Cause_English;
                CurrentAlarm.Type            = Detail.Code_Type;
                CurrentAlarm.IsStop          = Detail.IsStop;
                if (CurrentAlarm.IsStop)
                {
                    //RouteCtrl.Stop();
                }
            }
            catch (Exception e)
            {
                CurrentAlarm.Desc = "未定義";
                logger.Error(Node.Controller + "-" + Node.AdrNo + "(GetAlarmMessage)" + e.Message + "\n" + e.StackTrace);
            }
            CurrentAlarm.TimeStamp = DateTime.Now;
            AlarmManagement.Add(CurrentAlarm);
            AlarmUpdate.UpdateAlarmList(AlarmManagement.GetAll());
            AlarmUpdate.UpdateAlarmHistory(AlarmManagement.GetHistory());
        }
예제 #8
0
 public int Delete(AlarmInfo entityToInsert)
 {
     using (Conn)
     {
         return(Conn.Delete(entityToInsert));
     }
 }
예제 #9
0
        private void buttonX_Save_Click(object sender, EventArgs e)
        {
            try
            {
                AlarmInfoRepository repo         = new AlarmInfoRepository();
                AlarmInfo           newAlarmInfo = new AlarmInfo();
                newAlarmInfo.AlarmID         = DateTime.Now.Ticks.ToString();
                newAlarmInfo.AlarmTime       = dateTimeInput_Time.Value;
                newAlarmInfo.AlarmLocation   = textBoxX_AlarmLocation.Text;
                newAlarmInfo.AlarmType       = (int)comboBoxEx_AlarmType.SelectedIndex;
                newAlarmInfo.TargetAttribute = (int)comboBoxEx_TargetAttribute.SelectedIndex;
                newAlarmInfo.Description     = textBoxX_Description.Text;
                repo.Insert(newAlarmInfo);

                string sendMsg = "PostAlarmInfo " + JsonConvert.SerializeObject(newAlarmInfo) + "\r\n";
                IMCommunicate.SendMsgToServer(sendMsg);

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #10
0
 public long Insert(AlarmInfo entityToInsert)
 {
     using (Conn)
     {
         return(Conn.Insert <long>(entityToInsert));
     }
 }
예제 #11
0
 public int Update(AlarmInfo entityToInsert)
 {
     using (Conn)
     {
         return(Conn.Update(entityToInsert));
     }
 }
예제 #12
0
        public static string RecordAlarmToDB(AlarmInfo AlaInfo)
        {
            string         EXEPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            string         dbPath  = EXEPath + "Demo.db3";
            SQLiteDBHelper db      = new SQLiteDBHelper(dbPath);

            string sql2 = "INSERT INTO AlarmLog(datetime,AlarmID,AlarmName,AlarmLevel,HandleAlarmMode,ServerWarningID,IsPost)" +
                          "values(@datetime,@AlarmID,@AlarmName,@AlarmLevel,@HandleAlarmMode,@ServerWarningID,@IsPost)";

            SQLiteParameter[] parameters = new SQLiteParameter[] {
                new SQLiteParameter("@datetime", DateTime.Now),
                new SQLiteParameter("@AlarmID", AlaInfo.AlarmID),
                new SQLiteParameter("@AlarmName", AlaInfo.AlarmName),
                new SQLiteParameter("@AlarmLevel", AlaInfo.AlarmLevel),
                new SQLiteParameter("@HandleAlarmMode", AlaInfo.HandleAlarmMode),
                new SQLiteParameter("@ServerWarningID", AlaInfo.ServerWarningID),
                new SQLiteParameter("@IsPost", (AlaInfo.ServerWarningID == 0)?0:1)
            };
            db.ExecuteNonQuery(sql2, parameters);

            string sql3 = "select max(id) from AlarmLog";

            string stID = "";

            using (SQLiteDataReader reader = db.ExecuteReader(sql3, null))
            {
                while (reader.Read())
                {
                    stID = reader["max(id)"].ToString();
                }
            }
            return(stID);
        }
예제 #13
0
        /// <summary>
        /// 向陆地端推送考勤数据
        /// </summary>
        private void SyncAttendance()
        {
            if (!ManagerHelp.IsShipPort)
            {
                return;
            }
            List <Attendance>        attendances = new List <Attendance>();
            List <AttendancePicture> attendPic   = new List <AttendancePicture>();

            using (var context = new MyContext())
            {
                attendances = context.Attendance.Where(c => c.IsSyncSucces == false).OrderBy(c => c.Time).ToList();
                attendPic   = context.AttendancePicture.Where(c => attendances.Select(a => a.Id).Contains(c.AttendanceId)).ToList();
            }
            foreach (var item in attendances)
            {
                try
                {
                    //获取考勤数据
                    AlarmInfo alarmInfo = GetAttendanceInfo(attendPic, item);
                    ShipPushAttend(item, alarmInfo);
                }
                catch (Exception ex)
                {
                    continue;
                }
            }
        }
예제 #14
0
        public static int Insert(Database db, AlarmInfo oCameraInfo)
        {
            StringBuilder sbField = new StringBuilder();
            StringBuilder sbValue = new StringBuilder();

            sbField.Append("INSERT INTO AlarmInfo(");
            sbValue.Append("values(");
            sbField.Append("DeviceId");
            sbValue.AppendFormat("{0}", oCameraInfo.DeviceId);
            sbField.Append(",Name");
            sbValue.AppendFormat(",'{0}'", oCameraInfo.Name);
            sbField.Append(",Description");
            sbValue.AppendFormat(",'{0}'", oCameraInfo.Description);
            sbField.Append(",IsValid");
            sbValue.AppendFormat(",{0}", oCameraInfo.IsValid);
            sbField.Append(",ChannelNo)");
            sbValue.AppendFormat(",{0})", oCameraInfo.ChannelNo);
            string cmdText = sbField + " " + sbValue;

            try
            {
                return(db.ExecuteNonQuery(CommandType.Text, cmdText));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #15
0
        public Dictionary <int, AlarmInfo> GetAllAlarmInfo(ref string errMessage)
        {
            Database db = DatabaseFactory.CreateDatabase();

            errMessage = "";
            Dictionary <int, AlarmInfo> list = new Dictionary <int, AlarmInfo>();

            try
            {
                DataSet ds = AlarmDataAccess.GetAllAlarmInfo(db);

                AlarmInfo alarmInfo;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    alarmInfo = new AlarmInfo(ds.Tables[0].Rows[i]);
                    list.Add(alarmInfo.AlarmId, alarmInfo);
                }
                return(list);
            }
            catch (Exception ex)
            {
                errMessage = ex.Message + ex.StackTrace;
                logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace);
                return(null);
            }
        }
예제 #16
0
        /// <summary>
        /// 向陆地端推送数据
        /// </summary>
        /// <param name="item"></param>
        /// <param name="alarmInfo"></param>
        private void ShipPushAlarm(SmartWeb.Models.Alarm item, AlarmInfo alarmInfo)
        {
            List <SmartWeb.Models.Alarm> recordAlarm = new List <SmartWeb.Models.Alarm>();

            assembly.SendAlarm("upload", alarmInfo);
            Console.WriteLine("已推送数据" + alarmInfo.uid);
            recordAlarm.Add(item);
            bool flag = true;

            new TaskFactory().StartNew(() => {
                while (recordAlarm.Count != 0)
                {
                    if (ManagerHelp.LandResponse.Count > 0)
                    {
                        flag = false;
                        //修改同步状态
                        UpdateAlarmSyncStatus(recordAlarm);
                    }
                    Thread.Sleep(1000);
                }
            }).Wait(3000);
            if (flag)
            {
                ShipPushAlarm(item, alarmInfo);
            }
        }
예제 #17
0
        public async Task WriteAlarmListToDB(AlarmListInfo alarmListInfo)
        {
            await Task.Run(() =>
            {
                string insertSQL = $"Insert into `{_alarmTableName}` values ";

                for (int i = 0; i < alarmListInfo.AlarmList.Count(); i++)
                {
                    AlarmInfo temiAlarmItem = alarmListInfo.AlarmList[i];
                    string alarmSql;

                    alarmSql  = $"(null,'{temiAlarmItem.AlarmDate}','{temiAlarmItem.RecoveryDate}',";
                    alarmSql += $"'{temiAlarmItem.AlarmName}',{temiAlarmItem.AlarmLevel},";
                    alarmSql += $"{(int)temiAlarmItem.AlarmType},{temiAlarmItem.AlarmSpanTime},";
                    alarmSql += $"'{temiAlarmItem.DeviceType}','{temiAlarmItem.DeviceName}',";
                    alarmSql += $"'{temiAlarmItem.AlarmCondition}','{temiAlarmItem.AlarmHelp}',";
                    alarmSql += $"'{temiAlarmItem.Reserved1}','{temiAlarmItem.Reserved2}',";
                    alarmSql += $"'{temiAlarmItem.Reserved3}','{temiAlarmItem.Reserved4}',";
                    alarmSql += $"'{temiAlarmItem.Reserved5}'),";

                    insertSQL += alarmSql;
                }

                insertSQL = insertSQL.Remove(insertSQL.Length - 1, 1);

                try
                {
                    Common.Helper.MySqlHelper.ExecuteNonQuery(Conn, CommandType.Text, insertSQL, null);
                }
                catch (Exception ex)
                {
                    LoggerManager.Log.Error($"{_parentDeviceInfo.CompanyCode}-{_parentDeviceInfo.DeviceCode}:向数据库写故障数据失败!,SQL = {insertSQL}");
                }
            });
        }
예제 #18
0
        /// <summary>
        /// 历史报警信息
        /// </summary>
        /// <param name="historyAlarmInfo"></param>
        /// <returns></returns>
        private AlarmInfo CreateAlarmInfo(HistoryAlarmInfo historyAlarmInfo)
        {
            AlarmInfo alarmInfo = AlarmInfo.Load(historyAlarmInfo.AlarmSource, historyAlarmInfo.AlarmCode, historyAlarmInfo.AlarmDescription
                                                 , Convert.ToDateTime(historyAlarmInfo.AlarmFirstTime), Convert.ToDateTime(historyAlarmInfo.AlarmUpdateTime), Convert.ToDateTime(historyAlarmInfo.AlarmRemoveTime));

            return(alarmInfo);
        }
예제 #19
0
    /// <summary>
    /// 更新警报信息到数据库
    /// </summary>
    /// <param name="info"></param>
    private void UpdateAlarmInfoInDB(AlarmInfo info)
    {
        string update = "UPDATE `alarm_log` SET `isconfirm`=" + info.IsConfirm + ",`isShow`=" + info.Show + ",`status`='" + info.Status
                        + "' WHERE `_id`=" + info.Id;

        SqlAccess.ExecuteQuery(update);
    }
예제 #20
0
    /// <summary>
    /// 检查数据库是否有同样的故障信息
    /// </summary>
    /// <param name="info"></param>
    private void CheckAlarmInfoInDB(AlarmInfo info)
    {
        string  query = "SELECT * FROM alarm_log";
        DataSet ds    = SqlAccess.ExecuteQuery(query);

        if (ds != null && ds.Tables.Count > 0)
        {
            DataTable table = ds.Tables[0];
            if (table.Rows.Count > 0)
            {
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    DataRow dataRow    = table.Rows[i];
                    string  EndTime    = dataRow[4].ToString();
                    string  DeviceName = dataRow[7].ToString();
                    string  Column     = dataRow[10].ToString();
                    string  Brand      = dataRow[11].ToString();
                    if (string.IsNullOrEmpty(EndTime) && DeviceName.Equals(info.DeviceName) && Column.Equals(info.Column) &&
                        Brand.Equals(info.Brand))
                    {
                        return;
                    }
                }
                // 有数据且没有同一个故障报警
                InsertAlarmIntoDB(info);
                return;
            }
            else
            {
                //数据库没有数据
                InsertAlarmIntoDB(info);
            }
        }
    }
예제 #21
0
        /// <summary>
        /// 处理延迟结束告警
        /// </summary>
        private void ProcessAlarmReadyEnd(
            AlarmConfigData set,
            float temperture,
            AlarmInfo info)
        {
            if (info.mAlarmStatus == AlarmStatus.AlarmReadyEnd)
            {
                if (set.mAlarmReason == AlarmReason.High)
                {
                    AlarmLevel level;
                    if (temperture >= (set.mCriticalThreshold - HIGH_ALARM_ERROR_RANGE))
                    {
                        level = AlarmLevel.Critical;
                    }
                    else if (temperture >= (set.mSeriousThreshold - HIGH_ALARM_ERROR_RANGE))
                    {
                        level = AlarmLevel.Serious;
                    }
                    else if (temperture >= (set.mGeneralThreshold - HIGH_ALARM_ERROR_RANGE))
                    {
                        level = AlarmLevel.General;
                    }
                    else
                    {
                        level = AlarmLevel.Unknown;
                    }

                    if (level > AlarmLevel.Unknown)
                    {
                        info.mAlarmStatus       = AlarmStatus.Alarming;
                        info.mCurrentAlarmLevel = info.mLastAlarmLevel;
                    }
                }
            }
        }
예제 #22
0
        /// <summary>
        /// アラーム情報を作成しQueueStorageへ登録する
        /// </summary>
        /// <param name="alarmCreationTargets">アラーム対象データ</param>
        /// <returns>成功した場合true、失敗した場合falseを返す</returns>
        public bool CreateAndEnqueueAlarmInfo(List <Tuple <DtDevice, DtAlarmDefConnectionMonitor> > alarmCreationTargets)
        {
            bool result = true;

            _logger.EnterJson("{0}", new { alarmCreationTargets });

            foreach (var alarmTarget in alarmCreationTargets)
            {
                string message = null;
                try
                {
                    (var device, var alarmDef) = alarmTarget;

                    string alarmDescription = alarmDef.AlarmDescription;
                    if (!string.IsNullOrEmpty(alarmDescription))
                    {
                        if (alarmDescription.Contains("{0}"))
                        {
                            if (alarmDescription.Contains("{1}"))
                            {
                                alarmDescription = string.Format(alarmDescription, device.DisconnectionDays, device.LastConnectDateTime);
                            }
                            else
                            {
                                alarmDescription = string.Format(alarmDescription, device.DisconnectionDays);
                            }
                        }
                    }

                    // Sq1.4: アラームキューを生成する
                    var alarmInfo = new AlarmInfo
                    {
                        SourceEquipmentUid = device.EquipmentUid,
                        TypeCode           = device.TypeCode,
                        ErrorCode          = alarmDef.AnalysisResultErrorCode,
                        AlarmLevel         = alarmDef.AlarmLevel,
                        AlarmTitle         = alarmDef.AlarmTitle,
                        AlarmDescription   = alarmDescription,
                        AlarmDatetime      = _timeProvider.UtcNow.ToString(Utility.Const.AlarmQueueDateTimeFormat),
                        EventDatetime      = device.AlarmJudgementTime,
                        AlarmDefId         = $"{_settings.SystemName}_{_settings.SubSystemName}_{alarmDef.Sid.ToString()}",
                        MessageId          = null
                    };

                    message = JsonConvert.SerializeObject(alarmInfo);

                    // Sq1.5: キューを登録する
                    _queueRepository.SendMessageToAlarmQueue(message);
                }
                catch (Exception e)
                {
                    // アラーム生成エラー or アラームキューにアラーム情報を送信できない(基本設計書 5.2.1.1 エラー処理)
                    _logger.Error(e, string.IsNullOrEmpty(message) ? nameof(Resources.UT_DCM_DCM_005) : nameof(Resources.UT_DCM_DCM_006), new object[] { alarmTarget?.Item1?.Sid });
                    result = false;
                }
            }

            _logger.Leave();
            return(result);
        }
예제 #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NotifyClient client;

            base.Response.Write("success");
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);

            if (masterSettings.EnableSP)
            {
                client = new NotifyClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID);
            }
            else
            {
                client = new NotifyClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", "");
            }
            AlarmNotify alarmNotify = client.GetAlarmNotify(base.Request.InputStream);

            if (alarmNotify != null)
            {
                AlarmInfo info = new AlarmInfo {
                    AlarmContent = alarmNotify.AlarmContent,
                    AppId        = alarmNotify.AppId,
                    Description  = alarmNotify.Description
                };
                VShopHelper.SaveAlarm(info);
            }
        }
예제 #24
0
        static void ReportAlarmInfoThread(object obj)
        {
            Hashtable data = obj as Hashtable;

            if (data.Contains("TYPE") && data.Contains("AlarmID"))
            {
                string Status   = (string)data["TYPE"];
                int    nAlarmID = (int)data["AlarmID"];

                AlarmInfo AlaInfo = new AlarmInfo(nAlarmID);

                AlaInfo.ServerWarningID = PostSever.PostWarningData(nAlarmID);

                string stDBid = DatabaseHandle.RecordAlarmToDB(AlaInfo);

                if (!string.IsNullOrEmpty(stDBid))
                {
                    AlarmDetailForm dlg = new AlarmDetailForm(stDBid, 1)
                    {
                        StartPosition = FormStartPosition.CenterParent
                    };
                    dlg.ShowDialog();

                    dlg.Dispose();
                }
            }
        }
예제 #25
0
파일: Alarm.cs 프로젝트: radtek/PecsService
        /// <summary>
        /// Syn Alarms
        /// </summary>
        /// <param name="lscId">lscId</param>
        /// <param name="connectionString">connectionString</param>
        /// <returns>Alarms</returns>
        public List <AlarmInfo> SynAlarms(int lscId, string connectionString)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@LscID",  SqlDbType.Int),
                                         new SqlParameter("@AIType", SqlDbType.Int),
                                         new SqlParameter("@DIType", SqlDbType.Int) };
                parms[0].Value = lscId;
                parms[1].Value = (int)EnmNodeType.Aic;
                parms[2].Value = (int)EnmNodeType.Dic;

                List <AlarmInfo> alarms = new List <AlarmInfo>();
                SqlHelper.TestConnection(connectionString);
                using (DataTable dt = SqlHelper.ExecuteTable(connectionString, CommandType.Text, SqlText.SQL_SELECT_ALARM_SYNALARMS, parms)) {
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            AlarmInfo alarm = new AlarmInfo();
                            alarm.LscID          = ComUtility.DBNullInt32Handler(dr["LscID"]);
                            alarm.SerialNO       = ComUtility.DBNullInt32Handler(dr["SerialNO"]);
                            alarm.Area1Name      = ComUtility.DBNullStringHandler(dr["Area1Name"]);
                            alarm.Area2Name      = ComUtility.DBNullStringHandler(dr["Area2Name"]);
                            alarm.Area3Name      = ComUtility.DBNullStringHandler(dr["Area3Name"]);
                            alarm.Area4Name      = ComUtility.DBNullStringHandler(dr["Area4Name"]);
                            alarm.StaName        = ComUtility.DBNullStringHandler(dr["StaName"]);
                            alarm.DevName        = ComUtility.DBNullStringHandler(dr["DevName"]);
                            alarm.DevDesc        = ComUtility.DBNullStringHandler(dr["DevDesc"]);
                            alarm.NodeID         = ComUtility.DBNullInt32Handler(dr["NodeID"]);
                            alarm.NodeType       = ComUtility.DBNullNodeTypeHandler(dr["NodeType"]);
                            alarm.NodeName       = ComUtility.DBNullStringHandler(dr["NodeName"]);
                            alarm.AlarmID        = ComUtility.DBNullInt32Handler(dr["AlarmID"]);
                            alarm.AlarmValue     = ComUtility.DBNullFloatHandler(dr["AlarmValue"]);
                            alarm.AlarmLevel     = ComUtility.DBNullAlarmLevelHandler(dr["AlarmLevel"]);
                            alarm.AlarmStatus    = ComUtility.DBNullAlarmStatusHandler(dr["AlarmStatus"]);
                            alarm.AlarmDesc      = ComUtility.DBNullStringHandler(dr["AlarmDesc"]);
                            alarm.AuxAlarmDesc   = ComUtility.DBNullStringHandler(dr["AuxAlarmDesc"]);
                            alarm.StartTime      = ComUtility.DBNullDateTimeHandler(dr["StartTime"]);
                            alarm.EndTime        = ComUtility.DBNullDateTimeHandler(dr["EndTime"]);
                            alarm.ConfirmName    = ComUtility.DBNullStringHandler(dr["ConfirmName"]);
                            alarm.ConfirmMarking = ComUtility.DBNullConfirmMarkingHandler(dr["ConfirmMarking"]);
                            alarm.ConfirmTime    = ComUtility.DBNullDateTimeHandler(dr["ConfirmTime"]);
                            alarm.AuxSet         = ComUtility.DBNullStringHandler(dr["AuxSet"]);
                            alarm.TaskID         = ComUtility.DBNullStringHandler(dr["TaskID"]);
                            alarm.ProjName       = ComUtility.DBNullStringHandler(dr["ProjName"]);
                            alarm.TurnCount      = ComUtility.DBNullInt32Handler(dr["TurnCount"]);
                            alarm.UpdateTime     = ComUtility.DBNullDateTimeHandler(dr["UpdateTime"]);

                            alarms.Add(alarm);
                        }

                        SqlHelper.ExecuteBulkCopy(SqlHelper.ConnectionStringLocalTransaction, SqlText.TN_Alarm, dt);
                    }
                }

                return(alarms);
            } catch {
                throw;
            }
        }
        //报警记录载入数据库
        public static void LogSQLite(AlarmInfo info)
        {
            string sql = "Insert into AlarmData(InsertTime,VarName,AlarmState,Priority,AlarmValue,Note,Operator,AlarmImage) values('{0}','{1}','{2}',{3},'{4}','{5}','{6}','{7}')";

            sql = string.Format(sql, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), info.VarName, info.AlarmState, info.Priority, info.AlarmValue, info.Note, CommonMethods.objAdmins.LoginName, info.AlarmImage);

            SQLHelper.Update(sql);
        }
예제 #27
0
        public ActionResult Edit(AlarmInfo alarmInfoCode)
        {
            string strResult = string.Empty;
            bool   bResult   = AlarmInfoService.Save(alarmInfoCode, out strResult);
            string msg       = bResult ? "修改成功" : "修改失败";

            return(Json(JsonMessageHelper.getJsonMessage(bResult, msg, strResult), "text", JsonRequestBehavior.AllowGet));
        }
예제 #28
0
        public ActionResult Create(AlarmInfo alarmInfo)
        {
            string strResult = string.Empty;
            bool   bResult   = AlarmInfoService.Add(alarmInfo, out strResult);
            string msg       = bResult ? "新增成功" : "新增失败";

            return(Json(JsonMessageHelper.getJsonMessage(bResult, msg, strResult), "text", JsonRequestBehavior.AllowGet));
        }
예제 #29
0
파일: AlarmBLL.cs 프로젝트: yoona1992/Git
        /// <summary>
        /// 获取报警列表
        /// </summary>
        /// <param name="objectName">对象名称</param>
        /// <param name="alarmType">报警类型</param>
        /// <param name="stTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="start"></param>
        /// <param name="limit"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        public static List <AlarmInfo> GetList(string objectName, int alarmType, DateTime stTime, DateTime endTime, int start, int limit, out int totalCount)
        {
            StringBuilder pSBQueryCount = new StringBuilder();

            pSBQueryCount.Append("SELECT COUNT(*) FROM INFO_ALARMINFO WHERE ALARMTIME BETWEEN TO_DATE('" + stTime.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss') AND TO_DATE('" + endTime.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss') ");
            if (string.IsNullOrWhiteSpace(objectName) == false)
            {
                pSBQueryCount.Append("AND ALARMOBJECTNAME LIKE '%" + objectName + "%'");
            }
            if (alarmType != -1)
            {
                pSBQueryCount.Append("AND ALARMTYPE = " + alarmType);
            }
            totalCount = OracleOperateBLL.GetQueryCount(pSBQueryCount.ToString());

            int pStartNum = limit * (start - 1) + 1;
            int pEndNum   = limit * start;

            StringBuilder pSBQueryText = new StringBuilder();

            pSBQueryText.Append("SELECT ID,ALARMINFO,TO_CHAR(ALARMTIME, 'yyyy-mm-dd hh24:mi:ss') AS ALARMTIME,ALARMADDRESS,ALARMTYPE,ALARMOBJECTNAME FROM (SELECT A.*, rownum r FROM(");
            pSBQueryText.Append("SELECT * FROM INFO_ALARMINFO WHERE ALARMTIME BETWEEN TO_DATE('" + stTime.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss') AND TO_DATE('" + endTime.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss') ");
            if (string.IsNullOrWhiteSpace(objectName) == false)
            {
                pSBQueryText.Append("AND ALARMOBJECTNAME LIKE '%" + objectName + "%'");
            }
            if (alarmType != -1)
            {
                pSBQueryText.Append("AND ALARMTYPE = " + alarmType);
            }
            pSBQueryText.Append(" ORDER BY ALARMTIME DESC) A ");
            pSBQueryText.Append("WHERE rownum<=" + pEndNum + ") B WHERE r>=" + pStartNum);
            var data = OracleOperateBLL.FillDataTable(pSBQueryText.ToString());
            List <AlarmInfo> alarmInfoList = new List <AlarmInfo>();

            foreach (DataRow dr in data.Rows)
            {
                AlarmInfo a = new AlarmInfo();
                a.Id           = Convert.ToInt32(dr["ID"].ToString());
                a.Info         = dr["ALARMINFO"].ToString();
                a.AlarmTimeStr = dr["ALARMTIME"].ToString();
                var type = Convert.ToInt16(dr["ALARMTYPE"].ToString());
                if (type == 1)
                {
                    a.AlarmTypeName = "人员报警";
                }
                else
                {
                    a.AlarmTypeName = "车辆报警";
                }
                a.AlarmAddress    = dr["ALARMADDRESS"].ToString();
                a.AlarmObjectName = dr["ALARMOBJECTNAME"].ToString();

                alarmInfoList.Add(a);
            }

            return(alarmInfoList);
        }
예제 #30
0
 private void FillDataInfoForm(AlarmInfo info, GameObject item, int index)
 {
     Utils.FindGameObject(item, "Number").SetText((index + 1).ToString());
     Utils.FindGameObject(item, "Des").SetText(info.About);
     Utils.FindGameObject(item, "StartTime").SetText(info.StartTime);
     Utils.FindGameObject(item, "EndTime").SetText(info.EndTime);
     Utils.FindGameObject(item, "Status").SetText(info.Status);
     Utils.FindGameObject(item, "Value").SetText(info.Value);
 }
예제 #31
0
파일: Clock.cs 프로젝트: jonwa/CSharp
        public Clock(DateTime wakeup, bool snooze = false, int numSnooze = 0, int snoozeInterval = 0)
        {
            _info = new AlarmInfo();
            _info.Time = DateTime.Now;

            _e = new AlarmEventArgs();
            _e.Time = wakeup;
            _e.Snooze = snooze;
            _e.NumSnooze = numSnooze;
            _e.SnoozeInterval = snoozeInterval;
        }
 private void GetAlarmCallBack(AlarmInfo a)
 {
     //取消报警
     LumbarRobotController.RobotController.ControlCommand.ErrorReset();
 }
        public void RaiseAlarm(object sender, FALibrary.Alarm.FAAlarmEventArgs e)
        {
            AlarmInfo alarmInfo = new AlarmInfo();

            alarmInfo.RaisedTime = DateTime.Now;
            alarmInfo.AlarmEventArgs = e;
            if (sender is FALibrary.Sequence.FASequence)
            {
                FALibrary.Sequence.FASequence sequence = sender as FALibrary.Sequence.FASequence;
                SetSequenceRetryCommand(alarmInfo, sequence);
            }
            else
            {
                alarmInfo.ClearAlarm =
                    new CommandHandler(
                        obj =>
                        {
                            ClearAlarm(alarmInfo);
                        }, true);
            }

            App.Current.Dispatcher.Invoke(
                new Action(
                    delegate
                    {
                        RaisingAlarmList.Add(alarmInfo);
                        CurrentAlarmInfo = alarmInfo;
                    }));
        }
        private void SetSequenceRetryCommand(AlarmInfo alarmInfo, FALibrary.Sequence.FASequence sequence)
        {
            Action<object, PropertyChangedEventArgs> confirmStatus = null;

            PropertyChangedEventHandler changedStatus =
                    delegate(object sender, PropertyChangedEventArgs e)
                    {
                        if (confirmStatus != null)
                            confirmStatus(sender, e);
                    };

            alarmInfo.ClearAlarm =
                new CommandHandler(
                    obj =>
                    {
                        if (Equipment.AlarmClearable() == false) return;

                        Equipment.TurnOffSound();
                        ClearAlarm(alarmInfo);
                        sequence.PropertyChanged -= changedStatus;
                        if (Equipment.State == Equipment.StateRun ||
                            Equipment.State == Equipment.StateRundown)
                        {
                            sequence.Resume();
                        }
                    }, false);

            if (sequence.State == FALibrary.Sequence.SequenceState.Suspended)
                alarmInfo.ClearAlarm.SetCanExecute(true);
            else
                sequence.OnSuspended +=
                    delegate(object sender, EventArgs e)
                    {
                        try
                        {
                            alarmInfo.ClearAlarm.SetCanExecute(true);
                        }
                        catch (Exception exception)
                        {
                            Manager.LogManager.Instance.WriteSystemLog(exception.ToString());
                        }
                    };
        }