Beispiel #1
0
        /// <summary>
        /// 创建SmokeDetector信息
        /// </summary>
        public static int InsertSmokeDetector(SmokeDetector entity)
        {
            var sysNo = SmokeDetectorDA.InsertSmokeDetector(entity);

            (new MapDataService(entity.CompanySysNo)).InitAsync();

            //更新首页缓存数据

            return(sysNo);
        }
Beispiel #2
0
        /// <summary>
        /// 设备详情
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static SmokeDetector LoadSmokeDetail(string code)
        {
            SmokeDetector info = SmokeDetectorDA.LoadSmokeDetail(code);

            //if(info.Status== SmokeDetectorStatus.Delete)
            //{
            //    info = null;
            //}
            return(info);
        }
        public static SmokeMap GetAddressMapSmokes(int companySysNo, int addressId)
        {
            var model = new SmokeMap();

            model.AddressNo   = addressId;
            model.AddressMaps = AddressMapDA.QueryAddressMapList(new AddressMapFilter {
                AddressSysNo = addressId, PageSize = 100000
            }).data;

            //标记点分两种 烟感器 和 下级地址
            model.Smokes  = new List <AddressMapMarker>();
            model.Markers = new List <AddressMapMarker>();
            var smokes = SmokeDetectorDA.GetSmokeDetectorByAddressSysNo(companySysNo, new List <int> {
                addressId
            });

            if (smokes != null)
            {
                smokes.ForEach(a =>
                {
                    model.Smokes.Add(new AddressMapMarker {
                        SysNo = a.SysNo, Name = string.IsNullOrEmpty(a.Position) ? a.Code : a.Position, Type = AddressMapMarkerType.SmokeDetector,
                    });
                });
            }

            var address = AddressDA.GetTopLevelChildren(addressId);

            if (address != null)
            {
                address.ForEach(a =>
                {
                    model.Smokes.Add(new AddressMapMarker {
                        SysNo = a.SysNo, Name = a.Name, Type = AddressMapMarkerType.Address,
                    });
                });
            }

            return(model);
        }
Beispiel #4
0
 /// <summary>
 /// 用户绑定烟感器列表
 /// </summary>
 /// <param name="clientSysNo"></param>
 /// <returns></returns>
 public static QueryResult <QR_SmokeDetector> LoadUserSmokeDeletetorList(QF_UserDetector filter)
 {
     return(SmokeDetectorDA.LoadUserSmokeDeletetorList(filter));
 }
Beispiel #5
0
 /// <summary>
 /// 加载烟感器的数量
 /// </summary>
 /// <param name="companySysNo"></param>
 /// <returns></returns>
 public static SmokeDetectorCount LoadSmokeDetectorCountInArea(int companySysNo, int?addressId = null)
 {
     return(SmokeDetectorDA.LoadSmokeDetectorCountInArea(companySysNo, addressId));
 }
Beispiel #6
0
 /// <summary>
 /// 加载客户烟感器在线&离线数量
 /// </summary>
 /// <param name="companySysNo"></param>
 /// <returns></returns>
 public static SmokeDetectorCount LoadSmokeDetectorCount(int companySysNo)
 {
     return(SmokeDetectorDA.LoadSmokeDetectorCount(companySysNo));
 }
Beispiel #7
0
 /// <summary>
 /// 查询客户烟感器设备列表
 /// </summary>
 /// <param name="filter"></param>
 /// <returns></returns>
 public static QueryResult <QR_SmokeDetector> QuerySmokeDetectorList(QF_SmokeDetector filter)
 {
     return(SmokeDetectorDA.QuerySmokeDetectorList(filter));
 }
Beispiel #8
0
 public static SmokeDetector LoadSmokeDetailByDeviceID(string deviceID)
 {
     return(SmokeDetectorDA.LoadSmokeDetailByDeviceID(deviceID));
 }
Beispiel #9
0
 /// <summary>
 /// 解绑设备
 /// </summary>
 /// <param name="code"></param>
 public static void DeleteClientSmokeDetectorBycode(string code)
 {
     SmokeDetectorDA.DeleteClientSmokeDetectorBycode(code);
 }
Beispiel #10
0
 public static SmokeDetector LoadSmokeDetectorByInstaller(int installerSysNo)
 {
     return(SmokeDetectorDA.LoadSmokeDetectorByInstaller(installerSysNo).FirstOrDefault());
 }
Beispiel #11
0
 public static List <MapDataSmokeDetector> GetMapDataSmokeDetector(int companySysNo)
 {
     return(SmokeDetectorDA.GetMapDataSmokeDetector(companySysNo));
 }
Beispiel #12
0
 public static QueryResult <SmokeDetectorMessage> QuerySmokeDetectorMessage(QF_SmokeDetectorMessage filter)
 {
     return(SmokeDetectorDA.QuerySmokeDetectorMessage(filter));
 }
Beispiel #13
0
        /// <summary>
        ///
        /// </summary>
        public static SmokeDetector IsUniquenessCode(string code)
        {
            SmokeDetector info = SmokeDetectorDA.LoadSmokeDetail(code);

            return(info);
        }
Beispiel #14
0
 public static void DeleteSmokeDetector(SmokeDetector smokeDetector, CurrentUser currentUser)
 {
     SmokeDetectorDA.DeleteSmokeDetector(smokeDetector.SysNo);
     DeleteSmokeCoordinate(smokeDetector, currentUser);
 }
Beispiel #15
0
 public static void UpdateSmokeDetector(SmokeDetector entity)
 {
     SmokeDetectorDA.UpdateSmokeDetector(entity);
 }
Beispiel #16
0
 /// <summary>
 /// 加载用户绑定的烟感器在线&离线数量
 /// </summary>
 /// <param name="companySysNo"></param>
 /// <returns></returns>
 public static SmokeDetectorCount LoadUserSmokeDetectorCount(int clientSysNo)
 {
     return(SmokeDetectorDA.LoadUserSmokeDetectorCount(clientSysNo));
 }
Beispiel #17
0
 /// <summary>
 /// 用户批量解绑
 /// </summary>
 /// <param name="codes"></param>
 /// <param name="clientSysNo"></param>
 public static void DeleteClientSmokeDetector(List <string> codes, int clientSysNo)
 {
     SmokeDetectorDA.DeleteClientSmokeDetector(codes, clientSysNo);
 }
Beispiel #18
0
 public static List <SmokeDetector> LoadSmokeDetectorsByInstaller(int installerSysNo)
 {
     return(SmokeDetectorDA.LoadSmokeDetectorByInstaller(installerSysNo));
 }
Beispiel #19
0
 public static int InsertClientSmokeDetector(ClientSmokeDetector entity)
 {
     return(SmokeDetectorDA.InsertClientSmokeDetector(entity));
 }
Beispiel #20
0
 public static List <SmokeDetector> LoadSmokeDetectorsByClientSysNo(int ClientSysNo)
 {
     return(SmokeDetectorDA.LoadSmokeDetectorsByClientSysNo(ClientSysNo));
 }
Beispiel #21
0
        public static List <HomeMapMarker> GetHomeMarkers(int addressMapSysNo, int compnaySysNo)
        {
            //报警状态:烟雾报警,测试报警,低电量报警
            var warnStatus = new List <SmokeDetectorStatus> {
                SmokeDetectorStatus.Warning, SmokeDetectorStatus.TestWarning, SmokeDetectorStatus.LowPower
            };

            var addressMap = AddressMapDA.LoadAddressMap(addressMapSysNo);

            if (addressMap == null)
            {
                throw new BusinessException("addressMap 不存在");
            }

            if (!string.IsNullOrWhiteSpace(addressMap.SmokeCoordinate))
            {
                var countAddressList = new List <SmokeDetectorCountAddress>();
                var addressWarnList  = new List <AddressWarn>();
                var smokeDetectors   = new List <SmokeDetector>();

                var markers       = JsonConvert.DeserializeObject <List <HomeMapMarker> >(addressMap.SmokeCoordinate);
                var addressMarker = markers.Where(a => a.Type == AddressMapMarkerType.Address);
                var smokeMarker   = markers.Where(a => a.Type == AddressMapMarkerType.SmokeDetector);

                if (addressMarker.Count() > 0)
                {
                    var addressSysNos = addressMarker.Select(a => a.SysNo).ToList();
                    countAddressList = SmokeDetectorDA.LoadSmokeDetectorCountInArea(compnaySysNo, addressSysNos);
                    addressWarnList  = SmokeDetectorDA.GetAddressWarnCount(addressSysNos);
                }

                if (smokeDetectors.Count() > 0)
                {
                    smokeDetectors = SmokeDetectorDA.LoadSmokeDetectors(smokeMarker.Select(a => a.SysNo).ToList());
                }

                markers.ForEach(marker => {
                    if (marker.Type == AddressMapMarkerType.Address)
                    {
                        var countAddress = countAddressList.FirstOrDefault(a => a.AddressSysNo == marker.SysNo);
                        if (countAddress != null)
                        {
                            marker.DeviceTotal   = countAddress.ALLSmokeCount;
                            marker.DeviceOnline  = countAddress.OnlineCount;
                            marker.DeviceOffline = countAddress.OfflineCount;
                        }

                        var addressWarn = addressWarnList.FirstOrDefault(a => a.AddressSysNo == marker.SysNo);
                        if (addressWarn != null && addressWarn.WarnCount > 0)
                        {
                            marker.IsWarning = true;
                        }
                    }
                    else if (marker.Type == AddressMapMarkerType.SmokeDetector)
                    {
                        var smokeDetector = smokeDetectors.FirstOrDefault(a => a.SysNo == marker.SysNo);
                        if (smokeDetector != null && smokeDetector.Status.HasValue && warnStatus.Contains(smokeDetector.Status.Value))
                        {
                            marker.IsWarning = true;
                        }
                    }
                });

                return(markers);
            }

            return(new List <HomeMapMarker>());
        }
Beispiel #22
0
 public static SmokeDetector LoadSmokeDetectorByDeviceID(string DeviceID)
 {
     return(SmokeDetectorDA.LoadSmokeDetectorByDeviceID(DeviceID));
 }