コード例 #1
0
ファイル: PlanPersonBLL.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 处理预案关联人
 /// </summary>
 /// <param name="handleItemId"></param>
 /// <param name="planRecordId"></param>
 /// <param name="planType"></param>
 /// <param name="confirmType"></param>
 /// <returns></returns>
 public bool HandlePlanPerson(int handleItemId, ServAlarmRecordModel alarmRecord, int handleRecordId)
 {
     try
     {
         List <ServPlanPersonModel> personList = GetPlanPersonList(handleItemId);
         if (personList != null)
         {
             for (int i = 0; i < personList.Count; i++)
             {
                 if (personList[i].is_message == 1)//判断是否发短信
                 {
                     //TODO调用发短信接口,并记录到数据库
                     //1:获取短信模板和短信内容(模板应该固定)
                     //2:调用发送短信接口
                     //3:将短信记录数据库(短信记录及关联记录)
                 }
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         Log4NetHelp.Error("处理预案关联人失败!预案处置项ID:" + handleItemId + "预案处置项记录ID:" + handleRecordId + "错误信息:" + ex.Message);
         return(false);
     }
 }
コード例 #2
0
ファイル: LEDHandle.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 处理LED报警信息
 /// </summary>
 /// <param name="deviceInfo"></param>
 /// <param name="alarmRecord"></param>
 public bool HandleLedItem(string message, string regionCode)
 {
     try
     {
         // message = GetAlarmText();
         if (!string.IsNullOrEmpty(message))
         {
             LEDMsgModel ledMsg = new LEDMsgModel();
             ledMsg.message    = message;
             ledMsg.type       = (int)EnumClass.PlanHandleTime.确警前;
             ledMsg.regionCode = regionCode;
             string msg = JsonHelper.ObjectToString(ledMsg);
             string url = SubSystemRouteBLL.GetLedControlRoute();
             // HttpHelper.PostJsonData(url, msg, Encoding.UTF8);
             sendLedCmdDele.BeginInvoke(url, msg, Encoding.UTF8, null, null);
             Log4NetHelp.Info("调用LED接口成功!信息:" + msg);
             return(true);
         }
         else
         {
             Log4NetHelp.Info("待发送至LED信息为空!");
             return(false);
         }
     }
     catch (Exception ex)
     {
         message = "";
         Log4NetHelp.Info("调用LED接口失败!" + ex.Message);
         return(false);
     }
 }
コード例 #3
0
ファイル: VideoDownloadBLL.cs プロジェクト: zpzpp/School.CSM
        /// <summary>
        /// 视频下载记录
        /// </summary>
        /// <param name="handleRecordId"></param>
        /// <param name="eventId"></param>
        /// <param name="alarmTime"></param>
        /// <param name="deviceInfo"></param>
        /// <returns></returns>
        public bool VideoDownload(int handleRecordId, int eventId, DateTime alarmTime, List <ServDeviceInfoModel> deviceInfo)
        {
            try
            {
                ServAlarmVideoTimeDAL   videoTimeDal = new ServAlarmVideoTimeDAL();
                ServAlarmVideoTimeModel videoTime    = videoTimeDal.GetEntityByEventId(eventId);
                if (videoTime != null)
                {
                    DateTime startTime = alarmTime.AddSeconds(-videoTime.start_time);
                    DateTime endTime   = alarmTime.AddSeconds(videoTime.end_time);
                    if (startTime == endTime)
                    {
                        Log4NetHelp.Info("开始下载时间与结束时间一致!请重新配置事件,事件ID:" + eventId);
                        return(false);
                    }

                    //循环调用视频下载接口,
                    //记录存入视频下载表和关联表
                    if (deviceInfo != null)
                    {
                        ServVideoPlanHandleRecordDAL dal = new ServVideoPlanHandleRecordDAL();
                        for (int i = 0; i < deviceInfo.Count; i++)
                        {
                            try
                            {
                                //增加视频下载记录及报警视频关联记录
                                if (!dal.AddPlanVideoDownRecord(handleRecordId, "", DateTime.Now, deviceInfo[i].device_code, deviceInfo[i].device_name, (int)EnumClass.VideoDownLoadStatus.未开始下载, 1, endTime, startTime, (int)EnumClass.VideoDownLoadType.报警))
                                {
                                    Log4NetHelp.Info("视频下载记录写入下载记录表失败!处理记录ID:" + handleRecordId + " 设备名称:" + deviceInfo[i].device_name);
                                }
                            }
                            catch (Exception ex)
                            {
                                Log4NetHelp.Info("视频下载记录写入下载记录表失败!处理记录ID:" + handleRecordId + " 设备名称:" + deviceInfo[i].device_name + " 错误:" + ex.Message);
                            }
                        }
                    }
                    else
                    {
                        Log4NetHelp.Info("待下载摄像头数据为空!");
                    }
                    return(true);
                }
                else
                {
                    Log4NetHelp.Info("根据报警事件ID未找到事件!无法找到视频下载时间配置!");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Log4NetHelp.Error("处理预案视频下载失败!" + ex.Message);
                return(false);
            }
        }
コード例 #4
0
ファイル: PlanPersonBLL.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 查询预案关联人信息
 /// </summary>
 /// <param name="handleItemId"></param>
 /// <returns></returns>
 private List <ServPlanPersonModel> GetPlanPersonList(int handleItemId)
 {
     try
     {
         return(_servPlanPersonDal.GetPlanPersonByItemId(handleItemId));
     }
     catch (Exception ex)
     {
         Log4NetHelp.Error("查找预案关联人失败!预案处置项ID:" + handleItemId + "错误信息:" + ex.Message);
         return(null);
     }
 }
コード例 #5
0
ファイル: HandleCamerasBLL.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 根据预案处置项ID查找摄像头信息
 /// </summary>
 /// <returns></returns>
 public List <ServDeviceInfoModel> GetCameras(int handleItemId)
 {
     try
     {
         return(_servPlanHandleItemCameraDal.GetHandledCameras(handleItemId));
     }
     catch (Exception ex)
     {
         Log4NetHelp.Error("根据处置项ID查找摄像头失败!处置项ID:" + handleItemId + " 错误信息:" + ex.Message);
         return(null);
     }
 }
コード例 #6
0
ファイル: BusinessLogicBLL.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 将处置项结果拼装到hashtable中
 /// </summary>
 /// <param name="item_type"></param>
 /// <param name="obj"></param>
 /// <returns></returns>
 private void AddHashTable(int item_type, object obj)
 {
     if (!hash.ContainsKey(item_type))
     {
         hash.Add(item_type, obj);
     }
     else
     {
         Log4NetHelp.Info("处置项重复:" + Enum.Parse(typeof(EnumClass.DevicePlanDefaultOptions), item_type.ToString()).ToString());
     }
     //hash.Add(item_type, obj);
 }
コード例 #7
0
ファイル: BusinessLogicBLL.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 根据设备code查找设备
 /// </summary>
 /// <param name="code"></param>
 /// <returns></returns>
 private ServDeviceInfoModel GetDeviceInfo(string code)
 {
     try
     {
         ServDeviceInfoDAL deviceInfoDal = new ServDeviceInfoDAL();
         return(deviceInfoDal.GetEntity(code));
     }
     catch (Exception ex)
     {
         Log4NetHelp.Error("根据设备Code获取设备失败:" + code + " 错误信息:" + ex.Message);
         return(null);
     }
 }
コード例 #8
0
ファイル: HandleRelayBLL.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 通过四色灯继电器ID查找设备信息
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 private BaseRelayConfigModel GetRelayConfigById(int id)
 {
     try
     {
         BaseRelayConfigDAL baseRelayConfigDal = new BaseRelayConfigDAL();
         return(baseRelayConfigDal.GetEntity(id));
     }
     catch (Exception ex)
     {
         Log4NetHelp.Error("通过ID查找四色灯信息失败!ID:" + id + " 错误信息:" + ex.Message);
         return(null);
     }
 }
コード例 #9
0
ファイル: BusinessLogicBLL.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 根据预案类型,预案ID,确警前/后条件查找预案处置项
 /// </summary>
 /// <param name="planId"></param>
 /// <param name="planType"></param>
 /// <param name="configType"></param>
 /// <returns></returns>
 private List <ServPlanHandleItemModel> GetPlanHandleItem(int planId, int planType, int configType)
 {
     try
     {
         ServPlanHandleItemDAL planHandleItemDal = new ServPlanHandleItemDAL();
         return(planHandleItemDal.GetPlanHandleItem(planId, planType, configType));
     }
     catch (Exception ex)
     {
         Log4NetHelp.Error("根据预案类型,预案ID,确警前查找预案处置项失败!预案ID" + planId + "预案类型:" + planType + "确警前/后" + configType + "错误信息:" + ex.Message);
         return(null);
     }
 }
コード例 #10
0
ファイル: BusinessLogicBLL.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 根据事件ID获取视频下载时间
 /// </summary>
 /// <param name="eventId"></param>
 /// <returns></returns>
 public ServAlarmVideoTimeModel GetAlarmVideoTime(int eventId)
 {
     try
     {
         ServAlarmVideoTimeDAL alarmVideoTimeDal = new ServAlarmVideoTimeDAL();
         return(alarmVideoTimeDal.GetEntityByEventId(eventId));
     }
     catch (Exception ex)
     {
         Log4NetHelp.Error("根据事件ID查找视频播放时间失败!事件ID:" + eventId + " 错误信息:" + ex.Message);
         return(null);
     }
 }
コード例 #11
0
ファイル: HandleCamerasBLL.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 调取地图接口获取事件预案周围摄像头
 /// </summary>
 /// <param name="deviceId"></param>
 /// <param name="inNum"></param>
 /// <param name="outDistance"></param>
 /// <param name="outNum"></param>
 /// <returns></returns>
 public List <ServDeviceInfoModel> GetEventPlanCameras(int deviceId, int inNum, int outDistance, int outNum)
 {
     try
     {
         //TODO
         return(null);
     }
     catch (Exception ex)
     {
         Log4NetHelp.Error("根据设备ID查找事件预案周围摄像头失败!报警设备ID:" + deviceId + " 错误信息:" + ex.Message);
         return(null);
     }
 }
コード例 #12
0
ファイル: BusinessLogicBLL.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 根据设备ID,报警时间,预案状态查找设备预案
 /// </summary>
 /// <param name="deviceId"></param>
 /// <param name="planTime"></param>
 /// <param name="status"></param>
 /// <returns></returns>
 private List <DevicePlanAndTimeConfig> CheckDevicePlanIsExist(int deviceId, int status, string alarmTime)
 {
     try
     {
         ServDevicePlanDAL devicePlanDal = new ServDevicePlanDAL();
         DevicePlanQuery   query         = new DevicePlanQuery();
         query.alarmTime  = alarmTime;
         query.deviceId   = deviceId;
         query.planStatus = status;
         return(devicePlanDal.QueryDevicePlanByDeviceIdAndTime(query));
     }
     catch (Exception ex)
     {
         Log4NetHelp.Error("根据设备ID,报警时间,预案状态查找设备预案失败!设备ID:" + deviceId + "报警时间:" + alarmTime + "预案状态:" + status + "错误信息:" + ex.Message);
         return(null);
     }
 }
コード例 #13
0
ファイル: BusinessLogicBLL.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 通过事件类型,园区ID以及时间配置查找事件预案
 /// </summary>
 /// <param name="alarmTime"></param>
 /// <param name="eventType"></param>
 /// <param name="planStatus"></param>
 /// <param name="regionId"></param>
 /// <returns></returns>
 private List <EventPlanAndTimeConfig> CheckEventPlanIsExist(string alarmTime, int eventType, int planStatus, int regionId)
 {
     try
     {
         ServEventPlanDAL eventPlanDal = new ServEventPlanDAL();
         EventPlanQuery   query        = new EventPlanQuery();
         query.alarmTime  = alarmTime;
         query.eventType  = eventType;
         query.planStatus = planStatus;
         query.regionId   = regionId;
         return(eventPlanDal.QueryEventPlanByEventIdAndTime(query));
     }
     catch (Exception ex)
     {
         Log4NetHelp.Error("根据设备ID,报警时间,预案状态查找设备预案失败!事件类型:" + eventType + "报警时间:" + alarmTime + " 园区ID:" + regionId + " 预案状态:" + planStatus + "错误信息:" + ex.Message);
         return(null);
     }
 }
コード例 #14
0
ファイル: BusinessLogicBLL.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 处理预案
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public bool HandleBusiness(InterfaceData info)
 {
     try
     {
         //  InterfaceData interfaceData = JsonHelper.StringToObject<InterfaceData>(info);
         if (info != null)
         {
             if (info.dataType == 1)  //报警数据(默认类型1)
             {
                 ServAlarmRecordModel alarmRecord = JsonHelper.StringToObject <ServAlarmRecordModel>(info.data.ToString());
                 if (alarmRecord != null)
                 {
                     //Log4NetHelp.Info("业务层开始处理预案!");
                     HandlePlan(alarmRecord);
                     // Log4NetHelp.Info("业务层预案处理完成!");
                 }
                 else
                 {
                     //log:报警数据转换失败
                     Log4NetHelp.Info("数据类型转换失败!数据:" + info.data.ToString());
                 }
             }
             else
             {
                 //log:非报警数据
                 Log4NetHelp.Info("非报警数据");
             }
         }
         else
         {
             //log:HandleBusiness转换子系统数据失败
             Log4NetHelp.Info("业务层接收数据为空");
         }
         return(true);
     }
     catch (Exception ex)
     {
         //log  数据处理失败+ex.message
         Log4NetHelp.Error("预案处理出现异常!" + ex.Message);
         return(false);
     }
 }
コード例 #15
0
        /// <summary>
        /// 增加预案处置记录
        /// </summary>
        /// <returns></returns>
        public int AddPlanRecord(int alarmRecordId, int planId, int planType)
        {
            int planRecordId = 0;
            ServPlanRecordDAL planRecordDal = new ServPlanRecordDAL();

            try
            {
                ServPlanRecordModel planRecord = new ServPlanRecordModel();
                planRecord.alarm_id     = alarmRecordId;
                planRecord.plan_id      = planId;
                planRecord.plan_type    = planType;
                planRecord.trigger_time = DateTime.Now;
                return(planRecordId = planRecordDal.AddEntity(planRecord));
            }
            catch (Exception ex)
            {
                Log4NetHelp.Error("插入预案执行记录失败!" + "报警ID:" + alarmRecordId + "预案ID:" + planId + "预案类型:" + planType + "错误信息:" + ex.Message);
                return(0);
            }
        }
コード例 #16
0
ファイル: BusinessLogicBLL.cs プロジェクト: zpzpp/School.CSM
        /// <summary>
        /// 根据事件ID获取父级事件
        /// </summary>
        /// <returns></returns>
        //public int GetParentEvent(int eventId)
        //{
        //    try
        //    {
        //        BaseEventTypeBLL eventBll = new BaseEventTypeBLL();
        //        List<BaseEventTypeModel> eventList = eventBll.GetAllEventType();
        //        var currentEvent = eventList.Where(n => n.id == eventId).FirstOrDefault();  //获取当前事件
        //        if (currentEvent != null)
        //        {
        //            if (currentEvent.pid != -1)
        //            {
        //                var parentEvent = eventList.Where(n => n.id == currentEvent.pid).FirstOrDefault();//获取当前事件的父级事件
        //                if (parentEvent != null)
        //                {
        //                    return parentEvent.id;
        //                }
        //                else
        //                {
        //                    Log4NetHelp.Info("未找到当前事件的父级事件,事件ID:" + eventId);
        //                    return -1;
        //                }
        //            }
        //            else
        //            {
        //                return currentEvent.id;
        //            }
        //        }
        //        else
        //        {
        //            Log4NetHelp.Info("未找到当前事件,事件ID:" + eventId);
        //            return -1;
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Log4NetHelp.Info("根据当前事件ID未找到父级事件,事件ID:" + eventId + " " + ex.Message);
        //        return -1;
        //    }
        //}

        /// <summary>
        /// 根据事件ID获取父级事件
        /// </summary>
        /// <returns></returns>
        public int GetParentEvent(string eventCode)
        {
            try
            {
                BaseEventTypeBLL          eventBll  = new BaseEventTypeBLL();
                List <BaseEventTypeModel> eventList = eventBll.GetAllEventType();
                var currentEvent = eventList.Where(n => n.event_code == eventCode).FirstOrDefault();  //获取当前事件
                if (currentEvent != null)
                {
                    if (currentEvent.pid != -1)
                    {
                        var parentEvent = eventList.Where(n => n.id == currentEvent.pid).FirstOrDefault();//获取当前事件的父级事件
                        if (parentEvent != null)
                        {
                            return(parentEvent.id);
                        }
                        else
                        {
                            Log4NetHelp.Info("未找到当前事件的父级事件,事件Code:" + eventCode);
                            return(-1);
                        }
                    }
                    else
                    {
                        return(currentEvent.id);
                    }
                }
                else
                {
                    Log4NetHelp.Info("未找到当前事件,事件Code:" + eventCode);
                    return(-1);
                }
            }
            catch (Exception ex)
            {
                Log4NetHelp.Info("根据当前事件Code未找到父级事件,事件Code:" + eventCode + " " + ex.Message);
                return(-1);
            }
        }
コード例 #17
0
 /// <summary>
 /// 根据事件code获取事件类型ID
 /// </summary>
 /// <param name="code"></param>
 /// <returns></returns>
 private int GetBaseEventType(string code)
 {
     try
     {
         BaseEventTypeDAL   eventTypeDal = new BaseEventTypeDAL();
         BaseEventTypeModel model        = eventTypeDal.GetEntityByEventCode(code);
         if (model != null)
         {
             return(model.id);
         }
         else
         {
             Log4NetHelp.Info("根据事件code未找到对应事件类型:" + code);
             return(-1);
         }
     }
     catch (Exception ex)
     {
         Log4NetHelp.Error("根据事件code查找到事件类型失败:" + code + "消息:" + ex.Message);
         return(-1);
     }
 }
コード例 #18
0
        /// <summary>
        /// 插入预案处置项执行结果
        /// </summary>
        /// <param name="confirmType"></param>
        /// <param name="handleItemId"></param>
        /// <param name="itemType"></param>
        /// <param name="planRecordId"></param>
        /// <param name="content"></param>
        public int AddItemRecord(int confirmType, int handleItemId, int result, int itemType, int planRecordId, string content)
        {
            ServPlanItemResultDAL planItemResultDal = new ServPlanItemResultDAL();

            try
            {
                ServPlanItemResultModel itemResult = new ServPlanItemResultModel();
                itemResult.confirm_type   = confirmType;
                itemResult.content        = content;
                itemResult.execute_time   = DateTime.Now;
                itemResult.handleitem_id  = handleItemId;
                itemResult.item_result    = result;
                itemResult.item_type      = itemType;
                itemResult.plan_record_id = planRecordId;
                int id = planItemResultDal.AddEntity(itemResult);
                return(id);
            }
            catch (Exception ex)
            {
                Log4NetHelp.Error("插入预案处置项执行记录失败!" + "confirm_type:" + confirmType + "处置项ID:" + handleItemId + "处置项类型编号:" + itemType + "预案记录ID:" + planRecordId + "处置项描述:" + content + "错误信息:" + ex.Message);
                return(0);
            }
        }
コード例 #19
0
ファイル: HandleRelayBLL.cs プロジェクト: zpzpp/School.CSM
 /// <summary>
 /// 处理四色灯
 /// </summary>
 /// <param name="relayId"></param>
 /// <returns></returns>
 public bool HandleRelay(string relayId, string regionCode)
 {
     try
     {
         int id = int.Parse(relayId);
         //查找四色灯信息
         BaseRelayConfigModel baseRelayConfigModel = GetRelayConfigById(id);
         RelayMsgModel        relayMsg             = new RelayMsgModel();
         relayMsg.regionCode = regionCode;
         relayMsg.controlId  = baseRelayConfigModel.control_id;
         relayMsg.op         = (int)EnumClass.Operation.打开;
         string message = JsonHelper.ObjectToString(relayMsg);
         // HttpHelper.PostJsonData(SubSystemRouteBLL.GetRelayControlRoute(), message, Encoding.UTF8);
         sendRelayCmdDele.BeginInvoke(SubSystemRouteBLL.GetRelayControlRoute(), message, Encoding.UTF8, null, null);
         Log4NetHelp.Info("调用四色灯接口成功!信息:" + message);
         return(true);
     }
     catch (Exception ex)
     {
         Log4NetHelp.Info("调用四色灯接口失败!控制编号:" + relayId + ex.Message);
         return(false);
     }
 }
コード例 #20
0
 /// <summary>
 /// 处理丛文设备数据
 /// </summary>
 /// <returns></returns>
 private bool HandleCowinDeviceData(object message, string mark)
 {
     try
     {
         List <DeviceModel>         deviceList    = JsonHelper.StringToObject <List <DeviceModel> >(message.ToString());
         ServTempDeviceDAL          tempDeviceDal = new ServTempDeviceDAL();
         ServDeviceInfoDAL          deviceInfoDal = new ServDeviceInfoDAL();
         ConvertChinese             convert       = new ConvertChinese();
         List <BaseDeviceTypeModel> typeList      = null;
         try
         {
             typeList = baseMapConfigBLL.GetAllBaseDeviceTypeModel();
         }
         catch (Exception ex)
         {
             Log4NetHelp.Error("获取基本设备类型失败!" + ex.Message);
         }
         for (int i = 0; i < deviceList.Count; i++)
         {
             //int tempNum = tempDeviceDal.GetTempDeviceByCode(deviceList[i].deviceCode);
             ServTempDeviceModel tempDevice = tempDeviceDal.GetTempDeviceByDeviceCode(deviceList[i].deviceCode);
             ServDeviceInfoModel deviceInfo = deviceInfoDal.GetDeviceByDeviceCode(deviceList[i].deviceCode);
             if (tempDevice == null && deviceInfo == null)
             {
                 ServTempDeviceModel model = new ServTempDeviceModel();
                 var type = typeList.Where(n => n.type_name == deviceList[i].typeName).FirstOrDefault();
                 model.device_type  = type == null ? 0 : type.id;
                 model.create_time  = DateTime.Now;
                 model.device_code  = deviceList[i].deviceCode;
                 model.device_name  = deviceList[i].deviceName;
                 model.search_code  = convert.GetHeadOfChs(deviceList[i].deviceName);
                 model.subsystem_id = deviceList[i].subsystemId;
                 model.ext1         = deviceList[i].serverIp;
                 try
                 {
                     int res = tempDeviceDal.AddEntity(model);
                     if (res == 0)
                     {
                         Log4NetHelp.Error("设备code:" + deviceList[i].deviceCode + " 设备名称:" + deviceList[i].deviceName + " 插入临时表失败!");
                     }
                     else
                     {
                         Log4NetHelp.Info("设备code:" + deviceList[i].deviceCode + " 设备名称:" + deviceList[i].deviceName + " 插入临时表成功!");
                     }
                 }
                 catch (Exception ex)
                 {
                     Log4NetHelp.Error("设备code:" + deviceList[i].deviceCode + " 设备名称:" + deviceList[i].deviceName + " 插入临时表失败!" + ex.Message);
                 }
             }
             else if (tempDevice != null)
             {
                 Log4NetHelp.Error("设备code:" + deviceList[i].deviceCode + " 设备名称:" + deviceList[i].deviceName + " 在临时设备表已存在!");
             }
             else if (deviceInfo != null)
             {
                 Log4NetHelp.Error("设备code:" + deviceList[i].deviceCode + " 设备名称:" + deviceList[i].deviceName + " 在设备表已存在!");
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         Log4NetHelp.Error("标识为:" + mark + "驱动同步丛文设备数据失败!" + ex.Message);
         return(false);
     }
 }
コード例 #21
0
ファイル: BusinessLogicBLL.cs プロジェクト: zpzpp/School.CSM
        /// <summary>
        /// 处理报警数据
        /// </summary>
        /// <param name="alarmRecord"></param>
        public void HandlePlan(ServAlarmRecordModel alarmRecord)
        {
            try
            {
                ServExecutionTimeDAL executeTimeDal      = new ServExecutionTimeDAL();
                ServDeviceInfoModel  deviceInfo          = GetDeviceInfo(alarmRecord.alarm_code);
                BaseRegionConfigDAL  baseRegionConfigDal = new BaseRegionConfigDAL();
                if (deviceInfo != null)
                {
                    BaseRegionConfigModel regionModel = baseRegionConfigDal.GetEntity(deviceInfo.region_id); //获取设备所在园区
                    int parentEventId = GetParentEvent(alarmRecord.alarm_event);                             //获取父级事件ID
                    //查找设备预案
                    string alarmTime   = alarmRecord.alarm_time.ToLocalTime().ToString("HH:mm:ss");
                    var    devicePlans = CheckDevicePlanIsExist(deviceInfo.id, (int)EnumClass.PlanStatus.启用, alarmTime);
                    DevicePlanAndTimeConfig devicePlan = devicePlans == null ? null : devicePlans.FirstOrDefault(); //目前取第一条设备预案
                    if (devicePlan != null)
                    {
                        #region  检验时间表达式
                        //if (TimeExpression.TimePointIsExistSpan(alarmRecord.alarm_time.ToLocalTime(), devicePlan.update_time, timeModel.execution_cycle))
                        //{

                        //}
                        //else
                        //{
                        //    Log4NetHelp.Info("报警时间未在设置周期内,报警时间:" + alarmRecord.alarm_time.ToLocalTime().ToString() + " 开始时间:" + devicePlan.update_time + " 时间表达式:" + timeModel.execution_cycle);
                        //}

                        #endregion
                        List <ServPlanHandleItemModel> planHandleItemList = GetPlanHandleItem(devicePlan.id, (int)EnumClass.PlanType.设备预案, (int)EnumClass.PlanHandleTime.确警前);
                        if (planHandleItemList != null && planHandleItemList.Count != 0)
                        {
                            //执行设备预案,写入预案执行记录
                            PlanBLL planBll      = new PlanBLL();
                            int     planRecordId = planBll.AddPlanRecord(alarmRecord.id, devicePlan.id, (int)EnumClass.PlanType.设备预案);
                            if (planRecordId > 0)
                            {
                                List <ServDeviceInfoModel> camerasList = null;
                                string ledMessage = "";
                                HandleDevicePlanItem(planRecordId, parentEventId, regionModel, planHandleItemList, deviceInfo, alarmRecord, out camerasList, out ledMessage);
                                // Hashtable hash = HandleDevicePlanItem(planRecordId, planHandleItemList, deviceInfo, alarmRecord,out camerasList,out ledMessage);
                                if (hash != null && hash.Count != 0)
                                {
                                    WebSocketMsgModel  webMsg        = new WebSocketMsgModel();
                                    DevicePlanMsgModel devicePlanMsg = new DevicePlanMsgModel();
                                    devicePlanMsg.hash       = hash;
                                    devicePlanMsg.alarm      = alarmRecord;
                                    devicePlanMsg.deviceInfo = deviceInfo;
                                    // devicePlanMsg.videoTime = GetAlarmVideoTime(alarmRecord.alarm_event);
                                    devicePlanMsg.videoTime   = GetAlarmVideoTime(parentEventId);
                                    devicePlanMsg.camerasList = camerasList;
                                    devicePlanMsg.ledMessage  = ledMessage;       //用于页面显示滚动条信息
                                                                                  // string devicePlanMsgStr = JsonHelper.ObjectToString(devicePlanMsg);
                                    webMsg.info = devicePlanMsg;
                                    webMsg.type = (int)EnumClass.WebSocketMsgType.设备预案;
                                    string param = JsonHelper.ObjectToString(webMsg);
                                    HttpHelper.PostJsonData(SubSystemRouteBLL.GetToWebsocketRoute(), param, Encoding.UTF8);
                                }
                            }
                        }
                        else
                        {
                            //log:未找到相应设备预案处置项
                            Log4NetHelp.Info("未找到对应设备预案处置项:" + alarmRecord.alarm_code);
                        }
                    }
                    else
                    {
                        //log 未找到设备预案或者设备预案未启用
                        //TODO 查找事件预案
                        Log4NetHelp.Info("未找到当前时间段内配置的设备预案或者设备预案未启用,继续查找事件预案");
                        //int parentEventId = GetParentEvent(alarmRecord.alarm_event);  //获取父级事件ID
                        if (parentEventId != -1)
                        {
                            var eventPlans = CheckEventPlanIsExist(alarmTime, parentEventId, (int)EnumClass.PlanStatus.启用, regionModel.id);
                            EventPlanAndTimeConfig eventPlan = eventPlans == null ? null : eventPlans.FirstOrDefault();//目前取第一条设备预案
                            if (eventPlan != null)
                            {
                                List <ServPlanHandleItemModel> planHandleItemList = GetPlanHandleItem(eventPlan.id, (int)EnumClass.PlanType.事件预案, (int)EnumClass.PlanHandleTime.确警前);//获取事件预案处置项
                                if (planHandleItemList != null && planHandleItemList.Count != 0)
                                {
                                    //执行事件预案,写入预案执行记录
                                    PlanBLL planBll      = new PlanBLL();
                                    int     planRecordId = planBll.AddPlanRecord(alarmRecord.id, eventPlan.id, (int)EnumClass.PlanType.事件预案);
                                    if (planRecordId > 0)
                                    {
                                        List <ServDeviceInfoModel> camerasList = null;
                                        string ledMessage = "";
                                        HandleEventPlanItem(planRecordId, parentEventId, regionModel, planHandleItemList, deviceInfo, alarmRecord, out camerasList, out ledMessage);
                                        // Hashtable hash = HandleDevicePlanItem(planRecordId, planHandleItemList, deviceInfo, alarmRecord,out camerasList,out ledMessage);
                                        if (hash != null && hash.Count != 0)
                                        {
                                            WebSocketMsgModel  webMsg        = new WebSocketMsgModel();
                                            DevicePlanMsgModel devicePlanMsg = new DevicePlanMsgModel();
                                            devicePlanMsg.hash       = hash;
                                            devicePlanMsg.alarm      = alarmRecord;
                                            devicePlanMsg.deviceInfo = deviceInfo;
                                            //  devicePlanMsg.videoTime = GetAlarmVideoTime(alarmRecord.alarm_event);
                                            devicePlanMsg.videoTime   = GetAlarmVideoTime(parentEventId);
                                            devicePlanMsg.camerasList = camerasList;
                                            devicePlanMsg.ledMessage  = ledMessage;       //用于页面显示滚动条信息
                                                                                          // string devicePlanMsgStr = JsonHelper.ObjectToString(devicePlanMsg);
                                            webMsg.info = devicePlanMsg;
                                            webMsg.type = (int)EnumClass.WebSocketMsgType.事件预案;
                                            string param = JsonHelper.ObjectToString(webMsg);
                                            HttpHelper.PostJsonData(SubSystemRouteBLL.GetToWebsocketRoute(), param, Encoding.UTF8);
                                        }
                                    }
                                }
                                else
                                {
                                    Log4NetHelp.Info("未找到对应事件预案处置项,事件ID:" + alarmRecord.alarm_event + " 园区ID:" + regionModel.id + " 报警时间:" + alarmTime);
                                }
                            }
                            else
                            {
                                Log4NetHelp.Info("未找到对应事件预案,事件ID:" + alarmRecord.alarm_event + " 园区ID:" + regionModel.id + " 报警时间:" + alarmTime);
                            }
                        }
                        else
                        {
                            Log4NetHelp.Info("未找到对应事件,事件ID:" + alarmRecord.alarm_event);
                        }
                    }
                }
                else
                {
                    //log:未找到设备alarmRecord.alarm_code
                    Log4NetHelp.Info("未找到设备:" + alarmRecord.alarm_code);
                }
            }
            catch (Exception ex)
            {
                // Log4NetHelp.Error("业务层处理报警数据失败!" + ex.Message);
                Log4NetHelp.Error("业务层处理报警数据失败!" + ex.Message);
            }
        }
コード例 #22
0
ファイル: FilterBLL.cs プロジェクト: zpzpp/School.CSM
        /// <summary>
        /// 处理转发层数据
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public bool  HandleSystemData(InterfaceData info)
        {
            try
            {
                //  InterfaceData data = JsonHelper.StringToObject<InterfaceData>(info);
                switch (info.subSysType)
                {
                case (int)EnumClass.SubSystem.丛文报警子系统:
                    //TODO
                    CowinBLL cowinBll = new CowinBLL();
                    cowinBll.HandleCowinData(info.dataType, info.data, info.mark);
                    break;

                case (int)EnumClass.SubSystem.停车子系统:
                    //TODO
                    VehicleBLL vehicleBll = new VehicleBLL();
                    vehicleBll.HandleVehicleData(info.dataType, info.data, info.mark);
                    break;

                case (int)EnumClass.SubSystem.动力环境检测:
                    //TODO
                    PowerEnvironmentBLL pwEnvirBll = new PowerEnvironmentBLL();
                    pwEnvirBll.HandlePowerEnvironmentData(info.dataType, info.data, info.mark);
                    break;

                //case (int)EnumClass.SubSystem.北理巡更子系统:
                //    //TODO
                //    BITPatrolBLL bitPatrolBll = new BITPatrolBLL();
                //    bitPatrolBll.HandleBITPatrolData(info.dataType, info.data, info.mark);
                //    break;
                case (int)EnumClass.SubSystem.周界子系统:
                    //TODO
                    PerimeterBLL perimeterBll = new PerimeterBLL();
                    perimeterBll.HandlePerimeterData(info.dataType, info.data, info.mark);
                    break;

                case (int)EnumClass.SubSystem.巡更子系统:
                    //TODO
                    PatrolBLL patrolBll = new PatrolBLL();
                    patrolBll.HandlePatrolData(info.dataType, info.data, info.mark);
                    break;

                case (int)EnumClass.SubSystem.智能视频分析子系统:
                    //TODO
                    IntelligentBLL intelligentBll = new IntelligentBLL();
                    intelligentBll.HandleIntelligentData(info.dataType, info.data, info.mark);
                    break;

                case (int)EnumClass.SubSystem.消防子系统:
                    //TODO
                    FireBLL fireBll = new FireBLL();

                    fireBll.HandleFireData(info.dataType, info.data, info.mark);
                    break;

                case (int)EnumClass.SubSystem.视频子系统:
                    //TODO
                    VideoBLL videoBll = new VideoBLL();
                    videoBll.HandleVideoData(info.dataType, info.data, info.mark);
                    break;

                case (int)EnumClass.SubSystem.门禁子系统:
                    //TODO
                    EntranceBLL entranceBll = new EntranceBLL();
                    entranceBll.HandleEntranceData(info.dataType, info.data, info.mark);
                    break;

                case (int)EnumClass.SubSystem.尼韦尔报警子系统:
                    //TODO
                    HoneywellBLL honeywellBll = new HoneywellBLL();
                    honeywellBll.HandleHoneywellData(info.dataType, info.data, info.mark);
                    break;

                case (int)EnumClass.SubSystem.感器:
                    //TODO
                    SensorBLL sensorBll = new SensorBLL();
                    sensorBll.HandleSensorData(info.dataType, info.data, info.mark);
                    break;

                default:
                    //TODO
                    break;
                }
                return(true);
            }
            catch (Exception ex)
            {
                Log4NetHelp.Error("数据过滤处理失败!" + ex.Message);
                return(false);
            }
        }
コード例 #23
0
        /// <summary>
        /// 处理报警数据
        /// </summary>
        /// <param name="message">报警数据</param>
        /// <param name="mark">驱动标识</param>
        /// <param name="dataType">数据类型</param>
        /// <param name="subsystem">子系统类型</param>
        /// <returns></returns>
        protected virtual bool HandleAlarmData(object message, string mark, int dataType, int subsystem)
        {
            try
            {
                AlarmInfoModel alarmInfo = JsonHelper.StringToObject <AlarmInfoModel>(message.ToString());
                if (alarmInfo != null)
                {
                    ServAlarmRecordModel alarmRecord    = new ServAlarmRecordModel();
                    ServAlarmRecordDAL   alarmRecordDal = new ServAlarmRecordDAL();
                    InterfaceData        data           = new InterfaceData();
                    alarmRecord.alarm_cache_status = alarmInfo.alarm_cache_status;
                    alarmRecord.alarm_code         = alarmInfo.code;

                    #region  旧版
                    //if (string.IsNullOrEmpty(alarmInfo.alarm_event) || alarmInfo.alarm_event == "")
                    //{
                    //    alarmRecord.alarm_event = -1;
                    //}
                    //else
                    //{
                    //    alarmRecord.alarm_event = GetBaseEventType(alarmInfo.alarm_event);
                    //}

                    #endregion

                    #region  新版
                    alarmRecord.alarm_event = alarmInfo.alarm_event;
                    #endregion
                    alarmRecord.alarm_level        = alarmInfo.alarm_level;
                    alarmRecord.alarm_location     = alarmInfo.alarm_location;
                    alarmRecord.alarm_name         = alarmInfo.alarm_name;
                    alarmRecord.alarm_subsystem    = alarmInfo.alarm_subsystem;
                    alarmRecord.alarm_text         = alarmInfo.alarm_text;
                    alarmRecord.alarm_time         = alarmInfo.alarm_time.ToLocalTime();
                    alarmRecord.alarm_type         = alarmInfo.alarm_type;
                    alarmRecord.confirm_alarm_text = "";
                    alarmRecord.confirm_alarm_time = alarmInfo.alarm_time.ToLocalTime();//确警时间为报警时间(表示未确警)
                    alarmRecord.confirm_person_id  = -1;
                    alarmRecord.confirm_result     = -1;
                    alarmRecord.confirm_state      = (int)EnumClass.ConfirmAlarmState.未确警;
                    int id = alarmRecordDal.AddEntity(alarmRecord);
                    if (id > 0)
                    {
                        alarmRecord.id = id;
                        // string paramData = JsonHelper.ObjectToString(alarmRecord);
                        data.data       = alarmRecord;
                        data.dataType   = dataType;
                        data.mark       = mark;
                        data.subSysType = subsystem;
                        string jsonStr = JsonHelper.ObjectToString(data);
                        HttpHelper.PostJsonData(SubSystemRouteBLL.GetToLogicAlarmRoute(), jsonStr, Encoding.UTF8);
                        return(true);
                    }
                    else
                    {
                        //log:报警数据插入数据库失败+message+mark+dataType+subsystem

                        Log4NetHelp.Info("插入报警数据失败!" + "内容:" + message.ToString() + "驱动标识:" + mark + "数据类型:" + dataType + "子系统类型:" + subsystem);
                        return(false);
                    }
                }
                else
                {
                    Log4NetHelp.Info("数据体格式不正确" + message.ToString());
                    return(false);
                }
            }
            catch (Exception ex)
            {
                //log:处理报警数据失败+message+mark+dataType+subsystem+ex.message
                string msgStr = JsonHelper.ObjectToString(message);
                Log4NetHelp.Error("处理报警数据失败!" + "内容:" + msgStr + "驱动标识:" + mark + "数据类型:" + dataType + "子系统类型:" + subsystem + "错误信息:" + ex.Message);
                return(false);
            }
        }
コード例 #24
0
ファイル: BusinessLogicBLL.cs プロジェクト: zpzpp/School.CSM
        /// <summary>
        /// 查找事件预案并处理
        /// </summary>
        public void HandleEventPlanItem(int planRecordId, int eventId, BaseRegionConfigModel regionModel, List <ServPlanHandleItemModel> planHandleItemList, ServDeviceInfoModel deviceInfo, ServAlarmRecordModel alarmRecord, out List <ServDeviceInfoModel> camerasList, out string ledMessage)
        {
            try
            {
                PlanItemBLL planItemBll = new PlanItemBLL();
                //ServPlanHandleItemModel handleItemModel = planHandleItemList.FirstOrDefault(n => n.item_type == (int)EnumClass.EventPlanDefaultOptions.打开周围摄像头);
                //if (handleItemModel != null)
                //{
                //    HandleCamerasBLL camerasbll = new HandleCamerasBLL();
                //    camerasList = camerasbll.GetEventPlanCameras(deviceInfo.id, int.Parse(handleItemModel.ext2), int.Parse(handleItemModel.ext3), int.Parse(handleItemModel.ext4));
                //}
                //else
                //{
                //    camerasList = null;
                //}
                camerasList = null;
                LEDHandle ledHandle = new LEDHandle(deviceInfo, alarmRecord);
                ledMessage = ledHandle.GetAlarmText();
                //单独处理打开周围摄像头
                var cameraEventList = planHandleItemList.Where(n => n.item_type == (int)EnumClass.EventPlanDefaultOptions.打开周围摄像头);
                if (cameraEventList != null && cameraEventList.Count() > 0)
                {
                    AddEventHashTable((int)EnumClass.EventPlanDefaultOptions.打开周围摄像头, new { status = 0, planRecordId = planRecordId, model = cameraEventList.ToList() });
                }
                foreach (ServPlanHandleItemModel item in planHandleItemList)
                {
                    switch (item.item_type)
                    {
                    case (int)EnumClass.EventPlanDefaultOptions.中控室LED信息显示:
                        bool ledResult = ledHandle.HandleLedItem(ledMessage, regionModel.region_code);      //处理LED
                        planItemBll.AddItemRecord((int)EnumClass.PlanHandleTime.确警前, item.id, (int)EnumClass.PlanItemResult.成功, item.item_type, planRecordId, ledMessage);
                        AddHashTable(item.item_type, new { status = 1, info = "" });
                        break;

                    case (int)EnumClass.EventPlanDefaultOptions.告警视频下载:
                        //int handleDownloadRecordId = planItemBll.AddItemRecord((int)EnumClass.PlanHandleTime.确警前, item.id, item.item_type, planRecordId, "");
                        //if (handleDownloadRecordId > 0) //插入处置项记录成功,开始执行处置项
                        //{
                        //    VideoDownloadBLL videoDownloadBll = new VideoDownloadBLL();
                        //    bool bl = videoDownloadBll.VideoDownload(handleDownloadRecordId, eventId, alarmRecord.alarm_time.ToLocalTime(), camerasList);
                        //}
                        //AddHashTable(item.item_type, new { status = 1, info = "" });
                        AddHashTable(item.item_type, new { status = 0, itemid = item.id, itemType = item.item_type, planRecordId = planRecordId });
                        break;

                    //case (int)EnumClass.EventPlanDefaultOptions.打开周围摄像头:
                    //    AddEventHashTable(item.item_type, new { status = 0, itemid = item.id, itemType = item.item_type, planRecordId = planRecordId, model = item });
                    //    break;
                    case (int)EnumClass.EventPlanDefaultOptions.控制中心声光蜂鸣器开启:
                        HandleRelayBLL handleRelayBll = new HandleRelayBLL();
                        handleRelayBll.HandleRelay(item.ext1, regionModel.region_code);
                        planItemBll.AddItemRecord((int)EnumClass.PlanHandleTime.确警前, item.id, (int)EnumClass.PlanItemResult.成功, item.item_type, planRecordId, "");
                        //  ht.Add(item.item_type, new { status = 1, info = "" });//已执行
                        AddHashTable(item.item_type, new { status = 1, info = "" });
                        break;

                    case (int)EnumClass.EventPlanDefaultOptions.相关摄像头上大屏:
                        AddHashTable(item.item_type, new { status = 0, itemid = item.id, itemType = item.item_type, planRecordId = planRecordId, info = "" });
                        break;

                    case (int)EnumClass.EventPlanDefaultOptions.通知其他负责人:
                        PlanPersonBLL planPersonBll        = new PlanPersonBLL();
                        int           handlePersonRecordId = planItemBll.AddItemRecord((int)EnumClass.PlanHandleTime.确警前, item.id, (int)EnumClass.PlanItemResult.失败, item.item_type, planRecordId, "暂未设置短信平台");
                        if (handlePersonRecordId > 0)      //插入处置项记录成功,开始执行处置项
                        {
                            bool bl = planPersonBll.HandlePlanPerson(item.id, alarmRecord, handlePersonRecordId);
                        }
                        // ht.Add(item.item_type, new { status = 1, info = "" });
                        AddHashTable(item.item_type, new { status = 1, info = "" });
                        break;

                    case (int)EnumClass.EventPlanDefaultOptions.通知设备网格第一负责人:
                        int firstDutyRecordId = planItemBll.AddItemRecord((int)EnumClass.PlanHandleTime.确警前, item.id, (int)EnumClass.PlanItemResult.失败, item.item_type, planRecordId, "暂未设置短信平台");
                        AddHashTable(item.item_type, new { status = 1, info = "" });
                        break;

                    default: break;
                    }
                }
            }
            catch (Exception ex)
            {
                camerasList = null;
                ledMessage  = "";
                Log4NetHelp.Info("处理事件预案失败!预案执行记录ID:" + planRecordId + " " + ex.Message);
            }
        }
コード例 #25
0
ファイル: BusinessLogicBLL.cs プロジェクト: zpzpp/School.CSM
        /// <summary>
        /// 执行设备预案处置项
        /// </summary>
        /// <param name="itemList"></param>
        /// <returns></returns>
        public void HandleDevicePlanItem(int planRecordId, int eventId, BaseRegionConfigModel regionModel, List <ServPlanHandleItemModel> itemList, ServDeviceInfoModel deviceInfo, ServAlarmRecordModel alarmRecord, out List <ServDeviceInfoModel> camerasList, out string ledMessage)
        {
            try
            {
                PlanItemBLL             planItemBll     = new PlanItemBLL();
                ServPlanHandleItemModel handleItemModel = itemList.FirstOrDefault(n => n.item_type == (int)EnumClass.DevicePlanDefaultOptions.关联摄像头);
                if (handleItemModel != null)
                {
                    HandleCamerasBLL camerasbll = new HandleCamerasBLL();
                    camerasList = camerasbll.GetCameras(handleItemModel.id);
                }
                else
                {
                    camerasList = null;
                }
                LEDHandle ledHandle = new LEDHandle(deviceInfo, alarmRecord);
                ledMessage = ledHandle.GetAlarmText();

                foreach (ServPlanHandleItemModel item in itemList)
                {
                    switch (item.item_type)
                    {
                    case (int)EnumClass.DevicePlanDefaultOptions.中控室LED信息显示:
                        // string content = "";
                        // LEDHandle ledHandle = new LEDHandle(deviceInfo, alarmRecord);
                        bool ledResult = ledHandle.HandleLedItem(ledMessage, regionModel.region_code);      //处理LED
                        planItemBll.AddItemRecord((int)EnumClass.PlanHandleTime.确警前, item.id, (int)EnumClass.PlanItemResult.成功, item.item_type, planRecordId, ledMessage);
                        //if (!ht.ContainsKey(item.item_type))
                        //{
                        //    ht.Add(item.item_type, new { status = 1, info = "" });//已执行
                        //}
                        //else
                        //{
                        //    Log4NetHelp.Info("处置项重复:" + Enum.Parse(typeof(EnumClass.DevicePlanDefaultOptions), item.item_type.ToString()).ToString());
                        //}
                        AddHashTable(item.item_type, new { status = 1, info = "" });
                        break;

                    case (int)EnumClass.DevicePlanDefaultOptions.关联摄像头:

                        // ht.Add(item.item_type, new { status = 0, itemid = item.id, itemType = item.item_type, planRecordId = planRecordId });//未执行
                        AddHashTable(item.item_type, new { status = 0, itemid = item.id, itemType = item.item_type, planRecordId = planRecordId });
                        break;

                    case (int)EnumClass.DevicePlanDefaultOptions.告警视频下载:
                        int handleDownloadRecordId = planItemBll.AddItemRecord((int)EnumClass.PlanHandleTime.确警前, item.id, (int)EnumClass.PlanItemResult.成功, item.item_type, planRecordId, "");
                        if (handleDownloadRecordId > 0)     //插入处置项记录成功,开始执行处置项
                        {
                            VideoDownloadBLL videoDownloadBll = new VideoDownloadBLL();
                            bool             bl = videoDownloadBll.VideoDownload(handleDownloadRecordId, eventId, alarmRecord.alarm_time.ToLocalTime(), camerasList);
                        }
                        //  ht.Add(item.item_type, new { status = 1, info = "" });//已执行
                        AddHashTable(item.item_type, new { status = 1, info = "" });
                        break;

                    case (int)EnumClass.DevicePlanDefaultOptions.打开告警设备附近视频:
                        // ht.Add(item.item_type, new { status = 0, itemid = item.id, itemType = item.item_type, planRecordId = planRecordId, info = "" });//未执行
                        AddHashTable(item.item_type, new { status = 0, itemid = item.id, itemType = item.item_type, planRecordId = planRecordId, info = "" });
                        break;

                    case (int)EnumClass.DevicePlanDefaultOptions.控制中心声光蜂鸣器开启:
                        HandleRelayBLL handleRelayBll = new HandleRelayBLL();
                        handleRelayBll.HandleRelay(item.ext1, regionModel.region_code);
                        planItemBll.AddItemRecord((int)EnumClass.PlanHandleTime.确警前, item.id, (int)EnumClass.PlanItemResult.成功, item.item_type, planRecordId, "");
                        //  ht.Add(item.item_type, new { status = 1, info = "" });//已执行
                        AddHashTable(item.item_type, new { status = 1, info = "" });
                        break;

                    case (int)EnumClass.DevicePlanDefaultOptions.相关摄像头上大屏:
                        // ht.Add(item.item_type, new { status = 0, itemid = item.id, itemType = item.item_type, planRecordId = planRecordId, info = "" });//未执行
                        AddHashTable(item.item_type, new { status = 0, itemid = item.id, itemType = item.item_type, planRecordId = planRecordId, info = "" });
                        break;

                    case (int)EnumClass.DevicePlanDefaultOptions.通知其他负责人:
                        PlanPersonBLL planPersonBll        = new PlanPersonBLL();
                        int           handlePersonRecordId = planItemBll.AddItemRecord((int)EnumClass.PlanHandleTime.确警前, item.id, (int)EnumClass.PlanItemResult.失败, item.item_type, planRecordId, "暂未设置短信平台");
                        if (handlePersonRecordId > 0)      //插入处置项记录成功,开始执行处置项
                        {
                            bool bl = planPersonBll.HandlePlanPerson(item.id, alarmRecord, handlePersonRecordId);
                        }
                        // ht.Add(item.item_type, new { status = 1, info = "" });
                        AddHashTable(item.item_type, new { status = 1, info = "" });
                        break;

                    case (int)EnumClass.DevicePlanDefaultOptions.通知设备网格第一负责人:
                        //查找第一负责人,发送短信,记录短信记录与执行结果
                        // planItemBll.AddItemRecord((int)EnumClass.PlanHandleTime.确警前, item.id, item.item_type, planRecordId, "");
                        // ht.Add(item.item_type, new { status = 1, info = "" });
                        int dutyPersonRecordId = planItemBll.AddItemRecord((int)EnumClass.PlanHandleTime.确警前, item.id, (int)EnumClass.PlanItemResult.失败, item.item_type, planRecordId, "暂未设置短信平台");
                        AddHashTable(item.item_type, new { status = 1, info = "" });
                        break;

                    default: break;
                    }
                }
            }
            catch (Exception ex)
            {
                camerasList = null;
                ledMessage  = "";
                Log4NetHelp.Info("处理设备预案失败!报警记录ID:" + planRecordId + " " + ex.Message);
            }
            // return ht;
        }