From f718d23a262a5a8e1241fdeaeb4153399f95e79d Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 21 四月 2020 09:19:05 +0800 Subject: [PATCH] 20200421 --- HDL_ON/Entity/Function/Function.cs | 47 ++++++++++++++++++++++++++++++++++++----------- 1 files changed, 36 insertions(+), 11 deletions(-) diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index b7a8a44..6e0770d 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -19,7 +19,7 @@ /// <summary> /// 灞炴�х殑鍊� /// </summary> - public string value; + public List<string> value; /// <summary> /// 鏈�澶у�� /// </summary> @@ -108,8 +108,16 @@ { get { - var _functionCategoryString = sid.Substring(22, 2); - return (FunctionCategory)Enum.ToObject(typeof(FunctionCategory), Convert.ToInt32(_functionCategoryString)); + try + { + var _functionCategoryString = sid.Substring(24, 2); + return (FunctionCategory)Enum.ToObject(typeof(FunctionCategory), Convert.ToInt32(_functionCategoryString)); + } + catch (Exception ex) + { + MainPage.Log($"get FunctionCategory error : {ex.Message}"); + return FunctionCategory.UnKown; + } } } @@ -135,7 +143,7 @@ { string vendorCode = "HDL"; var code = sid.Substring(0, 4); - if (code == "00001") + if (code == "0001") vendorCode = "HDL"; return vendorCode; } @@ -196,7 +204,12 @@ /// <summary> /// 浣跨敤棰戠巼 /// </summary> - public double usageFrequency = 0; + public double usageFrequency { + get + { + return usageCount / 7; + } + } /// <summary> /// 鍥哄畾鐨勫簭鍙� /// </summary> @@ -213,12 +226,16 @@ { if (trait == null) return new List<string>(); - var proArr = trait.Split(',').ToList(); - foreach (var pro in proArr) + var proArr = new List<string>(); + foreach (var pro in trait) { - if (!dicPropert.ContainsKey(pro)) + if (!dicPropert.ContainsKey(pro.attri)) { - dicPropert.TryAdd(pro, "0"); + dicPropert.TryAdd(pro.attri, "0"); + } + if (!proArr.Contains(pro.attri)) + { + proArr.Add(pro.attri); } } return proArr; @@ -236,9 +253,9 @@ /// </summary> /// <param name="command">鎺у埗鍛戒护锛歸rite锛宺ead</param> /// <returns></returns> - public virtual JObject GetSendJObject(string command) + public virtual JObject GetSendJObject(CommandType_A command) { - var sendJob = new JObject { { "vendor_code", vendor_code }, { "Command", command }, { "Type", "device" }, }; + var sendJob = new JObject { { "vendor_code", vendor_code }, { "Command", command.ToString() }, { "Type", "device" }, }; var data = new JObject { { "sid", sid } }; sendJob.Add("objects", data); return sendJob; @@ -264,6 +281,8 @@ foreach(var roomId in roomIdList) { var findRoom = DB_ResidenceData.residenceData.rooms.Find(obj => obj.sid == roomId); + if (findRoom == null) + continue; if(roomNameList != "") { roomNameList += ","; @@ -272,5 +291,11 @@ } return roomNameList; } + + + /// <summary> + /// 鏇存柊鏃堕棿 + /// </summary> + public DateTime refreshTime = DateTime.MinValue; } } -- Gitblit v1.8.0