예제 #1
0
 /// <summary>
 /// 设备修改
 /// </summary>
 /// <param name="deviceID">设备id</param>
 /// <param name="device_name">设备名称</param>
 /// <param name="device_code">设备编码</param>
 /// <param name="device_type">设备类型</param>
 /// <param name="subsystem_id">子系统</param>
 /// <param name="device_status">设备状态</param>
 /// <param name="cover_range">覆盖角度</param>
 /// <param name="camera_towards">设备朝向</param>
 /// <param name="visual_range">覆盖角度</param>
 /// <param name="is_inbuilding">是否楼内</param>
 /// <param name="lonLat">2D坐标</param>
 /// <param name="lonLat25D">25D坐标</param>
 /// <param name="isParts">是否复合设备</param>
 /// <param name="regionID">园区id</param>
 /// <param name="jishihuifang">及时回放</param>
 /// <param name="duolubofang">多路播放</param>
 /// <param name="shangdaqiang">上大墙</param>
 /// <param name="lishihuifang">历史回放</param>
 /// <param name="deviceTempID">设备临时表id</param>
 /// <param name="industryId">行业id</param>
 /// <returns></returns>
 public JsonResult UpdateDevice2D(int deviceID, string device_name, string device_code, int device_type, int subsystem_id, int device_status, int cover_range, int camera_towards, int visual_range, int is_inbuilding, string lonLat, string lonLat25D, int isParts, int regionID, string jishihuifang, string duolubofang, string shangdaqiang, string lishihuifang, int industryId)
 {
     try
     {
         ServDeviceInfoQuery deviceInfo = new ServDeviceInfoQuery();
         deviceInfo.id              = deviceID;
         deviceInfo.device_code     = device_code;
         deviceInfo.is_parts        = isParts;
         deviceInfo.device_name     = device_name;
         deviceInfo.device_type     = device_type;
         deviceInfo.subsystem_id    = subsystem_id;
         deviceInfo.longitude       = lonLat.Split(',')[1];
         deviceInfo.latitude        = lonLat.Split(',')[0];
         deviceInfo.local_longitude = lonLat25D.Split(',')[1];
         deviceInfo.local_latitude  = lonLat25D.Split(',')[0];
         if (deviceInfo.local_latitude == "" || deviceInfo.local_longitude == "" || deviceInfo.local_latitude == "null" || deviceInfo.local_longitude == "null" || deviceInfo.local_latitude == "undefined" || deviceInfo.local_longitude == "undefined")
         {
             deviceInfo.local_latitude  = null;
             deviceInfo.local_longitude = null;
         }
         deviceInfo.search_code        = "";
         deviceInfo.device_status      = device_status;
         deviceInfo.update_status_time = "";
         deviceInfo.cover_range        = cover_range;
         deviceInfo.camera_towards     = camera_towards;
         deviceInfo.visual_range       = visual_range;
         deviceInfo.asset_code         = "";
         deviceInfo.org_id             = 0;
         deviceInfo.manufactor         = "";
         deviceInfo.asset_model        = "";
         deviceInfo.create_time        = "";
         deviceInfo.guarantee_time     = "";
         deviceInfo.asset_status       = 0;
         deviceInfo.asset_ip           = "";
         deviceInfo.port          = "";
         deviceInfo.mac_code      = "";
         deviceInfo.serial_number = "";
         deviceInfo.manager_id    = 0;
         deviceInfo.is_inbuilding = is_inbuilding;
         deviceInfo.room_id       = 0;
         deviceInfo.region_id     = regionID;
         deviceInfo.area_id       = 0;
         deviceInfo.ext1          = jishihuifang;
         deviceInfo.ext2          = duolubofang;
         deviceInfo.ext3          = shangdaqiang;
         deviceInfo.ext4          = lishihuifang;
         //根据设备类型查询设备图标地址
         ServDefinedDeviceModel definedDevice = mapRegisterBLL.GetDeviceIcon(industryId, device_type);
         string path   = definedDevice == null ? "" : definedDevice.normal_image;
         bool   result = mapRegisterBLL.UpdateDeviceInfo2D(deviceInfo);
         return(Json(new { result = result, iconPath = path }));
     }
     catch (Exception ex)
     {
         return(Json(new { state = 1, message = ex.Message }));
     }
 }
예제 #2
0
 /// <summary>
 /// 修改设备
 /// </summary>
 /// <param name="deviceInfo"></param>
 /// <returns></returns>
 public bool UpdateDeviceInfo2D(ServDeviceInfoQuery deviceInfo)
 {
     try
     {
         bool result = false;
         int  num    = servDeviceInfoDAL.UpdateDeviceInfo2D(deviceInfo);
         result = true;
         return(result);
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #3
0
 /// <summary>
 /// 2D设备注册
 /// </summary>
 /// <returns></returns>
 public ServDeviceInfoModel AddDevice2D(ServDeviceInfoQuery deviceInfo, int deviceTempID)
 {
     try
     {
         if (deviceInfo.device_code == "")//其他设备(非摄像头)
         {
             //提取中文首字母
             ConvertChinese chinese = new ConvertChinese();
             string         codes   = chinese.GetHeadOfChs(Enum.GetName(typeof(BaseDeviceType), deviceInfo.device_type));
             //根据基础设备类型取出设备表中该类型所有的设备计算设备code
             List <ServDeviceInfoModel> servDeviceList = servDeviceInfoDAL.GetDeviceInfoLikeCode(codes);
             string lastDeviceCode = "";
             if (servDeviceList.Count > 0)
             {
                 for (int i = servDeviceList.Count - 1; i >= 0; i--)//取出最后一条设备数据
                 {
                     if (servDeviceList[i].device_code.Substring(0, codes.Length) == codes)
                     {
                         lastDeviceCode = servDeviceList[i].device_code;
                         break;
                     }
                 }
                 if (lastDeviceCode.IndexOf(codes) >= 0)
                 {
                     int codeID = Convert.ToInt32(lastDeviceCode.Substring(codes.Length, lastDeviceCode.Length - codes.Length));
                     deviceInfo.device_code = codes + (codeID + 1);
                 }
             }
             else
             {
                 deviceInfo.device_code = codes + 1;
             }
         }
         int id = servDeviceInfoDAL.AddEntity(deviceInfo);
         if (id != 0)
         {
             //删除设备临时表数据
             int num = servTempDeviceDAL.DeleteTempDeviceById(deviceTempID);
         }
         ServDeviceInfoModel model = new ServDeviceInfoModel();
         model.id          = id;
         model.device_code = deviceInfo.device_code;
         return(model);
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #4
0
 /// <summary>
 /// 获取设备列表
 /// </summary>
 /// <param name="deviceName">设备名称</param>
 /// <param name="deviceCode">设备编码</param>
 /// <param name="pageIndex"></param>
 /// <param name="pageSize"></param>
 /// <param name="total"></param>
 /// <returns></returns>
 public List <ServDeviceInfoModel> GetDeviceInfoList(string deviceName, string deviceCode, int regionId, int deviceType, int pageIndex, int pageSize, out int total)
 {
     try
     {
         ServDeviceInfoQuery query = new ServDeviceInfoQuery();
         query.pageIndex   = pageIndex;
         query.pageSize    = pageSize;
         query.device_name = deviceName;
         query.device_code = deviceCode;
         query.region_id   = regionId;
         query.device_type = deviceType;
         List <ServDeviceInfoModel> deviceList = servDeviceInfoDAL.GetEntities(query, out total);
         return(deviceList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #5
0
 /// <summary>
 /// 设备注册2D
 /// </summary>
 /// <param name="device_name">设备名称</param>
 /// <param name="device_code">设备编码</param>
 /// <param name="device_type">设备类型</param>
 /// <param name="subsystem_id">子系统</param>
 /// <param name="device_status">设备状态</param>
 /// <param name="cover_range">覆盖角度</param>
 /// <param name="camera_towards">设备朝向</param>
 /// <param name="visual_range">覆盖角度</param>
 /// <param name="is_inbuilding">是否楼内</param>
 /// <param name="lonLat">坐标</param>
 /// <param name="isParts">是否复合设备</param>
 /// <param name="regionID">园区id</param>
 /// <param name="jishihuifang">及时回放</param>
 /// <param name="duolubofang">多路播放</param>
 /// <param name="shangdaqiang">上大墙</param>
 /// <param name="lishihuifang">历史回放</param>
 /// <param name="deviceTempID">设备临时表id</param>
 /// <param name="industryId">行业id</param>
 /// <returns></returns>
 public JsonResult AddDevice2D(string device_name, string device_code, int device_type, int subsystem_id, int device_status, int cover_range, int camera_towards, int visual_range, int is_inbuilding, string lonLat, int isParts, int regionID, string jishihuifang, string duolubofang, string shangdaqiang, string lishihuifang, int deviceTempID, int industryId)
 {
     try
     {
         ServDeviceInfoQuery deviceInfo = new ServDeviceInfoQuery();
         if (device_code != "")
         {
             //验证设备code是否已经存在
             ServDeviceInfoModel deviceInfoModel = mapRegisterBLL.GetDeviceInfoByDeviceCode(device_code);
             if (deviceInfoModel != null)
             {
                 return(Json(new { state = 2, message = "该设备code已存在" }));
             }
             deviceInfo.device_code = device_code;
         }
         else
         {
             deviceInfo.device_code = device_code;
         }
         deviceInfo.is_parts           = isParts;
         deviceInfo.device_name        = device_name;
         deviceInfo.device_type        = device_type;
         deviceInfo.subsystem_id       = subsystem_id;
         deviceInfo.longitude          = lonLat.Split(',')[1];
         deviceInfo.latitude           = lonLat.Split(',')[0];
         deviceInfo.register_time      = DateTime.Now.ToString();
         deviceInfo.search_code        = "";
         deviceInfo.local_longitude    = null;
         deviceInfo.local_latitude     = null;
         deviceInfo.device_status      = device_status;
         deviceInfo.update_status_time = "";
         deviceInfo.cover_range        = cover_range;
         deviceInfo.camera_towards     = camera_towards;
         deviceInfo.visual_range       = visual_range;
         deviceInfo.asset_code         = "";
         deviceInfo.org_id             = 0;
         deviceInfo.manufactor         = "";
         deviceInfo.asset_model        = "";
         deviceInfo.create_time        = "";
         deviceInfo.guarantee_time     = "";
         deviceInfo.asset_status       = 0;
         deviceInfo.asset_ip           = "";
         deviceInfo.port          = "";
         deviceInfo.mac_code      = "";
         deviceInfo.serial_number = "";
         deviceInfo.manager_id    = 0;
         deviceInfo.is_inbuilding = is_inbuilding;
         deviceInfo.room_id       = 0;
         deviceInfo.region_id     = regionID;
         deviceInfo.area_id       = 0;
         deviceInfo.ext1          = jishihuifang;
         deviceInfo.ext2          = duolubofang;
         deviceInfo.ext3          = shangdaqiang;
         deviceInfo.ext4          = lishihuifang;
         //根据设备类型查询设备图标地址
         ServDefinedDeviceModel definedDevice = mapRegisterBLL.GetDeviceIcon(industryId, device_type);
         string path = definedDevice == null ? "" : definedDevice.normal_image;
         ServDeviceInfoModel model = mapRegisterBLL.AddDevice2D(deviceInfo, deviceTempID);
         return(Json(new { id = model.id, device_code = model.device_code, iconPath = path }));
     }
     catch (Exception ex)
     {
         return(Json(new { state = 1, message = ex.Message }));
     }
 }
예제 #6
0
        /// <summary>
        /// 获取设备分组树,设备列表页面
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <param name="pageType">页面标识(设备列表:0;视频监控页面:1)</param>
        /// <returns></returns>
        public List <DeviceGroupTreeCustom> GetDeviceGroupTree(ServDeviceGroupInfoQuery query, int industryId, int pageType)
        {
            try
            {
                //分组树结构集合
                List <DeviceGroupTreeCustom> deviceGroupTreeList = new List <DeviceGroupTreeCustom>();
                //获取所有的分组
                List <ServDeviceGroupInfoModel> deviceGroupList = servDeviceGroupInfoDAL.GetDeviceGroupInfo(query);
                //获取行业下该园区的所有的设备
                ServDeviceInfoQuery deviceQuery = new ServDeviceInfoQuery();
                deviceQuery.area_id   = industryId;      //行业id
                deviceQuery.region_id = query.region_id; //园区id
                List <ServDeviceInfoModel> deviceInfoList = servDeviceInfoDAL.GetAllDeviceInfoByIndustry(deviceQuery);
                if (pageType == 1)                       //视频监控页面只取摄像头
                {
                    deviceInfoList = deviceInfoList.Where(n => n.device_type < 5).ToList();
                }
                DeviceGroupTreeCustom deviceGroupTree;
                for (int i = 0; i < deviceGroupList.Count; i++)
                {
                    deviceGroupTree             = new DeviceGroupTreeCustom();
                    deviceGroupTree.id          = deviceGroupList[i].id;
                    deviceGroupTree.name        = deviceGroupList[i].group_name;
                    deviceGroupTree.sid         = deviceGroupList[i].id;
                    deviceGroupTree.pid         = deviceGroupList[i].pid;
                    deviceGroupTree.device_code = "";
                    deviceGroupTree.iconOpen    = "../images/groupIcon/文件夹开.png";
                    deviceGroupTree.iconClose   = "../images/groupIcon/文件夹闭.png";
                    //根据设备分组id获取分组和设备的绑定
                    List <ServDeviceRelateModel> relateList = servDeviceRelateDAL.GetDeviceRelateByGroupId(deviceGroupList[i].id);
                    if (pageType == 1)                                                            //视频监控页面
                    {
                        List <ServDeviceInfoModel> deviceList = new List <ServDeviceInfoModel>(); //如果分组下没有设备则不添加分组
                        for (int j = 0; j < relateList.Count; j++)
                        {
                            ServDeviceInfoModel deviceModel = deviceInfoList.Where(n => n.id == relateList[j].device_id).FirstOrDefault();
                            if (deviceModel != null)
                            {
                                deviceList.Add(deviceModel);
                            }
                        }
                        if (deviceList.Count != 0)
                        {
                            deviceGroupTreeList.Add(deviceGroupTree);
                        }
                    }
                    else//设备列表页面
                    {
                        deviceGroupTreeList.Add(deviceGroupTree);
                    }

                    for (int j = 0; j < relateList.Count; j++)
                    {
                        ServDeviceInfoModel deviceModel = deviceInfoList.Where(n => n.id == relateList[j].device_id).FirstOrDefault();
                        if (deviceModel != null)
                        {
                            deviceGroupTree             = new DeviceGroupTreeCustom();
                            deviceGroupTree.id          = deviceModel.id;
                            deviceGroupTree.name        = deviceModel.device_name;
                            deviceGroupTree.sid         = 0;
                            deviceGroupTree.pid         = deviceGroupList[i].id;
                            deviceGroupTree.device_code = deviceModel.device_code;
                            deviceGroupTree.rank        = relateList[j].rank;
                            switch (deviceModel.device_type)
                            {
                            case 1:
                            case 2:
                            case 3:
                            case 4:
                                deviceGroupTree.icon = "../images/groupIcon/摄像头.png";
                                break;

                            case 5:
                            case 6:
                                deviceGroupTree.icon = "../images/groupIcon/门禁.png";
                                break;

                            case 7:
                            case 9:
                            case 14:
                                deviceGroupTree.icon = "../images/groupIcon/手报.png";
                                break;

                            case 8:
                            case 12:
                                deviceGroupTree.icon = "../images/groupIcon/卡口.png";
                                break;

                            case 10:
                            case 11:
                                deviceGroupTree.icon = "../images/groupIcon/消防栓.png";
                                break;

                            case 13:
                                deviceGroupTree.icon = "../images/groupIcon/水表.png";
                                break;

                            case 15:
                            case 19:
                                deviceGroupTree.icon = "../images/groupIcon/巡更点.png";
                                break;

                            case 16:
                                deviceGroupTree.icon = "../images/groupIcon/烟感.png";
                                break;

                            case 17:
                                deviceGroupTree.icon = "../images/groupIcon/广播.png";
                                break;

                            case 18:
                                deviceGroupTree.icon = "../images/groupIcon/红外对射探测器.png";
                                break;
                            }
                            deviceGroupTreeList.Add(deviceGroupTree);
                            deviceInfoList.Remove(deviceModel);
                        }
                    }
                }

                //将剩余未分组的设备加入树结构
                for (int i = 0; i < deviceInfoList.Count; i++)
                {
                    deviceGroupTree             = new DeviceGroupTreeCustom();
                    deviceGroupTree.id          = deviceInfoList[i].id;
                    deviceGroupTree.name        = deviceInfoList[i].device_name;
                    deviceGroupTree.device_code = deviceInfoList[i].device_code;
                    deviceGroupTree.sid         = -2;
                    deviceGroupTree.pid         = 0;
                    switch (deviceInfoList[i].device_type)
                    {
                    case 1:
                    case 2:
                    case 3:
                    case 4:
                        deviceGroupTree.icon = "../images/groupIcon/摄像头.png";
                        break;

                    case 5:
                    case 6:
                        deviceGroupTree.icon = "../images/groupIcon/门禁.png";
                        break;

                    case 7:
                    case 9:
                    case 14:
                        deviceGroupTree.icon = "../images/groupIcon/手报.png";
                        break;

                    case 8:
                    case 12:
                        deviceGroupTree.icon = "../images/groupIcon/卡口.png";
                        break;

                    case 10:
                    case 11:
                        deviceGroupTree.icon = "../images/groupIcon/消防栓.png";
                        break;

                    case 13:
                        deviceGroupTree.icon = "../images/groupIcon/水表.png";
                        break;

                    case 15:
                    case 19:
                        deviceGroupTree.icon = "../images/groupIcon/巡更点.png";
                        break;

                    case 16:
                        deviceGroupTree.icon = "../images/groupIcon/烟感.png";
                        break;

                    case 17:
                        deviceGroupTree.icon = "../images/groupIcon/广播.png";
                        break;

                    case 18:
                        deviceGroupTree.icon = "../images/groupIcon/红外对射探测器.png";
                        break;
                    }
                    deviceGroupTreeList.Add(deviceGroupTree);
                }

                //加入一个未分组的树结构
                deviceGroupTree             = new DeviceGroupTreeCustom();
                deviceGroupTree.id          = 0;
                deviceGroupTree.name        = "未分组设备";
                deviceGroupTree.device_code = "";
                deviceGroupTree.sid         = 0;
                deviceGroupTree.pid         = -1;
                deviceGroupTree.iconOpen    = "../images/groupIcon/文件夹开.png";
                deviceGroupTree.iconClose   = "../images/groupIcon/文件夹闭.png";
                deviceGroupTreeList.Add(deviceGroupTree);
                return(deviceGroupTreeList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }