Exemple #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);
        }