/// <summary>
        /// 删除网络模块
        /// </summary>
        /// <param name="NetworkModuleRequest"></param>
        /// <returns></returns>
        public BasicResponse DeleteNetworkModule(NetworkModuleDeleteByMacRequest NetworkModuleRequest)
        {
            BasicResponse Result = new BasicResponse();

            //重复判断
            NetworkModuleCacheGetByKeyRequest networkModuleCacheRequest = new NetworkModuleCacheGetByKeyRequest();

            networkModuleCacheRequest.Mac = NetworkModuleRequest.Mac;
            var        result  = _NetworkModuleCacheService.GetNetworkModuleCacheByKey(networkModuleCacheRequest);
            Jc_MacInfo OldItem = result.Data;

            if (result.Data == null)
            {
                //缓存中存在此测点
                Result.Code    = 1;
                Result.Message = "当前删除的网络模块不存在!";
                return(Result);
            }

            OldItem.InfoState = InfoState.Delete;

            //保存数据库
            if (!OldItem.IsMemoryData)
            {
                //向网关同步数据
                List <Jc_MacInfo> SendItemList = new List <Jc_MacInfo>();
                SendItemList.Add(OldItem);
                var resultSync = SynchronousDataToGateway(SendItemList);
                if (!resultSync)
                {
                    Result.Code    = 1;
                    Result.Message = "向网关同步数据失败!";
                    return(Result);
                }

                _Repository.DeleteNetworkModule(OldItem.ID);
            }

            //更新缓存
            NetworkModuleCacheDeleteRequest DeleteNetworkModuleCacheRequest = new NetworkModuleCacheDeleteRequest();

            DeleteNetworkModuleCacheRequest.NetworkModuleInfo = OldItem;
            _NetworkModuleCacheService.DeleteNetworkModuleCache(DeleteNetworkModuleCacheRequest);

            return(Result);
        }
        /// <summary>
        /// 网络模块保存巡检
        /// </summary>
        /// <returns></returns>
        public BasicResponse NetworkModuleSaveData()
        {
            BasicResponse Result = new BasicResponse();

            NetworkModuleCacheGetAllRequest networkModuleCacheRequest = new NetworkModuleCacheGetAllRequest();
            var resultAllNetwork = _NetworkModuleCacheService.GetAllNetworkModuleCache(networkModuleCacheRequest);
            List <Jc_MacInfo> ALLNetworkModule = resultAllNetwork.Data;

            foreach (Jc_MacInfo NetworkModule in ALLNetworkModule)
            {
                if (NetworkModule.IsMemoryData)
                {
                    if (NetworkModule.Type == 0 && NetworkModule.Wzid == "-1" && !NetworkModuleIsDefinePoint(NetworkModule.Bz1))//处理未定义网络模块,只有绑定了分站的网络模块才保留,否则从缓存中清除 20170331
                    {
                        NetworkModuleCacheDeleteRequest DeleteNetworkModuleCacheRequest = new NetworkModuleCacheDeleteRequest();
                        DeleteNetworkModuleCacheRequest.NetworkModuleInfo = NetworkModule;
                        _NetworkModuleCacheService.DeleteNetworkModuleCache(DeleteNetworkModuleCacheRequest);
                    }
                }
            }

            return(Result);
        }
 public BasicResponse DeleteNetworkModuleCache(NetworkModuleCacheDeleteRequest networkModuleCacheRequest)
 {
     NetworkModuleCache.NetworModuleCahceInstance.DeleteItem(networkModuleCacheRequest.NetworkModuleInfo);
     return(new BasicResponse());
 }