From 7034036d6ab7163a6ea0e5d712ba86d6cd9591bc Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期四, 24 七月 2025 16:37:27 +0800
Subject: [PATCH] 1. 根据文档更新JobDataS

---
 SourceCode/Bond/Servo/CJobDataS.h   |   19 +++---
 SourceCode/Bond/Servo/CJobDataS.cpp |  125 ++++++++++++++++++++++++-----------------
 2 files changed, 82 insertions(+), 62 deletions(-)

diff --git a/SourceCode/Bond/Servo/CJobDataS.cpp b/SourceCode/Bond/Servo/CJobDataS.cpp
index d4eb751..f293233 100644
--- a/SourceCode/Bond/Servo/CJobDataS.cpp
+++ b/SourceCode/Bond/Servo/CJobDataS.cpp
@@ -20,15 +20,17 @@
 		m_nProcessResonCode = 0;
 		m_nLastGlassFlag = 0;
 		m_nFirstGlassFlag = 0;
-		m_nQTime[3] = {0};
+		m_nQTime[3] = { 0 };
 		m_nQTimeOverFlag = 0;
 		m_nMasterRecipe = 0;
+		m_nRecipeIds[DEVICE_COUNT] = { 0 };
 		m_nMode = 0;
 		m_nSlotUnitSelectFlag = 0;
 		m_nSourcePortNo = 0;
 		m_nSourceSlotNo = 0;
 		m_nTargetPortNo = 0;
 		m_nTargetSlotNo = 0;
+		m_nProductJudge = 0;
 		m_pRawData = nullptr;
 		m_pOwner = nullptr;
 		if (ENABLE_JOBDATAS_RAWDATA) {
@@ -75,9 +77,7 @@
 		m_nQTime[2] = pScr->m_nQTime[2];
 		m_nQTimeOverFlag = pScr->m_nQTimeOverFlag;
 		m_nMasterRecipe = pScr->m_nMasterRecipe;
-		m_strProductRecipeId = pScr->m_strProductRecipeId;
-		m_strPCode = pScr->m_strPCode;
-		m_strUseType = pScr->m_strUseType;
+		memcpy(m_nRecipeIds, pScr->m_nRecipeIds, sizeof(m_nRecipeIds));
 		m_strPanelMeasure = pScr->m_strPanelMeasure;
 		m_nMode = pScr->m_nMode;
 		m_nSlotUnitSelectFlag = pScr->m_nSlotUnitSelectFlag;
@@ -85,6 +85,7 @@
 		m_nSourceSlotNo = pScr->m_nSourceSlotNo;
 		m_nTargetPortNo = pScr->m_nTargetPortNo;
 		m_nTargetSlotNo = pScr->m_nTargetSlotNo;
+		m_nProductJudge = pScr->m_nProductJudge;
 		m_pOwner = pScr->m_pOwner;
 	}
 
@@ -111,9 +112,7 @@
 		m_nQTime[2] = pScr->m_nQTime[2];
 		m_nQTimeOverFlag = pScr->m_nQTimeOverFlag;
 		m_nMasterRecipe = pScr->m_nMasterRecipe;
-		m_strProductRecipeId = pScr->m_strProductRecipeId;
-		m_strPCode = pScr->m_strPCode;
-		m_strUseType = pScr->m_strUseType;
+		memcpy(m_nRecipeIds, pScr->m_nRecipeIds, sizeof(m_nRecipeIds));
 		m_strPanelMeasure = pScr->m_strPanelMeasure;
 		m_nMode = pScr->m_nMode;
 		m_nSlotUnitSelectFlag = pScr->m_nSlotUnitSelectFlag;
@@ -121,6 +120,7 @@
 		m_nSourceSlotNo = pScr->m_nSourceSlotNo;
 		m_nTargetPortNo = pScr->m_nTargetPortNo;
 		m_nTargetSlotNo = pScr->m_nTargetSlotNo;
+		m_nProductJudge = pScr->m_nProductJudge;
 		m_pOwner = pScr->m_pOwner;
 	}
 
@@ -339,34 +339,40 @@
 		m_nMasterRecipe = recipe;
 	}
 
-	std::string& CJobDataS::getProductRecipeId()
+	short CJobDataS::getDeviceRecipeId(int nDeviceIndex) const
 	{
-		return m_strProductRecipeId;
+		if (nDeviceIndex < 0 || nDeviceIndex >= DEVICE_COUNT) {
+			return 0;
+		}
+
+		return m_nRecipeIds[nDeviceIndex];
 	}
 
-	void CJobDataS::setProductRecipeId(const char* pszId)
+	void CJobDataS::setDeviceRecipeId(int nDeviceIndex, short nRecipeId)
 	{
-		m_strProductRecipeId = pszId;
+		if (nDeviceIndex < 0 || nDeviceIndex >= DEVICE_COUNT) {
+			return;
+		}
+
+		m_nRecipeIds[nDeviceIndex] = nRecipeId;
 	}
 
-	std::string& CJobDataS::getPCode()
-	{
-		return m_strPCode;
+	const short* CJobDataS::getRecipeIds() const
+	{ 
+		return m_nRecipeIds;
 	}
 
-	void CJobDataS::setPCode(const char* pszCode)
+	void CJobDataS::setRecipeIds(const short* pIds, int nCount)
 	{
-		m_strPCode = pszCode;
-	}
+		int nCopyCount = nCount > DEVICE_COUNT ? DEVICE_COUNT : nCount;
+		for (int i = 0; i < nCopyCount; ++i) {
+			m_nRecipeIds[i] = pIds[i];
+		}
 
-	std::string& CJobDataS::getUseType()
-	{
-		return m_strPCode;
-	}
-
-	void CJobDataS::setUseType(const char* pszType)
-	{
-		m_strPCode = pszType;
+		// 如果 nCount < DEVICE_COUNT,可以选择补零
+		for (int i = nCopyCount; i < DEVICE_COUNT; ++i) {
+			m_nRecipeIds[i] = 0;
+		}
 	}
 
 	std::string& CJobDataS::getPanelMeasure()
@@ -437,6 +443,16 @@
 	void CJobDataS::setTargetSlotNo(int no)
 	{
 		m_nTargetSlotNo = no;
+	}
+
+	short CJobDataS::getProductJudge() const
+	{
+		return m_nProductJudge;
+	}
+
+	void CJobDataS::setProductJudge(short nProductJudge)
+	{
+		m_nProductJudge = nProductJudge;
 	}
 
 	int CJobDataS::serialize(char* pszBuffer, int nBufferSize)
@@ -515,17 +531,10 @@
 		memcpy(&pszBuffer[index], &m_nMasterRecipe, sizeof(short));
 		index += sizeof(short);
 
-		strLen = min(10, (int)m_strProductRecipeId.size());
-		memcpy(&pszBuffer[index], m_strProductRecipeId.c_str(), strLen);
-		index += 10;
-
-		strLen = min(10, (int)m_strPCode.size());
-		memcpy(&pszBuffer[index], m_strPCode.c_str(), strLen);
-		index += 10;
-
-		strLen = min(10, (int)m_strUseType.size());
-		memcpy(&pszBuffer[index], m_strUseType.c_str(), strLen);
-		index += 10;
+		for (int i = 0; i < DEVICE_COUNT; i++) {
+			memcpy(&pszBuffer[index], &m_nRecipeIds[i], sizeof(short));
+			index += sizeof(short);
+		}
 
 		strLen = min(80, (int)m_strPanelMeasure.size());
 		memcpy(&pszBuffer[index], m_strPanelMeasure.c_str(), strLen);
@@ -547,6 +556,9 @@
 		index += sizeof(short);
 
 		memcpy(&pszBuffer[index], &m_nTargetSlotNo, sizeof(short));
+		index += sizeof(short);
+
+		memcpy(&pszBuffer[index], &m_nProductJudge, sizeof(short));
 		index += sizeof(short);
 
 		return 256 * 2;
@@ -620,16 +632,12 @@
 		memcpy(&m_nMasterRecipe, &pszBuffer[index], sizeof(short));
 		index += sizeof(short);
 
-		CToolUnits::convertString(&pszBuffer[index], 10, m_strProductRecipeId);
-		index += 10;
+		for (int i = 0; i < DEVICE_COUNT; i++) {
+			memcpy(&m_nRecipeIds[i], &pszBuffer[index], sizeof(short));
+			index += sizeof(short);
+		}
 
-		CToolUnits::convertString(&pszBuffer[index], 10, m_strProductRecipeId);
-		index += 10;
-
-		CToolUnits::convertString(&pszBuffer[index], 10, m_strProductRecipeId);
-		index += 10;
-
-		CToolUnits::convertString(&pszBuffer[index], 80, m_strProductRecipeId);
+		CToolUnits::convertString(&pszBuffer[index], 80, m_strPanelMeasure);
 		index += 80;
 
 		memcpy(&m_nMode, &pszBuffer[index], sizeof(short));
@@ -650,12 +658,13 @@
 		memcpy(&m_nTargetSlotNo, &pszBuffer[index], sizeof(short));
 		index += sizeof(short);
 
+		memcpy(&m_nProductJudge, &pszBuffer[index], sizeof(short));
+		index += sizeof(short);
 
 		// 缓存原始数据
 		if (m_pRawData != nullptr) {
 			memcpy(m_pRawData, pszBuffer, JOBDATAS_SIZE);
 		}
-
 
 		return JOBDATAS_SIZE;
 	}
@@ -728,14 +737,23 @@
 		attrubutes.addAttribute(new CAttribute("MasterRecipe",
 			std::to_string(getMasterRecipe()).c_str(), "", weight++));
 
-		attrubutes.addAttribute(new CAttribute("ProductRecipeId",
-			getProductRecipeId().c_str(), "", weight++));
+		attrubutes.addAttribute(new CAttribute("Recipe ID(EFEM)",
+			std::to_string(getDeviceRecipeId(0)).c_str(), "", weight++));
 
-		attrubutes.addAttribute(new CAttribute("PCode",
-			getPCode().c_str(), "", weight++));
+		attrubutes.addAttribute(new CAttribute("Recipe ID(BONDER1)",
+			std::to_string(getDeviceRecipeId(1)).c_str(), "", weight++));
 
-		attrubutes.addAttribute(new CAttribute("UseType",
-			getUseType().c_str(), "", weight++));
+		attrubutes.addAttribute(new CAttribute("Recipe ID(BONDER2)",
+			std::to_string(getDeviceRecipeId(2)).c_str(), "", weight++));
+
+		attrubutes.addAttribute(new CAttribute("Recipe ID(Bake Cooling)",
+			std::to_string(getDeviceRecipeId(3)).c_str(), "", weight++));
+
+		attrubutes.addAttribute(new CAttribute("Recipe ID(Vacuum Bake)",
+			std::to_string(getDeviceRecipeId(4)).c_str(), "", weight++));
+
+		attrubutes.addAttribute(new CAttribute("Recipe ID(Measurement)",
+			std::to_string(getDeviceRecipeId(5)).c_str(), "", weight++));
 
 		attrubutes.addAttribute(new CAttribute("PanelMeasure",
 			getPanelMeasure().c_str(), "", weight++));
@@ -754,5 +772,8 @@
 
 		attrubutes.addAttribute(new CAttribute("TargetSlotNo",
 			std::to_string(getTargetSlotNo()).c_str(), "", weight++));
+
+		attrubutes.addAttribute(new CAttribute("ProductJudge",
+			std::to_string(getProductJudge()).c_str(), "", weight++));
 	}
 }
diff --git a/SourceCode/Bond/Servo/CJobDataS.h b/SourceCode/Bond/Servo/CJobDataS.h
index ad3e2a9..1867b7d 100644
--- a/SourceCode/Bond/Servo/CJobDataS.h
+++ b/SourceCode/Bond/Servo/CJobDataS.h
@@ -2,7 +2,7 @@
 #include "CAttributeVector.h"
 #include "CJobDataB.h"
 
-
+#define DEVICE_COUNT		15
 #define JOBDATAS_SIZE		(256 * 2)
 namespace SERVO {
 	class CJobDataS
@@ -56,12 +56,10 @@
 		void setQTimeOverFlag(int flag);
 		int getMasterRecipe();
 		void setMasterRecipe(int recipe);
-		std::string& getProductRecipeId();
-		void setProductRecipeId(const char* pszId);
-		std::string& getPCode();
-		void setPCode(const char* pszCode);
-		std::string& getUseType();
-		void setUseType(const char* pszType);
+		short getDeviceRecipeId(int nDeviceIndex) const;
+		void setDeviceRecipeId(int nDeviceIndex, short nRecipeId);
+		const short* getRecipeIds() const;
+		void setRecipeIds(const short* pIds, int nCount);
 		std::string& getPanelMeasure();
 		void setPanelMeasure(const char* pszMeasure);
 		int getMode();
@@ -76,6 +74,8 @@
 		void setTargetPortNo(int no);
 		int getTargetSlotNo();
 		void setTargetSlotNo(int no);
+		short getProductJudge() const;
+		void setProductJudge(short nProductJudge);
 		int serialize(char* pszBuffer, int nBufferSize);
 		int unserialize(const char* pszBuffer, int nBufferSize);
 		void getAttributeVector(CAttributeVector& attrubutes, int beginWeight);
@@ -102,9 +102,7 @@
 		int m_nQTime[3];
 		int m_nQTimeOverFlag;
 		int m_nMasterRecipe;
-		std::string m_strProductRecipeId;
-		std::string m_strPCode;
-		std::string m_strUseType;
+		short m_nRecipeIds[DEVICE_COUNT];
 		std::string m_strPanelMeasure;
 		int m_nMode;
 		int m_nSlotUnitSelectFlag;
@@ -112,6 +110,7 @@
 		int m_nSourceSlotNo;
 		int m_nTargetPortNo;
 		int m_nTargetSlotNo;
+		short m_nProductJudge;
 
 	private:
 		char* m_pRawData;

--
Gitblit v1.9.3