From fba7be989c27154db963cfce1ddd7b01d71e8b21 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期五, 20 十月 2023 14:21:12 +0800
Subject: [PATCH] 2023年10月20日14:20:17
---
HDL_ON/DAL/Server/HttpUtil.cs | 4
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 61 +++++++++++++++++++
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 55 +++++++++---------
HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs | 4
HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs | 8 +-
5 files changed, 95 insertions(+), 37 deletions(-)
diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs
index 5235064..b659327 100644
--- a/HDL_ON/DAL/Server/HttpUtil.cs
+++ b/HDL_ON/DAL/Server/HttpUtil.cs
@@ -18,8 +18,8 @@
/// 鍥哄畾鍩熷悕,姝e紡鐜
/// 鍏叡鍩熷悕灏辫繎瑙f瀽
/// </summary>
- public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
- //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
+ //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+ public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
const string APP_KEY = "HDL-HOME-APP-TEST";
const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index 7d455a8..87f5585 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -239,7 +239,7 @@
int h = time / (60 * 60);
int m = time % (60 * 60) / 60;
int s = (time % (60 * 60) % 60);
- view2.btnState.Text = inputs.hold_time + "s";
+ view2.btnState.Text = LogicMethod.Current.getTimeStr(inputs.hold_time);
view2.btnState.Name = h + ":" + m + ":" + s;
this.hold_time = inputs.hold_time;
}
@@ -1400,7 +1400,7 @@
this.hold_time = (h + m + s).ToString();
if (button != null)
{
- button.Text = this.hold_time + "s";
+ button.Text = LogicMethod.Current.getTimeStr(this.hold_time);
button.Name = timeValue;
}
selectedState = device.spk + "_" + timeValue;
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 80db2e3..073fe47 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -489,7 +489,7 @@
string value = this.GetKeyValue("people_status", dicList);
if (string.IsNullOrEmpty(value))
{
- inputView.btnState.Text = inputCondition.hold_time + "s";
+ inputView.btnState.Text = LogicMethod.Current.getTimeStr(inputCondition.hold_time).Replace("0s","");
break;
}
@@ -502,8 +502,8 @@
}
if (!string.IsNullOrEmpty(inputCondition.hold_time) && int.Parse(inputCondition.hold_time) > 0)
{
-
- inputView.btnState.Text += "鎸佺画" + inputCondition.hold_time + "s";
+ int time = int.Parse(inputCondition.hold_time);
+ inputView.btnState.Text += "鎸佺画" + LogicMethod.Current.getTimeStr(inputCondition.hold_time).Replace("0s", "");
}
@@ -2292,7 +2292,7 @@
foreach (var dic in dicList)
{
string value = dic["value"];
- if (value == "open")
+ if (value == "on"|| value == "open")
{
button1.Text = Language.StringByID(StringId.onLogic);
}
@@ -2893,29 +2893,30 @@
string state = "";
var minutes = timeValue / 60;
var seconds = timeValue % 60;
- if (minutes != 0)
- {
- if (seconds == 0)
- {
- state = minutes.ToString() + Language.StringByID(StringId.minute);
- }
- else
- {
- state = minutes.ToString() + Language.StringByID(StringId.minute) + seconds.ToString() + Language.StringByID(StringId.s);
- }
- }
- else
- {
- if (seconds != 0)
- {
- state = seconds.ToString() + Language.StringByID(StringId.s);
- }
- }
- if (!string.IsNullOrEmpty(state))
- {
- state = Language.StringByID(StringId.delayLogic) + state;
- }
- return state;
+ return LogicMethod.Current.getTimeStr(strTimeValue).Replace("0s","");
+ //if (minutes != 0)
+ //{
+ // if (seconds == 0)
+ // {
+ // state = minutes.ToString() + Language.StringByID(StringId.minute);
+ // }
+ // else
+ // {
+ // state = minutes.ToString() + Language.StringByID(StringId.minute) + seconds.ToString() + Language.StringByID(StringId.s);
+ // }
+ //}
+ //else
+ //{
+ // if (seconds != 0)
+ // {
+ // state = seconds.ToString() + Language.StringByID(StringId.s);
+ // }
+ //}
+ //if (!string.IsNullOrEmpty(state))
+ //{
+ // state = Language.StringByID(StringId.delayLogic) + state;
+ //}
+ //return state;
}
/// <summary>
/// 鑾峰彇鏄剧ず闈㈢啛鏂囨湰
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index fd883fb..80b27c9 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -189,7 +189,7 @@
list.AddRange(list2);
list.AddRange(FunctionList.List.groupControls);
#if DEBUG
- //GetTestDevice(ref list, true);
+ GetTestDevice(ref list, true);
#endif
return list;
}
@@ -998,6 +998,63 @@
return Entity.DB_ResidenceData.Instance.CurrentRegion.isOtherShare;
}
}
+ /// <summary>
+ /// 鎷兼帴鏃堕棿鏍煎紡//"{h}h{m}min{s}s";
+ /// </summary>
+ /// <param name="totalSeconds">绉�(娌℃湁榛樿浼犲叆0)</param>
+ /// <returns></returns>
+ public string getTimeStr(string totalSeconds)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(totalSeconds))
+ {
+ return "";
+ }
+ int time = int.Parse(totalSeconds);
+ int h = time / (60 * 60);
+ int m = time % (60 * 60) / 60;
+ int s = (time % (60 * 60) % 60);
+
+ if (h == 0 && m != 0 && s != 0)
+ {
+ return $"{m}min{s}s";
+ }
+ else if (h == 0 && m == 0 && s != 0)
+ {
+ return $"{s}s";
+ }
+ else if (h == 0 && m != 0 && s == 0)
+ {
+ return $"{m}min";
+ }
+ else if (h != 0 && m == 0 && s != 0)
+ {
+ return $"{h}h{s}s";
+ }
+ else if (h != 0 && m == 0 && s == 0)
+ {
+ return $"{h}h";
+ }
+ else if (h != 0 && m != 0 && s == 0)
+ {
+ return $"{h}h{m}min";
+ }
+ else if (h != 0 && m != 0 && s != 0)
+ {
+ return $"{h}h{m}min{s}s";
+ }
+ else if (h == 0 && m == 0 && s == 0)
+ {
+ return $"0s";
+ }
+ return "";
+ }
+ catch
+ {
+ return "";
+ }
+ }
#region 楂樺痉鍧愭爣杞琖GS84鍧愭爣
/// <summary>
@@ -1242,7 +1299,7 @@
new Entity.Function { sid = "12345678921", name = "閫氱敤寮�鍏�", spk = Entity.SPK.OtherCommon },
//new Entity.Function { sid = "12345678933456", name = "闂ㄩ攣", spk = Entity.SPK.DoorLock },
// new Entity.Function { sid = "1234567895444", name = "瑙嗛闂ㄩ攣", spk = Entity.SPK.VideoDoorLock },
- //new Entity.Function { sid = "12345678968888", name = "浜轰綋瀛樺湪浼犳劅鍣�", spk = Entity.SPK.SensorPirHold },
+ new Entity.Function { sid = "123456789688889", name = "浜轰綋瀛樺湪浼犳劅鍣�", spk = Entity.SPK.SensorPirHold },
new Entity.Function { sid = "12345678968888", name = "娴嬭瘯鐚溂", spk = Entity.SPK.Peephole },
new Entity.Function { sid = "12345678968889", name = "娴嬭瘯钀ょ煶鎽勫儚澶�", spk = Entity.SPK.Ev_Ipcam },
// new Entity.Function { sid = "1234567897", name = "姣背娉紶鎰熷櫒1", spk = Entity.SPK.SenesorMegahealth2 },
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index 8472433..1bdd1b3 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -1046,7 +1046,7 @@
LogicView.FunTypeView delayView = new LogicView.FunTypeView();
delayView.frameLayout.Y = bottomY;
delayView.btnText.TextID = StringId.Delay;
- delayView.btnState.Text = strdelay + "s";
+ delayView.btnState.Text = LogicMethod.Current.getTimeStr(strdelay);
fLayout.AddChidren(delayView.FLayoutView());
///璧嬪�煎璞�
this.btnDelay = delayView.btnState;
@@ -1056,9 +1056,9 @@
InpOrOutLogicMethod inpOrOutLogicMethod = new InpOrOutLogicMethod();
inpOrOutLogicMethod.Delayed(this, strdelay, (value) =>
{
- selectedState = "delay_" + strdelay;
strdelay = value.ToString();
- delayView.btnState.Text = strdelay + "s";
+ delayView.btnState.Text = LogicMethod.Current.getTimeStr(strdelay);
+ selectedState = "delay_" + strdelay;
});
};
@@ -1291,7 +1291,7 @@
if (this.btnDelay != null)
{
///寤舵椂鏄剧ず鏂囨湰
- this.btnDelay.Text = outputs.delay + "s";
+ this.btnDelay.Text =LogicMethod.Current.getTimeStr(outputs.delay);
this.strdelay = outputs.delay;
}
InpOrOutLogicMethod.Current.EditDeviceState(device, dicList, button1, button2, button3, button4, attribute);
--
Gitblit v1.8.0