From 52e82dcdc401782b58ed50bc14ae270b143370a9 Mon Sep 17 00:00:00 2001
From: LAPTOP-T815PCOQ\25526 <mr.liuyang@126.com>
Date: 星期六, 11 一月 2025 08:35:52 +0800
Subject: [PATCH] 1.添加轴设定和细部设定

---
 /dev/null                                               |  104 -----------------
 SourceCode/Bond/BoounionPLC/BoounionPLC.rc              |    0 
 SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp          |   18 ++-
 SourceCode/Bond/BoounionPLC/Common.h                    |   58 +++++++++
 SourceCode/Bond/BoounionPLC/Resource.h                  |    0 
 SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj.filters |   42 +++++--
 SourceCode/Bond/BoounionPLC/stdafx.h                    |   18 +++
 SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj         |   14 +
 SourceCode/Bond/BoounionPLC/FileManager/IOManager.cpp   |    4 
 SourceCode/Bond/BoounionPLC/IOMonitoringDlg.h           |    2 
 SourceCode/Bond/BoounionPLC/IOMonitoringDlg.cpp         |   43 ++++---
 11 files changed, 154 insertions(+), 149 deletions(-)

diff --git a/SourceCode/Bond/BoounionPLC/BoounionPLC.rc b/SourceCode/Bond/BoounionPLC/BoounionPLC.rc
index a204a97..f97ba4a 100644
--- a/SourceCode/Bond/BoounionPLC/BoounionPLC.rc
+++ b/SourceCode/Bond/BoounionPLC/BoounionPLC.rc
Binary files differ
diff --git a/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj b/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj
index 164182d..c4d1ecc 100644
--- a/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj
+++ b/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj
@@ -197,9 +197,12 @@
     <ClInclude Include="AlarmMonitor.h" />
     <ClInclude Include="AlarmPopupDlg.h" />
     <ClInclude Include="ApredTreeCtrl.h" />
+    <ClInclude Include="AxisDetailSettingsDlg.h" />
+    <ClInclude Include="AxisSettingsDlg.h" />
     <ClInclude Include="BlButton.h" />
     <ClInclude Include="BoounionPLC.h" />
     <ClInclude Include="BoounionPLCDlg.h" />
+    <ClInclude Include="CBaseDlg.h" />
     <ClInclude Include="CBaseView.h" />
     <ClInclude Include="CMainContainer.h" />
     <ClInclude Include="Common.h" />
@@ -208,13 +211,12 @@
     <ClInclude Include="Context.h" />
     <ClInclude Include="CPageLogcat.h" />
     <ClInclude Include="DBManager\AlarmManager.h" />
-    <ClInclude Include="DBManager\AxisManager.h" />
     <ClInclude Include="DBManager\SystemLogManager.h" />
     <ClInclude Include="DBManager\UserManager.h" />
+    <ClInclude Include="FileManager\AxisManager.h" />
     <ClInclude Include="FileManager\IOManager.h" />
     <ClInclude Include="FileManager\pugiconfig.hpp" />
     <ClInclude Include="FileManager\pugixml.hpp" />
-    <ClInclude Include="FileManager\RecipeManager.h" />
     <ClInclude Include="InputDialog.h" />
     <ClInclude Include="Intent.h" />
     <ClInclude Include="IOMonitoringDlg.h" />
@@ -228,6 +230,7 @@
     <ClInclude Include="PagePlcList.h" />
     <ClInclude Include="PLC.h" />
     <ClInclude Include="PlcView.h" />
+    <ClInclude Include="RegexEdit.h" />
     <ClInclude Include="Resource.h" />
     <ClInclude Include="stdafx.h" />
     <ClInclude Include="targetver.h" />
@@ -241,9 +244,12 @@
     <ClCompile Include="AlarmMonitor.cpp" />
     <ClCompile Include="AlarmPopupDlg.cpp" />
     <ClCompile Include="ApredTreeCtrl.cpp" />
+    <ClCompile Include="AxisDetailSettingsDlg.cpp" />
+    <ClCompile Include="AxisSettingsDlg.cpp" />
     <ClCompile Include="BlButton.cpp" />
     <ClCompile Include="BoounionPLC.cpp" />
     <ClCompile Include="BoounionPLCDlg.cpp" />
+    <ClCompile Include="CBaseDlg.cpp" />
     <ClCompile Include="CBaseView.cpp" />
     <ClCompile Include="CMainContainer.cpp" />
     <ClCompile Include="Component.cpp" />
@@ -253,15 +259,14 @@
     <ClCompile Include="DBManager\AlarmManager.cpp">
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
     </ClCompile>
-    <ClCompile Include="DBManager\AxisManager.cpp" />
     <ClCompile Include="DBManager\SystemLogManager.cpp" />
     <ClCompile Include="DBManager\UserManager.cpp" />
+    <ClCompile Include="FileManager\AxisManager.cpp" />
     <ClCompile Include="FileManager\IOManager.cpp" />
     <ClCompile Include="FileManager\pugixml.cpp">
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
     </ClCompile>
-    <ClCompile Include="FileManager\RecipeManager.cpp" />
     <ClCompile Include="InputDialog.cpp" />
     <ClCompile Include="Intent.cpp" />
     <ClCompile Include="IOMonitoringDlg.cpp" />
@@ -275,6 +280,7 @@
     <ClCompile Include="PagePlcList.cpp" />
     <ClCompile Include="PLC.cpp" />
     <ClCompile Include="PlcView.cpp" />
+    <ClCompile Include="RegexEdit.cpp" />
     <ClCompile Include="stdafx.cpp">
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
diff --git a/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj.filters b/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj.filters
index 1f13872..d3f05ab 100644
--- a/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj.filters
+++ b/SourceCode/Bond/BoounionPLC/BoounionPLC.vcxproj.filters
@@ -117,9 +117,6 @@
     <ClInclude Include="DBManager\AlarmManager.h">
       <Filter>DBManager</Filter>
     </ClInclude>
-    <ClInclude Include="DBManager\AxisManager.h">
-      <Filter>DBManager</Filter>
-    </ClInclude>
     <ClInclude Include="DBManager\SystemLogManager.h">
       <Filter>DBManager</Filter>
     </ClInclude>
@@ -141,13 +138,25 @@
     <ClInclude Include="FileManager\pugixml.hpp">
       <Filter>FileManager</Filter>
     </ClInclude>
-    <ClInclude Include="FileManager\RecipeManager.h">
-      <Filter>FileManager</Filter>
-    </ClInclude>
     <ClInclude Include="InputDialog.h">
       <Filter>澶存枃浠�</Filter>
     </ClInclude>
     <ClInclude Include="IOMonitoringDlg.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="FileManager\AxisManager.h">
+      <Filter>FileManager</Filter>
+    </ClInclude>
+    <ClInclude Include="AxisDetailSettingsDlg.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="AxisSettingsDlg.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="CBaseDlg.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="RegexEdit.h">
       <Filter>澶存枃浠�</Filter>
     </ClInclude>
   </ItemGroup>
@@ -236,9 +245,6 @@
     <ClCompile Include="DBManager\AlarmManager.cpp">
       <Filter>DBManager</Filter>
     </ClCompile>
-    <ClCompile Include="DBManager\AxisManager.cpp">
-      <Filter>DBManager</Filter>
-    </ClCompile>
     <ClCompile Include="DBManager\SystemLogManager.cpp">
       <Filter>DBManager</Filter>
     </ClCompile>
@@ -257,15 +263,27 @@
     <ClCompile Include="FileManager\pugixml.cpp">
       <Filter>FileManager</Filter>
     </ClCompile>
-    <ClCompile Include="FileManager\RecipeManager.cpp">
-      <Filter>FileManager</Filter>
-    </ClCompile>
     <ClCompile Include="InputDialog.cpp">
       <Filter>婧愭枃浠�</Filter>
     </ClCompile>
     <ClCompile Include="IOMonitoringDlg.cpp">
       <Filter>婧愭枃浠�</Filter>
     </ClCompile>
+    <ClCompile Include="FileManager\AxisManager.cpp">
+      <Filter>FileManager</Filter>
+    </ClCompile>
+    <ClCompile Include="AxisDetailSettingsDlg.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="AxisSettingsDlg.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="CBaseDlg.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="RegexEdit.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="BoounionPLC.rc">
diff --git a/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp b/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
index d7a9b20..060a46e 100644
--- a/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
+++ b/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
@@ -10,9 +10,11 @@
 #include "PlcView.h"
 #include "Log.h"
 #include "InputDialog.h"
+#include "AxisManager.h"
 #include "IOManager.h"
 
 // 测试
+#include "AxisSettingsDlg.h"
 #include "IOMonitoringDlg.h"
 
 
@@ -502,10 +504,13 @@
 		if (!strName.IsEmpty()) {
 			theApp.m_model.addPlc((LPTSTR)(LPCTSTR)strName, "192.168.1.188", 1001);
 
+			// 新建轴文件
+			AxisManager axisManager;
+			axisManager.SaveAxis((LPTSTR)(LPCTSTR)strName);
+
 			// 新建IO文件
-			IOManager io;
-			io.DefaultMachineData();
-			io.SaveToFile((LPTSTR)(LPCTSTR)strName);
+			IOManager ioManager;
+			ioManager.SaveToFile((LPTSTR)(LPCTSTR)strName);
 		}
 	}
 	else if (id == IDC_BUTTON_DELETE) {
@@ -518,9 +523,10 @@
 		// 测试 IO模块
 		CPLC* pPLC = theApp.m_model.getCurrentPlc();
 		if (pPLC != nullptr) {
-			CIOMonitoringDlg dlg;
-			dlg.SetPLC(pPLC);
-			dlg.SetIOManager(pPLC->getName());
+			//CIOMonitoringDlg dlg;
+			//dlg.DoModal();
+
+			CAxisSettingsDlg dlg;
 			dlg.DoModal();
 		}
 	}
diff --git a/SourceCode/Bond/BoounionPLC/Common.h b/SourceCode/Bond/BoounionPLC/Common.h
index 2143140..da71696 100644
--- a/SourceCode/Bond/BoounionPLC/Common.h
+++ b/SourceCode/Bond/BoounionPLC/Common.h
@@ -31,10 +31,12 @@
 #define PLC_VIEW_BACKGROUND				RGB(252, 252, 255)
 #define LOGCAT_BACKGROUND_COLOR			RGB(252, 252, 255)
 
+/* PLC页面颜色定义 */
+
 /* PLCVIEW按钮 */
-#define BTN_PLCVIEW_FRAME_NORMAL	RGB(88, 88, 88)
-#define BTN_PLCVIEW_FRAME_HOVER		RGB(88, 88, 88)
-#define BTN_PLCVIEW_FRAME_PRESS		RGB(88, 88, 88)
+#define BTN_PLCVIEW_FRAME_NORMAL		RGB(88, 88, 88)
+#define BTN_PLCVIEW_FRAME_HOVER			RGB(88, 88, 88)
+#define BTN_PLCVIEW_FRAME_PRESS			RGB(88, 88, 88)
 #define BTN_PLCVIEW_OFF_BKGND_NORMAL	RGB(255, 127, 39)
 #define BTN_PLCVIEW_OFF_BKGND_HOVER		RGB(255, 157, 59)
 #define BTN_PLCVIEW_OFF_BKGND_PRESS		RGB(255, 100, 29)
@@ -42,6 +44,56 @@
 #define BTN_PLCVIEW_ON_BKGND_HOVER		RGB(150, 250, 150)
 #define BTN_PLCVIEW_ON_BKGND_PRESS		RGB(50, 150, 50)
 
+/* 轴设定页面颜色定义 */
+
+/* 5个按钮页, 按钮背景色,正常状态*/
+#define BTN_PAGE_FACE_NORMAL_COLOR		RGB(0, 168, 0)
+#define BTN_PAGE_FACE_SELECT_COLOR		RGB(0, 232, 0)
+#define BTN_PAGE_TEXT_NORMAL_COLOR		RGB(22, 22, 22)
+#define BTN_PAGE_TEXT_SELECT_COLOR		RGB(22, 22, 22)
+
+/* JOG+, JOG-*/
+#define BTN_JOG_FRAME_NORMAL			RGB(88, 88, 88)
+#define BTN_JOG_FRAME_HOVER				RGB(88, 88, 88)
+#define BTN_JOG_FRAME_PRESS				RGB(88, 88, 88)
+#define BTN_JOG_BKGND_NORMAL			RGB(0, 232, 0)
+#define BTN_JOG_BKGND_HOVER				RGB(0, 222, 0)
+#define BTN_JOG_BKGND_PRESS				RGB(0, 168, 0)
+
+/* Sev按钮 */
+#define BTN_SEV_FRAME_NORMAL			RGB(88, 88, 88)
+#define BTN_SEV_FRAME_HOVER				RGB(88, 88, 88)
+#define BTN_SEV_FRAME_PRESS				RGB(88, 88, 88)
+#define BTN_SEV_BKGND_NORMAL			RGB(0, 232, 0)
+#define BTN_SEV_BKGND_HOVER				RGB(0, 222, 0)
+#define BTN_SEV_BKGND_PRESS				RGB(222, 0, 0)
+
+/* Stop按钮 */
+#define BTN_STOP_FRAME_NORMAL			RGB(88, 88, 88)
+#define BTN_STOP_FRAME_HOVER			RGB(88, 88, 88)
+#define BTN_STOP_FRAME_PRESS			RGB(88, 88, 88)
+#define BTN_STOP_BKGND_NORMAL			RGB(0, 168, 0)
+#define BTN_STOP_BKGND_HOVER			RGB(0, 138, 0)
+#define BTN_STOP_BKGND_PRESS			RGB(222, 0, 0)
+
+/* OPR 按钮 */
+#define BTN_OPR_FRAME_NORMAL			RGB(88, 88, 88)
+#define BTN_OPR_FRAME_HOVER				RGB(88, 88, 88)
+#define BTN_OPR_FRAME_PRESS				RGB(88, 88, 88)
+#define BTN_OPR_BKGND_NORMAL			RGB(222, 222, 222)
+#define BTN_OPR_BKGND_HOVER				RGB(208, 208, 222)
+#define BTN_OPR_BKGND_PRESS				RGB(0, 232, 0)
+
+/* 定位按钮 */
+#define BTN_POINT_FRAME_NORMAL			RGB(88, 88, 88)
+#define BTN_POINT_FRAME_HOVER			RGB(88, 88, 88)
+#define BTN_POINT_FRAME_PRESS			RGB(88, 88, 88)
+#define BTN_POINT_BKGND_NORMAL			RGB(222, 222, 222)
+#define BTN_POINT_BKGND_HOVER			RGB(208, 208, 222)
+#define BTN_POINT_BKGND_PRESS			RGB(0, 232, 0)
+
+/* 报警页面颜色定义 */
+
 /* 解除警告 按钮 */
 #define BTN_ALARM_OFF_FRAME_NORMAL		RGB(88, 88, 88)
 #define BTN_ALARM_OFF_FRAME_HOVER		RGB(88, 88, 88)
diff --git a/SourceCode/Bond/BoounionPLC/DBManager/AxisManager.cpp b/SourceCode/Bond/BoounionPLC/DBManager/AxisManager.cpp
deleted file mode 100644
index e3e1ae5..0000000
--- a/SourceCode/Bond/BoounionPLC/DBManager/AxisManager.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-#include "stdafx.h"
-#include "AxisManager.h"
-#include <sstream>
-#include <stdexcept>
-#include <mutex>
-
-// 静态成员初始化
-std::mutex AxisManager::m_mutex;
-
-// 获取单例实例
-AxisManager& AxisManager::getInstance() {
-    static AxisManager instance;
-    return instance;
-}
-
-AxisManager::AxisManager() : m_pDB(nullptr) {}
-
-AxisManager::~AxisManager() {
-    m_pDB = nullptr;
-}
-
-// 设置数据库连接
-void AxisManager::setDatabase(BL::Database* db) {
-    std::lock_guard<std::mutex> lock(m_mutex);
-    m_pDB = db;
-}
-
-// 初始化轴表和定位点表
-bool AxisManager::initializeTables() {
-    if (!m_pDB) {
-        throw std::runtime_error("Database connection is not set.");
-    }
-
-    const std::string createAxesTableQuery = R"(
-        CREATE TABLE IF NOT EXISTS axes (
-            axis_id INTEGER PRIMARY KEY,
-            axis_no TEXT NOT NULL,
-            description TEXT NOT NULL,
-            start_address TEXT,
-            jog_distance REAL,
-            manual_speed REAL,
-            max_manual_speed REAL,
-            min_manual_speed REAL,
-            auto_speed REAL,
-            max_auto_speed REAL,
-            min_auto_speed REAL,
-            acceleration_time REAL,
-            deceleration_time REAL
-        )
-    )";
-
-    const std::string createPositionsTableQuery = R"(
-        CREATE TABLE IF NOT EXISTS positions (
-            position_id INTEGER PRIMARY KEY AUTOINCREMENT,
-            axis_id INTEGER NOT NULL,
-            description TEXT,
-            position_value REAL,
-            plc_address TEXT,
-            FOREIGN KEY (axis_id) REFERENCES axes(axis_id)
-        )
-    )";
-
-    return m_pDB->executeQuery(createAxesTableQuery) && m_pDB->executeQuery(createPositionsTableQuery);
-}
-
-// 初始化默认数据
-bool AxisManager::initializeDefaultData() {
-    if (!m_pDB) {
-        throw std::runtime_error("Database connection is not set.");
-    }
-
-    for (int axisId = 1; axisId <= 12; ++axisId) {
-        std::ostringstream axisQuery;
-        axisQuery << "INSERT OR IGNORE INTO axes (axis_id, axis_no, description, start_address, jog_distance, manual_speed, "
-            << "max_manual_speed, min_manual_speed, auto_speed, max_auto_speed, min_auto_speed, acceleration_time, deceleration_time) "
-            << "VALUES (" << axisId << ", 'M" << axisId * 10 << "', '轴 " << axisId << "', 'D" << (5090 + axisId * 2) << "', "
-            << "0.5, 10.0, 20.0, 5.0, 15.0, 25.0, 10.0, 0.2, 0.3)";
-        m_pDB->executeQuery(axisQuery.str());
-    }
-
-    for (int axisId = 1; axisId <= 12; ++axisId) {
-        for (int positionIndex = 1; positionIndex <= 25; ++positionIndex) {
-            std::ostringstream positionQuery;
-            positionQuery << "INSERT OR IGNORE INTO positions (axis_id, description, position_value, plc_address) "
-                << "VALUES (" << axisId << ", '定位点 " << positionIndex << "', " << (positionIndex * 10.0) << ", "
-                << "'D" << (5240 + positionIndex * 2) << "')";
-            m_pDB->executeQuery(positionQuery.str());
-        }
-    }
-
-    return true;
-}
-
-// 添加或更新轴信息
-bool AxisManager::saveAxis(int axisId, const std::string& axisNo, const std::string& description,
-    const std::string& startAddress, double jogDistance, double manualSpeed,
-    double maxManualSpeed, double minManualSpeed, double autoSpeed,
-    double maxAutoSpeed, double minAutoSpeed, double accelerationTime,
-    double decelerationTime) {
-    if (!m_pDB) {
-        throw std::runtime_error("Database connection is not set.");
-    }
-
-    std::ostringstream query;
-    query << "INSERT INTO axes (axis_id, axis_no, description, start_address, jog_distance, manual_speed, "
-        << "max_manual_speed, min_manual_speed, auto_speed, max_auto_speed, min_auto_speed, acceleration_time, deceleration_time) "
-        << "VALUES (" << axisId << ", '" << axisNo << "', '" << description << "', '" << startAddress << "', "
-        << jogDistance << ", " << manualSpeed << ", " << maxManualSpeed << ", " << minManualSpeed << ", " << autoSpeed
-        << ", " << maxAutoSpeed << ", " << minAutoSpeed << ", " << accelerationTime << ", " << decelerationTime << ") "
-        << "ON CONFLICT(axis_id) DO UPDATE SET "
-        << "axis_no=excluded.axis_no, description=excluded.description, start_address=excluded.start_address, "
-        << "jog_distance=excluded.jog_distance, manual_speed=excluded.manual_speed, max_manual_speed=excluded.max_manual_speed, "
-        << "min_manual_speed=excluded.min_manual_speed, auto_speed=excluded.auto_speed, max_auto_speed=excluded.max_auto_speed, "
-        << "min_auto_speed=excluded.min_auto_speed, acceleration_time=excluded.acceleration_time, deceleration_time=excluded.deceleration_time";
-
-    std::lock_guard<std::mutex> lock(m_mutex);
-    return m_pDB->executeQuery(query.str());
-}
-
-// 获取单个轴信息
-std::vector<std::string> AxisManager::getAxis(int axisId) {
-    if (!m_pDB) {
-        throw std::runtime_error("Database connection is not set.");
-    }
-
-    std::ostringstream query;
-    query << "SELECT * FROM axes WHERE axis_id = " << axisId;
-
-    auto result = m_pDB->fetchResults(query.str());
-    return !result.empty() ? result[0] : std::vector<std::string>();
-}
-
-// 获取所有轴信息
-std::vector<std::vector<std::string>> AxisManager::getAllAxes() {
-    if (!m_pDB) {
-        throw std::runtime_error("Database connection is not set.");
-    }
-
-    return m_pDB->fetchResults("SELECT * FROM axes ORDER BY axis_id");
-}
-
-// 删除指定轴
-bool AxisManager::deleteAxis(int axisId) {
-    if (!m_pDB) {
-        throw std::runtime_error("Database connection is not set.");
-    }
-
-    std::ostringstream query;
-    query << "DELETE FROM axes WHERE axis_id = " << axisId;
-
-    std::lock_guard<std::mutex> lock(m_mutex);
-    return m_pDB->executeQuery(query.str());
-}
-
-// 添加或更新定位点
-bool AxisManager::savePosition(int axisId, const std::string& description, double positionValue, const std::string& plcAddress) {
-    if (!m_pDB) {
-        throw std::runtime_error("Database connection is not set.");
-    }
-
-    std::ostringstream query;
-    query << "INSERT INTO positions (axis_id, description, position_value, plc_address) VALUES ("
-        << axisId << ", '" << description << "', " << positionValue << ", '" << plcAddress << "') "
-        << "ON CONFLICT(axis_id) DO UPDATE SET "
-        << "description=excluded.description, position_value=excluded.position_value, plc_address=excluded.plc_address";
-
-    std::lock_guard<std::mutex> lock(m_mutex);
-    return m_pDB->executeQuery(query.str());
-}
-
-// 获取轴的所有定位点
-std::vector<std::vector<std::string>> AxisManager::getPositions(int axisId, int pageNumber, int pageSize) {
-    if (!m_pDB) {
-        throw std::runtime_error("Database connection is not set.");
-    }
-
-    int offset = (pageNumber - 1) * pageSize;
-    std::ostringstream query;
-    query << "SELECT * FROM positions WHERE axis_id = " << axisId << " LIMIT " << pageSize << " OFFSET " << offset;
-
-    return m_pDB->fetchResults(query.str());
-}
-
-// 获取定位点总数
-int AxisManager::getTotalPositionCount(int axisId) {
-    if (!m_pDB) {
-        throw std::runtime_error("Database connection is not set.");
-    }
-
-    std::ostringstream query;
-    query << "SELECT COUNT(*) FROM positions WHERE axis_id = " << axisId;
-
-    auto result = m_pDB->fetchResults(query.str());
-    return (!result.empty() && !result[0].empty()) ? std::stoi(result[0][0]) : 0;
-}
-
-// 删除指定定位点
-bool AxisManager::deletePosition(int positionId) {
-    if (!m_pDB) {
-        throw std::runtime_error("Database connection is not set.");
-    }
-
-    std::ostringstream query;
-    query << "DELETE FROM positions WHERE position_id = " << positionId;
-
-    std::lock_guard<std::mutex> lock(m_mutex);
-    return m_pDB->executeQuery(query.str());
-}
-
-// 获取所有的轴ID
-std::vector<int> AxisManager::getUsedAxisIds() {
-    if (!m_pDB) {
-        throw std::runtime_error("Database connection is not set.");
-    }
-
-    std::vector<int> usedAxisIds;
-    std::string query = "SELECT axis_id FROM axes ORDER BY axis_id";
-    auto results = m_pDB->fetchResults(query);
-
-    for (const auto& row : results) {
-        if (!row.empty()) {
-            usedAxisIds.push_back(std::stoi(row[0]));
-        }
-    }
-
-    return usedAxisIds;
-}
-
-// 获取所有轴的轴NO
-std::vector<std::string> AxisManager::getAllAxisNumbers() {
-    if (!m_pDB) {
-        throw std::runtime_error("Database connection is not set.");
-    }
-
-    std::vector<std::string> axisNumbers;
-    std::string query = "SELECT axis_no FROM axes ORDER BY axis_id";
-    auto results = m_pDB->fetchResults(query);
-
-    for (const auto& row : results) {
-        if (!row.empty()) {
-            axisNumbers.push_back(row[0]);
-        }
-    }
-
-    return axisNumbers;
-}
diff --git a/SourceCode/Bond/BoounionPLC/DBManager/AxisManager.h b/SourceCode/Bond/BoounionPLC/DBManager/AxisManager.h
deleted file mode 100644
index b0d65ca..0000000
--- a/SourceCode/Bond/BoounionPLC/DBManager/AxisManager.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef AXIS_MANAGER_H
-#define AXIS_MANAGER_H
-
-#include <string>
-#include <vector>
-#include <mutex>
-#include "Database.h"
-
-// 轴管理类
-class AxisManager {
-public:
-    // 获取单例实例
-    static AxisManager& getInstance();
-
-    // 设置数据库连接
-    void setDatabase(BL::Database* db);
-
-    // 初始化轴表和定位点表
-    bool initializeTables();
-
-    // 初始化默认数据
-    bool initializeDefaultData();
-
-    // 添加或更新轴信息
-    bool saveAxis(int axisId, const std::string& axisNo, const std::string& description,
-        const std::string& startAddress, double jogDistance, double manualSpeed,
-        double maxManualSpeed, double minManualSpeed, double autoSpeed,
-        double maxAutoSpeed, double minAutoSpeed, double accelerationTime,
-        double decelerationTime);
-
-    // 获取单个轴信息
-    std::vector<std::string> getAxis(int axisId);
-
-    // 获取所有轴信息
-    std::vector<std::vector<std::string>> getAllAxes();
-
-    // 删除指定轴
-    bool deleteAxis(int axisId);
-
-    // 添加或更新定位点
-    bool savePosition(int axisId, const std::string& description, double positionValue,
-        const std::string& plcAddress);
-
-    // 获取轴的所有定位点
-    std::vector<std::vector<std::string>> getPositions(int axisId, int pageNumber, int pageSize);
-
-    // 获取定位点总数
-    int getTotalPositionCount(int axisId);
-
-    // 删除指定定位点
-    bool deletePosition(int positionId);
-
-    // 获取所有的轴ID
-    std::vector<int> getUsedAxisIds();
-
-    // 获取所有轴的轴NO
-    std::vector<std::string> getAllAxisNumbers();
-
-private:
-    // 私有构造函数和析构函数
-    AxisManager();
-    ~AxisManager();
-
-    // 禁止拷贝和赋值
-    AxisManager(const AxisManager&) = delete;
-    AxisManager& operator=(const AxisManager&) = delete;
-
-    // 数据库连接
-    BL::Database* m_pDB;
-
-    // 线程安全锁
-    static std::mutex m_mutex;
-};
-
-#endif // AXIS_MANAGER_H
\ No newline at end of file
diff --git a/SourceCode/Bond/BoounionPLC/FileManager/IOManager.cpp b/SourceCode/Bond/BoounionPLC/FileManager/IOManager.cpp
index 174b4d2..18815ab 100644
--- a/SourceCode/Bond/BoounionPLC/FileManager/IOManager.cpp
+++ b/SourceCode/Bond/BoounionPLC/FileManager/IOManager.cpp
@@ -154,6 +154,10 @@
 		return;
 	}
 
+	if (m_vecMachines.empty()) {
+		DefaultMachineData();
+	}
+
 	for (const auto& entry : m_vecMachines) {
 		file << entry.inputAddress << ","
 			<< entry.inputDescription << ","
diff --git a/SourceCode/Bond/BoounionPLC/FileManager/RecipeManager.cpp b/SourceCode/Bond/BoounionPLC/FileManager/RecipeManager.cpp
deleted file mode 100644
index 7507ea2..0000000
--- a/SourceCode/Bond/BoounionPLC/FileManager/RecipeManager.cpp
+++ /dev/null
@@ -1,314 +0,0 @@
-#include "stdafx.h"
-#include <sstream>
-#include <fstream>
-#include <iostream>
-#include "RecipeManager.h"
-
-// 单例获取
-RecipeManager& RecipeManager::getInstance() {
-    static RecipeManager instance;
-    return instance;
-}
-
-// 构造函数
-RecipeManager::RecipeManager() : m_recipeFolder("Recipe"), m_currentRecipeName("") {}
-
-// 加载轴信息
-bool RecipeManager::loadAxes(pugi::xml_node axesNode) {
-    m_axes.clear();
-    for (auto axisNode : axesNode.children("Axis")) {
-        AxisInfo axisInfo;
-        axisInfo.id = axisNode.attribute("id").as_int();
-        axisInfo.number = axisNode.attribute("number").value();
-        axisInfo.description = axisNode.attribute("description").value();
-        axisInfo.startAddress = axisNode.attribute("start_address").value();
-
-        // 加载 ValueRange 值
-        axisInfo.jogDistance = ValueRange(
-            axisNode.child("jog_distance").attribute("min").as_double(),
-            axisNode.child("jog_distance").attribute("max").as_double(),
-            axisNode.child("jog_distance").attribute("current").as_double()
-        );
-        axisInfo.manualSpeed = ValueRange(
-            axisNode.child("manual_speed").attribute("min").as_double(),
-            axisNode.child("manual_speed").attribute("max").as_double(),
-            axisNode.child("manual_speed").attribute("current").as_double()
-        );
-        axisInfo.autoSpeed = ValueRange(
-            axisNode.child("auto_speed").attribute("min").as_double(),
-            axisNode.child("auto_speed").attribute("max").as_double(),
-            axisNode.child("auto_speed").attribute("current").as_double()
-        );
-        axisInfo.accelerationTime = ValueRange(
-            axisNode.child("acceleration_time").attribute("min").as_double(),
-            axisNode.child("acceleration_time").attribute("max").as_double(),
-            axisNode.child("acceleration_time").attribute("current").as_double()
-        );
-        axisInfo.decelerationTime = ValueRange(
-            axisNode.child("deceleration_time").attribute("min").as_double(),
-            axisNode.child("deceleration_time").attribute("max").as_double(),
-            axisNode.child("deceleration_time").attribute("current").as_double()
-        );
-
-        // 加载 PositionRange 值
-        axisInfo.positioningPointCount = axisNode.child("Positions").attribute("positioningPointCount").as_int();
-        for (auto positionNode : axisNode.child("Positions").children("Position")) {
-            bool isEnable = positionNode.attribute("isEnable").as_bool();
-            std::string description = positionNode.attribute("description").value();
-            ValueRange positionRange(
-                positionNode.attribute("min").as_double(),
-                positionNode.attribute("max").as_double(),
-                positionNode.attribute("current").as_double()
-            );
-
-            axisInfo.positions.emplace_back(PositionRange(isEnable, description, positionRange));
-        }
-
-        m_axes[axisInfo.id] = axisInfo;
-    }
-
-    return true;
-}
-
-// 保存轴信息
-void RecipeManager::saveAxes(pugi::xml_node& axesNode) {
-    for (const auto& axisEntry : m_axes) {
-        const AxisInfo& axisInfo = axisEntry.second;
-
-        auto axisNode = axesNode.append_child("Axis");
-        axisNode.append_attribute("id") = axisInfo.id;
-        axisNode.append_attribute("number") = axisInfo.number.c_str();
-        axisNode.append_attribute("description") = axisInfo.description.c_str();
-        axisNode.append_attribute("start_address") = axisInfo.startAddress.c_str();
-
-        // 保存 ValueRange 值
-        auto jog_distance = axisNode.append_child("jog_distance");
-        jog_distance.append_attribute("min") = axisInfo.jogDistance.minValue;
-        jog_distance.append_attribute("max") = axisInfo.jogDistance.maxValue;
-        jog_distance.append_attribute("current") = axisInfo.jogDistance.currentValue;
-
-        auto manual_speed = axisNode.append_child("manual_speed");
-        manual_speed.append_attribute("min") = axisInfo.manualSpeed.minValue;
-        manual_speed.append_attribute("max") = axisInfo.manualSpeed.maxValue;
-        manual_speed.append_attribute("current") = axisInfo.manualSpeed.currentValue;
-
-        auto auto_speed = axisNode.append_child("auto_speed");
-        auto_speed.append_attribute("min") = axisInfo.autoSpeed.minValue;
-        auto_speed.append_attribute("max") = axisInfo.autoSpeed.maxValue;
-        auto_speed.append_attribute("current") = axisInfo.autoSpeed.currentValue;
-
-        auto acceleration_time = axisNode.append_child("acceleration_time");
-        acceleration_time.append_attribute("min") = axisInfo.accelerationTime.minValue;
-        acceleration_time.append_attribute("max") = axisInfo.accelerationTime.maxValue;
-        acceleration_time.append_attribute("current") = axisInfo.accelerationTime.currentValue;
-
-        auto deceleration_time = axisNode.append_child("deceleration_time");
-        deceleration_time.append_attribute("min") = axisInfo.decelerationTime.minValue;
-        deceleration_time.append_attribute("max") = axisInfo.decelerationTime.maxValue;
-        deceleration_time.append_attribute("current") = axisInfo.decelerationTime.currentValue;
-
-        // 保存 PositionRange 值
-        auto positionsNode = axisNode.append_child("Positions");
-        positionsNode.append_attribute("positioningPointCount") = axisInfo.positioningPointCount;
-        for (const auto& position : axisInfo.positions) {
-            auto positionNode = positionsNode.append_child("Position");
-            positionNode.append_attribute("isEnable") = position.isEnable;
-            positionNode.append_attribute("description") = position.description.c_str();
-            positionNode.append_attribute("min") = position.range.minValue;
-            positionNode.append_attribute("max") = position.range.maxValue;
-            positionNode.append_attribute("current") = position.range.currentValue;
-        }
-    }
-}
-
-// 设置配方文件夹
-void RecipeManager::setRecipeFolder(const std::string& folderPath) {
-    m_recipeFolder = folderPath;
-}
-
-// 获取当前配方名称
-std::string RecipeManager::getCurrentRecipeName() const {
-	return m_currentRecipeName;
-}
-
-// 加载配方(如果文件不存在,加载默认数据)
-bool RecipeManager::loadRecipe(const std::string& recipeName) {
-    std::string filePath = m_recipeFolder + "/" + recipeName + ".xml";
-    pugi::xml_document doc;
-
-    if (!doc.load_file(filePath.c_str())) {
-        std::cerr << "Recipe file not found: " << filePath << ". Loading default recipe." << std::endl;
-        return false; // 文件不存在
-    }
-	m_currentRecipeName = recipeName;
-
-    auto recipeNode = doc.child("Recipe");
-    auto axesNode = recipeNode.child("Axes");
-    loadAxes(axesNode);  // 加载轴信息
-
-    return true;
-}
-
-// 保存配方
-bool RecipeManager::saveRecipe(const std::string& recipeName) {
-    // 生成文件路径
-    std::string filePath = m_recipeFolder + "/" + recipeName + ".xml";
-
-    // 创建 XML 文档对象
-    pugi::xml_document doc;
-
-    // 如果轴数据为空,生成默认配方
-    if (m_axes.empty()) {
-        generateDefaultRecipe();
-    }
-
-    // 添加配方根节点
-    auto recipeNode = doc.append_child("Recipe");
-
-    // 添加轴信息
-    auto axesNode = recipeNode.append_child("Axes");
-    saveAxes(axesNode);
-
-    // 保存 XML 文件
-    return doc.save_file(filePath.c_str());
-}
-
-// 生成默认配方
-void RecipeManager::generateDefaultRecipe() {
-    m_axes.clear();
-	m_currentRecipeName = "Default";
-
-    for (int axisId = 1; axisId <= 12; ++axisId) {
-        AxisInfo axisInfo;
-        axisInfo.id = axisId;
-        axisInfo.positioningPointCount = 25;
-        axisInfo.number = "M100-M" + std::to_string(axisId);
-        axisInfo.description = "Default_Axis" + std::to_string(axisId);
-        axisInfo.startAddress = "ZR" + std::to_string(10000 + (axisId - 1) * 300);
-
-        // 设置默认的 ValueRange
-        axisInfo.jogDistance = ValueRange(1.0, 10.0, 1.0);
-        axisInfo.manualSpeed = ValueRange(1.0, 100.0, 10.0);
-        axisInfo.autoSpeed = ValueRange(5.0, 200.0, 50.0);
-        axisInfo.accelerationTime = ValueRange(1.0, 10.0, 1.0);
-        axisInfo.decelerationTime = ValueRange(1.0, 10.0, 1.0);
-
-        // 添加定位点并设置默认的最小值和最大值
-        for (int posId = 0; posId < axisInfo.positioningPointCount; ++posId) {
-            double minPos = (posId + 1) * 5.0;
-            double maxPos = (posId + 1) * 20.0;
-            axisInfo.positions.emplace_back(PositionRange(TRUE, "Position " + std::to_string(posId + 1), ValueRange(minPos, maxPos, (posId + 1) * 10.0)));
-        }
-
-        m_axes[axisId] = axisInfo;
-    }
-}
-
-// 获取所有轴信息
-const std::map<int, AxisInfo>& RecipeManager::getAxes() const {
-    return m_axes;
-}
-
-// 获取单个轴信息
-AxisInfo RecipeManager::getAxis(int axisId) const {
-    auto it = m_axes.find(axisId);
-    if (it != m_axes.end()) {
-        return it->second;  // 如果找到了轴,返回其详细信息
-    }
-
-    // 如果没有找到该轴,返回一个默认的无效 AxisInfo
-    return AxisInfo{ -1, 0, /*0.0, 0.0,*/ "", "", "", ValueRange(), ValueRange(), ValueRange(), ValueRange(), ValueRange(), {} };
-}
-
-// 更新轴信息
-bool RecipeManager::updateAxis(const AxisInfo& axisInfo) {
-    if (m_axes.find(axisInfo.id) == m_axes.end()) {
-        return false; // 轴不存在
-    }
-    m_axes[axisInfo.id] = axisInfo;
-    return true;
-}
-
-// 添加新的轴信息
-bool RecipeManager::addAxis(const AxisInfo& axisInfo) {
-    if (m_axes.find(axisInfo.id) != m_axes.end()) {
-        return false; // 轴已存在
-    }
-    m_axes[axisInfo.id] = axisInfo;
-    return true;
-}
-
-// 删除轴信息
-bool RecipeManager::deleteAxis(int axisId) {
-    return m_axes.erase(axisId) > 0;
-}
-
-// 获取所有轴编号
-std::vector<int> RecipeManager::getAllAxisID() const {
-    std::vector<int> axisNumbers;
-    for (const auto& axis : m_axes) {
-        int axisId = axis.first;
-        axisNumbers.push_back(axisId);
-    }
-
-    return axisNumbers;
-}
-
-// 获取指定页的定位点
-std::vector<PositionRange> RecipeManager::getPositions(int axisId, int pageNumber, int pageSize) const {
-    std::vector<PositionRange> result;
-
-    // 检查轴是否存在
-    auto it = m_axes.find(axisId);
-    if (it == m_axes.end()) {
-        return result; // 如果轴 ID 不存在,返回空结果
-    }
-
-    // 获取指定轴的所有定位点
-    const auto& positions = it->second.positions;
-
-    // 确定分页范围
-    int startIndex = (pageNumber - 1) * pageSize;
-    int endIndex = startIndex + pageSize;
-
-    // 遍历定位点,按分页提取数据
-    int index = 0;
-    for (const auto& pos : positions) {
-        const PositionRange& position = pos;  // 定位点包含描述、位置、最小值、最大值和当前值
-
-        if (index >= startIndex && index < endIndex) {
-            result.push_back(position);  // 添加完整的 PositionRange 对象
-        }
-
-        ++index;
-        if (index >= endIndex) {
-            break; // 达到分页结束点
-        }
-    }
-
-    return result;
-}
-
-// 获取指定轴的定位点
-PositionRange RecipeManager::getPositionByIndex(int axisId, int pageNumber, int pageSize, int currentIndex) const {
-    // 检查轴是否存在
-    auto it = m_axes.find(axisId);
-    if (it == m_axes.end()) {
-        return PositionRange();  // 轴不存在,返回默认构造的 PositionRange(无效的定位点)
-    }
-
-    // 获取指定轴的所有定位点
-    const auto& positions = it->second.positions;
-
-    // 确定分页范围
-    int startIndex = (pageNumber - 1) * pageSize;
-    int endIndex = startIndex + pageSize;
-
-    // 如果 currentIndex 超过了当前页的范围,返回无效的 PositionRange
-    if (currentIndex < 0 || currentIndex >= pageSize || currentIndex + startIndex >= positions.size()) {
-        return PositionRange();  // 返回无效的定位点
-    }
-
-    // 返回指定定位点(考虑分页)
-    return positions[startIndex + currentIndex];
-}
diff --git a/SourceCode/Bond/BoounionPLC/FileManager/RecipeManager.h b/SourceCode/Bond/BoounionPLC/FileManager/RecipeManager.h
deleted file mode 100644
index ed43b0c..0000000
--- a/SourceCode/Bond/BoounionPLC/FileManager/RecipeManager.h
+++ /dev/null
@@ -1,104 +0,0 @@
-#ifndef RECIPE_MANAGER_H
-#define RECIPE_MANAGER_H
-
-#include <string>
-#include <vector>
-#include <map>
-#include "pugixml.hpp"
-
-struct ValueRange {
-    double minValue;        // 最小值
-    double maxValue;        // 最大值
-    double currentValue;    // 当前值
-
-    // 构造函数初始化
-    ValueRange(double minVal = 0.0, double maxVal = 0.0, double curVal = 0.0)
-        : minValue(minVal), maxValue(maxVal), currentValue(curVal) {}
-};
-
-struct PositionRange {
-	BOOL isEnable;            // 是否启用
-    std::string description;  // 定位点描述
-    ValueRange range;         // 位置的最小值、最大值和当前值
-
-    // 构造函数初始化
-    PositionRange(BOOL b = TRUE, const std::string& desc = "", const ValueRange& r = ValueRange())
-        :isEnable(b), description(desc), range(r) {}
-};
-
-// 轴信息结构体
-struct AxisInfo {
-    int id;                                    // 轴ID
-    int positioningPointCount;                 // 定位点数
-    //double maxPositioningSpeed;                // 定位速度上限
-    //double maxManualSpeed;                     // 手动速度上限
-    std::string number;                        // 轴编号
-    std::string description;                   // 轴描述
-    std::string startAddress;                  // 起始地址
-    ValueRange jogDistance;                    // 微动量(最小值、最大值、当前值)
-    ValueRange manualSpeed;                    // 手动速度(最小值、最大值、当前值)
-    ValueRange autoSpeed;                      // 自动速度(最小值、最大值、当前值)
-    ValueRange accelerationTime;               // 加速时间(最小值、最大值、当前值)
-    ValueRange decelerationTime;               // 减速时间(最小值、最大值、当前值)
-    std::vector<PositionRange> positions;      // 定位点:描述、位置及最小最大值
-};
-
-// 配方管理类
-class RecipeManager {
-public:
-    // 单例模式获取实例
-    static RecipeManager& getInstance();
-
-    // 设置配方文件夹路径
-    void setRecipeFolder(const std::string& folderPath);
-
-	// 获取当前配方名称
-	std::string getCurrentRecipeName() const;
-
-    // 加载配方(文件不存在时加载默认数据)
-    bool loadRecipe(const std::string& recipeName);
-
-    // 保存配方
-    bool saveRecipe(const std::string& recipeName);
-
-    // 生成默认配方
-    void generateDefaultRecipe();    
-
-    // 获取所有轴信息
-    const std::map<int, AxisInfo>& getAxes() const;
-
-    // 获取单个轴信息
-    AxisInfo getAxis(int axisId) const;
-
-    // 更新轴信息
-    bool updateAxis(const AxisInfo& axisInfo);
-
-    // 添加新的轴信息
-    bool addAxis(const AxisInfo& axisInfo);
-
-    // 删除轴信息
-    bool deleteAxis(int axisId);
-
-	// 获取所有轴ID
-    std::vector<int> getAllAxisID() const;
-
-	// 获取指定页的定位点
-    std::vector<PositionRange> getPositions(int axisId, int pageNumber, int pageSize) const;
-
-	// 获取指定页的定位点
-    PositionRange getPositionByIndex(int axisId, int pageNumber, int pageSize, int currentIndex) const;
-
-private:
-    RecipeManager();
-
-    // 轴加载和保存函数
-    bool loadAxes(pugi::xml_node axesNode);
-    void saveAxes(pugi::xml_node& axesNode);
-
-private:
-	std::string m_currentRecipeName; // 当前配方名称
-    std::string m_recipeFolder;      // 配方文件夹路径
-    std::map<int, AxisInfo> m_axes;  // 轴信息缓存
-};
-
-#endif // RECIPE_MANAGER_H
diff --git a/SourceCode/Bond/BoounionPLC/IOMonitoringDlg.cpp b/SourceCode/Bond/BoounionPLC/IOMonitoringDlg.cpp
index 5bc1d1c..734f047 100644
--- a/SourceCode/Bond/BoounionPLC/IOMonitoringDlg.cpp
+++ b/SourceCode/Bond/BoounionPLC/IOMonitoringDlg.cpp
@@ -27,6 +27,22 @@
 	m_nTotalPages = 1;
 	m_nRowsPerPage = 16;
 	m_nCols = 6;
+
+	CPLC* pPLC = theApp.m_model.getCurrentPlc();
+	if (pPLC != nullptr) {
+		m_pPLC = pPLC;
+
+		// 鍔犺浇鏁版嵁
+		IOManager manager;
+		manager.LoadFromFile(pPLC->getName());
+		manager.GetMachineData(m_displayData);
+
+		// 璁$畻椤垫暟
+		m_nCurrentPage = 1;
+		m_nTotalPages = ((int)m_displayData.size() + m_nRowsPerPage - 1) / m_nRowsPerPage;
+	} else {
+		m_pPLC = nullptr;
+	}
 }
 
 CIOMonitoringDlg::~CIOMonitoringDlg()
@@ -46,24 +62,6 @@
 {
 	CDialogEx::DoDataExchange(pDX);
 	DDX_Control(pDX, IDC_STATIC_PAGE_NUMBER, m_staticPageNum);
-}
-
-void CIOMonitoringDlg::SetIOManager(const std::string& machineName)
-{
-	// 鍔犺浇鏁版嵁
-	IOManager manager;
-	manager.LoadFromFile(machineName);
-	manager.GetMachineData(m_displayData);
-
-	// 璁$畻椤垫暟
-	m_nCurrentPage = 1;
-	m_nTotalPages = ((int)m_displayData.size() + m_nRowsPerPage - 1) / m_nRowsPerPage;
-}
-
-void CIOMonitoringDlg::SetPLC(CPLC* pPLC)
-{
-	ASSERT(pPLC);
-	m_pPLC = pPLC;
 }
 
 CFont* CIOMonitoringDlg::GetOrCreateFont(int nFontSize)
@@ -568,6 +566,15 @@
 	CDialogEx::OnInitDialog();
 
 	// TODO:  鍦ㄦ娣诲姞棰濆鐨勫垵濮嬪寲
+	if (m_pPLC == nullptr || !m_pPLC->isConnected()) {
+		AfxMessageBox(_T("PLC 鏈繛鎺ワ紒"));
+		return FALSE;
+	}
+
+	CString strTitle;
+	strTitle.Format(_T("IO鐩戞帶椤甸潰(PLC: %s)"), m_pPLC->getName().c_str());
+	SetWindowText(strTitle);
+
 	CRect screenRect, dlgRect, clientRect;
 	SystemParametersInfo(SPI_GETWORKAREA, 0, &screenRect, 0);
 
diff --git a/SourceCode/Bond/BoounionPLC/IOMonitoringDlg.h b/SourceCode/Bond/BoounionPLC/IOMonitoringDlg.h
index 7874705..e079aca 100644
--- a/SourceCode/Bond/BoounionPLC/IOMonitoringDlg.h
+++ b/SourceCode/Bond/BoounionPLC/IOMonitoringDlg.h
@@ -14,8 +14,6 @@
 public:
 	CIOMonitoringDlg(CWnd* pParent = nullptr);   // 鏍囧噯鏋勯�犲嚱鏁�
 	virtual ~CIOMonitoringDlg();
-	void SetIOManager(const std::string& machineName); // 璁剧疆 IOManager 鍜屾満鍣ㄥ悕
-	void SetPLC(CPLC* pPLC); // 璁剧疆 PLC
 
 // 瀵硅瘽妗嗘暟鎹�
 #ifdef AFX_DESIGN_TIME
diff --git a/SourceCode/Bond/BoounionPLC/Resource.h b/SourceCode/Bond/BoounionPLC/Resource.h
index 1e0914a..aa5f648 100644
--- a/SourceCode/Bond/BoounionPLC/Resource.h
+++ b/SourceCode/Bond/BoounionPLC/Resource.h
Binary files differ
diff --git a/SourceCode/Bond/BoounionPLC/stdafx.h b/SourceCode/Bond/BoounionPLC/stdafx.h
index 8713f15..400123b 100644
--- a/SourceCode/Bond/BoounionPLC/stdafx.h
+++ b/SourceCode/Bond/BoounionPLC/stdafx.h
@@ -34,6 +34,24 @@
 #include <afxcontrolbars.h>     // 功能区和控件条的 MFC 支持
 
 
+// 控件样式
+static UINT g_nGridFixCellColor = RGB(144, 200, 246);
+static UINT g_nGridFixFontColor = RGB(0, 0, 0);
+static UINT g_nGridCellColor = RGB(255, 255, 224);
+static UINT g_nGridCellColor_NonSelect = RGB(150, 150, 150);
+static UINT g_nGridCellReadyColor = RGB(255, 255, 0);
+static UINT g_nGridCellOnColor = RGB(255, 69, 0);
+static UINT g_nGridCellOffColor = RGB(128, 191, 255);
+static UINT g_nPropertyGridFixCellColor = RGB(150, 150, 150);
+static UINT g_nPropertyGridFixFontColor = RGB(0, 0, 0);
+static UINT g_nSequenceOffColor = RGB(0, 0, 0);
+static UINT g_nSequenceOnColor = RGB(0, 180, 0);
+static UINT g_nSequenceErrorColor = RGB(255, 0, 0);
+static UINT g_nSequenceWarningColor = RGB(255, 255, 0);
+static UINT g_nSequenceReadyColor = RGB(0, 0, 255);
+static UINT g_nSequenceRunningColor = RGB(0, 255, 255);
+static UINT g_nSequencePauseColor = RGB(255, 0, 255);
+static UINT g_nSequenceStopColor = RGB(128, 128, 128);
 
 
 #include "..\RxWindows1.0\include\RxWindowsLib.h"

--
Gitblit v1.9.3