/// <summary> /// 初始化设备信息 /// </summary> public void InitDevInfo(bool isUpgradeFireDev = true) { Log.Info(LogTags.DbInit, "导入设备信息"); string filePath = GetBasicDevBackupDir() + "DevInfoBackup.xml"; bool value = DevInfoHelper.ImportDevInfoFromFile(filePath, _bll); Log.Info(LogTags.DbInit, string.Format("导入设备信息结果:{0}", value)); Log.Info(LogTags.DbInit, "导入门禁信息"); string doorAccessFilePath = GetBasicDevBackupDir() + "DoorAccessBackup.xml"; bool valueSub = DevInfoHelper.ImportDoorAccessInfoFromFile(doorAccessFilePath, _bll); Log.Info(LogTags.DbInit, string.Format("导入门禁信息结果:{0}", valueSub)); Log.Info(LogTags.DbInit, "导入摄像头信息"); string cameraFilePath = GetBasicDevBackupDir() + "CameraInfoBackup.xml"; bool valueCamera = DevInfoHelper.ImportCameraInfoFromFile(cameraFilePath, _bll); Log.Info(LogTags.DbInit, string.Format("导入摄像头信息结果:{0}", valueCamera)); if (isUpgradeFireDev) { Log.Info(LogTags.DbInit, "导入消防信息"); string FireFightDevfilePath = GetBasicDevBackupDir() + "FireFightInfoBackup.xml"; bool valueFireFightDev = DevInfoHelper.ImportFireFightDevInfoFromFile(FireFightDevfilePath, _bll); Log.Info(LogTags.DbInit, string.Format("导入设备信息结果:{0}", valueFireFightDev)); } }
/// <summary> /// 删除重复设备 /// </summary> public void ClearRepeatDev(string tag) { Log.Info(tag, "删除重复设备信息start..."); var value = DevInfoHelper.ClearRepeatDev(_bll, tag); Log.Info(tag, string.Format("删除重复设备信息结果:{0}", value)); }
/// <summary> /// 初始化设备信息 /// </summary> private void InitDevInfo() { Log.Info("导入设备信息"); string basePath = AppDomain.CurrentDomain.BaseDirectory; string filePath = basePath + "Data\\设备信息\\DevInfoBackup.xml"; bool value = DevInfoHelper.ImportDevInfoFromFile(filePath, DevInfos); Log.Info(string.Format("导入设备信息信息结果:{0}", value)); }
/// <summary> /// 导入设备监控节点 /// </summary> private void InitDevMonitorNode() { Log.Info(LogTags.DbInit, "导入设备监控节点"); string basePath = AppDomain.CurrentDomain.BaseDirectory; Log.Info(LogTags.DbInit, "BaseDirectory:" + basePath); //string filePath = basePath + "Data\\KKS\\EDOS.xls"; string filePath = basePath + "Data\\KKS\\" + DbModel.AppSetting.ParkName + "\\EDOS_New.xls"; DevInfoHelper.ImportDevMonitorNodeFromFile <DevMonitorNode>(new FileInfo(filePath), false); }
private void InitDevMonitorNode() { //导入设备监控节点 Log.Info("导入设备监控节点"); string basePath = AppDomain.CurrentDomain.BaseDirectory; Log.Info("BaseDirectory:" + basePath); string filePath = basePath + "Data\\EDOS.xls"; DevInfoHelper.ImportDevMonitorNodeFromFile <DevMonitorNode>(new FileInfo(filePath)); }
/// <summary> /// 将分析出来保存的测点信息(EDOS_New.xls)保存到数据库中 /// </summary> public static void SaveMonitorPoint() { try { DateTime start = DateTime.Now; Log.Info(LogTags.KKS, "导入设备监控节点"); string basePath = AppDomain.CurrentDomain.BaseDirectory; Log.Info(LogTags.KKS, "BaseDirectory:" + basePath); //string filePath = basePath + "Data\\KKS\\EDOS.xls"; string filePath = basePath + "Data\\KKS\\EDOS_New.xls"; DevInfoHelper.ImportDevMonitorNodeFromFile <DbModel.Location.AreaAndDev.DevMonitorNode>( new FileInfo(filePath), true); TimeSpan time = DateTime.Now - start; Log.Info(LogTags.KKS, string.Format("【3】【SaveMonitorPoint】完成 用时:{0}", time)); } catch (Exception ex) { Log.Error(LogTags.KKS, "导入测点失败:" + ex.Message); } }
private void MenuRemoveArchor_Click(object sender, RoutedEventArgs e) { DevInfoHelper.RemoveArchorDev(); MessageBox.Show("完成"); }
/// <summary> /// 重新分析测点数据,原来未找到kks的进行二次深入分析 /// </summary> public static void ReParseMonitPoint(bool fromFile) { DateTime start = DateTime.Now; Log.Info(LogTags.KKS, "重新分析设备监控节点"); Bll bll = new Bll(); List <DbModel.Location.AreaAndDev.DevMonitorNode> monitors = null; if (fromFile) //从文件读取 { string basePath = AppDomain.CurrentDomain.BaseDirectory; Log.Info(LogTags.KKS, "BaseDirectory:" + basePath); string filePath = basePath + "Data\\KKS\\EDOS_New.xls"; monitors = DevInfoHelper.CreateDevMonitorNodeListFromFile <DbModel.Location.AreaAndDev.DevMonitorNode>( new FileInfo(filePath)); } else //从数据库读取 { monitors = bll.DevMonitorNodes.ToList(); } var kksCodes = bll.KKSCodes.ToListEx(); var kksDict = KKSCode.ToDict(kksCodes); for (int i = 0; i < monitors.Count; i++) { DbModel.Location.AreaAndDev.DevMonitorNode monitor = monitors[i]; if (i > 0) { monitor.PreNode = monitors[i - 1]; } if (i < monitors.Count - 1) { monitor.NextMode = monitors[i + 1]; } if (kksDict.ContainsKey(monitor.ParentKKS)) { monitor.KKSCode = kksDict[monitor.ParentKKS]; } } var monitors1 = monitors.Where(i => i.ParseResult == "0").ToList(); var monitors2 = monitors.Where(i => i.ParseResult == "1").ToList(); var monitors31 = monitors.Where(i => i.ParseResult == "-1").ToList(); var monitors311 = monitors31.Where(i => i.Unit != "").ToList(); var monitors32 = monitors.Where(i => i.ParseResult == "-2").ToList(); var monitors321 = monitors32.Where(i => i.Unit != "").ToList(); var monitors4 = monitors.Where(i => i.ParseResult.ToInt() > 1).ToList(); List <DbModel.Location.AreaAndDev.DevMonitorNode> editMonitorNodes = new List <DbModel.Location.AreaAndDev.DevMonitorNode>(); for (int i = 0; i < monitors4.Count; i++) { DbModel.Location.AreaAndDev.DevMonitorNode monitorNode = monitors4[i]; try { var parentCode = monitorNode.ParentKKS; TagToKKSInfo info = KKSCodeHelper.ReParese(kksCodes, monitorNode.ParentKKS, monitorNode.KKS); var code = info.GetParentCode(); if (info.Type == 1 || info.Type == 0) { monitorNode.ParentKKS = code; monitorNode.ParseResult = "1"; //这里统一为1 editMonitorNodes.Add(monitorNode); Log.Info(LogTags.KKS, string.Format("解析测点:{0}=>{1}[{2}],({3}/{4})", parentCode, code, info.KKS, i, monitors4.Count)); } else { if (monitorNode.PreNode != null) { if (monitorNode.PreNode.KKSCode != null) { var kksCode = monitorNode.PreNode.KKSCode.GetAncestor("系统"); if (kksCode != null) { monitorNode.ParentKKS = kksCode.Code; monitorNode.ParseResult = "1"; //感觉这里要区分开来了 editMonitorNodes.Add(monitorNode); } else { Log.Info(LogTags.KKS, string.Format("monitorNode.PreNode.KKSCode 未找到系统节点:{0}", monitorNode.PreNode.KKSCode)); } } else { Log.Info(LogTags.KKS, string.Format("monitorNode.PreNode.KKSCode == null:{0}", monitorNode.PreNode)); } } else { } } } catch (Exception e) { Log.Error(LogTags.KKS, monitorNode + "\n" + e + ""); } } bll.DevMonitorNodes.EditRange(editMonitorNodes); TimeSpan time = DateTime.Now - start; Log.Info(LogTags.KKS, string.Format("【4】【ReParseMonitPoint】完成 用时:{0}", time)); }