From e731e05bb712765bf85a359ff4d505e39ca09c02 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 01 七月 2025 14:19:01 +0800
Subject: [PATCH] 1.Port Status 测试; 2.Cassette ctrl cmd测试和修改地址;

---
 SourceCode/Bond/Servo/CPageGraph2.cpp          |    4 +
 SourceCode/Bond/Servo/CEquipment.cpp           |    7 +++
 SourceCode/Bond/Servo/CPortStatusReport.h      |    1 
 SourceCode/Bond/Servo/CLoadPort.h              |    3 +
 SourceCode/Bond/Servo/CPageCassetteCtrlCmd.cpp |   15 ++++++-
 SourceCode/Bond/Servo/CLoadPort.cpp            |   50 ++++++++++++++----------
 SourceCode/Bond/Servo/CPortStatusReport.cpp    |    5 ++
 SourceCode/Bond/Servo/Common.h                 |    4 ++
 8 files changed, 63 insertions(+), 26 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index 817f4bc..9b3ea67 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -601,7 +601,7 @@
 		CHECK_WRITE_STEP_SIGNAL(STEP_ID_IN_OP_CMD_REPLY, pszData, size);
 
 		// Panel Data Report
-		CHECK_WRITE_STEP_SIGNAL(STEP_ID_PANEL_DATA_REPORT, pszData, size);
+		CHECK_READ_STEP_SIGNAL(STEP_ID_PANEL_DATA_REPORT, pszData, size);
 
 		// Panel Data Request
 		CHECK_WRITE_STEP_SIGNAL(STEP_ID_PANEL_DATA_REQUEST, pszData, size);	
@@ -612,6 +612,11 @@
 		// job process start/end report
 		CHECK_READ_STEP_SIGNAL(STEP_ID_JOB_PROCESS_START_REPORT, pszData, size);
 		CHECK_READ_STEP_SIGNAL(STEP_ID_JOB_PROCESS_END_REPORT, pszData, size);
+
+		CHECK_WRITE_STEP_SIGNAL(STEP_ID_PROT1_CASSETTE_CTR_CMD_REPLY, pszData, size);
+		CHECK_WRITE_STEP_SIGNAL(STEP_ID_PROT2_CASSETTE_CTR_CMD_REPLY, pszData, size);
+		CHECK_WRITE_STEP_SIGNAL(STEP_ID_PROT3_CASSETTE_CTR_CMD_REPLY, pszData, size);
+		CHECK_WRITE_STEP_SIGNAL(STEP_ID_PROT4_CASSETTE_CTR_CMD_REPLY, pszData, size);
 	}
 
 	BOOL CEquipment::isBitOn(const char* pszData, size_t size, int index)
diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index f23f005..aa096e3 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -83,15 +83,15 @@
 
 		{
 			// Cassette Ctrl Cmd
-			static char* pszName[] = { STEP_EQ_P1_CASSETTE_CTRL_CMD,	STEP_EQ_P2_CASSETTE_CTRL_CMD, STEP_EQ_P3_CASSETTE_CTRL_CMD,	STEP_EQ_P4_CASSETTE_CTRL_CMD };
-			static int writeSignalDev[] = { 0x120, 0x121, 0x122, 0x123 };
+			static char* pszName[] = { STEP_EQ_P1_CASSETTE_CTRL_CMD, STEP_EQ_P2_CASSETTE_CTRL_CMD, STEP_EQ_P3_CASSETTE_CTRL_CMD, STEP_EQ_P4_CASSETTE_CTRL_CMD };
+			static int writeSignalDev[] = { 0x130, 0x131, 0x132, 0x133 };
 			static int dev[] = { 0x45, 0x1a5, 0x305, 0x465 };
-			static int addr[] = { 0x480, 0x481, 0x482, 0x483 };
+			static int addr[] = { STEP_ID_PROT1_CASSETTE_CTR_CMD_REPLY, STEP_ID_PROT2_CASSETTE_CTR_CMD_REPLY, STEP_ID_PROT3_CASSETTE_CTR_CMD_REPLY, STEP_ID_PROT4_CASSETTE_CTR_CMD_REPLY };
 
-			CEqCassetteCtrlCmdStep* pStep = new CEqCassetteCtrlCmdStep();
+			CEqWriteStep* pStep = new CEqWriteStep();
 			pStep->setName(pszName[m_nIndex]);
 			pStep->setWriteSignalDev(writeSignalDev[m_nIndex]);
-			pStep->setCtrlCmdDev(dev[m_nIndex]);
+			pStep->setDataDev(dev[m_nIndex]);
 			if (addStep(addr[m_nIndex], pStep) != 0) {
 				delete pStep;
 			}
@@ -324,12 +324,12 @@
 			};
 			static int dev[] = { 0x6050, 0x6070, 0x6090, 0x60b0 };
 			static int writeSignalDev[6][4] = {
+				{0xc8, 0xc9, 0xca, 0xcb},
+				{0xd0, 0xd1, 0xd2, 0xd3},
 				{0xd8, 0xd9, 0xda, 0xdb},
 				{0xe0, 0xe1, 0xe2, 0xe3},
 				{0xe8, 0xe9, 0xea, 0xeb},
-				{0xf0, 0xf1, 0xf2, 0xf3},
-				{0xf8, 0xf9, 0xfa, 0xfb},
-				{0x100, 0x101, 0x102, 0x103}
+				{0xf0, 0xf1, 0xf2, 0xf3}
 			};
 			static int addr[6][4] = {
 				{ STEP_ID_PORT1_EMPTY, STEP_ID_PORT2_EMPTY, STEP_ID_PORT3_EMPTY, STEP_ID_PORT4_EMPTY },
@@ -423,17 +423,22 @@
 		int jobExistenceSize,
 		short slotProcess,
 		short jopCount,
-		CJobDataA* pJobDataA)
+		CJobDataA* pJobDataA,
+		ONWRITED onWritedBlock)
 	{
-		int id = getID();
-		if ( !(id == EQ_ID_LOADPORT1 || id == EQ_ID_LOADPORT2) ) {
-			return -1;
-		}
-
-
-		SERVO::CEqCassetteCtrlCmdStep* pStep = (SERVO::CEqCassetteCtrlCmdStep*)getCassetteCtrlCmdStep();
+		SERVO::CEqWriteStep* pStep = (SERVO::CEqWriteStep*)getCassetteCtrlCmdStep();
 		ASSERT(pStep);
-		return pStep->sendCtrlCmd(cmd, jobExistence, jobExistenceSize, slotProcess, jopCount, pJobDataA);
+
+		ASSERT(jobExistenceSize == 12);
+		ASSERT(pJobDataA);
+
+		char szBuffer[1024] = { 0 };
+		memcpy(&szBuffer[0], &cmd, sizeof(short));
+		memcpy(&szBuffer[2], jobExistence, sizeof(short) * jobExistenceSize);
+		memcpy(&szBuffer[26], &slotProcess, sizeof(short));
+		memcpy(&szBuffer[36], &jopCount, sizeof(short));
+		int nLen = pJobDataA->serialize(&szBuffer[38], 1024 - 38);
+		return pStep->writeDataEx(szBuffer, 352 * 2, onWritedBlock);
 	}
 
 	CStep* CLoadPort::getCassetteCtrlCmdStep()
@@ -897,10 +902,13 @@
 		CAttributeVector& attrubutes = pStep->attributeVector();
 		m_portStatusReport.getAttributeVector(attrubutes, weight);
 
-		LOGI("<CCassetteTranserStateStep>decodePortStatusReport<Status:%d, CassetteSequenceNo:%d>",
-			m_portStatusReport.getPortStatus(), m_portStatusReport.getCassetteSequenceNo());
-
-
+		LOGI("<CCassetteTranserStateStep>decodePortStatusReport<Status:%d, CassetteSequenceNo:%d, CassetteId:%s>",
+			m_portStatusReport.getPortStatus(), m_portStatusReport.getCassetteSequenceNo(), 
+			m_portStatusReport.getCassetteId().c_str());
+		if (m_portStatusReport.getPortStatus() == 3) {
+			LOGI("<CCassetteTranserStateStep>InUse<JobExistenceSlot:%d>",
+				m_portStatusReport.getJobExistenceSlot());
+		}
 		return nRet;
 	}
 
diff --git a/SourceCode/Bond/Servo/CLoadPort.h b/SourceCode/Bond/Servo/CLoadPort.h
index bc91232..daf5516 100644
--- a/SourceCode/Bond/Servo/CLoadPort.h
+++ b/SourceCode/Bond/Servo/CLoadPort.h
@@ -76,7 +76,8 @@
 			int jobExistenceSize,
 			short slotProcess,
 			short jopCount,
-			CJobDataA* pJobDataA);
+			CJobDataA* pJobDataA,
+			ONWRITED onWritedBlock);
 		CStep* getCassetteCtrlCmdStep();
 
 	private:
diff --git a/SourceCode/Bond/Servo/CPageCassetteCtrlCmd.cpp b/SourceCode/Bond/Servo/CPageCassetteCtrlCmd.cpp
index 0b36e1e..324e975 100644
--- a/SourceCode/Bond/Servo/CPageCassetteCtrlCmd.cpp
+++ b/SourceCode/Bond/Servo/CPageCassetteCtrlCmd.cpp
@@ -90,7 +90,9 @@
 {
 	ASSERT(m_pEquipment != nullptr);
 	ASSERT(m_pEquipment->getID() == EQ_ID_LOADPORT1
-		|| m_pEquipment->getID() == EQ_ID_LOADPORT2);
+		|| m_pEquipment->getID() == EQ_ID_LOADPORT2
+		|| m_pEquipment->getID() == EQ_ID_LOADPORT3
+		|| m_pEquipment->getID() == EQ_ID_LOADPORT4);
 	SERVO::CLoadPort* pLoadPort = (SERVO::CLoadPort*)m_pEquipment;
 
 	short cmd = 0;
@@ -112,5 +114,14 @@
 
 
 	pLoadPort->sendCassetteCtrlCmd(cmd, &jobExistence[0], jobExistenceSize, slotProcess,
-		jobCount, pJobDataA);
+		jobCount, pJobDataA, [&](int code) -> int {
+			if (code == WOK) {
+				LOGI("sendCassetteCtrlCmd 鎴愬姛.");
+			}
+			else {
+				LOGI("sendCassetteCtrlCmd 澶辫触.");
+			}
+
+			return 0;
+		});
 }
diff --git a/SourceCode/Bond/Servo/CPageGraph2.cpp b/SourceCode/Bond/Servo/CPageGraph2.cpp
index eb40345..bc21845 100644
--- a/SourceCode/Bond/Servo/CPageGraph2.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -159,7 +159,9 @@
 		}
 
 		if (pEquipment->getID() == EQ_ID_LOADPORT1
-			|| pEquipment->getID() == EQ_ID_LOADPORT2) {
+			|| pEquipment->getID() == EQ_ID_LOADPORT2
+			|| pEquipment->getID() == EQ_ID_LOADPORT3
+			|| pEquipment->getID() == EQ_ID_LOADPORT4) {
 			CPageCassetteCtrlCmd* pPage = new CPageCassetteCtrlCmd();
 			pPage->setEquipment(pEquipment);
 			pPage->Create(IDD_PAGE_CASSETTE_CTRL_CMD);
diff --git a/SourceCode/Bond/Servo/CPortStatusReport.cpp b/SourceCode/Bond/Servo/CPortStatusReport.cpp
index 03864e2..e132f12 100644
--- a/SourceCode/Bond/Servo/CPortStatusReport.cpp
+++ b/SourceCode/Bond/Servo/CPortStatusReport.cpp
@@ -237,6 +237,11 @@
 		return false;
 	}
 
+	short CPortStatusReport::getJobExistenceSlot()
+	{
+		return m_nJobExistenceSlot[0];
+	}
+
 	void CPortStatusReport::WriteString(CArchive& ar, std::string& string)
 	{
 		CString strTemp = string.c_str();
diff --git a/SourceCode/Bond/Servo/CPortStatusReport.h b/SourceCode/Bond/Servo/CPortStatusReport.h
index 4c6fa4b..0555d51 100644
--- a/SourceCode/Bond/Servo/CPortStatusReport.h
+++ b/SourceCode/Bond/Servo/CPortStatusReport.h
@@ -28,6 +28,7 @@
 	public:
 		bool canPickFromPort();
 		bool isJobExistenceSlot();
+		short getJobExistenceSlot();
 
 	private:
 		void WriteString(CArchive& ar, std::string& string);
diff --git a/SourceCode/Bond/Servo/Common.h b/SourceCode/Bond/Servo/Common.h
index 93ff1aa..cc58f4f 100644
--- a/SourceCode/Bond/Servo/Common.h
+++ b/SourceCode/Bond/Servo/Common.h
@@ -444,6 +444,10 @@
 #define STEP_ID_PROT2_CASSETTE_TYPE_CHANGE_REPLY	0x699
 #define STEP_ID_PROT3_CASSETTE_TYPE_CHANGE_REPLY	0x69A
 #define STEP_ID_PROT4_CASSETTE_TYPE_CHANGE_REPLY	0x69B
+#define STEP_ID_PROT1_CASSETTE_CTR_CMD_REPLY		0x6A0
+#define STEP_ID_PROT2_CASSETTE_CTR_CMD_REPLY		0x6A1
+#define STEP_ID_PROT3_CASSETTE_CTR_CMD_REPLY		0x6A2
+#define STEP_ID_PROT4_CASSETTE_CTR_CMD_REPLY		0x6A3
 #define STEP_ID_ROBOT_CMD_REPLY						0x6b0
 
 

--
Gitblit v1.9.3