wjc
2023-04-11 f2b2a70331d574a345cab0906d4d4b0de48c38b1
2023年04月11日17:01:15

自动化输入条件可视对讲,萤石门锁视频支持配置多个用户。
8个文件已修改
336 ■■■■ 已修改文件
HDL_ON/DAL/Server/HttpUtil.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs 130 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs 94 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/FunTypeView.cs 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ys/Jars/hdl_ezvizsdk.aar 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/HttpUtil.cs
@@ -18,8 +18,8 @@
        /// 固定域名,正式环境
        /// 公共域名就近解析
        /// </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
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) =>
                        publicInterface.MultiSelectShow(this, faceIdList, device.name, stateValue, (indexeList) =>
                        {
                            var face = faceIDList[index];
                            //界面显示选中值
                            btnState.Text = face.userName;
                         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)
                {
                    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是否完整包含另一个dictionaryA
        /// </summary>
        /// <param name="dictionaryA"></param>
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:
@@ -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,8 +2199,25 @@
                    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;
              
@@ -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;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -1184,9 +1184,9 @@
                 //new Entity.Function { sid = "1234567890", name = "超声波传感器", 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 },
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/FunTypeView.cs
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>
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>
@@ -495,6 +496,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>
        ///请求服务器(与住宅有关:例如;homeId) 
        /// </summary>
        /// <param name="o">发送数据</param>
ys/Jars/hdl_ezvizsdk.aar
Binary files differ