From df3906c03db154e8622b7caeaa3bf93b67c6d40a Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期五, 15 十月 2021 10:25:35 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/newBranch1' into CJL-Linphone
---
HDL_ON/Entity/Function/Scene.cs | 149 ++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 133 insertions(+), 16 deletions(-)
diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs
index 386ded3..48481ec 100644
--- a/HDL_ON/Entity/Function/Scene.cs
+++ b/HDL_ON/Entity/Function/Scene.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using HDL_ON.Common;
using HDL_ON.DAL.Server;
+using HDL_ON.UI;
using Shared;
namespace HDL_ON.Entity
@@ -66,7 +67,7 @@
/// </summary>
public string delay = "0";
/// <summary>
- /// 鍦烘櫙鐨勬渶濂戒竴娆℃墽琛屾椂闂�
+ /// 鍦烘櫙鐨勬渶鍚庝竴娆℃墽琛屾椂闂�
/// </summary>
public string LastExecutionTime = "";
@@ -76,12 +77,24 @@
public string group = "1";
/// <summary>
/// 鍦烘櫙绫诲瀷
+ /// 0:鏅��
+ /// 1:鐢靛奖
+ /// 2:璋冨厜
/// </summary>
public SceneType sceneType = SceneType.OrdinaryScenes;
/// <summary>
/// 鏀惰棌鏍囪
/// </summary>
public bool collect = false;
+ /// <summary>
+ /// 鏄惁鍏佽鍒犻櫎
+ /// </summary>
+ public bool can_delete = true;
+
+ /// <summary>
+ /// 鍒涘缓璇ュ満鏅殑鐢ㄦ埛ID
+ /// </summary>
+ public string userId = UserInfo.Current.ID;
///// <summary>
///// 鍦烘櫙鑳屾櫙
@@ -137,13 +150,14 @@
sTimeSpan = arry[0].ToString("X2") + arry[1].ToString("X2") + arry[2].ToString("X2") + arry[3].ToString("X2");
- if (sTimeSpan.Length > 8)
+ if (sTimeSpan.Length >= 8)
{
sTimeSpan = sTimeSpan.Substring(0, 8);
}
else
{
- sTimeSpan = "00000000";
+ sTimeSpan = Guid.NewGuid().ToString().Substring(0, 8);
+ //sTimeSpan = "00000000";
}
sceneId = sOidBeginsWith + sTimeSpan;
@@ -303,6 +317,11 @@
var revPack = pm.EditScene(this);
if (revPack.Code == StateCode.SUCCESS)
{
+ if(MainPage.NoLoginMode)
+ {
+ var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
+ Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd);
+ }
var scenes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString());
var tempScene = scenes.Find((obj) => obj.sid == sid);
if (tempScene != null)
@@ -339,7 +358,21 @@
/// </summary>
public string GetDelayText()
{
+ var delayInt = 0;
+ int.TryParse(delay,out delayInt);
+ if(delayInt == 0)
+ {
+ return Language.StringByID(StringId.NoDelay);
+ }
string text = "";
+ if (delayInt > 60)
+ {
+ text = (delayInt / 60) + Language.StringByID(StringId.m) + (delayInt % 60) + Language.StringByID(StringId.s);
+ }else
+ {
+ text = delayInt + Language.StringByID(StringId.s);
+ }
+ return text;
switch (delay)
{
case "0":
@@ -368,6 +401,8 @@
/// 浜戠鏁版嵁淇敼鐨勬渶鍚庢椂闂�
/// </summary>
public string modifyTime = "";
+
+
}
/// <summary>
/// 鍦烘櫙鍔熻兘瀵硅薄
@@ -381,6 +416,7 @@
/// 鍔熻兘寤舵椂
/// </summary>
public string delay = "0";
+
Function _localFunction;
/// <summary>
@@ -403,11 +439,71 @@
/// 杞崲鎴愬姛鑳藉璞�
/// </summary>
/// <returns></returns>
- Function ConvertFunctionObject()
+ private Function ConvertFunctionObject()
{
var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid);
return localFunction;
}
+
+
+ /// <summary>
+ /// 瑙f瀽鍦烘櫙鍔熻兘鏁版嵁
+ /// </summary>
+ /// <param name="sceneFunction"></param>
+ public string GetFunctionScnenInfo()
+ {
+ var sceneFunctionInfo = "";
+ foreach (var sfs in status)
+ {
+ if (sfs.key == FunctionAttributeKey.OnOff)
+ {
+ if (sfs.value == "off")
+ {
+ return Language.StringByID(StringId.Close);
+ }
+ }
+ }
+ sceneFunctionInfo += Language.StringByID(StringId.Open) + " ";
+
+ var modeState = status.Find((obj) => obj.key == FunctionAttributeKey.Mode);
+ var tempState = status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp);
+ var fanState = status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed);
+ if (modeState != null)
+ {
+ sceneFunctionInfo += modeState.GetValueText() + " ";
+ }
+ if (tempState != null)
+ {
+ sceneFunctionInfo += tempState.GetValueText() + " ";
+ sceneFunctionInfo += tempState.GetUintString();
+ }
+ if (fanState != null)
+ {
+ sceneFunctionInfo += fanState.GetValueText() + " ";
+ }
+ var briState = status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
+ if (briState != null)
+ {
+ sceneFunctionInfo += briState.value + "%" + " ";
+ }
+ var perState = status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
+ if (perState != null)
+ {
+ sceneFunctionInfo += perState.value + "%" + " ";
+ }
+ var cctState = status.Find((obj) => obj.key == FunctionAttributeKey.CCT);
+ if(cctState != null)
+ {
+ sceneFunctionInfo += cctState.value + "%" + " ";
+ }
+ var rgbState = status.Find((obj) => obj.key == FunctionAttributeKey.RGB);
+ if(rgbState!=null)
+ {
+ //sceneFunctionInfo += new cctState.value + "%" + " ";
+ }
+ return sceneFunctionInfo;
+ }
+
}
@@ -418,6 +514,9 @@
{
public string key = "";
public string value = "";
+
+ public int max = 0;
+ public int min = 0;
/// <summary>
/// 灞炴�у悕绉版樉绀烘枃鏈�
@@ -446,7 +545,7 @@
case FunctionAttributeKey.SetTemp:
text = Language.StringByID(StringId.Temp);
break;
- case FunctionAttributeKey.IndoorTemp:
+ case FunctionAttributeKey.RoomTemp:
text = Language.StringByID(StringId.IndoorTemp);
break;
case FunctionAttributeKey.Delay:
@@ -469,18 +568,26 @@
/// <summary>
/// 灞炴�у�煎崟浣�
/// </summary>
- public string GetUintString()
+ public string GetUintString(string inputKey = "")
{
var us = "";
- switch (key)
+ var swithchString = key;
+ if(!string.IsNullOrEmpty(inputKey))
+ {
+ swithchString = inputKey;
+ }
+ switch (swithchString)
{
case FunctionAttributeKey.SetTemp:
- case FunctionAttributeKey.IndoorTemp:
+ case FunctionAttributeKey.RoomTemp:
us = "掳C";
break;
case FunctionAttributeKey.Percent:
case FunctionAttributeKey.Brightness:
us = "%";
+ break;
+ case FunctionAttributeKey.CCT:
+ us = "K";
break;
}
return us;
@@ -491,26 +598,35 @@
/// 鑾峰彇鎸囧畾灞炴�х殑鏄剧ず鏂囨湰
/// 涓嫳鏂囨樉绀�
/// </summary>
- public string GetValueText()
+ public string GetValueText(string temp = "")
{
+ string catchString = value;
+ if(temp!= "")
+ {
+ catchString = temp;
+ }
string text = "";
switch (key)
{
case FunctionAttributeKey.OnOff:
- text = value == "on" ? Language.StringByID(StringId.On) : Language.StringByID(StringId.OFF);
+ text = catchString == "on" ? Language.StringByID(StringId.On) : Language.StringByID(StringId.OFF);
break;
case FunctionAttributeKey.SetTemp:
- case FunctionAttributeKey.IndoorTemp:
+ case FunctionAttributeKey.RoomTemp:
case FunctionAttributeKey.Brightness:
case FunctionAttributeKey.Percent:
- if (value == "")
+ int outT = 0;
+ int.TryParse(catchString,out outT);
+ if (outT < 0)
+ catchString = "0";
+ if (catchString == "")
{
- value = "0";
+ catchString = "0";
}
- text = value;
+ text = catchString;
break;
case FunctionAttributeKey.Mode:
- switch (value)
+ switch (catchString)
{
//----绌鸿皟
case "auto":
@@ -529,6 +645,7 @@
text = Language.StringByID(StringId.AirSupply);
break;
//-----鍦扮儹
+ // 1:鏅��,2:鐧藉ぉ,3:澶滄櫄,4:绂诲紑,5:鏃堕棿
case "day":
text = Language.StringByID(StringId.Day);
break;
@@ -547,7 +664,7 @@
}
break;
case FunctionAttributeKey.FanSpeed:
- switch (value)
+ switch (catchString)
{
case "high":
text = Language.StringByID(StringId.HighWindSpeed);
--
Gitblit v1.8.0