/// <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); }
/// <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; } }
/// <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; } }
/// <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); } }