From 016183bc4926c4fd80599dc7e06542c5396e6fd8 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期六, 12 四月 2025 16:24:25 +0800
Subject: [PATCH] 1.读取机器的Job Event上报; 2.修复在读取CC-Link数据当单元号超出32767时读取失败的问题。
---
SourceCode/Bond/Servo/CJobDataB.cpp | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 112 insertions(+), 3 deletions(-)
diff --git a/SourceCode/Bond/Servo/CJobDataB.cpp b/SourceCode/Bond/Servo/CJobDataB.cpp
index efa4896..8373485 100644
--- a/SourceCode/Bond/Servo/CJobDataB.cpp
+++ b/SourceCode/Bond/Servo/CJobDataB.cpp
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "CJobDataB.h"
+#include "ToolUnits.h"
namespace SERVO {
@@ -13,19 +14,36 @@
}
+ short CJobDataB::getPortNo()
+ {
+ return m_nPortNo;
+ }
+
+ std::string& CJobDataB::getCarrierId()
+ {
+ return m_strCarrierId;
+ }
+
+ std::string& CJobDataB::getPruductId()
+ {
+ return m_pruductId;
+ }
+
int CJobDataB::serialize(char* pszBuffer, int nBufferSize)
{
+ if (nBufferSize < 640) return -1;
+
int index = 0;
memcpy(&pszBuffer[index], &m_nPortNo, sizeof(short));
index += sizeof(short);
int strLen = min(20, m_strCarrierId.size());
memcpy(&pszBuffer[index], m_strCarrierId.c_str(), strLen);
- index += strLen;
+ index += 20;
strLen = min(20, m_pruductId.size());
memcpy(&pszBuffer[index], m_pruductId.c_str(), strLen);
- index += strLen;
+ index += 20;
memcpy(&pszBuffer[index], &m_nCarrierState, sizeof(short));
index += sizeof(short);
@@ -40,9 +58,100 @@
std::string& strGlassId = m_glassIds.at(i);
strLen = min(20, strGlassId.size());
memcpy(&pszBuffer[index], strGlassId.c_str(), strLen);
- index += strLen;
+ index += 20;
}
return 320 * 2;
}
+
+ int CJobDataB::unserialize(char* pszBuffer, int nBufferSize)
+ {
+ if (nBufferSize < 640) return -1;
+
+ int index = 0;
+ memcpy(&m_nPortNo, &pszBuffer[index], sizeof(short));
+ index += sizeof(short);
+
+ CToolUnits::convertString(&pszBuffer[index], 20, m_strCarrierId);
+ index += 20;
+
+ CToolUnits::convertString(&pszBuffer[index], 20, m_pruductId);
+ index += 20;
+
+ memcpy(&m_nCarrierState, &pszBuffer[index], sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&m_nSlotMapping, &pszBuffer[index], sizeof(int));
+ index += sizeof(int);
+
+ memcpy(&m_nSlotSelectedFlag, &pszBuffer[index], sizeof(int));
+ index += sizeof(int);
+
+ std::string strGlassId;
+ m_glassIds.clear();
+ for (int i = 0; i < 25; i++) {
+ CToolUnits::convertString(&pszBuffer[index], 20, strGlassId);
+ index += 20;
+ if (!strGlassId.empty()) {
+ m_glassIds.push_back(strGlassId);
+ }
+ }
+
+ return 320 * 2;
+ }
+
+ short CJobDataB::getCarrierState()
+ {
+ return m_nCarrierState;
+ }
+
+ std::string& CJobDataB::getCarrierStateDescription(std::string& strDescription)
+ {
+ static char* pszDescription[20] = {
+ "Bind",
+ "CancelPod",
+ "CancelPodNotification",
+ "CancelPodOut",
+ "CancelPodAtPort",
+ "CancelBind",
+ "Clamp",
+ "ClosePod",
+ "IndexDown",
+ "IndexUp",
+ "OpenPod",
+ "PodComplete",
+ "PodIn",
+ "PodNotification",
+ "PodOut",
+ "PodRelease",
+ "PodTagReadData",
+ "PodTagWriteData",
+ "Proceed WithPod",
+ "Unclamp"
+ };
+
+ if (0 <= m_nCarrierState && m_nCarrierState < 20) {
+ strDescription = pszDescription[m_nCarrierState];
+ }
+ else {
+ strDescription = "";
+ }
+
+ return strDescription;
+ }
+
+ int CJobDataB::getSlotMapping()
+ {
+ return m_nSlotMapping;
+ }
+
+ int CJobDataB::getSlotSelectedFlag()
+ {
+ return m_nSlotSelectedFlag;
+ }
+
+ std::vector<std::string>& CJobDataB::getGlassIds()
+ {
+ return m_glassIds;
+ }
}
--
Gitblit v1.9.3