lss
2020-06-12 9c16d3614d9b88c637f967518a329f239fcd3aaf
ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs
@@ -13,7 +13,7 @@
        /// <summary>
        /// 其它界面跳进来的入口
        /// </summary>
        public static void SkipAddLogic(int intvalue, DoorLock doorLock = null, UserCenter.MemberInfoRes accountObj = null)
        public async static void SkipAddLogic(int intvalue, DoorLock doorLock = null, UserCenter.MemberInfoRes accountObj = null)
        {
            /// 0.正常自动化;1.门锁自动化;2.Sone门锁;
            switch (intvalue)
@@ -30,7 +30,6 @@
                        UserView.HomePage.Instance.AddChidren(addLogicPage);
                        UserView.HomePage.Instance.PageIndex += 1;
                        addLogicPage.Show();
                    }
                    break;
                case 1:
@@ -60,12 +59,10 @@
                        doorLockLogicList.Show();
                    }
                    break;
            }
        }
        #region ◆ 自动化__________________________
        /// <summary>
        /// 自动化功能代码入口
@@ -716,9 +713,16 @@
            timeConditionsInfo.Add("EnDelay", "0");
            timeConditionsInfo.Add("DelayTime", "0");
            timeConditionsInfo.Add("StartHour", h);
            timeConditionsInfo.Add("StartMin", m);
            timeConditionsInfo.Add("DoorLockOpenDelayTime", (timeVlaue*60*60).ToString());
            //timeConditionsInfo.Add("DoorLockOpenDelayTime", (timeVlaue * 3600).ToString());
            timeConditionsInfo.Add("StartMin", m);
            if (UserCenter.UserCenterResourse.HideOption.DoorLockNomallyOpenTimeMode == 1)
            {
                //强制变更时间模式为分钟
                timeConditionsInfo.Add("DoorLockOpenDelayTime", (timeVlaue * 60).ToString());
            }
            else
            {
                timeConditionsInfo.Add("DoorLockOpenDelayTime", (timeVlaue * 3600).ToString());
            }
            Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
            actionsInfo.Add("LinkType", 8);
            actionsInfo.Add("DeviceAddr", common.DeviceAddr);
@@ -756,37 +760,32 @@
        /// </summary>
        public static async System.Threading.Tasks.Task<int> Exist(int valueInt, ZigBee.Device.DoorLock doorLock)
        {
            int exist = 0;
            var Idlist = await Send.GetLogicId(valueInt);
            if (Idlist.Count != 0)
            var IdList = await Send.GetLogicId(valueInt);
            if (IdList.Count != 0)
            {
                //默认取第一个逻辑ID
                var id = Idlist[0];
                if (valueInt != 3)
                for (int i = 0; i < IdList.Count; i++)
                {
                    exist = id;
                }
                else
                {
                    var logic = await Send.GetLogic(id, 3);
                    var id = IdList[i];
                    var logic = await Send.GetLogic(id, valueInt);
                    if (logic != null)
                    {
                        if (ExistLogic(logic, doorLock))
                        {
                            exist = id;
                        }
                        else
                        {
                            exist = 0;
                            ///找到退出
                            break;
                        }
                    }
                }
            }
            return exist;
        }
        ///<summary>
        ///获取门锁逻辑信息
        ///获取门锁时效性逻辑信息
        /// 返回值:null不存在;其它值都存在;
        /// </summary>
        public static async System.Threading.Tasks.Task<Common.Logic> GetLogicIfon(ZigBee.Device.DoorLock doorLock)
@@ -810,14 +809,12 @@
        ///删除该门锁所有时效性自动化
        /// 返回值:true成功;false失败;
        /// </summary>
        public static async System.Threading.Tasks.Task<bool> GetLogicAll(ZigBee.Device.DoorLock doorLock)
        public static async System.Threading.Tasks.Task<bool> DelAllLogic(ZigBee.Device.DoorLock doorLock)
        {
            bool _if = false;
            var Idlist = await Send.GetLogicId(3);
            if (Idlist.Count != 0)
            {
                _if = true;
                for (int i = 0; i < Idlist.Count; i++)
                {
                    int id = Idlist[i];
@@ -828,7 +825,16 @@
                        {
                            //本来只有一条时效性自动化,
                            //防止特殊情况,找到就删除掉;
                            //var valueInt = await Send.DelLogic(id);
                            //if (valueInt == 0)
                            //{
                            //    _if = true;
                            //}
                            //(考虑性能默认删除成功,直接返回成功结果true)
                            _if = true;
                            Send.DelLogic(id);
                        }
                    }
                }
@@ -844,7 +850,7 @@
        {
            for (int j = 0; j < logic.Accounts.Count; j++)
            {
                //Option4是设备mac;Option2是设备端口;
                //Option4是设备mac;
                if (logic.Accounts[j]["Option4"].ToString() == doorLock.DeviceAddr)
                {
                    //查找是否是那个门锁;