/// <summary> /// 删除设备类型 /// </summary> /// <param name="jc_Devrequest"></param> /// <returns></returns> public BasicResponse DeleteDeviceDefine(DeviceDefineDeleteRequest DeviceDefineRequest) { BasicResponse Result = new BasicResponse(); //重复判断 DeviceDefineCacheGetByKeyRequest DeviceDefineCacheRequest = new DeviceDefineCacheGetByKeyRequest(); DeviceDefineCacheRequest.Devid = DeviceDefineRequest.Id; var result = _DeviceDefineCacheService.GetPointDefineCacheByKey(DeviceDefineCacheRequest); if (result.Data == null) { //缓存中存在此测点 Result.Code = 1; Result.Message = "当前删除的设备类型不存在!"; return(Result); } //向网关同步数据 Jc_DevInfo DeleteDevInfo = result.Data; DeleteDevInfo.InfoState = InfoState.Delete; List <Jc_DevInfo> SendItemList = new List <Jc_DevInfo>(); SendItemList.Add(DeleteDevInfo); var resultSync = SynchronousDataToGateway(SendItemList); if (!resultSync) { Result.Code = 1; Result.Message = "向网关同步数据失败!"; return(Result); } //保存数据库 _Repository.DeleteDeviceDefine(DeleteDevInfo.ID); //更新缓存 DeviceDefineCacheDeleteRequest deviceDefineCacheRequest = new DeviceDefineCacheDeleteRequest(); deviceDefineCacheRequest.DeviceDefineInfo = DeleteDevInfo; _DeviceDefineCacheService.DeletePointDefineCache(deviceDefineCacheRequest); return(Result); }
public BasicResponse DeletePointDefineCache(DeviceDefineCacheDeleteRequest deviceDefineCacheRequest) { DeviceDefineCache.DeviceDefineCahceInstance.DeleteItem(deviceDefineCacheRequest.DeviceDefineInfo); return(new BasicResponse()); }