From 792ca2a402feb952ef890d653f2e049c1230baf1 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期六, 19 十二月 2020 18:48:33 +0800
Subject: [PATCH] 1111
---
HDL_ON/Entity/Room.cs | 44 ++++++++++++++++++++++++++++++++++----------
1 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/HDL_ON/Entity/Room.cs b/HDL_ON/Entity/Room.cs
index fd1094c..0f3cc1d 100644
--- a/HDL_ON/Entity/Room.cs
+++ b/HDL_ON/Entity/Room.cs
@@ -46,7 +46,7 @@
public SpatialInfo(string spatialType)
{
roomType = "FLOOR";
- parentId = UserInfo.Current.CurReginID;
+ parentId = DB_ResidenceData.Instance.CurrentRegion.RegionID;
}
public string roomId = "";
@@ -247,7 +247,7 @@
/// 澧炲姞妤煎眰
/// </summary>
/// <param name="floor"></param>
- public string AddFloor(SpatialInfo floor)
+ public string AddFloor(SpatialInfo floor, out SpatialInfo newFloor)
{
var pm = new HttpServerRequest();
var revPack = new ResponsePackNew();
@@ -255,17 +255,23 @@
if (revPack.Code == StateCode.SUCCESS)
{
var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SpatialInfo>>(revPack.Data.ToString());
- if(revData.Count>0)
+ if (revData.Count > 0)
{
var addFloor = revData.Find((obj) => obj.uid == floor.uid);
- if(addFloor!= null)
+ if (addFloor != null)
{
CurrentSpatial.FloorList.Add(addFloor);
+ floor = addFloor;
}
}
var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(CurrentSpatial.FloorList));
Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd);
}
+ else
+ {
+ Utlis.ShowTip(Language.StringByID(StringId.AddFloorFail) + "\r\nCode:" + revPack.Code);
+ }
+ newFloor = floor;
return revPack.Code;
}
/// <summary>
@@ -357,7 +363,7 @@
/// 澧炲姞鎴块棿
/// </summary>
/// <param name="room"></param>
- public string AddRoom(Room room)
+ public string AddRoom(Room room,out Room newRoom)
{
var pm = new HttpServerRequest();
var pack = pm.AddRoom(new List<SpatialInfo>() { room });
@@ -372,7 +378,7 @@
var tempRoom = revData.Find((obj) => obj.uid == room.uid);
if (tempRoom != null)
{
- room = tempRoom as Room;
+ room.roomId = tempRoom.roomId;
CurrentSpatial.RoomList.Add(room);
var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(room));
Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd);
@@ -380,6 +386,7 @@
}
}
}
+ newRoom = room;
return pack.Code;
}
/// <summary>
@@ -410,8 +417,25 @@
{
Common.FileUtlis.Files.DeleteFile(localRoom.dataSavePath);
}
- RoomList.Clear();
+ rooms = null;
}
+
+ public void Clear()
+ {
+ if (_currentSpatial != null)
+ {
+ if (_currentSpatial.floors != null)
+ {
+ _currentSpatial.floors.Clear();
+ }
+ if (_currentSpatial.rooms != null)
+ {
+ _currentSpatial.rooms.Clear();
+ }
+ _currentSpatial = null;
+ }
+ }
+
/// <summary>
/// 鍒濆鍖栨瘡涓埧闂寸殑鍔熻兘鏁版嵁
/// </summary>
@@ -499,7 +523,7 @@
{
if (CurrentSpatial.FloorList.Count > 0)
{
- var f = CurrentSpatial.FloorList.Find((obj) => obj.roomId == parentId);
+ var f = CurrentSpatial.FloorList.Find((obj) => obj.uid == parentId);
if (f != null)
{
return f.roomName + " ";
@@ -524,7 +548,7 @@
}
if (functions.Count == 0)
{
- foreach (var f in DB_ResidenceData.functionList.GetAllFunction())
+ foreach (var f in FunctionList.List.GetDeviceFunctionList())
{
if (f.roomIds.Contains(roomId) && roomId != null)
{
@@ -566,7 +590,7 @@
}
if (scenes.Count == 0)
{
- foreach (var s in DB_ResidenceData.functionList.scenes)
+ foreach (var s in FunctionList.List.scenes)
{
if (s.roomIds.Contains(roomId) && roomId != null)
{
--
Gitblit v1.8.0