HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-12-14 e90209beae6a4e822cecb18e6889f8bda23f630e
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAlarmsLogic.cs
File was renamed from ZigbeeApp/Shared/Phone/Common/Logic/HdlAlarmsLogic.cs
@@ -4,7 +4,7 @@
using Shared.Common;
using ZigBee.Device;
namespace Shared.Phone
namespace Shared.Phone.UserCenter
{
    /// <summary>
    /// 报警类的逻辑
@@ -59,7 +59,7 @@
            string fileName = DateTime.Now.ToString("yyyyMMdd");
            //安防报警
            string fullName = System.IO.Path.Combine(HdlFileNameResourse.SafeguardAlarmDirectory, fileName);
            string fullName = System.IO.Path.Combine(DirNameResourse.SafeguardAlarmDirectory, fileName);
            var data1 = HdlFileLogic.Current.ReadFileByteContent(fullName);
            if (data1 != null)
            {
@@ -71,7 +71,7 @@
            }
            //门锁记录
            fullName = System.IO.Path.Combine(HdlFileNameResourse.DoorLockAlarmDirectory, fileName);
            fullName = System.IO.Path.Combine(DirNameResourse.DoorLockAlarmDirectory, fileName);
            var data2 = HdlFileLogic.Current.ReadFileByteContent(fullName);
            if (data2 != null)
            {
@@ -128,19 +128,19 @@
                //限制它的长度
                this.listSafetyAlarmInfo.Insert(0, data);
                if (this.listSafetyAlarmInfo.Count > HdlUserCenterResourse.ResidenceOption.SafetyOnedayMaxAlarmMsgCount)
                if (this.listSafetyAlarmInfo.Count > UserCenterResourse.ResidenceOption.SafetyOnedayMaxAlarmMsgCount)
                {
                    this.listSafetyAlarmInfo.RemoveAt(this.listSafetyAlarmInfo.Count - 1);
                }
                //保存到本地
                string fullName = System.IO.Path.Combine(HdlFileNameResourse.SafeguardAlarmDirectory, fileName);
                string fullName = System.IO.Path.Combine(DirNameResourse.SafeguardAlarmDirectory, fileName);
                HdlFileLogic.Current.SaveFileContent(fullName, this.listSafetyAlarmInfo);
                var form = HdlFormLogic.Current.GetFormByName("SafetyManagementMainForm");
                if (form != null)
                if (UserCenterResourse.DicActionForm.ContainsKey("SafetyManagementMainForm") == true)
                {
                    ((UserCenter.Safety.SafetyManagementMainForm)form).AddSafeguardLogPushRow(device);
                    var form = (Phone.UserCenter.Safety.SafetyManagementMainForm)UserCenterResourse.DicActionForm["SafetyManagementMainForm"];
                    form?.AddSafeguardLogPushRow(device);
                }
                return true;
            }
@@ -202,13 +202,13 @@
                //限制它的长度
                this.listSafetyAlarmInfo.Insert(0, data);
                if (this.listSafetyAlarmInfo.Count > HdlUserCenterResourse.ResidenceOption.SafetyOnedayMaxAlarmMsgCount)
                if (this.listSafetyAlarmInfo.Count > UserCenterResourse.ResidenceOption.SafetyOnedayMaxAlarmMsgCount)
                {
                    this.listSafetyAlarmInfo.RemoveAt(this.listSafetyAlarmInfo.Count - 1);
                }
                //保存到本地
                string fullName = System.IO.Path.Combine(HdlFileNameResourse.SafeguardAlarmDirectory, fileName);
                string fullName = System.IO.Path.Combine(DirNameResourse.SafeguardAlarmDirectory, fileName);
                HdlFileLogic.Current.SaveFileContent(fullName, this.listSafetyAlarmInfo);
            }
        }
@@ -237,7 +237,7 @@
        {
            lock (listSafetyAlarmInfo)
            {
                string fullPath = HdlFileNameResourse.SafeguardAlarmDirectory;
                string fullPath = DirNameResourse.SafeguardAlarmDirectory;
                //获取指定目录下面的文件
                List<string> listFile = HdlFileLogic.Current.GetFileFromDirectory(fullPath);
                //升序
@@ -254,7 +254,7 @@
                    var listInfo = new List<SafeguardAlarmInfo>();
                    for (int j = 0; j < info.Count; j++)
                    {
                        if (j == HdlUserCenterResourse.ResidenceOption.SafetyOnedayMaxAlarmMsgCount)
                        if (j == UserCenterResourse.ResidenceOption.SafetyOnedayMaxAlarmMsgCount)
                        {
                            //每天最多三十条数据
                            break;
@@ -263,7 +263,7 @@
                    }
                    dic[listFile[i]] = listInfo;
                    if (dic.Count == HdlUserCenterResourse.ResidenceOption.SafetyMaxAlarmMsgDay)
                    if (dic.Count == UserCenterResourse.ResidenceOption.SafetyMaxAlarmMsgDay)
                    {
                        //只要三天的量
                        break;
@@ -289,9 +289,9 @@
            {
                return null;
            }
            string mainkey = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(i_device);
            string mainkey = Common.LocalDevice.Current.GetDeviceMainKeys(i_device);
            //因为推送的是虚拟的设备,所以去获取真实物理设备
            CommonDevice device = HdlDeviceCommonLogic.Current.GetDevice(mainkey);
            CommonDevice device = Common.LocalDevice.Current.GetDevice(mainkey);
            if (device == null)
            {
                return null;
@@ -435,7 +435,7 @@
        /// <param name="jobject"></param>
        public bool SaveDoorLockAlarmInfo(Newtonsoft.Json.Linq.JObject jobject)
        {
            var device = HdlDeviceCommonLogic.Current.GetDevice(jobject.Value<string>("DeviceAddr"), jobject.Value<int>("Epoint"));
            var device = Common.LocalDevice.Current.GetDevice(jobject.Value<string>("DeviceAddr"), jobject.Value<int>("Epoint"));
            if ((device is ZigBee.Device.DoorLock) == false)
            {
                //它不是门锁
@@ -461,13 +461,13 @@
                //限制它的长度
                this.listDoorLockAlarmInfo.Insert(0, msgInfo);
                if (this.listDoorLockAlarmInfo.Count > HdlUserCenterResourse.ResidenceOption.DoorLockOnedayMaxAlarmMsgCount)
                if (this.listDoorLockAlarmInfo.Count > UserCenterResourse.ResidenceOption.DoorLockOnedayMaxAlarmMsgCount)
                {
                    this.listDoorLockAlarmInfo.RemoveAt(this.listDoorLockAlarmInfo.Count - 1);
                }
                //保存到本地
                string fullName = System.IO.Path.Combine(HdlFileNameResourse.DoorLockAlarmDirectory, fileName);
                string fullName = System.IO.Path.Combine(DirNameResourse.DoorLockAlarmDirectory, fileName);
                HdlFileLogic.Current.SaveFileContent(fullName, this.listDoorLockAlarmInfo);
                return true;
@@ -482,7 +482,7 @@
        {
            lock (listDoorLockAlarmInfo)
            {
                string fullPath = HdlFileNameResourse.DoorLockAlarmDirectory;
                string fullPath = DirNameResourse.DoorLockAlarmDirectory;
                //获取指定目录下面的文件
                List<string> listFile = HdlFileLogic.Current.GetFileFromDirectory(fullPath);
                //升序
@@ -499,7 +499,7 @@
                    var listInfo = new List<DeviceAlarmInfo>();
                    for (int j = 0; j < info.Count; j++)
                    {
                        if (j == HdlUserCenterResourse.ResidenceOption.DoorLockOnedayMaxAlarmMsgCount)
                        if (j == UserCenterResourse.ResidenceOption.DoorLockOnedayMaxAlarmMsgCount)
                        {
                            //每天最多三十条数据
                            break;
@@ -508,7 +508,7 @@
                    }
                    dic[listFile[i]] = listInfo;
                    if (dic.Count == HdlUserCenterResourse.ResidenceOption.DoorLockMaxAlarmMsgDay)
                    if (dic.Count == UserCenterResourse.ResidenceOption.DoorLockMaxAlarmMsgDay)
                    {
                        //只要三天的量
                        break;