From e8a27bb203fe2aff70390a5eca002d7438da9b0f Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期三, 22 十月 2025 14:24:34 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang

---
 SourceCode/Bond/Servo/CBonder.cpp |  364 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 328 insertions(+), 36 deletions(-)

diff --git a/SourceCode/Bond/Servo/CBonder.cpp b/SourceCode/Bond/Servo/CBonder.cpp
index 0943eea..b9f8343 100644
--- a/SourceCode/Bond/Servo/CBonder.cpp
+++ b/SourceCode/Bond/Servo/CBonder.cpp
@@ -157,7 +157,6 @@
 			}
 		}
 
-
 		{
 			CEqDateTimeSetCmdStep* pStep = new CEqDateTimeSetCmdStep();
 			pStep->setName(STEP_DATETIME_SET_CMD);
@@ -193,12 +192,13 @@
 			// master recipe list report
 			CEqReadStep* pStep = new CEqReadStep(m_nIndex == 0 ? 0xa955 : 0xe955, 255 * 2,
 				[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
+					CEqReadStep* pTmpStep = (CEqReadStep*)pFrom;
+					short ret = MRLRC_OK;
 					if (code == ROK && pszData != nullptr && size > 0) {
 						// 此处解释配方数据
-						short ret = decodeRecipeListReport(pszData, size);
-						pStep->setReturnCode(ret);
+						ret = decodeRecipeListReport(pszData, size);
 					}
-					pStep->setReturnCode(MRLRC_OK);
+					pTmpStep->setReturnCode(ret);
 					return -1;
 				});
 			pStep->setName(STEP_EQ_MASTER_RECIPE_LIST);
@@ -223,13 +223,14 @@
 		{
 			// recipe parameter report
 			CEqReadStep* pStep = new CEqReadStep(m_nIndex == 0 ? 0xaa54 : 0xea54, 257 * 2,
-				[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
+				[&, pStep](void* pFrom, int code, const char* pszData, size_t size) -> int {
+					CEqReadStep* pTmpStep = (CEqReadStep*)pFrom;
+					short ret = MRLRC_OK;
 					if (code == ROK && pszData != nullptr && size > 0) {
 						// 此处解释配方数据
-						short ret = decodeRecipeParameterReport(pszData, size);
-						pStep->setReturnCode(ret);
+						ret = decodeRecipeParameterReport(pszData, size);
 					}
-					pStep->setReturnCode(MRLRC_OK);
+					pTmpStep->setReturnCode(ret);
 					return -1;
 				});
 			pStep->setName(STEP_EQ_RECIPE_PARAMETER);
@@ -244,7 +245,7 @@
 		{
 			// Received Job Report Upstream #1~9
 			char szBuffer[256];
-			for (int i = 0; i < 1; i++) {
+			for (int i = 0; i < 2; i++) {
 				CEqReadStep* pStep = new CEqReadStep((m_nIndex == 0 ? 0x8c90 : 0xcc90) + 320 * i, 320 * 2,
 					[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
 						if (code == ROK && pszData != nullptr && size > 0) {
@@ -264,16 +265,17 @@
 				}
 			}
 		}
+
 		{
 			// Sent Out Job Report Downstream #1~9
 			char szBuffer[256];
-			for (int i = 0; i < 1; i++) {
+			for (int i = 0; i < 2; i++) {
 				CEqReadStep* pStep = new CEqReadStep((m_nIndex == 0 ? 0x8000 : 0xc000) + 320 * i, 320 * 2,
 					[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
 						if (code == ROK && pszData != nullptr && size > 0) {
 							int port = (int)(__int64)((CEqReadStep*)pFrom)->getProp("Port");
 							if (port > 0) {
-								decodeReceivedJobReport((CStep*)pFrom, port, pszData, size);
+								decodeSentOutJobReport((CStep*)pFrom, port, pszData, size);
 							}
 						}
 						return -1;
@@ -291,7 +293,7 @@
 		{
 			// Fetched Out Job Report #1~15
 			char szBuffer[256];
-			for (int i = 0; i < 1; i++) {
+			for (int i = 0; i < 2; i++) {
 				CEqReadStep* pStep = new CEqReadStep((m_nIndex == 0 ? 0x9c31 : 0xdc31) + 18 * i, 18 * 2,
 					[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
 						if (code == ROK && pszData != nullptr && size > 0) {
@@ -315,7 +317,7 @@
 		{
 			// Stored Job Report #1~15
 			char szBuffer[256];
-			for (int i = 0; i < 1; i++) {
+			for (int i = 0; i < 2; i++) {
 				CEqReadStep* pStep = new CEqReadStep((m_nIndex == 0 ? 0x9b23 : 0xdb23) + 18 * i, 18 * 2,
 					[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
 						if (code == ROK && pszData != nullptr && size > 0) {
@@ -348,29 +350,15 @@
 			}
 		}
 
+		// FAC Data Report
+		addFacDataReportStep(m_nIndex == 0 ? 0xA589 : 0xE589,
+			m_nIndex == 0 ? 0x34d : 0x64d, 1);
+		/*
 		{
-			// Panel Data Report
-			CEqReadStep* pStep = new CEqReadStep(0xA17f, 386 * 2,
+			CEqReadStep* pStep = new CEqReadStep(m_nIndex == 0 ? 0xA589 : 0xE589, 133 * 2,
 				[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
 					if (code == ROK && pszData != nullptr && size > 0) {
-						decodePanelDataReport((CStep*)pFrom, pszData, size);
-					}
-					return -1;
-				});
-			pStep->setName(STEP_EQ_PANEL_DATA_REPORT);
-			pStep->setProp("Port", (void*)1);
-			pStep->setWriteSignalDev(0x45e);
-			if (addStep(STEP_ID_PANEL_DATA_REPORT, pStep) != 0) {
-				delete pStep;
-			}
-		}
-
-		{
-			// FAC Data Report
-			CEqReadStep* pStep = new CEqReadStep(0xA60E, 108 * 2,
-				[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
-					if (code == ROK && pszData != nullptr && size > 0) {
-						decodePanelDataReport((CStep*)pFrom, pszData, size);
+						decodeFacDataReport((CStep*)pFrom, pszData, size);
 					}
 					return -1;
 				});
@@ -378,6 +366,39 @@
 			pStep->setProp("Port", (void*)1);
 			pStep->setWriteSignalDev(0x34d);
 			if (addStep(STEP_ID_FAC_DATA_REPORT, pStep) != 0) {
+				delete pStep;
+			}
+		}
+		*/
+
+		// process start/end report
+		{
+			CEqReadStep* pStep = new CEqReadStep(m_nIndex == 0 ? 0x9D3F : 0xDD3F, 13 * 2,
+				[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
+					if (code == ROK && pszData != nullptr && size > 0) {
+						decodeJobProcessStartReport((CStep*)pFrom, pszData, size);
+					}
+					return -1;
+				});
+			pStep->setName(STEP_EQ_JOB_PROCESS_START_REPORT);
+			pStep->setProp("Port", (void*)1);
+			pStep->setWriteSignalDev(m_nIndex == 0 ? 0x333 : 0x633);
+			if (addStep(STEP_ID_JOB_PROCESS_START_REPORT, pStep) != 0) {
+				delete pStep;
+			}
+		}
+		{
+			CEqReadStep* pStep = new CEqReadStep(m_nIndex == 0 ? 0x9D4C : 0xDD4C, 13 * 2,
+				[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
+					if (code == ROK && pszData != nullptr && size > 0) {
+						decodeJobProcessEndReport((CStep*)pFrom, pszData, size);
+					}
+					return -1;
+				});
+			pStep->setName(STEP_EQ_JOB_PROCESS_END_REPORT);
+			pStep->setProp("Port", (void*)1);
+			pStep->setWriteSignalDev(m_nIndex == 0 ? 0x334 : 0x634);
+			if (addStep(STEP_ID_JOB_PROCESS_END_REPORT, pStep) != 0) {
 				delete pStep;
 			}
 		}
@@ -390,17 +411,33 @@
 		m_slot[0].setPosition(m_nID);
 		m_slot[0].setNo(1);
 		m_slot[0].setName("Slot 1(G2)");
+		m_slot[0].setLinkSignalPath(0);
 		m_slot[0].setType(MaterialsType::G2);
 		m_slot[1].enable();
 		m_slot[1].setPosition(m_nID);
 		m_slot[1].setNo(2);
 		m_slot[1].setName("Slot 2(G1)");
+		m_slot[1].setLinkSignalPath(1);
 		m_slot[1].setType(MaterialsType::G1);
 	}
 
 	void CBonder::onTimer(UINT nTimerid)
 	{
 		CEquipment::onTimer(nTimerid);
+
+		// test	 
+		/*
+		static int i[2] = { 0, 0 };
+		i[m_nIndex]++;
+		if (m_nIndex == 0 && i[m_nIndex] % 20 == 0) {
+			if (m_listener.onAlarm != nullptr) {
+				m_listener.onAlarm(this, 1,
+					i[m_nIndex],
+					getID(),
+					1);
+			}
+		}
+		*/
 	}
 
 	void CBonder::serialize(CArchive& ar)
@@ -428,12 +465,18 @@
 		return m_nIndex;
 	}
 
-	BOOL CBonder::hasBondClass()
+	BOOL CBonder::hasBondGlass()
 	{
 		CGlass* pGlass = (CGlass*)m_slot[1].getContext();
 		if (pGlass == nullptr) return FALSE;
 		CGlass* pBuddy = pGlass->getBuddy();
 		return pBuddy != nullptr;
+	}
+
+	BOOL CBonder::hasG2Glass()
+	{
+		CGlass* pGlass = (CGlass*)m_slot[0].getContext();
+		return (pGlass != nullptr);
 	}
 
 	int CBonder::onProcessData(CProcessData* pProcessData)
@@ -444,9 +487,9 @@
 		return 0;
 	}
 
-	int CBonder::onProcessStateChanged(PROCESS_STATE state)
+	int CBonder::onProcessStateChanged(int slotNo, PROCESS_STATE state)
 	{
-		CEquipment::onProcessStateChanged(state);
+		CEquipment::onProcessStateChanged(slotNo, state);
 
 		if (state == PROCESS_STATE::Complete) {
 			// 检查数据,当前两片玻璃,一片为G1, 一片为G2, 且pProcessData中的id能匹配G1或G2
@@ -484,4 +527,253 @@
 	{
 		return m_nIndex == 0 ? 15000 : 20000;
 	}
+
+	int CBonder::parsingParams(const char* pszData, size_t size, std::vector<CParam>& params)
+	{
+		ASSERT(pszData);
+		if (size < 250) return 0;
+		int i = 0, v;
+
+
+		// 1.校正对位延时
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("校正对位延时", "", this->getName().c_str(), v * 0.01f));
+		i += 2;
+
+		// 2.保压时间
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("保压时间", "", this->getName().c_str(), v * 0.01f));
+		i += 2;
+
+		// 3.腔体破真空延时
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("腔体破真空延时", "", this->getName().c_str(), v * 0.01f));
+		i += 2;
+
+		// 4.腔体分子泵启动延时
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("腔体分子泵启动延时", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 5.腔体贴附抽真空延时
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("腔体贴附抽真空延时", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 6.加热等待延时
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("加热等待延时", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 7.气囊压力设定
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+		params.push_back(CParam("气囊压力设定", "", this->getName().c_str(), v * 0.001f));
+		i += 4;
+
+		// 8.气囊加压速率
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+		params.push_back(CParam("气囊加压速率", "", this->getName().c_str(), v * 0.001f));
+		i += 4;
+
+		// 9.气囊泄压速率
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+		params.push_back(CParam("气囊泄压速率", "", this->getName().c_str(), v * 0.001f));
+		i += 4;
+
+		// 10.贴附压力上限
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+		params.push_back(CParam("贴附压力上限", "", this->getName().c_str(), v * 0.1f));
+		i += 4;
+
+		// 11.Z轴转矩速度设定
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+		params.push_back(CParam("上腔Z轴转矩速度设定", "", this->getName().c_str(), v * 0.001f));
+		i += 4;
+
+		// 12.上腔温度设定
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("上腔温度设定", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 13.下腔温度设定
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("下腔温度设定", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 14.上腔Z轴预贴合位速度
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+		params.push_back(CParam("上腔Z轴预贴合位速度", "", this->getName().c_str(), v * 0.001f));
+		i += 4;
+
+		// 15.上腔Z轴贴附位速度
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+		params.push_back(CParam("上腔Z轴贴附位速度", "", this->getName().c_str(), v * 0.001f));
+		i += 4;
+
+		// 16.上腔Z上腔加热位间距
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+		params.push_back(CParam("上腔Z上腔加热位间距", "", this->getName().c_str(), v * 0.001f));
+		i += 4;
+
+		// 17.上腔贴附位压入量
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+		params.push_back(CParam("上腔贴附位压入量", "", this->getName().c_str(), v * 0.001f));
+		i += 4;
+
+		// 18.上腔Z轴破真空距离
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+		params.push_back(CParam("上腔Z轴破真空距离", "", this->getName().c_str(), v * 0.001f));
+		i += 4;
+
+		// 19.下顶Pin破真空距离
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+		params.push_back(CParam("下顶Pin破真空距离", "", this->getName().c_str(), v * 0.001f));
+		i += 4;
+
+		// 20.下顶Pin加热位间距
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+		params.push_back(CParam("下顶Pin加热位间距", "", this->getName().c_str(), v * 0.001f));
+		i += 4;
+
+		// 21.腔体真空泵真空规设定值
+		params.push_back(CParam("腔体真空泵真空规设定值", "", this->getName().c_str(), (double)toFloat(&pszData[i])));
+		i += 4;
+
+		// 22.腔体分子泵到达设定值
+		params.push_back(CParam("腔体分子泵到达设定值", "", this->getName().c_str(), (double)toFloat(&pszData[i])));
+		i += 4;
+
+
+		return (int)params.size();
+	}
+
+	int CBonder::parsingProcessData(const char* pszData, size_t size, std::vector<CParam>& params)
+	{
+		return parsingParams(pszData, size, params);
+	}
+
+	int CBonder::parsingSVData(const char* pszData, size_t size, std::vector<CParam>& params)
+	{
+		/*
+		1	工艺运行步骤	1Word	123456
+			2	气囊压力当前	2Word	12345.6
+			3	上腔压力合计	1Word	1234.56
+			4	管道真空规值	FLOAT	123.456
+			5	腔体真空规值	FLOAT	123.456
+			6	上腔温度1	1Word	12345.6
+			7	上腔温度2	1Word	12345.6
+			8	上腔温度3	1Word	12345.6
+			9	上腔温度4	1Word	12345.6
+			10	上腔温度5	1Word	12345.6
+			11	上腔温度6	1Word	12345.6
+			12	下腔温度1	1Word	12345.6
+			13	下腔温度2	1Word	12345.6
+			14	下腔温度3	1Word	12345.6
+			15	下腔温度4	1Word	12345.6
+			16	下腔温度5	1Word	12345.6
+			17	下腔温度6	1Word	12345.6
+			18	压合剩余时间	1Word	1234.56
+*/
+
+		ASSERT(pszData);
+		if (size < 125) return 0;
+		int i = 0, v;
+
+
+		// 1.工艺运行步骤
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("工艺运行步骤", "", this->getName().c_str(), v));
+		i += 2;
+
+		// 2.气囊压力当前
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+		params.push_back(CParam("气囊压力当前", "", this->getName().c_str(), v * 0.1f));
+		i += 4;
+
+		// 3.上腔压力合计
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("上腔压力合计", "", this->getName().c_str(), ((short)v) * 0.01f));
+		i += 2;
+
+		// 4.管道真空规值
+		params.push_back(CParam("管道真空规值", "", this->getName().c_str(), (double)toFloat(&pszData[i])));
+		i += 4;
+
+		// 5.腔体真空规值
+		params.push_back(CParam("腔体真空规值", "", this->getName().c_str(), (double)toFloat(&pszData[i])));
+		i += 4;
+
+		// 6.上腔温度1
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("上腔温度1", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 7.上腔温度2
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("上腔温度2", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 8.上腔温度3
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("上腔温度3", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 9.上腔温度4
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("上腔温度4", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 10.上腔温度5
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("上腔温度5", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 11.上腔温度6
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("上腔温度6", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 12.下腔温度1
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("下腔温度1", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 13.下腔温度2
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("下腔温度2", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 14.下腔温度3
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("下腔温度3", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 15.下腔温度4
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("下腔温度4", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 16.下腔温度5
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("下腔温度5", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 17.下腔温度6
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("下腔温度6", "", this->getName().c_str(), v * 0.1f));
+		i += 2;
+
+		// 18.加热剩余时间
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("加热剩余时间", "", this->getName().c_str(), v * 0.01f));
+		i += 2;
+
+		// 19.压合剩余时间
+		v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+		params.push_back(CParam("压合剩余时间", "", this->getName().c_str(), v * 0.01f));
+		i += 2;
+
+		return (int)params.size();
+	}
+
 }

--
Gitblit v1.9.3