From fc881732b096f1c5a6dfcb9751c89f0ffca90768 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 28 四月 2025 14:49:20 +0800
Subject: [PATCH] 1.LoadPort增加 mode, type, cassette type, transfer mode等属性值,并增加对应属性页;

---
 SourceCode/Bond/Servo/CPageGraph2.cpp       |   12 +
 SourceCode/Bond/Servo/CPagePortProperty.cpp |  139 +++++++++++++++++++
 SourceCode/Bond/Servo/CEqVcrEventStep.cpp   |    2 
 SourceCode/Bond/Servo/Servo.vcxproj         |    2 
 SourceCode/Bond/Servo/Servo.vcxproj.filters |    2 
 SourceCode/Bond/Servo/resource.h            |    0 
 SourceCode/Bond/Servo/CPagePortProperty.h   |   40 +++++
 SourceCode/Bond/Servo/CLoadPort.h           |   23 +++
 SourceCode/Bond/Servo/Servo.rc              |    0 
 SourceCode/Bond/Servo/CEqReadIntStep.cpp    |    4 
 SourceCode/Bond/Servo/CLoadPort.cpp         |  187 ++++++++++++++++++++++++++
 11 files changed, 404 insertions(+), 7 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEqReadIntStep.cpp b/SourceCode/Bond/Servo/CEqReadIntStep.cpp
index c6de8df..e966f42 100644
--- a/SourceCode/Bond/Servo/CEqReadIntStep.cpp
+++ b/SourceCode/Bond/Servo/CEqReadIntStep.cpp
@@ -62,7 +62,7 @@
 	int CEqReadIntStep::onComplete()
 	{
 		CReadStep::onComplete();
-		LOGI("<CEQPortChangeStep> onComplete.");
+		LOGI("<CEqReadIntStep> onComplete.");
 
 		return 0;
 	}
@@ -70,7 +70,7 @@
 	int CEqReadIntStep::onTimeout()
 	{
 		CReadStep::onTimeout();
-		LOGI("<CEQPortChangeStep> onTimeout.");
+		LOGI("<CEqReadIntStep> onTimeout.");
 
 		return 0;
 	}
diff --git a/SourceCode/Bond/Servo/CEqVcrEventStep.cpp b/SourceCode/Bond/Servo/CEqVcrEventStep.cpp
index 644a7e3..e4c14d7 100644
--- a/SourceCode/Bond/Servo/CEqVcrEventStep.cpp
+++ b/SourceCode/Bond/Servo/CEqVcrEventStep.cpp
@@ -83,6 +83,8 @@
 	{
 		memcpy(m_szReturnBuf, &code, sizeof(short));
 		m_nReturnDataSize = sizeof(short);
+
+		return 0;
 	}
 }
 
diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index 3e93d7c..9aab4ad 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -5,7 +5,12 @@
 namespace SERVO {
 	CLoadPort::CLoadPort() : CEquipment()
 	{
-
+		m_nType = 0;
+		m_nMode = 0;
+		m_nCassetteType = 0;
+		m_nTransferMode = 4;
+		m_bEnable = FALSE;
+		m_bAutoChangeEnable = FALSE;
 	}
 
 	CLoadPort::~CLoadPort()
@@ -121,4 +126,184 @@
 
 		return pStep;
 	}
+
+	BOOL CLoadPort::isEnable()
+	{
+		return m_bEnable;
+	}
+
+	int CLoadPort::getPortType()
+	{
+		return m_nType;
+	}
+
+	int CLoadPort::getPortMode()
+	{
+		return m_nMode;
+	}
+
+	int CLoadPort::getCessetteType()
+	{
+		return m_nCassetteType;
+	}
+
+	int CLoadPort::getTransferMode()
+	{
+		return m_nTransferMode;
+	}
+
+	BOOL CLoadPort::isAutoChange()
+	{
+		return m_bAutoChangeEnable;
+	}
+
+	/*
+	 1: Loading Port
+	 2: Unloading Port
+	 3: Both Port
+	 4: Buffer Port-Buffer Type
+	 5: Buffer Port-Loader in Buffer Type
+	 6: Buffer Port-Un-loader in Buffer Type
+	 7: Unloading Partial Port
+	 */
+	std::string& CLoadPort::getPortTypeDescription(int portType, std::string& strDescription)
+	{
+		switch (portType) {
+		case 1:
+			strDescription = _T("Loading Port");
+			break;
+		case 2:
+			strDescription = _T("Unloading Port");
+			break;
+		case 3:
+			strDescription = _T("Both Port");
+			break;
+		case 4:
+			strDescription = _T("Buffer Port - Buffer Type");
+			break;
+		case 5:
+			strDescription = _T("Buffer Port - Loader in Buffer Type");
+			break;
+		case 6:
+			strDescription = _T("Buffer Port - Un-loader in Buffer Type");
+			break;
+		case 7:
+			strDescription = _T("Unloading Partial Port");
+			break;
+		default:
+			strDescription = _T("");
+			break;
+		}
+
+		return strDescription;
+	}
+
+	/*
+	 0: OutOfService
+	 1: TransferBlocked
+	 2: ReadyToLoad
+	 3: ReadyToUnload
+	 4: InService
+	 5: TransferReady
+	 */
+	std::string& CLoadPort::getPortModeDescription(int portMode, std::string& strDescription)
+	{
+		switch (portMode) {
+		case 0:
+			strDescription = _T("OutOfService");
+			break;
+		case 1:
+			strDescription = _T("TransferBlocked");
+			break;
+		case 2:
+			strDescription = _T("ReadyToLoad");
+			break;
+		case 3:
+			strDescription = _T("ReadyToUnload");
+			break;
+		case 4:
+			strDescription = _T("InService");
+			break;
+		case 5:
+			strDescription = _T("TransferReady");
+			break;
+		default:
+			strDescription = _T("");
+			break;
+		}
+
+		return strDescription;
+	}
+
+	/*
+	 1: G1
+	 2: G2
+	 3: G1&G2
+	 */
+	std::string& CLoadPort::getPortCassetteTypeDescription(int casseteType, std::string& strDescription)
+	{
+		switch (casseteType) {
+		case 1:
+			strDescription = _T("G1");
+			break;
+		case 2:
+			strDescription = _T("G2");
+			break;
+		case 3:
+			strDescription = _T("G1&G2");
+			break;
+		default:
+			strDescription = _T("");
+			break;
+		}
+
+		return strDescription;
+	}
+
+	/*
+	 1: MGV Mode
+	 2: AGV Mode
+	 3: Stocker Inline Mode
+	 */
+	std::string& CLoadPort::getPortTransferModeDescription(int mode, std::string& strDescription)
+	{
+		switch (mode) {
+		case 1:
+			strDescription = _T("MGV Mode");
+			break;
+		case 2:
+			strDescription = _T("AGV Mode");
+			break;
+		case 3:
+			strDescription = _T("Stocker Inline Mode");
+			break;
+		default:
+			strDescription = _T("");
+			break;
+		}
+
+		return strDescription;
+	}
+
+
+	/*
+	 1 : Enable
+	 2 : Disable
+	 */
+	std::string& CLoadPort::getEnableModeDescription(int mode, std::string& strDescription)
+	{
+		switch (mode) {
+		case 1:
+			strDescription = _T("Enable");
+			break;
+		case 2:
+			strDescription = _T("Disable");
+			break;
+		default:
+			strDescription = _T("");
+			break;
+		}
+
+		return strDescription;
+	}
 }
diff --git a/SourceCode/Bond/Servo/CLoadPort.h b/SourceCode/Bond/Servo/CLoadPort.h
index 69aff38..df5e7bf 100644
--- a/SourceCode/Bond/Servo/CLoadPort.h
+++ b/SourceCode/Bond/Servo/CLoadPort.h
@@ -22,6 +22,21 @@
 		virtual BOOL glassWillArrive(CGlass* pGlass);
 
 	public:
+		BOOL isEnable();
+		int getPortType();
+		int getPortMode();
+		int getCessetteType();
+		int getTransferMode();
+		BOOL isAutoChange();
+
+	public:
+		static std::string& getPortTypeDescription(int portType, std::string& strDescription);
+		static std::string& getPortModeDescription(int portMode, std::string& strDescription);
+		static std::string& getPortCassetteTypeDescription(int casseteType, std::string& strDescription);
+		static std::string& getPortTransferModeDescription(int mode, std::string& strDescription);
+		static std::string& getEnableModeDescription(int mode, std::string& strDescription);
+
+	public:
 		virtual int outputGlass(int port);
 		int sendCassetteCtrlCmd(short cmd,
 			short* jobExistence,
@@ -30,6 +45,14 @@
 			short jopCount,
 			CJobDataA* pJobDataA);
 		CStep* getCassetteCtrlCmdStep();
+
+	private:
+		int m_nType;
+		int m_nMode;
+		int m_nCassetteType;
+		int m_nTransferMode;
+		BOOL m_bEnable;
+		BOOL m_bAutoChangeEnable;
 	};
 }
 
diff --git a/SourceCode/Bond/Servo/CPageGraph2.cpp b/SourceCode/Bond/Servo/CPageGraph2.cpp
index 9e6a522..4d81345 100644
--- a/SourceCode/Bond/Servo/CPageGraph2.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -8,6 +8,7 @@
 #include "CHMPropertyDlg.h"
 #include "CEquipmentPage1.h"
 #include "CEquipmentPage2.h"
+#include "CPagePortProperty.h"
 #include "CPageCassetteCtrlCmd.h"
 
 
@@ -87,10 +88,13 @@
 		SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
 
 		CHMPropertyDlg dlg(pEquipment->getName().c_str(), 600, 680);
-		CEquipmentPage1* pPage1 = new CEquipmentPage1();
-		pPage1->setEquipment(pEquipment);
-		pPage1->Create(IDD_PAGE_EQUIPMENT1);
-		dlg.addPage(pPage1, "test1");
+
+		if (_strcmpi(pEquipment->getClassName(), "CLoadPort") == 0) {
+			CPagePortProperty* pPage1 = new CPagePortProperty();
+			pPage1->setLoadPort((SERVO::CLoadPort*)pEquipment);
+			pPage1->Create(IDD_PAGE_PORT_PROPERTY);
+			dlg.addPage(pPage1, "灞炴��");
+		}
 
 		CEquipmentPage2* pPage2 = new CEquipmentPage2();
 		pPage2->setEquipment(pEquipment);
diff --git a/SourceCode/Bond/Servo/CPagePortProperty.cpp b/SourceCode/Bond/Servo/CPagePortProperty.cpp
new file mode 100644
index 0000000..88728b5
--- /dev/null
+++ b/SourceCode/Bond/Servo/CPagePortProperty.cpp
@@ -0,0 +1,139 @@
+锘�// CPagePortProperty.cpp: 瀹炵幇鏂囦欢
+//
+
+#include "stdafx.h"
+#include "Servo.h"
+#include "CPagePortProperty.h"
+#include "afxdialogex.h"
+
+
+// CPagePortProperty 瀵硅瘽妗�
+
+IMPLEMENT_DYNAMIC(CPagePortProperty, CHMPropertyPage)
+
+CPagePortProperty::CPagePortProperty(CWnd* pParent /*=nullptr*/)
+	: CHMPropertyPage(IDD_PAGE_PORT_PROPERTY, pParent)
+{
+	m_pPort = nullptr;
+}
+
+CPagePortProperty::~CPagePortProperty()
+{
+}
+
+void CPagePortProperty::DoDataExchange(CDataExchange* pDX)
+{
+	CHMPropertyPage::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CPagePortProperty, CHMPropertyPage)
+	ON_WM_CTLCOLOR()
+	ON_WM_DESTROY()
+	ON_WM_SIZE()
+	ON_BN_CLICKED(IDC_CHECK_ENABLE, &CPagePortProperty::OnBnClickedCheckEnable)
+END_MESSAGE_MAP()
+
+
+// CPagePortProperty 娑堟伅澶勭悊绋嬪簭
+void CPagePortProperty::setLoadPort(SERVO::CLoadPort* pPort)
+{
+	m_pPort = pPort;
+}
+
+BOOL CPagePortProperty::OnInitDialog()
+{
+	CHMPropertyPage::OnInitDialog();
+
+
+	ASSERT(m_pPort);
+	CComboBox* pComboBox;
+	std::string strTemp;
+
+	
+	pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_PORT_TYPE);
+	for (int i = 1; i <= 7; i++) {
+		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortTypeDescription(i, strTemp).c_str());
+	}
+	int portType = m_pPort->getPortType();
+	if (1 <= portType && portType <= 7) {
+		pComboBox->SetCurSel(portType - 1);
+	}
+
+	pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_PORT_MODE);
+	for (int i = 1; i <= 3; i++) {
+		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortModeDescription(i, strTemp).c_str());
+	}
+	int portMode = m_pPort->getPortMode();
+	if (1 <= portMode && portMode <= 3) {
+		pComboBox->SetCurSel(portMode - 1);
+	}
+
+	pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_PORT_CASSERT_TYPE);
+	for (int i = 1; i <= 3; i++) {
+		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortCassetteTypeDescription(i, strTemp).c_str());
+	}
+	int cessetteType = m_pPort->getCessetteType();
+	if (1 <= cessetteType && cessetteType <= 3) {
+		pComboBox->SetCurSel(cessetteType - 1);
+	}
+
+	pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_PORT_TRANSFER_MODE);
+	for (int i = 1; i <= 3; i++) {
+		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortTransferModeDescription(i, strTemp).c_str());
+	}
+	int transferMode = m_pPort->getTransferMode();
+	if (1 <= transferMode && transferMode <= 3) {
+		pComboBox->SetCurSel(transferMode - 1);
+	}
+
+	((CButton*)GetDlgItem(IDC_CHECK_AUTO_CHANGE))->SetCheck(m_pPort->isAutoChange() ? BST_CHECKED : BST_UNCHECKED);
+	
+	
+	
+	EnableCtrls(m_pPort->isEnable());
+
+
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
+}
+
+HBRUSH CPagePortProperty::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
+{
+	HBRUSH hbr = CHMPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
+
+	// TODO:  鍦ㄦ鏇存敼 DC 鐨勪换浣曠壒鎬�
+
+	// TODO:  濡傛灉榛樿鐨勪笉鏄墍闇�鐢荤瑪锛屽垯杩斿洖鍙︿竴涓敾绗�
+	return hbr;
+}
+
+void CPagePortProperty::OnDestroy()
+{
+	CHMPropertyPage::OnDestroy();
+
+	// TODO: 鍦ㄦ澶勬坊鍔犳秷鎭鐞嗙▼搴忎唬鐮�
+}
+
+void CPagePortProperty::OnSize(UINT nType, int cx, int cy)
+{
+	CHMPropertyPage::OnSize(nType, cx, cy);
+
+	// TODO: 鍦ㄦ澶勬坊鍔犳秷鎭鐞嗙▼搴忎唬鐮�
+}
+
+void CPagePortProperty::OnBnClickedCheckEnable()
+{
+	BOOL bCheck = ((CButton*)GetDlgItem(IDC_CHECK_ENABLE))->GetCheck() == BST_CHECKED;
+	EnableCtrls(bCheck);
+}
+
+void CPagePortProperty::EnableCtrls(BOOL bEnable)
+{
+	GetDlgItem(IDC_COMBO_PORT_TYPE)->EnableWindow(bEnable);
+	GetDlgItem(IDC_COMBO_PORT_MODE)->EnableWindow(bEnable);
+	GetDlgItem(IDC_COMBO_PORT_CASSERT_TYPE)->EnableWindow(bEnable);
+	GetDlgItem(IDC_COMBO_PORT_TRANSFER_MODE)->EnableWindow(bEnable);
+	GetDlgItem(IDC_CHECK_AUTO_CHANGE)->EnableWindow(bEnable);
+}
diff --git a/SourceCode/Bond/Servo/CPagePortProperty.h b/SourceCode/Bond/Servo/CPagePortProperty.h
new file mode 100644
index 0000000..f7e159c
--- /dev/null
+++ b/SourceCode/Bond/Servo/CPagePortProperty.h
@@ -0,0 +1,40 @@
+锘�#pragma once
+#include "CHMPropertyPage.h"
+
+
+// CPagePortProperty 瀵硅瘽妗�
+
+class CPagePortProperty : public CHMPropertyPage
+{
+	DECLARE_DYNAMIC(CPagePortProperty)
+
+public:
+	CPagePortProperty(CWnd* pParent = nullptr);   // 鏍囧噯鏋勯�犲嚱鏁�
+	virtual ~CPagePortProperty();
+
+public:
+	void setLoadPort(SERVO::CLoadPort* pPort);
+
+private:
+	void EnableCtrls(BOOL bEnable);
+
+private:
+	SERVO::CLoadPort* m_pPort;
+
+
+// 瀵硅瘽妗嗘暟鎹�
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_PAGE_PORT_PROPERTY };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 鏀寔
+
+	DECLARE_MESSAGE_MAP()
+public:
+	virtual BOOL OnInitDialog();
+	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
+	afx_msg void OnDestroy();
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+	afx_msg void OnBnClickedCheckEnable();
+};
diff --git a/SourceCode/Bond/Servo/Servo.rc b/SourceCode/Bond/Servo/Servo.rc
index a5b077d..9569c6b 100644
--- a/SourceCode/Bond/Servo/Servo.rc
+++ b/SourceCode/Bond/Servo/Servo.rc
Binary files differ
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj b/SourceCode/Bond/Servo/Servo.vcxproj
index 1802cf0..e94146c 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj
+++ b/SourceCode/Bond/Servo/Servo.vcxproj
@@ -238,6 +238,7 @@
     <ClInclude Include="CPageCassetteCtrlCmd.h" />
     <ClInclude Include="CPageGraph1.h" />
     <ClInclude Include="CPageGraph2.h" />
+    <ClInclude Include="CPagePortProperty.h" />
     <ClInclude Include="CPanelAttributes.h" />
     <ClInclude Include="CPanelEquipment.h" />
     <ClInclude Include="CPanelMaster.h" />
@@ -323,6 +324,7 @@
     <ClCompile Include="CPageCassetteCtrlCmd.cpp" />
     <ClCompile Include="CPageGraph1.cpp" />
     <ClCompile Include="CPageGraph2.cpp" />
+    <ClCompile Include="CPagePortProperty.cpp" />
     <ClCompile Include="CPanelAttributes.cpp" />
     <ClCompile Include="CPanelEquipment.cpp" />
     <ClCompile Include="CPanelMaster.cpp" />
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj.filters b/SourceCode/Bond/Servo/Servo.vcxproj.filters
index 2f428f0..de28b85 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj.filters
+++ b/SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -91,6 +91,7 @@
     <ClCompile Include="CJobDataS.cpp" />
     <ClCompile Include="CVcrEventReport.cpp" />
     <ClCompile Include="CEqVcrEventStep.cpp" />
+    <ClCompile Include="CPagePortProperty.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="AlarmManager.h" />
@@ -180,6 +181,7 @@
     <ClInclude Include="CJobDataS.h" />
     <ClInclude Include="CVcrEventReport.h" />
     <ClInclude Include="CEqVcrEventStep.h" />
+    <ClInclude Include="CPagePortProperty.h" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="Servo.rc" />
diff --git a/SourceCode/Bond/Servo/resource.h b/SourceCode/Bond/Servo/resource.h
index 1098369..b61d88b 100644
--- a/SourceCode/Bond/Servo/resource.h
+++ b/SourceCode/Bond/Servo/resource.h
Binary files differ

--
Gitblit v1.9.3