From 15a7d8ae540c2993d166fe99b1ca13b6d2b101f0 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 29 七月 2025 08:48:50 +0800
Subject: [PATCH] 1.Port Enable修改为保存配置到本地,不再同步与EFEM通讯;

---
 SourceCode/Bond/Servo/CPagePortProperty.cpp |    3 +++
 SourceCode/Bond/Servo/Configuration.h       |    1 +
 SourceCode/Bond/Servo/Model.h               |    1 +
 SourceCode/Bond/Servo/CMaster.cpp           |    8 ++++++++
 SourceCode/Bond/Servo/Configuration.cpp     |    9 +++++++++
 SourceCode/Bond/Servo/CMaster.h             |    1 +
 SourceCode/Bond/Servo/Model.cpp             |    6 ++++++
 7 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index f1b3b26..615a7fd 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -1501,6 +1501,14 @@
 		pPort->localSetCessetteType(type);
 	}
 
+	void CMaster::setPortEnable(unsigned int index, BOOL bEnable)
+	{
+		ASSERT(index < 4);
+		int eqid[] = { EQ_ID_LOADPORT1, EQ_ID_LOADPORT2, EQ_ID_LOADPORT3, EQ_ID_LOADPORT4 };
+		CLoadPort* pPort = (CLoadPort*)getEquipment(eqid[index]);
+		pPort->localEanblePort(bEnable);
+	}
+
 	void CMaster::setCompareMapsBeforeProceeding(BOOL bCompare)
 	{
 		m_isCompareMapsBeforeProceeding = bCompare;
diff --git a/SourceCode/Bond/Servo/CMaster.h b/SourceCode/Bond/Servo/CMaster.h
index fb040fc..ed55cd9 100644
--- a/SourceCode/Bond/Servo/CMaster.h
+++ b/SourceCode/Bond/Servo/CMaster.h
@@ -73,6 +73,7 @@
         void setPortType(unsigned int index, BOOL enable, int type, int mode,
             int cassetteType, int transferMode, BOOL autoChangeEnable);
         void setPortCassetteType(unsigned int index, SERVO::CassetteType type);
+        void setPortEnable(unsigned int index, BOOL bEnable);
         void setCompareMapsBeforeProceeding(BOOL bCompare);
         void datetimeSync(SYSTEMTIME& time);
         void enableEventReport(bool bEnable);
diff --git a/SourceCode/Bond/Servo/CPagePortProperty.cpp b/SourceCode/Bond/Servo/CPagePortProperty.cpp
index 492a2a7..f61f01a 100644
--- a/SourceCode/Bond/Servo/CPagePortProperty.cpp
+++ b/SourceCode/Bond/Servo/CPagePortProperty.cpp
@@ -145,6 +145,8 @@
 	CMsgDlg msgDlg("璇风瓑寰�", "姝e湪鎿嶄綔锛岃绛夊緟...");
 
 	ASSERT(m_pPort != nullptr);
+	theApp.m_model.setPortEnable(m_pPort->getIndex(), bCheck);
+	/*
 	m_pPort->eablePort(bCheck, [&](int code) -> int {
 		Sleep(100);
 		CString strMsg;
@@ -184,6 +186,7 @@
 
 	msgDlg.DoModal();
 	g_nMsgDlgShow = 1;
+	*/
 }
 
 void CPagePortProperty::OnCbnSelchangeComboPortType()
diff --git a/SourceCode/Bond/Servo/Configuration.cpp b/SourceCode/Bond/Servo/Configuration.cpp
index 6402828..08fd582 100644
--- a/SourceCode/Bond/Servo/Configuration.cpp
+++ b/SourceCode/Bond/Servo/Configuration.cpp
@@ -146,6 +146,15 @@
 	return true;
 }
 
+BOOL CConfiguration::setPortEnable(unsigned int index, BOOL bEnable)
+{
+	if (index >= 4) return FALSE;
+
+	static char* pszSection[] = { "Port1", "Port2", "Port3", "Port4" };
+	WritePrivateProfileString(pszSection[index], _T("Enable"), std::to_string(bEnable ? 1 : 0).c_str(), m_strFilepath);
+	return true;
+}
+
 BOOL CConfiguration::isCompareMapsBeforeProceeding()
 {
 	return GetPrivateProfileInt(_T("Master"), _T("CompareMapsBeforeProceeding"), 0, m_strFilepath);
diff --git a/SourceCode/Bond/Servo/Configuration.h b/SourceCode/Bond/Servo/Configuration.h
index 036e811..8e0d569 100644
--- a/SourceCode/Bond/Servo/Configuration.h
+++ b/SourceCode/Bond/Servo/Configuration.h
@@ -25,6 +25,7 @@
 	BOOL getPortParms(unsigned int index, BOOL& bEnable, int& type, int& mode,
 		int& cassetteType, int& transferMode, BOOL& bAutoChangeEnable);
 	BOOL setPortCassetteType(unsigned int index, int cassetteType);
+	BOOL setPortEnable(unsigned int index, BOOL bEnable);
 	BOOL isCompareMapsBeforeProceeding();
 
 public:
diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index 1a63ddd..e00949f 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -58,6 +58,12 @@
 	m_configuration.setPortCassetteType(index, (int)type);
 }
 
+void CModel::setPortEnable(unsigned int index, BOOL bEnable)
+{
+	m_master.setPortEnable(index, bEnable);
+	m_configuration.setPortEnable(index, bEnable);
+}
+
 int CModel::init()
 {
 	CString strIniFile;
diff --git a/SourceCode/Bond/Servo/Model.h b/SourceCode/Bond/Servo/Model.h
index 0679568..98f5e49 100644
--- a/SourceCode/Bond/Servo/Model.h
+++ b/SourceCode/Bond/Servo/Model.h
@@ -16,6 +16,7 @@
 	void setWorkDir(const char* pszWorkDir);
 	void loadPortParams();
 	void setPortCassetteType(unsigned int index, SERVO::CassetteType type);
+	void setPortEnable(unsigned int index, BOOL bEnable);
 	int init();
 	int term();
 

--
Gitblit v1.9.3