From f540130ba442e39f981d2d37796c6460db8a00ed Mon Sep 17 00:00:00 2001
From: LAPTOP-T815PCOQ\25526 <mr.liuyang@126.com>
Date: 星期一, 13 一月 2025 18:07:57 +0800
Subject: [PATCH] 1. 添加PLC信息界面

---
 SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp b/SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
index 70c30d3..1f8db8c 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"
 
@@ -502,24 +503,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