From f2b2a70331d574a345cab0906d4d4b0de48c38b1 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 11 四月 2023 17:02:59 +0800
Subject: [PATCH] 2023年04月11日17:01:15

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/FunTypeView.cs  |    4 
 HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs        |   77 ++++++++++++
 HDL_ON/DAL/Server/HttpUtil.cs                                     |    4 
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs            |    6 
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs    |   98 ++++++++++++++--
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs |  144 ++++++++++++++++-------
 HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs                   |   25 ++++
 ys/Jars/hdl_ezvizsdk.aar                                          |    0 
 8 files changed, 294 insertions(+), 64 deletions(-)

diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs
index 14e83b1..aa884c3 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";
         //public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index ef2c271..ea5a613 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -2,7 +2,7 @@
 using Shared;
 using System.Collections.Generic;
 using HDL_ON.Entity;
-
+using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock;
 
 namespace HDL_ON.UI.UI2.Intelligence.Automation
 {
@@ -1060,37 +1060,52 @@
         /// <param name="frame">褰撳墠鐣岄潰</param>
         /// <param name="device">褰撳墠璁惧</param>
         /// <param name="btnState">鏃х姸鎬�</param>
-        public void FaceAction(FrameLayout frame, Entity.Function device,Button btnState) {
+        public void FaceAction(FrameLayout frame, Entity.Function device, Button btnState)
+        {
             selectedState = device.spk + "_";
             Loading loading = new Loading();
             frame.AddChidren(loading);
             loading.Start();
-            System.Threading.Tasks.Task.Run(() =>
+
+            CommonMethod.Current.SunThread(() =>
             {
                 try
                 {
-                    var faceIDList = Send.Current.GetListHomeFace(device.deviceId, true);
-                    List<string> faceNameList = new List<string>();
-                    for (int i = 0; i < faceIDList.Count; i++)
-                    {
-                        var face = faceIDList[i];
-                        faceNameList.Add(face.userName);
-                    }
-                    Application.RunOnMainThread(() =>
+                    var faceIdList = Send.Current.GetListHomeFace(device.deviceId, true);
+                   
+                    CommonMethod.Current.MainThread(() =>
                     {
                         loading.Hide();
+                        string stateValue=btnState.Tag==null?"":btnState.Tag.ToString();
                         PublicInterface publicInterface = new PublicInterface();
-                        publicInterface.FrameOrVv(this, faceNameList, new List<string> { btnState.Text }, device.name, (index) =>
-                        {
-                            var face = faceIDList[index];
-                            //鐣岄潰鏄剧ず閫変腑鍊�
-                            btnState.Text = face.userName;
-                            //鏁版嵁灏佽
-                            AddDictionary("open_type", "1", "integer");
-                            AddDictionary("user_id", face.userId, "string");
+                        publicInterface.MultiSelectShow(this, faceIdList, device.name, stateValue, (indexeList) =>
+                     {
+                         if (indexeList.Count > 0)
+                         {
+                             dicSateteList.Clear();
+                             string s = string.Empty;
+                             string tag = string.Empty;
+                             //鏁版嵁灏佽
+                             AddDictionary("open_type", "1", "integer");
+                             for (int indexe = 0; indexe < indexeList.Count; indexe++)
+                             {
+                                 if (indexe > faceIdList.Count)
+                                 {
+                                     continue;
+                                 }
+                                 var face = faceIdList[indexe];
+                                 AddDictionary("user_id", face.userId, "string");
+                                 s += face.userName;
+                                 s += ",";
+                                 tag += face.userId;
+                                 tag += "_";
+                             }
+                             //鐣岄潰鏄剧ず閫変腑鍊�
+                             btnState.Text = s;
+                             btnState.Tag = tag;
+                         }
 
-                        }, false);
-
+                     });
                     });
                 }
                 catch { }
@@ -1118,30 +1133,44 @@
             Loading loading = new Loading();
             frame.AddChidren(loading);
             loading.Start();
-            System.Threading.Tasks.Task.Run(() =>
+            CommonMethod.Current.SunThread(() =>
             {
                 try
                 {
-                    var userList =FuntionControlView.VideoDoorLock.VideDoorLockSend.Current.GetVideoDoorLockUserListInfo(device);
-                    List<string> userNameList = new List<string>();
-                    for (int i = 0; i < userList.Count; i++)
+                    var faceIdList = Send.Current.GetVideoDoorLockUserListInfo(device);
+                    CommonMethod.Current.MainThread(() =>
                     {
-                        var user = userList[i];
-                        userNameList.Add(user.extUserName);
-                    }
-                    Application.RunOnMainThread(() =>
-                    {
-                        loading.Hide();
-                        PublicInterface publicInterface = new PublicInterface();//鐢ㄦ埛鐣岄潰
-                        publicInterface.FrameOrVv(this, userNameList, new List<string> { btnState.Text }, device.name, (index) =>
-                        {
-                            var userId = userNameList[index];
-                            //鐣岄潰鏄剧ず閫変腑鍊�
-                            btnState.Text = userId;
-                            //鏁版嵁灏佽
-                            AddDictionary("open_user", userId, "string");
 
-                        }, false);
+                        loading.Hide();
+                        string stateValue = btnState.Tag == null ? "" : btnState.Tag.ToString();
+                        PublicInterface publicInterface = new PublicInterface();
+                        publicInterface.MultiSelectShow(this, faceIdList, device.name, stateValue, (indexeList) =>
+                        {
+                            if (indexeList.Count > 0)
+                            {
+                                dicSateteList.Clear();
+                                string s = string.Empty;
+                                string tag = string.Empty;
+                                for (int indexe = 0; indexe < indexeList.Count; indexe++)
+                                {
+                                    if (indexe > faceIdList.Count)
+                                    {
+                                        continue;
+                                    }
+                                    var face = faceIdList[indexe];
+                                    //鏁版嵁灏佽
+                                    AddDictionary("open_user", face.userId, "string");
+                                    s += face.userName;
+                                    s += ",";
+                                    tag += face.userId;
+                                    tag += "_";
+                                }
+                                //鐣岄潰鏄剧ず閫変腑鍊�
+                                btnState.Text = s;
+                                btnState.Tag = tag;
+                            }
+
+                        });
 
                     });
                 }
@@ -1267,16 +1296,45 @@
                 var dic = dictionaryB[i];
                 string key = dic["key"];
                 string comparatorValue = dic["comparator"];
+                string value = dic["value"];
                 if (dictionaryA["key"] == key && dictionaryA["comparator"] == comparatorValue)
                 {
-                    //鍒ゆ柇鏄惁瀛樺湪
-                    valueInt = i;
-                    break;
+                    if (this.checkSpk())
+                    {
+                        //鏈変簺璁惧闇�瑕佸鍔犺繖涓垽鏂�
+                        if (dictionaryA["value"] == value)
+                        {
+                            //鍒ゆ柇鏄惁瀛樺湪
+                            valueInt = i;
+                            break;
+                        }
+                    }
+                    else
+                    {
+                        //鍒ゆ柇鏄惁瀛樺湪
+                        valueInt = i;
+                        break;
+                    }
                 }
             }
             return valueInt;
         }
         /// <summary>
+        /// 妫�鏌ユ槸鍚︽敮鎸�
+        /// </summary>
+        /// <returns></returns>
+        private bool checkSpk()
+        {
+            if (this.function.spk == SPK.VideoDoorLock ||
+               this.function.spk == SPK.doorgate
+                )
+            {
+                return true;
+            }
+            return false;
+
+        }
+        /// <summary>
         /// 鍒ゆ柇dictionaryB鏄惁瀹屾暣鍖呭惈鍙︿竴涓猟ictionaryA
         /// </summary>
         /// <param name="dictionaryA"></param>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 58b303f..be9b2c6 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -409,22 +409,48 @@
                                     break;
                                 case SPK.VideoDoorLock:
                                     {
-                                        string value = this.GetValue(dicList);
-                                        inputView.btnState.Text = value;
+                                        string s = string.Empty;
+                                        string tag = string.Empty;
+                                        for (int b = 0; b < dicList.Count; b++)
+                                        {
+                                            var dic = dicList[b];
+                                            var userId = dic["value"].ToString();
+                                            var FaceItem = this.GetVideoDoorLockUserItem(userId, device);
+                                            s += FaceItem.userName;
+                                            s += ",";
+                                            tag += FaceItem.userId;
+                                            tag += "_";
+                                        }
+                                        inputView.btnState.Text = s;
                                     }
                                     break;
                                 case SPK.doorgate:
                                     {
+                                        string s = string.Empty;
                                         if (inputCondition.identifier == "door_call_cloud_event")
                                         {
-                                            inputView.btnState.Text = Language.StringByID(StringId.shipintonghuahujiao);
+                                            s = Language.StringByID(StringId.shipintonghuahujiao);
                                         }
                                         else
                                         {
-                                            string userId = this.GetKeyValue("user_id",dicList);
-                                            var FaceItem = this.GetFaceItem(userId, device.deviceId);
-                                            inputView.btnState.Text = FaceItem.userName;
+                                            for (int b = 0; b < dicList.Count; b++)
+                                            {
+                                                var dic = dicList[b];
+                                                var key = dic["key"].ToString();
+                                                if (key != "user_id")
+                                                {
+                                                    continue;
+                                                }
+                                                var userId = dic["value"].ToString();
+                                                var FaceItem = this.GetFaceItem(userId, device.deviceId);
+                                                s += FaceItem.userName;
+                                                s += ",";
+                                            }
+                                            //string userId = this.GetKeyValue("user_id",dicList);
+                                            //var FaceItem = this.GetFaceItem(userId, device.deviceId);
+                                            //inputView.btnState.Text = FaceItem.userName;
                                         }
+                                        inputView.btnState.Text = s;
                                     }
                                     break;
                                 case SPK.IpCam_Imou:
@@ -1499,7 +1525,7 @@
                 //寮�鍏崇伅鍏�
                 case SPK.AirSwitch:
                 case SPK.LightSwitch:
-                    //鏈烘鎵�
+                //鏈烘鎵�
                 case SPK.MechanicalArm:
                     {
                         foreach (var dic in dicList)
@@ -2139,11 +2165,20 @@
                     break;
                 case SPK.VideoDoorLock:
                     {
-                        foreach (var dic in dicList)
+                        string s = string.Empty;
+                        string tag = string.Empty;
+                        for (int b = 0; b < dicList.Count; b++)
                         {
-                            string value = dic["value"];
-                            button1.Text = value;
+                            var dic = dicList[b];
+                            var userId = dic["value"].ToString();
+                            var FaceItem = this.GetVideoDoorLockUserItem(userId, device);
+                            s += FaceItem.userName;
+                            s += ",";
+                            tag += FaceItem.userId;
+                            tag += "_";
                         }
+                        button1.Text = s;
+                        button1.Tag = tag;
                     }
                     break;
                 case SPK.MusicStandard:
@@ -2164,11 +2199,28 @@
                     break;
                 case SPK.doorgate:
                     {
-                        string value = this.GetKeyValue("user_id", dicList);
-                        button2.Text = this.GetFaceItem(value, device.deviceId).userName;
+                        string s = string.Empty;
+                        string tag = string.Empty;
+                        for (int b = 0; b < dicList.Count; b++)
+                        {
+                            var dic = dicList[b];
+                            var key = dic["key"].ToString();
+                            if (key != "user_id")
+                            {
+                                continue;
+                            }
+                            var userId = dic["value"].ToString();
+                            var FaceItem = this.GetFaceItem(userId, device.deviceId);
+                            s += FaceItem.userName;
+                            s += ",";
+                            tag += FaceItem.userId;
+                            tag += "_";
+                        }
+                        button2.Text = s;
+                        button2.Tag = tag;
                     }
                     break;
-              
+
             }
         }
         /// <summary>
@@ -2635,7 +2687,7 @@
             }
         }
         /// <summary>
-        /// 鏌ユ壘鎸囧畾userId
+        /// 鏌ユ壘鎸囧畾鍙瀵硅userId
         /// </summary>
         /// <param name="userId"></param>
         /// <returns></returns> 
@@ -2652,6 +2704,24 @@
             }
             return face;
         }
+        /// <summary>
+        /// 鏌ユ壘鎸囧畾钀ょ煶瑙嗛闂ㄩ攣userId
+        /// </summary>
+        /// <param name="userId"></param>
+        /// <returns></returns> 
+        public Face GetVideoDoorLockUserItem(string userId, Function device)
+        {
+            if (Send.Current.VideoDoorLockUserListInfo.Count == 0)
+            {
+                Send.Current.GetVideoDoorLockUserListInfo(device);
+            }
+            var face = Send.Current.VideoDoorLockUserListInfo.Find((o) => { return o.userId == userId; });
+            if (face == null)
+            {
+                face = new Face();
+            }
+            return face;
+        }
 
     }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index 6435a0c..9ed7f66 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -1184,9 +1184,9 @@
                  //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 = "12345678933456", name = "闂ㄩ攣", spk = Entity.SPK.DoorLock },
-                      new Entity.Function { sid = "1234567895444", name = "瑙嗛闂ㄩ攣", spk = Entity.SPK.VideoDoorLock },
-                      //new Entity.Function { sid = "12345678968888", name = "pm10", spk = Entity.SPK.SensorPm10 },
+                    //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 = "pm10", spk = Entity.SPK.LightDimming },
                       //  new Entity.Function { sid = "1234567897", name = "姣背娉紶鎰熷櫒1", spk = Entity.SPK.SenesorMegahealth2 },
                       // new Entity.Function { sid = "1234567899", name = "闂ㄧ浼犳劅鍣�", spk = Entity.SPK.SensorDoorWindow },
                       //  new Entity.Function { sid = "12345678991234", name = "HDL鏈烘鎵�", spk = Entity.SPK.MechanicalArm },
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/FunTypeView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/FunTypeView.cs
index 7ef9350..fef3b95 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/FunTypeView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/FunTypeView.cs
@@ -26,7 +26,7 @@
             Gravity = Gravity.CenterVertical,
             TextAlignment = TextAlignment.CenterLeft,
         };
-       
+
         /// <summary>
         /// 锛堟潯浠舵垨鑰呯洰鏍囷級璁惧鐘舵�佹枃鏈弿杩�
         /// </summary>
@@ -39,7 +39,7 @@
             Y = Application.GetRealHeight(17),
             X = Application.GetRealWidth(375 - 48 - 130),
             TextAlignment = TextAlignment.CenterRight,
-            Text="",
+            Text = "",
         };
         /// <summary>
         /// 鍥炬爣
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
index 0dc90c0..a073cc9 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -156,6 +156,83 @@
         }
 
         /// <summary>
+        /// 澶氶�夋嫨
+        /// </summary>
+        /// <param name="frameLayout">鐖舵帶浠�</param>
+        /// <param name="list">鏄剧ず鏁版嵁婧�</param>
+        /// <param name="titleText"></param>
+        /// <param name="stateTextList">涔嬪墠鐘舵�佹枃鏈�</param>
+        /// <param name="action">杩斿洖绱㈠紩鍊煎垪琛�</param>
+        /// <param name="textSize">鏄剧ず鏂囨湰瀛椾綋澶у皬</param>
+        public void MultiSelectShow(FrameLayout frameLayout, List<Face> list, string titleText, string stateTexts, Action<List<int>> action, int textSize = LogicView.TextSize.text14)
+        {
+            LogicView.DateView view = new LogicView.DateView();
+            view.btnTitle.Text = titleText;
+            view.FLayoutView(frameLayout, list.Count);
+            view.btnCancel.MouseUpEventHandler += (sender, e) =>
+            {
+                //绉婚櫎fLayout鐣岄潰
+                view.frameLayout.RemoveFromParent();
+            };
+            List<int> intList = new List<int>();
+            for (int i = 0; i < list.Count; i++)
+            {
+                var  face= list[i];
+                LogicView.CheckView checkView = new LogicView.CheckView();
+                checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
+                checkView.btnText.TextSize = textSize;
+                view.frameLayout.AddChidren(checkView.FLayoutView());
+                checkView.btnText.Text = face.userName;
+                checkView.btnClick.Tag = i;//鏍囪
+
+                if (stateTexts.Contains(face.userId))
+                {
+                    //鏄剧ず涔嬪墠鐨勯�変腑鐘舵��
+                    checkView.btnCheckIcon.IsSelected = true;
+                    intList.Add(i);
+                }
+                //鐐瑰嚮浜嬩欢
+                checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
+                {
+
+                    int clickIndex =int.Parse(checkView.btnClick.Tag.ToString());
+                    checkView.btnClick.IsSelected = !checkView.btnClick.IsSelected;
+                    if (checkView.btnClick.IsSelected)
+                    {
+                        checkView.btnCheckIcon.IsSelected = true;
+                        if (!intList.Contains(clickIndex))
+                        {
+                            //娣诲姞閫変腑鏁版嵁
+                            intList.Add(clickIndex);
+                        }
+                    }
+                    else
+                    {
+                        checkView.btnCheckIcon.IsSelected = false;
+                        if (intList.Contains(clickIndex))
+                        {
+                            //绉婚櫎閫変腑鏁版嵁
+                            intList.Remove(clickIndex);
+                        }
+                    }
+
+                };
+
+            }
+            view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
+            {
+                if (intList.Count == 0)
+                {
+                    return;
+                }
+                action(intList);
+                //绉婚櫎fLayout鐣岄潰
+                view.frameLayout.RemoveFromParent();
+            };
+
+        }
+
+        /// <summary>
         /// 鏈�-澶氶�夋嫨
         /// </summary>
         /// <param name="frameLayout">鐖舵帶浠�</param>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
index fbf8818..8ea607a 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
@@ -23,6 +23,7 @@
             }
         }
         public List<Face> faceList = new List<Face>();
+        public List<Face> VideoDoorLockUserListInfo = new List<Face>();
         /// <summary>
         /// 璋冪敤鑾峰彇浣忓畢瀛愯处鍙峰垪琛�
         /// </summary>
@@ -494,6 +495,30 @@
 
         }
 
+        /// <summary> 
+        ///  鑾峰彇闂ㄩ攣鐢ㄦ埛鍒楄〃(钀ょ煶瑙嗛闂ㄩ攣)
+        /// </summary>
+        /// <param name="deviceId">璁惧</param>
+        /// <returns></returns>
+        public List<Face> GetVideoDoorLockUserListInfo(Function device)
+        {
+            var userList = FuntionControlView.VideoDoorLock.VideDoorLockSend.Current.GetVideoDoorLockUserListInfo(device);
+            List<Face> faceIdList = new List<Face>();
+            for (int i = 0; i < userList.Count; i++)
+            {
+                Face face = new Face();
+                var user = userList[i];
+                face.userId = user.extUserId;
+                face.userName = user.extUserName;
+                faceIdList.Add(face);
+            }
+            VideoDoorLockUserListInfo.Clear();
+            VideoDoorLockUserListInfo.AddRange(faceIdList);
+            return faceIdList;
+        }
+
+      
+
         /// <summary>
         ///璇锋眰鏈嶅姟鍣紙涓庝綇瀹呮湁鍏�:渚嬪锛沨omeId锛� 
         /// </summary>
diff --git a/ys/Jars/hdl_ezvizsdk.aar b/ys/Jars/hdl_ezvizsdk.aar
index 1c6af32..4bf94e5 100644
--- a/ys/Jars/hdl_ezvizsdk.aar
+++ b/ys/Jars/hdl_ezvizsdk.aar
Binary files differ

--
Gitblit v1.8.0