From 2b9a05133cb79683a940c9d8f53e0e7bc495009d Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 23 五月 2025 16:29:36 +0800
Subject: [PATCH] 1.Port状态展示界面;

---
 SourceCode/Bond/Servo/CPageGraph2.cpp       |   14 +
 SourceCode/Bond/Servo/Servo.vcxproj         |    3 
 SourceCode/Bond/Servo/Servo.vcxproj.filters |    3 
 SourceCode/Bond/Servo/CPagePortStatus.cpp   |  127 ++++++++++++++++++
 SourceCode/Bond/Servo/resource.h            |    0 
 SourceCode/Bond/Servo/CLoadPort.h           |   12 +
 SourceCode/Bond/Servo/Servo.rc              |    0 
 SourceCode/Bond/Servo/CPagePortStatus.h     |   35 +++++
 SourceCode/Bond/Servo/CLoadPort.cpp         |  185 ++++++++++++++++++++++++++
 9 files changed, 375 insertions(+), 4 deletions(-)

diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index 940dbbc..1c7becf 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -466,6 +466,41 @@
 		return m_bAutoChangeEnable;
 	}
 
+	int CLoadPort::getPortStatus()
+	{
+		return m_portStatusReport.getPortStatus();
+	}
+
+	int CLoadPort::getCassetteSequenceNo()
+	{
+		return m_portStatusReport.getCassetteSequenceNo();
+	}
+
+	std::string& CLoadPort::getCassetteId()
+	{
+		return m_portStatusReport.getCassetteId();
+	}
+
+	int CLoadPort::getLoadingCassetteType()
+	{
+		return m_portStatusReport.getLoadingCassetteType();
+	}
+
+	int CLoadPort::getQTimeFlag()
+	{
+		return m_portStatusReport.getQTimeFlag();
+	}
+
+	int CLoadPort::getCassetteMappingState()
+	{
+		return m_portStatusReport.getCassetteMappingState();
+	}
+
+	int CLoadPort::getCassetteStatus()
+	{
+		return m_portStatusReport.getCassetteStatus();
+	}
+
 	/*
 	 1: Loading Port
 	 2: Unloading Port
@@ -616,6 +651,156 @@
 		return strDescription;
 	}
 
+	/*
+	 1: Load Ready(Load Request)
+	 2: Loaded
+	 3: In Use (Load Complete)
+	 4: Unload Ready (Unload Request)
+	 5: Empty (Unload Complete)
+	 6: Blocked
+ */
+	std::string& CLoadPort::getPortStatusDescription(int portStatus, std::string& strDescription)
+	{
+		switch (portStatus) {
+		case 1:
+			strDescription = _T("Load Ready(Load Request)");
+			break;
+		case 2:
+			strDescription = _T("Loaded");
+			break;
+		case 3:
+			strDescription = _T("In Use(Load Complete)");
+			break;
+		case 4:
+			strDescription = _T("Unload Ready(Unload Request)");
+			break;
+		case 5:
+			strDescription = _T("Empty(Unload Complete)");
+			break;
+		case 6:
+			strDescription = _T("Blocked");
+			break;
+		default:
+			strDescription = _T("");
+			break;
+		}
+
+		return strDescription;
+	}
+
+	/*
+	 1: G1 Cassette
+	 2: G2 Cassette
+	 3: G1 + G2 Cassette
+	 4: Empty Cassette
+	 *  Include this item only when cassette exists"
+	*/
+	std::string& CLoadPort::getLoadingCassetteTypeDescription(int type, std::string& strDescription)
+	{
+		switch (type) {
+		case 1:
+			strDescription = _T("G1 Cassette)");
+			break;
+		case 2:
+			strDescription = _T("G2 Cassette");
+			break;
+		case 3:
+			strDescription = _T("G1+G2 Cassette)");
+			break;
+		case 4:
+			strDescription = _T("Empty Cassette)");
+			break;
+		default:
+			strDescription = _T("");
+			break;
+		}
+
+		return strDescription;
+	}
+
+	/*
+	 1: Normal Un-loading
+	 2: Q-Time Over & Un-loading
+	*/
+	std::string& CLoadPort::getQTimeFlagDescription(int flag, std::string& strDescription)
+	{
+		switch (flag) {
+		case 1:
+			strDescription = _T("Normal Un-loading");
+			break;
+		case 2:
+			strDescription = _T("Q-Time Over & Un-loading");
+			break;
+		default:
+			strDescription = _T("");
+			break;
+		}
+
+		return strDescription;
+	}
+
+	/*
+	 1: mapping use
+	 2: mapping not use
+	*/
+	std::string& CLoadPort::getCassetteMappingStateDescription(int state, std::string& strDescription)
+	{
+		switch (state) {
+		case 1:
+			strDescription = _T("Mapping use");
+			break;
+		case 2:
+			strDescription = _T("Mapping not use");
+			break;
+		default:
+			strDescription = _T("");
+			break;
+		}
+
+		return strDescription;
+	}
+
+	/*
+	 1: No Cassette Exist
+	 2: Waiting for Cassette Data
+	 3: Waiting for Start Command
+	 4: Waiting for Processing
+	 5: In Processing
+	 6: Process Paused
+	 7: Process Completed
+	*/
+	std::string& CLoadPort::getCassetteStatusDescription(int state, std::string& strDescription)
+	{
+		switch (state) {
+		case 1:
+			strDescription = _T("No Cassette Exist");
+			break;
+		case 2:
+			strDescription = _T("Waiting for Cassette Data");
+			break;
+		case 3:
+			strDescription = _T("Waiting for Start Command");
+			break;
+		case 4:
+			strDescription = _T("Waiting for Processing");
+			break;
+		case 5:
+			strDescription = _T("In Processing");
+			break;
+		case 6:
+			strDescription = _T("Process Paused");
+			break;
+		case 7:
+			strDescription = _T("Process Completed");
+			break;
+		default:
+			strDescription = _T("");
+			break;
+		}
+
+		return strDescription;
+	}
+
 	void CLoadPort::onReceiveLBData(const char* pszData, size_t size)
 	{
 		static int type[] = { STEP_ID_PORT1_TYPE_CHANGE, STEP_ID_PORT2_TYPE_CHANGE,
diff --git a/SourceCode/Bond/Servo/CLoadPort.h b/SourceCode/Bond/Servo/CLoadPort.h
index cd5146e..3e011fc 100644
--- a/SourceCode/Bond/Servo/CLoadPort.h
+++ b/SourceCode/Bond/Servo/CLoadPort.h
@@ -41,6 +41,13 @@
 		int getCessetteType();
 		int getTransferMode();
 		BOOL isAutoChange();
+		int getPortStatus();
+		int getCassetteSequenceNo();
+		std::string& getCassetteId();
+		int getLoadingCassetteType();
+		int getQTimeFlag();
+		int getCassetteMappingState();
+		int getCassetteStatus();
 		int testGenerateGlassList(MaterialsType type, int count, const char* pszPrefix, int startSuffix);
 
 	public:
@@ -49,6 +56,11 @@
 		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);
+		static std::string& getPortStatusDescription(int portStatus, std::string& strDescription);
+		static std::string& getLoadingCassetteTypeDescription(int type, std::string& strDescription);
+		static std::string& getQTimeFlagDescription(int flag, std::string& strDescription);
+		static std::string& getCassetteMappingStateDescription(int state, std::string& strDescription);
+		static std::string& getCassetteStatusDescription(int state, std::string& strDescription);
 
 	public:
 		virtual int outputGlass(int port);
diff --git a/SourceCode/Bond/Servo/CPageGraph2.cpp b/SourceCode/Bond/Servo/CPageGraph2.cpp
index 83e917f..467c68e 100644
--- a/SourceCode/Bond/Servo/CPageGraph2.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -10,6 +10,7 @@
 #include "CEquipmentPage2.h"
 #include "CEquipmentPage3.h"
 #include "CPagePortProperty.h"
+#include "CPagePortStatus.h"
 #include "CPageCassetteCtrlCmd.h"
 #include "CJobDataB.h"
 
@@ -128,10 +129,15 @@
 		CHMPropertyDlg dlg(pEquipment->getName().c_str(), 600, 680);
 
 		if (_strcmpi(pEquipment->getClassName(), "CLoadPort") == 0) {
-			CPagePortProperty* pPage1 = new CPagePortProperty();
-			pPage1->setLoadPort((SERVO::CLoadPort*)pEquipment);
-			pPage1->Create(IDD_PAGE_PORT_PROPERTY);
-			dlg.addPage(pPage1, "灞炴��");
+			CPagePortProperty* pPageA = new CPagePortProperty();
+			pPageA->setLoadPort((SERVO::CLoadPort*)pEquipment);
+			pPageA->Create(IDD_PAGE_PORT_PROPERTY);
+			dlg.addPage(pPageA, "灞炴��");
+
+			CPagePortStatus* pPageB = new CPagePortStatus();
+			pPageB->setLoadPort((SERVO::CLoadPort*)pEquipment);
+			pPageB->Create(IDD_PAGE_PORT_STATUS);
+			dlg.addPage(pPageB, "Status");
 		}
 
 		CEquipmentPage2* pPage2 = new CEquipmentPage2();
diff --git a/SourceCode/Bond/Servo/CPagePortStatus.cpp b/SourceCode/Bond/Servo/CPagePortStatus.cpp
new file mode 100644
index 0000000..198e904
--- /dev/null
+++ b/SourceCode/Bond/Servo/CPagePortStatus.cpp
@@ -0,0 +1,127 @@
+锘�// CPagePortStatus.cpp: 瀹炵幇鏂囦欢
+//
+
+#include "stdafx.h"
+#include "Servo.h"
+#include "CPagePortStatus.h"
+#include "afxdialogex.h"
+
+
+// CPagePortStatus 瀵硅瘽妗�
+
+IMPLEMENT_DYNAMIC(CPagePortStatus, CHMPropertyPage)
+
+CPagePortStatus::CPagePortStatus(CWnd* pParent /*=nullptr*/)
+	: CHMPropertyPage(IDD_PAGE_PORT_STATUS, pParent)
+{
+	m_pPort = nullptr;
+}
+
+CPagePortStatus::~CPagePortStatus()
+{
+}
+
+void CPagePortStatus::DoDataExchange(CDataExchange* pDX)
+{
+	CHMPropertyPage::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CPagePortStatus, CHMPropertyPage)
+	ON_WM_CTLCOLOR()
+	ON_WM_DESTROY()
+	ON_WM_SIZE()
+END_MESSAGE_MAP()
+
+
+// CPagePortStatus 娑堟伅澶勭悊绋嬪簭
+void CPagePortStatus::setLoadPort(SERVO::CLoadPort* pPort)
+{
+	m_pPort = pPort;
+}
+
+BOOL CPagePortStatus::OnInitDialog()
+{
+	CHMPropertyPage::OnInitDialog();
+
+
+	ASSERT(m_pPort);
+	CComboBox* pComboBox;
+	std::string strTemp;
+
+	pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_PORT_STATUS);
+	for (int i = 1; i <= 6; i++) {
+		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortStatusDescription(i, strTemp).c_str());
+	}
+	int portStatus = m_pPort->getPortStatus();
+	if (1 <= portStatus && portStatus <= 6) {
+		pComboBox->SetCurSel(portStatus - 1);
+	}
+
+	SetDlgItemInt(IDC_EDIT_CASSETTE_NO, m_pPort->getCassetteSequenceNo());
+	SetDlgItemText(IDC_EDIT_CASSETTE_ID, m_pPort->getCassetteId().c_str());
+
+	pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_LOADING_CASSETTE_TYPE);
+	for (int i = 1; i <= 4; i++) {
+		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getLoadingCassetteTypeDescription(i, strTemp).c_str());
+	}
+	int loadingCassetteType = m_pPort->getLoadingCassetteType();
+	if (1 <= loadingCassetteType && loadingCassetteType <= 4) {
+		pComboBox->SetCurSel(loadingCassetteType - 1);
+	}
+
+	pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_QTIME_FLAG);
+	for (int i = 1; i <= 2; i++) {
+		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getQTimeFlagDescription(i, strTemp).c_str());
+	}
+	int qTimeFlag = m_pPort->getQTimeFlag();
+	if (1 <= qTimeFlag && qTimeFlag <= 2) {
+		pComboBox->SetCurSel(qTimeFlag - 1);
+	}
+	
+	pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_CASSETTE_MAPPING_STATE);
+	for (int i = 1; i <= 2; i++) {
+		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getCassetteMappingStateDescription(i, strTemp).c_str());
+	}
+	int mappingState = m_pPort->getCassetteMappingState();
+	if (1 <= mappingState && mappingState <= 2) {
+		pComboBox->SetCurSel(mappingState - 1);
+	}
+	
+	pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_CASSETTE_STATUS);
+	for (int i = 1; i <= 7; i++) {
+		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getCassetteStatusDescription(i, strTemp).c_str());
+	}
+	int cassetteStatus = m_pPort->getCassetteStatus();
+	if (1 <= cassetteStatus && cassetteStatus <= 7) {
+		pComboBox->SetCurSel(cassetteStatus - 1);
+	}
+
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
+}
+
+HBRUSH CPagePortStatus::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
+{
+	HBRUSH hbr = CHMPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
+
+	// TODO:  鍦ㄦ鏇存敼 DC 鐨勪换浣曠壒鎬�
+
+	// TODO:  濡傛灉榛樿鐨勪笉鏄墍闇�鐢荤瑪锛屽垯杩斿洖鍙︿竴涓敾绗�
+	return hbr;
+}
+
+void CPagePortStatus::OnDestroy()
+{
+	CHMPropertyPage::OnDestroy();
+
+	// TODO: 鍦ㄦ澶勬坊鍔犳秷鎭鐞嗙▼搴忎唬鐮�
+}
+
+void CPagePortStatus::OnSize(UINT nType, int cx, int cy)
+{
+	CHMPropertyPage::OnSize(nType, cx, cy);
+
+	// TODO: 鍦ㄦ澶勬坊鍔犳秷鎭鐞嗙▼搴忎唬鐮�
+}
\ No newline at end of file
diff --git a/SourceCode/Bond/Servo/CPagePortStatus.h b/SourceCode/Bond/Servo/CPagePortStatus.h
new file mode 100644
index 0000000..dd1a1a2
--- /dev/null
+++ b/SourceCode/Bond/Servo/CPagePortStatus.h
@@ -0,0 +1,35 @@
+锘�#pragma once
+#include "CHMPropertyPage.h"
+
+
+// CPagePortStatus 瀵硅瘽妗�
+
+class CPagePortStatus : public CHMPropertyPage
+{
+	DECLARE_DYNAMIC(CPagePortStatus)
+
+public:
+	CPagePortStatus(CWnd* pParent = nullptr);   // 鏍囧噯鏋勯�犲嚱鏁�
+	virtual ~CPagePortStatus();
+
+public:
+	void setLoadPort(SERVO::CLoadPort* pPort);
+
+private:
+	SERVO::CLoadPort* m_pPort;
+
+// 瀵硅瘽妗嗘暟鎹�
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_PAGE_PORT_STATUS };
+#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);
+};
diff --git a/SourceCode/Bond/Servo/Servo.rc b/SourceCode/Bond/Servo/Servo.rc
index a341402..d65ad7f 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 778e944..592daa4 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj
+++ b/SourceCode/Bond/Servo/Servo.vcxproj
@@ -200,6 +200,7 @@
   <ItemGroup>
     <ClInclude Include="CEquipmentPage3.h" />
     <ClInclude Include="CGlassPool.h" />
+    <ClInclude Include="CPagePortStatus.h" />
     <ClInclude Include="CPortStatusReport.h" />
     <ClInclude Include="MsgDlg.h" />
     <ClInclude Include="PageRecipe.h" />
@@ -290,6 +291,7 @@
     <ClInclude Include="SECSRuntimeManager.h" />
     <ClInclude Include="SecsTestDlg.h" />
     <ClInclude Include="Servo.h" />
+    <ClInclude Include="ServoCommo.h" />
     <ClInclude Include="ServoDlg.h" />
     <ClInclude Include="ServoGraph.h" />
     <ClInclude Include="stdafx.h" />
@@ -301,6 +303,7 @@
   <ItemGroup>
     <ClCompile Include="CEquipmentPage3.cpp" />
     <ClCompile Include="CGlassPool.cpp" />
+    <ClCompile Include="CPagePortStatus.cpp" />
     <ClCompile Include="CPortStatusReport.cpp" />
     <ClCompile Include="MsgDlg.cpp" />
     <ClCompile Include="PageRecipe.cpp" />
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj.filters b/SourceCode/Bond/Servo/Servo.vcxproj.filters
index eb0a614..81267f5 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj.filters
+++ b/SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -107,6 +107,7 @@
     <ClCompile Include="CEquipmentPage3.cpp" />
     <ClCompile Include="CPortStatusReport.cpp" />
     <ClCompile Include="MsgDlg.cpp" />
+    <ClCompile Include="CPagePortStatus.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="AlarmManager.h" />
@@ -212,6 +213,8 @@
     <ClInclude Include="CEquipmentPage3.h" />
     <ClInclude Include="CPortStatusReport.h" />
     <ClInclude Include="MsgDlg.h" />
+    <ClInclude Include="CPagePortStatus.h" />
+    <ClInclude Include="ServoCommo.h" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="Servo.rc" />
diff --git a/SourceCode/Bond/Servo/resource.h b/SourceCode/Bond/Servo/resource.h
index 140bfaf..1c4a361 100644
--- a/SourceCode/Bond/Servo/resource.h
+++ b/SourceCode/Bond/Servo/resource.h
Binary files differ

--
Gitblit v1.9.3