From ef0c6b76b06590b38f6e87d1e4efb35b81374502 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期一, 25 五月 2020 09:49:02 +0800
Subject: [PATCH] 请合并代码,优化逻辑执行提示和撤销门锁定时功能。

---
 ZigbeeApp20200519/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs |  124 +++++++++++++++++++++--------------------
 1 files changed, 64 insertions(+), 60 deletions(-)

diff --git a/ZigbeeApp20200519/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs b/ZigbeeApp20200519/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs
index de85ddf..63c7c0b 100644
--- a/ZigbeeApp20200519/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs
+++ b/ZigbeeApp20200519/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs
@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Text;
 using Newtonsoft.Json.Linq;
+using Shared.Common;
 using ZigBee.Device;
 
 namespace Shared.Phone.UserCenter
@@ -599,39 +600,36 @@
         /// </summary>
         /// <param name="receiveData"></param>
         private void DoorLockDeviceReportPush(JObject receiveData)
-        {
-            if (UserCenterResourse.UserInfo.AuthorityNo == 1)
-            {
-                var device = Common.LocalDevice.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint"));
-                if (device.Type != DeviceType.DoorLock)
-                {
-                    //瀹冧笉鏄棬閿�
-                    return;
-                }
-
-                var info = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLockAlarmsResult>(receiveData["Data"].ToString());
-                if (info.Clusterid == 257)
-                {
-                    //216锛氶攣涓婅缃殑甯稿紑 
-                    if (info.AlarmCode == 216)
-                    {
-                        HdlThreadLogic.Current.RunThread(async () =>
-                        {
-                            HdlThreadLogic.Current.RunMain(() =>
-                           {
-                               //鏇存柊闂ㄩ攣娑夊強鐨勫父寮�/甯稿叧鐨勭晫闈�
-                               if (UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction != null)
-                               {
-                                   UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction(device.DeviceAddr + device.DeviceEpoint, true);
-                               }
-                           });
-                        });
-                    }
-                }
-                //鏄剧ず鏈夋柊娑堟伅鐨勭壒鏁�
-                this.ShowHadNewMessageAppeal();
-            }
-        }
+        {
+            if (UserCenterResourse.UserInfo.AuthorityNo == 1)
+            {
+                var device = Common.LocalDevice.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint"));
+                if (device.Type != DeviceType.DoorLock)
+                {
+                    //瀹冧笉鏄棬閿�
+                    return;
+                }
+
+                var info = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLockAlarmsResult>(receiveData["Data"].ToString());
+                if (info.Clusterid == 257)
+                {
+                    //216锛氶攣涓婅缃殑甯稿紑
+                    if (info.AlarmCode == 216)
+                    {
+                        HdlThreadLogic.Current.RunMain(() =>
+                        {
+                            //鏇存柊闂ㄩ攣娑夊強鐨勫父寮�/甯稿叧鐨勭晫闈�
+                            if (UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction != null)
+                            {
+                                UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction(device.DeviceAddr + device.DeviceEpoint, true);
+                            }
+                        });
+                    }
+                }
+                //鏄剧ず鏈夋柊娑堟伅鐨勭壒鏁�
+                this.ShowHadNewMessageAppeal();
+            }
+        }
         #endregion
 
         #region 鈻� 璁惧鍦ㄧ嚎鐘舵�佹洿鏂板弽棣坃______________
@@ -823,39 +821,45 @@
         private void LogicExecutePush(JObject receiveData)
         {
             //鏄剧ず鏈夋柊娑堟伅鐨勭壒鏁�
-            this.ShowHadNewMessageAppeal();
-
-            // 閫昏緫鎵ц甯稿紑妯″紡澶辨晥鐨勬儏鍐�
-            if (UserCenterResourse.UserInfo.AuthorityNo == 1)
-            {
-                //鑷姩鍖栨墽琛� 甯稿紑鍏抽棴
-                var data = Newtonsoft.Json.JsonConvert.DeserializeObject<LogicPushResult>(receiveData["Data"].ToString());
-                if (data != null && data.ActionData != null)
-                {
-                    var deviceAddr = data.ActionData.MacStr;
-                    var epoint = 1; //data.ActionData.Epoint;  闂ㄩ攣鍙戦�佹椂鏄�200锛屼絾鏄笂浼犳椂瑕佹妸鐪熷疄鐨勭鐐圭粰缃戝叧涓婃姤
-                    var device = Common.LocalDevice.Current.GetDevice(deviceAddr, epoint);
-                    if (device.Type != DeviceType.DoorLock)
-                    {
-                        return;
-                    }
+            this.ShowHadNewMessageAppeal();
 
-                    if (data.ActionData.Actiontype == 8 && data.ActionData.PassDataString == "055704010113")
-                    {
-                        HdlThreadLogic.Current.RunThread(async () =>
+            // 閫昏緫鎵ц甯稿紑妯″紡澶辨晥鐨勬儏鍐�
+            if (UserCenterResourse.UserInfo.AuthorityNo == 1)
+            {
+                //鑷姩鍖栨墽琛� 甯稿紑鍏抽棴
+                var data = Newtonsoft.Json.JsonConvert.DeserializeObject<LogicPushResult>(receiveData["Data"].ToString());
+                if (data != null && data.ActionData != null)
+                {
+                    if (data.ActionData.Actiontype == 8 && data.ActionData.PassDataString == "055704010113")
+                    {
+                        var deviceAddr = data.ActionData.MacStr;
+                        var device = Common.LocalDevice.Current.GetDevicesByMac(deviceAddr, false);
+                        if (device.Count > 0 && device[0].Type != DeviceType.DoorLock)
+                        {
+                            return;
+                        }
+
+                        HdlThreadLogic.Current.RunThread(async () =>
                         {
-                            var result = await Shared.Phone.Device.Logic.SkipView.Exist(3, (ZigBee.Device.DoorLock)device);
                             HdlThreadLogic.Current.RunMain(() =>
                             {
-                                //寮瑰嚭寰愭鐨勯偅涓獥鍙�
-                                DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidDialog((ZigBee.Device.DoorLock)device, DoorLock.DoorLockCommonInfo.DoorLockMessType.ServicePush,
-                                    result != 0 ? true : false, ControlCommonResourse.UpdateDoorLockStatusAction);
+                                //鎻愮ず闂ㄩ攣宸茬粡澶辨晥
+                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.NormallyClosed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
                             });
-                        });
-                    }
-                }
+
+                            //鏇存柊闂ㄩ攣鐨勬繁搴︽帶鍒堕〉
+                            ControlCommonResourse.UpdateDoorLockStatusAction?.Invoke(false);
+
+                            //閫昏緫鎵ц鐨勫け鏁堣鏇存柊鐘舵��
+                            if (DoorLock.DoorLockCommonInfo.LogicAction != null)
+                            {
+                                DoorLock.DoorLockCommonInfo.LogicAction(false);
+                            }
+                        });
+                    }
+                }
             }
-        }
+        }
         #endregion
 
         #region 鈻� 鍦烘櫙瑙﹀彂涓婃姤_______________________

--
Gitblit v1.8.0