From 88c9c1847ce8cfe8d94fe6c509b5af6f07a7b0fa Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期三, 21 五月 2025 13:49:11 +0800
Subject: [PATCH] 1.补充上一提交;
---
SourceCode/Bond/Servo/CPortStatusReport.h | 42 ++++++++
SourceCode/Bond/Servo/CPortStatusReport.cpp | 212 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 254 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/CPortStatusReport.cpp b/SourceCode/Bond/Servo/CPortStatusReport.cpp
new file mode 100644
index 0000000..6b2b7ca
--- /dev/null
+++ b/SourceCode/Bond/Servo/CPortStatusReport.cpp
@@ -0,0 +1,212 @@
+#include "stdafx.h"
+#include "CPortStatusReport.h"
+#include "ToolUnits.h"
+#include "Common.h"
+#include "Log.h"
+
+
+namespace SERVO {
+ CPortStatusReport::CPortStatusReport()
+ {
+ m_nPortStatus = 0;
+ m_nCassetteSequenceNo = 0;
+ m_nLoadingCassetteType = 0;
+ m_nQTimeFlag = 0;
+ m_nCassetteMappingState = 0;
+ m_nCassetteStatus = 0;
+ }
+
+ CPortStatusReport::~CPortStatusReport()
+ {
+
+ }
+
+ void CPortStatusReport::copyEx(CPortStatusReport& other)
+ {
+ m_nPortStatus = other.m_nPortStatus;
+ m_nCassetteSequenceNo = other.m_nCassetteSequenceNo;
+ m_strCassetteID = other.m_strCassetteID;
+
+ // Job Existence Slot
+ if (PORT_INUSE == m_nPortStatus) {
+ for (int i = 0; i < 12; i++) {
+ m_nJobExistenceSlot[i] = other.m_nJobExistenceSlot[i];
+ }
+ }
+
+ if (!m_strCassetteID.empty()) {
+ m_nLoadingCassetteType = other.m_nLoadingCassetteType;
+ }
+
+ if (PORT_UNLOAD_READY == m_nPortStatus) {
+ m_nQTimeFlag = other.m_nQTimeFlag;
+ }
+
+ m_nCassetteMappingState = other.m_nCassetteMappingState;
+ m_nCassetteStatus = other.m_nCassetteStatus;
+ }
+
+ short CPortStatusReport::getPortStatus()
+ {
+ return m_nPortStatus;
+ }
+
+ short CPortStatusReport::getCassetteSequenceNo()
+ {
+ return m_nCassetteSequenceNo;
+ }
+
+ std::string& CPortStatusReport::getCassetteId()
+ {
+ return m_strCassetteID;
+ }
+
+ short CPortStatusReport::getLoadingCassetteType()
+ {
+ return m_nLoadingCassetteType;
+ }
+
+ short CPortStatusReport::getQTimeFlag()
+ {
+ return m_nQTimeFlag;
+ }
+
+ short CPortStatusReport::getCassetteMappingState()
+ {
+ return m_nCassetteMappingState;
+ }
+
+ short CPortStatusReport::getCassetteStatus()
+ {
+ return m_nCassetteStatus;
+ }
+
+ int CPortStatusReport::serialize(char* pszBuffer, int nBufferSize)
+ {
+ if (nBufferSize < 32 * 2) return -1;
+
+ int index = 0;
+ memcpy(&pszBuffer[index], &m_nPortStatus, sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&pszBuffer[index], &m_nCassetteSequenceNo, sizeof(short));
+ index += sizeof(short);
+
+ int strLen = min(20, m_strCassetteID.size());
+ memcpy(&pszBuffer[index], m_strCassetteID.c_str(), strLen);
+ index += 20;
+
+ memcpy(&pszBuffer[index], &m_nJobExistenceSlot[0], sizeof(short));
+ index += 12 * sizeof(short);
+
+ memcpy(&pszBuffer[index], &m_nLoadingCassetteType, sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&pszBuffer[index], &m_nQTimeFlag, sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&pszBuffer[index], &m_nCassetteMappingState, sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&pszBuffer[index], &m_nCassetteStatus, sizeof(short));
+ index += sizeof(short);
+
+ return 32 * 2;
+ }
+
+ int CPortStatusReport::unserialize(const char* pszBuffer, int nBufferSize)
+ {
+ if (nBufferSize < 32 * 2) return -1;
+
+ int index = 0;
+ memcpy(&m_nPortStatus, &pszBuffer[index], sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&m_nCassetteSequenceNo, &pszBuffer[index], sizeof(short));
+ index += sizeof(short);
+
+ CToolUnits::convertString(&pszBuffer[index], 20, m_strCassetteID);
+ index += 20;
+
+ memcpy(&m_nJobExistenceSlot[0], &pszBuffer[index], sizeof(short));
+ index += 12 * sizeof(short);
+
+ memcpy(&m_nLoadingCassetteType, &pszBuffer[index], sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&m_nLoadingCassetteType, &pszBuffer[index], sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&m_nQTimeFlag, &pszBuffer[index], sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&m_nCassetteMappingState, &pszBuffer[index], sizeof(short));
+ index += sizeof(short);
+
+ memcpy(&m_nCassetteStatus, &pszBuffer[index], sizeof(short));
+ index += sizeof(short);
+
+ return 15 * 2;
+ }
+
+ void CPortStatusReport::getAttributeVector(CAttributeVector& attrubutes, int beginWeight)
+ {
+ unsigned int weight = beginWeight;
+ std::string strTemp;
+
+ attrubutes.addAttribute(new CAttribute("PortStatus",
+ std::to_string(m_nPortStatus).c_str(), "", weight++));
+
+ attrubutes.addAttribute(new CAttribute("CassetteSequenceNo",
+ std::to_string(m_nCassetteSequenceNo).c_str(), "", weight++));
+
+ attrubutes.addAttribute(new CAttribute("CassetteID",
+ m_strCassetteID.c_str(), "", weight++));
+
+ attrubutes.addAttribute(new CAttribute("LoadingCassetteType",
+ std::to_string(m_nLoadingCassetteType).c_str(), "", weight++));
+
+ attrubutes.addAttribute(new CAttribute("QTimeFlag",
+ std::to_string(m_nQTimeFlag).c_str(), "", weight++));
+
+ attrubutes.addAttribute(new CAttribute("CassetteMappingState",
+ std::to_string(m_nCassetteMappingState).c_str(), "", weight++));
+
+ attrubutes.addAttribute(new CAttribute("CassetteStatus",
+ std::to_string(m_nCassetteStatus).c_str(), "", weight++));
+ }
+
+ bool CPortStatusReport::canPickFromPort()
+ {
+ // 1. Port 状态必须是 Load Ready(上料请求)
+ if (m_nPortStatus != PORT_LOAD_REQUEST) return false;
+
+ // 2. Cassette 状态必须不是“无盒子”,应为等待开始或处理中等
+ if (m_nCassetteStatus == CASSETTE_NO_EXIST || m_nCassetteStatus == CASSETTE_PROCCESS_PAUSED)
+ return false;
+
+ // 3. Cassette ID 不可为空
+ if (m_strCassetteID.empty()) return false;
+
+ // 4. 至少一个Slot存在玻璃
+ if (!isJobExistenceSlot()) return false;
+
+ // 5. Mapping状态必须已使用
+ if (m_nCassetteMappingState != 1) return false;
+
+ // 6. Cassette 类型必须是有效盒子
+ if (m_nLoadingCassetteType != 1) return false;
+
+ return true;
+ }
+
+ bool CPortStatusReport::isJobExistenceSlot()
+ {
+ for (int i = 0; i < 12; i++) {
+ if (m_nJobExistenceSlot[i] != 0) return true;
+ }
+
+ return false;
+ }
+}
+
diff --git a/SourceCode/Bond/Servo/CPortStatusReport.h b/SourceCode/Bond/Servo/CPortStatusReport.h
new file mode 100644
index 0000000..4aede52
--- /dev/null
+++ b/SourceCode/Bond/Servo/CPortStatusReport.h
@@ -0,0 +1,42 @@
+#pragma once
+#include <string>
+#include "CAttributeVector.h"
+#include "CReadStep.h"
+
+
+namespace SERVO {
+ class CPortStatusReport
+ {
+ public:
+ CPortStatusReport();
+ ~CPortStatusReport();
+
+ public:
+ void copyEx(CPortStatusReport& other);
+ short getPortStatus();
+ short getCassetteSequenceNo();
+ std::string& getCassetteId();
+ short getLoadingCassetteType();
+ short getQTimeFlag();
+ short getCassetteMappingState();
+ short getCassetteStatus();
+ int serialize(char* pszBuffer, int nBufferSize);
+ int unserialize(const char* pszBuffer, int nBufferSize);
+ void getAttributeVector(CAttributeVector& attrubutes, int beginWeight);
+
+ public:
+ bool canPickFromPort();
+ bool isJobExistenceSlot();
+
+ private:
+ short m_nPortStatus;
+ short m_nCassetteSequenceNo;
+ std::string m_strCassetteID;
+ short m_nJobExistenceSlot[12]; // 12 * 16 = 192 个slot是否存在glass
+ short m_nLoadingCassetteType; // 1: Actual Cassette 2 : Empty Cassette
+ short m_nQTimeFlag;
+ short m_nCassetteMappingState; // 1: mapping use 2: mapping not use
+ short m_nCassetteStatus;
+ };
+}
+
--
Gitblit v1.9.3