From bfe14e41fa5b07771d78af4511ba18d706bc23cc Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 28 七月 2025 17:07:52 +0800
Subject: [PATCH] 1.Spooling Config功能EAP模拟测试;

---
 SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp b/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
index 3da6b35..d859bee 100644
--- a/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
+++ b/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
@@ -10,6 +10,7 @@
 #include "PlcView.h"
 #include "Log.h"
 #include "InputDialog.h"
+#include "AddPLCInfo.h"
 #include "AxisManager.h"
 #include "IOManager.h"
 
@@ -126,7 +127,10 @@
 						}
 						ASSERT(m_pActiveView);
 						if (m_pActiveView->GetContext() != (void*)pPlc) {
-							m_pActiveView->SetWindowText(pPlc->getName().c_str());
+							CString strTitle;
+							strTitle.Format(_T("%s[%s:%d]"), pPlc->getName().c_str(), pPlc->getIp().c_str(),
+								pPlc->getPort());
+							m_pActiveView->SetWindowText(strTitle);
 							m_pActiveView->SetContext(pPlc);
 							m_pActiveView->SendMessage(WM_NCPAINT, 0, 0);
 						}
@@ -136,6 +140,9 @@
 
 					theApp.m_model.setCurrentPlc(pPlc);
 				}
+			}
+			else if (RX_PLC_STATE_CHANGED == code) {
+
 			}
 			else if (code == RX_CODE_ALARM_ON) {
 				CPLC* pPlc;
@@ -499,24 +506,25 @@
 {
 	int id = (int)lParam;
 	if (id == IDC_BUTTON_ADD) {
-		CInputDialog inputDialog(_T("新建设备"), _T("请输入设备名称:"));
-		if (inputDialog.DoModal() != IDOK) {
-			AfxMessageBox(_T("取消验证!"));
+		CAddPLCInfo dlgAddPLCInfo;
+		if (dlgAddPLCInfo.DoModal() != IDOK) {
 			return 0;
 		}
 
-		CString strName;
-		strName = inputDialog.GetInputText();
-		if (!strName.IsEmpty()) {
-			theApp.m_model.addPlc((LPTSTR)(LPCTSTR)strName, "192.168.1.188", 1001);
+		CString strPLCName = dlgAddPLCInfo.GetPLCName();
+		CString strIP = dlgAddPLCInfo.GetIP();
+		CString strPort = dlgAddPLCInfo.GetPort();
+
+		if (!strPLCName.IsEmpty() && !strIP.IsEmpty() && !strPort.IsEmpty()) {
+			theApp.m_model.addPlc((LPTSTR)(LPCTSTR)strPLCName, (LPTSTR)(LPCTSTR)strIP, std::stoi((LPTSTR)(LPCTSTR)strPort));
 
 			// 新建轴文件
 			AxisManager axisManager;
-			axisManager.SaveAxis((LPTSTR)(LPCTSTR)strName);
+			axisManager.SaveAxis((LPTSTR)(LPCTSTR)strPLCName);
 
 			// 新建IO文件
 			IOManager ioManager;
-			ioManager.SaveToFile((LPTSTR)(LPCTSTR)strName);
+			ioManager.SaveToFile((LPTSTR)(LPCTSTR)strPLCName);
 		}
 	}
 	else if (id == IDC_BUTTON_DELETE) {

--
Gitblit v1.9.3