/// <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> /// 根据预案类型,预案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); } }
/// <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; } }