Example #1
0
        /// <summary>
        /// 查找预案处置项执行结果记录
        /// 先根据报警ID查找预案执行记录planRecordId,再通过planRecordId查找Serv_Plan_ItemResult
        /// </summary>
        /// <param name="alarmId"></param>
        /// <returns></returns>
        private PlanItemHandledInfo PlanItemResultList(ServAlarmRecordModel alarmRecord)
        {
            PlanItemHandledInfo handleInfoModel = new PlanItemHandledInfo();

            try
            {
                ServPlanRecordDAL           planRecordDal           = new ServPlanRecordDAL();
                ServPlanItemResultDAL       planItemResultDal       = new ServPlanItemResultDAL();
                ServPlanHandleItemDAL       planHandleItemDal       = new ServPlanHandleItemDAL();
                ServPlanHandleItemCameraDAL planHandleItemCameraDal = new ServPlanHandleItemCameraDAL();
                // ServAlarmRecordModel alarmRecord = _servAlarmRecordDal.GetEntity(alarmId);
                //查找预案执行记录
                ServPlanRecordModel planRecord = planRecordDal.GetEntityByAlarmId(alarmRecord.id);

                if (planRecord != null)
                {
                    //查找预案处置项记录
                    List <ServPlanItemResultModel> planItemRecordList = planItemResultDal.GetEntitiesByPlanRecordId(planRecord.id);
                    if (planItemRecordList != null)
                    {
                        handleInfoModel = TranPlanItemRecord(planRecord.plan_type, planItemRecordList, alarmRecord.alarm_event, alarmRecord.alarm_time);
                    }
                    else
                    {
                        //log 根据预案执行记录ID未找到预案处置项记录
                    }

                    //查找关联摄像头信息(事件预案无关联摄像头)
                    //if (planRecord.plan_type == (int)EnumClass.PlanType.事件预案)
                    //{
                    //    ServPlanHandleItemModel planHandleItemModel = planHandleItemDal.GetPlanHandleItemByTypeAndId(planRecord.plan_id, planRecord.plan_type, (int)EnumClass.EventPlanDefaultOptions.关联摄像头);
                    //    if (planHandleItemModel != null)
                    //    {
                    //        handleInfoModel.cameraList = planHandleItemCameraDal.GetHandledCameras(planHandleItemModel.id);
                    //    }
                    //}
                    if (planRecord.plan_type == (int)EnumClass.PlanType.设备预案)
                    {
                        ServPlanHandleItemModel planHandleItemModel = planHandleItemDal.GetPlanHandleItemByTypeAndId(planRecord.plan_id, planRecord.plan_type, (int)EnumClass.DevicePlanDefaultOptions.关联摄像头);
                        if (planHandleItemModel != null)
                        {
                            handleInfoModel.cameraList = planHandleItemCameraDal.GetHandledCameras(planHandleItemModel.id);
                        }
                    }
                }
                else
                {
                    //log 根据alarmId查找预案执行记录为null
                }
                handleInfoModel.alarmRecord = alarmRecord;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(handleInfoModel);
        }
Example #2
0
 /// <summary>
 /// 通过报警ID查找预案执行记录
 /// </summary>
 /// <param name="alarmId"></param>
 /// <returns></returns>
 public ServPlanRecordModel GetEntityByAlarmId(int alarmId)
 {
     try
     {
         ServPlanRecordModel record = mapContext.QueryForObject <ServPlanRecordModel>("QueryPlanRecordByAlarmId", alarmId);
         return(record);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #3
0
        /// <summary>
        /// 将报警记录转入卷宗
        /// </summary>
        /// <param name="alarmId"></param>
        private void GotoArchive(int alarmId, int ssoId, ServAlarmRecordModel alarmRecord, int handleItemId, int itemType)
        {
            try
            {
                ServVideoInfoDAL          videoDal          = new ServVideoInfoDAL();
                ServPlanRecordDAL         planRecordDal     = new ServPlanRecordDAL();
                ServArchiveInfoBLL        archiveInfoBll    = new ServArchiveInfoBLL();
                ServPlanItemResultDAL     planItemResultDal = new ServPlanItemResultDAL();
                List <ServVideoInfoModel> videoList         = videoDal.GetVideoInfoByAlarmId(alarmId);//获取下载的视频
                List <ServFileInfoModel>  fileInfoList      = new List <ServFileInfoModel>();
                ServFileInfoModel         fileInfo          = null;
                for (int i = 0; i < videoList.Count; i++)
                {
                    fileInfo               = new ServFileInfoModel();
                    fileInfo.content       = "确警后转入";
                    fileInfo.create_time   = DateTime.Now;
                    fileInfo.file_address  = videoList[i].video_path;
                    fileInfo.file_ext_name = Path.GetExtension(videoList[i].video_path);
                    fileInfo.file_name     = videoList[i].video_name;
                    fileInfo.file_type     = (int)EnumClass.FileType.视频;
                    fileInfo.person_id     = ssoId;
                    fileInfoList.Add(fileInfo);
                }


                bool bl = archiveInfoBll.AddservArchiveInfo(alarmRecord.alarm_name, 7, ssoId, alarmRecord.alarm_code, "", alarmRecord.id.ToString(), fileInfoList, (int)EnumClass.ArchiveStatus.新建);
                //插入数据库
                ServPlanRecordModel     planRecord = planRecordDal.GetEntityByAlarmId(alarmId);
                ServPlanItemResultModel result     = new ServPlanItemResultModel();
                result.confirm_type   = (int)EnumClass.PlanHandleTime.确警后;
                result.content        = "";
                result.execute_time   = DateTime.Now;
                result.handleitem_id  = handleItemId;
                result.item_result    = bl == true ? (int)EnumClass.PlanItemResult.成功 : (int)EnumClass.PlanItemResult.失败;
                result.item_type      = itemType;
                result.plan_record_id = planRecord == null ? -1 : planRecord.id;
                planItemResultDal.AddEntity(result);  //插入处置项处理记录
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #4
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);
            }
        }
Example #5
0
 /// <summary>
 /// 增加预案处置项记录
 /// </summary>
 /// <param name="planRecordId"></param>
 /// <param name="itemType"></param>
 /// <param name="itemResult"></param>
 /// <param name="exeTime"></param>
 /// <param name="content"></param>
 /// <param name="confirmType"></param>
 /// <param name="handleItemId"></param>
 private void AddPlanItemRecord(ServPlanRecordModel planRecord, int itemType, int itemResult, DateTime exeTime, string content, int confirmType, int handleItemId)
 {
     try
     {
         ServPlanItemResultDAL   planItemResultDal = new ServPlanItemResultDAL();
         ServPlanItemResultModel result            = new ServPlanItemResultModel();
         result.confirm_type   = confirmType;
         result.content        = content;
         result.execute_time   = exeTime;
         result.handleitem_id  = handleItemId;
         result.item_result    = itemResult;
         result.item_type      = itemType;
         result.plan_record_id = planRecord == null ? -1 : planRecord.id;
         planItemResultDal.AddEntity(result);  //插入处置项处理记录
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #6
0
        /// <summary>
        /// 确警
        /// </summary>
        /// <param name="alarmId"></param>
        /// <param name="ssoid"></param>
        /// <param name="confirmResult"></param>
        /// <param name="location"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        public bool ConfirmAlarm(int alarmId, int ssoid, int confirmResult, string location, string content)
        {
            try
            {
                ServAlarmRecordModel alarmRecord = _servAlarmRecordDal.GetEntity(alarmId);
                ServPlanRecordModel  planRecord  = _servPlanRecordDal.GetEntityByAlarmId(alarmId);
                if (alarmRecord != null)
                {
                    alarmRecord.alarm_location     = location;
                    alarmRecord.confirm_alarm_text = content;
                    alarmRecord.confirm_alarm_time = DateTime.Now;
                    alarmRecord.confirm_person_id  = ssoid;
                    if (confirmResult == (int)EnumClass.ConfirmAlarmResult.真警执行预案)
                    {
                        //执行确警后预案处置项
                        //ServAlarmRecordModel model = _servAlarmRecordDal.GetEntity(alarmId);
                        //string deviceCode = model.alarm_code;
                        //DateTime alarmTime = model.alarm_time;
                        //查找预案(获取确警后的处置项)

                        #region  确警后操作
                        HandleConfirmAlarm(alarmId, ssoid, alarmRecord, planRecord);
                        #endregion
                    }
                    alarmRecord.confirm_result = confirmResult;
                    alarmRecord.confirm_state  = (int)EnumClass.ConfirmAlarmState.确警;
                    return(_servAlarmRecordDal.UpdateAlarmRecordById(alarmRecord));
                }
                else
                {
                    //log未找到报警记录,确警失败!+"alarmId"=alarmId+"ssoid"=ssoid
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #7
0
 public bool UpdateEntity(int id, ServPlanRecordModel newentity)
 {
     throw new NotImplementedException();
 }
Example #8
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="model"></param>
        public int UpdatePlanRecordById(ServPlanRecordModel model)
        {
            int result = mapContext.Update("UpdatePlanRecordById", model);

            return(result);
        }
Example #9
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        /// <param name="entity"></param>
        public int AddEntity(ServPlanRecordModel entity)
        {
            int id = (int)mapContext.Insert("InsertPlanRecord", entity);

            return(id);
        }
Example #10
0
        /// <summary>
        /// 处理确警后预案处置项
        /// </summary>
        /// <param name="alarmId"></param>
        public void HandleConfirmAlarm(int alarmId, int ssoId, ServAlarmRecordModel alarmRecord, ServPlanRecordModel planRecord)
        {
            try
            {
                ServPlanHandleItemDAL          planHandleDal = new ServPlanHandleItemDAL();
                List <ServPlanHandleItemModel> handleList    = planHandleDal.GetConfirmPlanHandleItemByAlarmId(alarmId);//根据报警ID获取确警后处置项
                if (handleList != null)
                {
                    for (int i = 0; i < handleList.Count; i++)
                    {
                        switch (handleList[i].plan_type)
                        {
                        case (int)EnumClass.PlanType.设备预案:
                            switch (handleList[i].item_type)
                            {
                            case (int)EnumClass.DevicePlanConfirmOptions.启动户外LED信息提示系统:
                                AddPlanItemRecord(planRecord, handleList[i].item_type, (int)EnumClass.PlanItemResult.失败, DateTime.Now, "暂无设备", handleList[i].confirm_type, handleList[i].id);
                                break;

                            case (int)EnumClass.DevicePlanConfirmOptions.是否转到卷宗:
                                GotoArchive(alarmId, ssoId, alarmRecord, handleList[i].id, handleList[i].item_type);
                                break;

                            case (int)EnumClass.DevicePlanConfirmOptions.通知其他负责人:
                                AddPlanItemRecord(planRecord, handleList[i].item_type, (int)EnumClass.PlanItemResult.失败, DateTime.Now, "暂无设备", handleList[i].confirm_type, handleList[i].id);
                                break;

                            case (int)EnumClass.DevicePlanConfirmOptions.通知设备网格第一负责人:
                                AddPlanItemRecord(planRecord, handleList[i].item_type, (int)EnumClass.PlanItemResult.失败, DateTime.Now, "暂无设备", handleList[i].confirm_type, handleList[i].id);
                                break;

                            default: break;
                            }
                            break;

                        case (int)EnumClass.PlanType.事件预案:
                            switch (handleList[i].item_type)
                            {
                            case (int)EnumClass.EventPlanConfirmOptions.启动户外LED信息提示系统:
                                AddPlanItemRecord(planRecord, handleList[i].item_type, (int)EnumClass.PlanItemResult.失败, DateTime.Now, "暂无设备", handleList[i].confirm_type, handleList[i].id);
                                break;

                            case (int)EnumClass.EventPlanConfirmOptions.是否转到卷宗:
                                GotoArchive(alarmId, ssoId, alarmRecord, handleList[i].id, handleList[i].item_type);
                                break;

                            case (int)EnumClass.EventPlanConfirmOptions.通知其他负责人:
                                AddPlanItemRecord(planRecord, handleList[i].item_type, (int)EnumClass.PlanItemResult.失败, DateTime.Now, "暂无设备", handleList[i].confirm_type, handleList[i].id);
                                break;

                            case (int)EnumClass.EventPlanConfirmOptions.通知设备网格第一负责人:
                                AddPlanItemRecord(planRecord, handleList[i].item_type, (int)EnumClass.PlanItemResult.失败, DateTime.Now, "暂无设备", handleList[i].confirm_type, handleList[i].id);
                                break;

                            default: break;
                            }
                            break;

                        default: break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }