From 0ee75b88cfe03e46289de0de96e8ed4580c797d3 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 27 九月 2022 14:04:21 +0800
Subject: [PATCH] Merge branch 'Dev-Branch' into dev--wxr
---
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 189 ++++++++++++++++++++++++++++++++++++----------
1 files changed, 147 insertions(+), 42 deletions(-)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index b6334d8..ab8885b 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -10,20 +10,20 @@
{
/// <summary>
/// 瀹氫箟涓�涓潤鎬佸璞�
- /// </summary>
- private static LogicMethod logicMethod = null;
+ /// </summary>
+ private static LogicMethod s_Current = null;
/// <summary>
/// 鑾峰彇闈欐�佸璞�
/// </summary>
- public static LogicMethod CurrLogicMethod
+ public static LogicMethod Current
{
get
{
- if (logicMethod == null)
+ if (s_Current == null)
{
return new LogicMethod();
}
- return logicMethod;
+ return s_Current;
}
}
@@ -147,7 +147,9 @@
/// <returns></returns>
public List<HDL_ON.Entity.Room> GetGatewayRoomList()
{
- return HDL_ON.Entity.SpatialInfo.CurrentSpatial.RoomList;
+ return HDL_ON.Entity.SpatialInfo.CurrentSpatial.RoomList;
+
+
}
/// <summary>
/// 鑾峰彇缃戝叧鎴块棿鍒楄〃
@@ -180,7 +182,35 @@
/// <returns></returns>
public List<HDL_ON.Entity.Function> GetGatewayDeviceList()
{
- return Entity.FunctionList.List.GetDeviceFunctionList();
+ var list = new List<HDL_ON.Entity.Function>();
+ var list1 = Entity.FunctionList.List.GetDeviceFunctionList();
+ var list2 = this.GetVideoDeviceList();
+ list.AddRange(list1);
+ list.AddRange(list2);
+ GetTestDevice(ref list, true);
+ return list;
+ }
+ /// <summary>
+ /// 鑾峰彇鍙瀵硅璁惧鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ public List<HDL_ON.Entity.Function> GetVideoDeviceList()
+ {
+ var functionList = new List<Function>();
+ foreach (var videoDevice in FunctionList.List.videoIntercom) {
+ Function function = new Function();
+ function.spk = videoDevice.spk;
+ function.name = videoDevice.deviceName;
+ function.deviceId = videoDevice.deviceId;
+ function.online = videoDevice.status== "online";
+ function.sid = videoDevice.sid;
+ var video = functionList.Find((o) => o.deviceId == function.deviceId);
+ if (video == null) {
+ functionList.Add(function);
+ }
+
+ }
+ return functionList;
}
/// <summary>
/// 鑾峰彇鍦烘櫙鍒楄〃
@@ -322,7 +352,11 @@
string strPath = "";
switch (functionType)
{
-
+ case SPK.doorgate:
+ {
+ strPath = "VideoIcon/keshiduijiang.png";
+ }
+ break;
case SPK.AirSwitch:
{
strPath = "FunctionIcon/Icon/electricalbreaker.png";
@@ -401,6 +435,12 @@
case SPK.DoorLock:
{
strPath = "FunctionIcon/DoorLock/DoorLock.png";
+ }
+ break;
+ case SPK.MusicStandard:
+ case SPK.AvMusic:
+ {
+ strPath = "MusicIcon/localMusic.png";
}
break;
@@ -501,6 +541,18 @@
{
deviceStrTypeList.Add(Language.StringByID(StringId.DoorLock));
}
+ ///闊充箰绫�
+ var music = deviceList.Find((device) => device.spk == SPK.MusicStandard || device.spk == SPK.AvMusic);
+ if (music != null)
+ {
+ deviceStrTypeList.Add(Language.StringByID(StringId.Music));
+ }
+ ///鍙瀵硅
+ var doorgate = deviceList.Find((device) => device.spk == SPK.doorgate);
+ if (doorgate != null)
+ {
+ deviceStrTypeList.Add(Language.StringByID(StringId.VideoIntercom));
+ }
return deviceStrTypeList;
}
@@ -586,10 +638,22 @@
///闂ㄩ攣绫�
else if (deviceType == Language.StringByID(StringId.DoorLock))
{
- functionTypeList.Add(SPK.DoorLock);
+ functionTypeList.Add(SPK.DoorLock);
+ }
+ ///闊充箰绫�
+ else if (deviceType == Language.StringByID(StringId.Music))
+ {
+ functionTypeList.Add(SPK.MusicStandard);
+ functionTypeList.Add(SPK.AvMusic);
+ }
+ ///HDL鍙瀵硅
+ else if (deviceType == Language.StringByID(StringId.VideoIntercom))
+ {
+ functionTypeList.Add(SPK.doorgate);
}
else
{
+ //鍏ㄩ儴鍖哄煙
functionTypeList.Add(SPK.LightSwitch);
functionTypeList.Add(SPK.LightDimming);
functionTypeList.Add(SPK.LightRGB);
@@ -634,6 +698,11 @@
functionTypeList.Add(SPK.HvacCac);
functionTypeList.Add(SPK.SensorHelp);
functionTypeList.Add(SPK.DoorLock);
+ functionTypeList.Add(SPK.CurtainDream);
+ functionTypeList.Add(SPK.MusicStandard);
+ functionTypeList.Add(SPK.AvMusic);
+ functionTypeList.Add(SPK.doorgate);
+
}
@@ -688,6 +757,7 @@
deviceTypeList.Add(SPK.HvacCac);
deviceTypeList.Add(SPK.SensorHelp);
deviceTypeList.Add(SPK.DoorLock);
+ deviceTypeList.Add(SPK.doorgate);
}
break;
@@ -708,6 +778,8 @@
deviceTypeList.Add(SPK.PanelSocket);
deviceTypeList.Add(SPK.ElectricSocket);
deviceTypeList.Add(SPK.CurtainDream);
+ deviceTypeList.Add(SPK.MusicStandard);
+ deviceTypeList.Add(SPK.AvMusic);
}
break;
}
@@ -941,57 +1013,57 @@
{
try
{
- //鑾峰彇閫昏緫ID鍒楄〃锛岀洰鍓嶉拡瀵规墍鏈�<澶囨敞:濡傛灉鍙拡瀵瑰綋鍓嶆墜鏈虹殑璇濓紝鍙互鐩存帴鎷跨紦瀛樻暟鎹嚜鍔ㄥ寲鍒楄〃閬嶅巻>
- var idStr = Send.GetLogicIdList();
- if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "")
+ //鑾峰彇閫昏緫ID鍒楄〃锛岀洰鍓嶉拡瀵规墍鏈�<澶囨敞:濡傛灉鍙拡瀵瑰綋鍓嶆墜鏈虹殑璇濓紝鍙互鐩存帴鎷跨紦瀛樻暟鎹嚜鍔ㄥ寲鍒楄〃閬嶅巻>
+ var idStr = Send.Current.GetLogicIdList();
+ if (idStr != null)
{
var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data);
logicDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date);
}
- ///鏈夎嚜鍔ㄥ垪琛ㄦ墠澶勭悊
- if (logicDataList.Count > 0)
+ ///鏈夎嚜鍔ㄥ垪琛ㄦ墠澶勭悊
+ if (logicDataList.Count > 0)
{
- ///閬嶅巻鎵�鏈夊垪琛�
- for (int i = 0; i < logicDataList.Count; i++)
+ ///閬嶅巻鎵�鏈夊垪琛�
+ for (int i = 0; i < logicDataList.Count; i++)
{
var logicDate = logicDataList[i];
- ///鑷姩鍖栨病鏈夐厤缃湴鐞嗗洿鏍忎笉澶勭悊
- if (string.IsNullOrEmpty(logicDate.geo_fence.latitude) || string.IsNullOrEmpty(logicDate.geo_fence.longitude))
+ ///鑷姩鍖栨病鏈夐厤缃湴鐞嗗洿鏍忎笉澶勭悊
+ if (string.IsNullOrEmpty(logicDate.geo_fence.latitude) || string.IsNullOrEmpty(logicDate.geo_fence.longitude))
{
- //缁忕含搴︿负绌�,璁や负鑷姩鍖栨病鏈夐厤缃湴鐞嗗洿鏍忥紝涓嶅鐞�;
- continue;
+ //缁忕含搴︿负绌�,璁や负鑷姩鍖栨病鏈夐厤缃湴鐞嗗洿鏍忥紝涓嶅鐞�;
+ continue;
}
- //鑷姩鍖栭厤缃緭鍏ユ潯浠剁含搴�
- double lat = Convert.ToDouble(logicDate.geo_fence.latitude.Replace(",", "."));
- //鑷姩鍖栭厤缃緭鍏ユ潯浠剁粡搴�
- double lon = Convert.ToDouble(logicDate.geo_fence.longitude.Replace(",", "."));
- //鑷姩鍖栭厤缃緭鍏ユ潯浠�<鍦扮悊鍥存爮鍗婂緞><鍗曚綅锛屽叕閲屻�佸崈绫�.绫�>
- int radius = int.Parse(logicDate.geo_fence.radius);
- //璁$畻2涓粡绾害涔嬮棿鐨勮窛绂�
- int r = Infrastructure.Service.Helper.CalculatedDistance.Distance(out_lat, out_lng, lat, lon);
- //瀹氫箟涓�涓眬閮ㄥ彉閲�
- string direction = string.Empty;
- //涓ょ偣璺濈灏忎簬閰嶇疆璺濈<鏃㈣嚜鍔ㄥ寲閰嶇疆杈撳叆鏉′欢鍦扮悊鍥存爮鍗婂緞>,璇存槑杩涘叆鍖哄煙
- if (r < radius)
+ //鑷姩鍖栭厤缃緭鍏ユ潯浠剁含搴�
+ double lat = Convert.ToDouble(logicDate.geo_fence.latitude.Replace(",", "."));
+ //鑷姩鍖栭厤缃緭鍏ユ潯浠剁粡搴�
+ double lon = Convert.ToDouble(logicDate.geo_fence.longitude.Replace(",", "."));
+ //鑷姩鍖栭厤缃緭鍏ユ潯浠�<鍦扮悊鍥存爮鍗婂緞><鍗曚綅锛屽叕閲屻�佸崈绫�.绫�>
+ int radius = int.Parse(logicDate.geo_fence.radius);
+ //璁$畻2涓粡绾害涔嬮棿鐨勮窛绂�
+ int r = Infrastructure.Service.Helper.CalculatedDistance.Distance(out_lat, out_lng, lat, lon);
+ //瀹氫箟涓�涓眬閮ㄥ彉閲�
+ string direction = string.Empty;
+ //涓ょ偣璺濈灏忎簬閰嶇疆璺濈<鏃㈣嚜鍔ㄥ寲閰嶇疆杈撳叆鏉′欢鍦扮悊鍥存爮鍗婂緞>,璇存槑杩涘叆鍖哄煙
+ if (r < radius)
{
- //鍒拌揪鏌愬湴
- direction = "arrive";
+ //鍒拌揪鏌愬湴
+ direction = "arrive";
}
else
{
- //绂诲紑
- direction = "leave";
+ //绂诲紑
+ direction = "leave";
}
- ///閬嶅巻缂撳瓨鍒楄〃<涓嶄负绌鸿鏄庢暟鎹凡缁忔帹閫佽繃锛屼笉鍐嶆帹閫�>
- var isPush = pushList.Find((o) => o.homeId == HomeId && o.userId == UserInfo.Current.ID && o.userLogicId == logicDate.userLogicId && o.arriveOnLeave == direction);
+ ///閬嶅巻缂撳瓨鍒楄〃<涓嶄负绌鸿鏄庢暟鎹凡缁忔帹閫佽繃锛屼笉鍐嶆帹閫�>
+ var isPush = pushList.Find((o) => o.homeId == HomeId && o.userId == UserInfo.Current.ID && o.userLogicId == logicDate.userLogicId && o.arriveOnLeave == direction);
if (isPush == null)
{
- //鎺ㄩ�佺粰浜戠鏄惁鎴愬姛
- bool push = Send.GeoFenceStateReport(logicDate.userLogicId, logicDate.sid, direction);
+ //鎺ㄩ�佺粰浜戠鏄惁鎴愬姛
+ bool push = Send.Current.GetFenceStateReport(logicDate.userLogicId, logicDate.sid, direction);
if (push)
{
- ///娣诲姞鍒版帹閫佸垪琛�
- pushList.Add(new Push
+ ///娣诲姞鍒版帹閫佸垪琛�
+ pushList.Add(new Push
{
homeId = HomeId,
userId = UserInfo.Current.ID,
@@ -1012,6 +1084,39 @@
/// 鎺ㄩ�佸垪琛�<杩欓噷鏁版嵁宸茬粡鎺ㄩ�佽繃>
/// </summary>
private static List<Push> pushList = new List<Push>();
+ /// <summary>
+ /// 鑾峰彇妯℃嫙鐨勮澶囧垪琛�
+ /// </summary>
+ /// <param name="isBool">鏄惁寮�鍚�</param>
+ /// <returns></returns>
+ private List<Entity.Function> GetTestDevice(ref List<HDL_ON.Entity.Function> list, bool isBool)
+ {
+ if (isBool)
+ {
+ //妯℃嫙璁惧
+ var functions = new List<Function> {
+ //new Entity.Function { sid = "1234567890", name = "瓒呭0娉紶鎰熷櫒", spk = Entity.SPK.SensorUtrasonic },
+ // new Entity.Function { sid = "1234567891", name = "娓╁害浼犳劅鍣�", spk = Entity.SPK.SensorTemperature },
+ // new Entity.Function { sid = "1234567892", name = "婀垮害浼犳劅鍣�", spk = Entity.SPK.SensorHumidity },
+ // new Entity.Function { sid = "1234567893", name = "绾㈠瀵瑰皠浼犳劅鍣�", spk = Entity.SPK.SensorDuiShe },
+ // new Entity.Function { sid = "1234567895", name = "瓒呭0娉紶鎰熷櫒", spk = Entity.SPK.SensorUtrasonic },
+ new Entity.Function { sid = "1234567896", name = "姣背娉紶鎰熷櫒", spk = Entity.SPK.SenesorMegahealth },
+ new Entity.Function { sid = "1234567897", name = "姣背娉紶鎰熷櫒1", spk = Entity.SPK.SenesorMegahealth2 },
+ new Entity.Function { sid = "1234567899", name = "闂ㄧ浼犳劅鍣�", spk = Entity.SPK.SensorDoorWindow },
+ };
+ foreach (var function in functions)
+ {
+ var device = list.Find((o) => { return o.sid == function.sid; });
+ if (device == null)
+ {
+ list.Add(function);
+ }
+ }
+
+ }
+ return list;
+
+ }
}
public class Push
--
Gitblit v1.8.0