From 4ef35bf238fc6f7217e4b6de4aee37192ec503ec Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期三, 17 九月 2025 13:36:27 +0800
Subject: [PATCH] 1.自绘CListCtrl用于ProcessJob的Carrier选择
---
SourceCode/Bond/Servo/CGlass.cpp | 260 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 249 insertions(+), 11 deletions(-)
diff --git a/SourceCode/Bond/Servo/CGlass.cpp b/SourceCode/Bond/Servo/CGlass.cpp
index a9e88eb..d1c7a94 100644
--- a/SourceCode/Bond/Servo/CGlass.cpp
+++ b/SourceCode/Bond/Servo/CGlass.cpp
@@ -8,11 +8,15 @@
m_pPath = nullptr;
m_type = MaterialsType::G1;
m_pBuddy = nullptr;
+ m_nOriginPort = 0;
+ m_nOriginSlot = 0;
+ m_bScheduledForProcessing = FALSE;
+ m_pProcessJob = nullptr;
}
CGlass::~CGlass()
{
-
+ reset();
}
void CGlass::reset()
@@ -27,6 +31,7 @@
if (m_pBuddy != nullptr) {
m_pBuddy->release();
+ m_pBuddy = nullptr;
}
}
@@ -46,7 +51,7 @@
return strText;
}
- MaterialsType CGlass::getType()
+ MaterialsType CGlass::getType() const
{
return m_type;
}
@@ -61,9 +66,41 @@
m_strID = pszID;
}
- std::string& CGlass::getID()
+ const std::string& CGlass::getID() const
{
return m_strID;
+ }
+
+ void CGlass::setOriginPort(int port, int slot)
+ {
+ m_nOriginPort = port;
+ m_nOriginSlot = slot;
+ }
+
+ void CGlass::getOrginPort(int& port, int& slot)
+ {
+ port = m_nOriginPort;
+ slot = m_nOriginSlot;
+ }
+
+ BOOL CGlass::isScheduledForProcessing()
+ {
+ return m_bScheduledForProcessing;
+ }
+
+ void CGlass::setScheduledForProcessing(BOOL bProcessing)
+ {
+ m_bScheduledForProcessing = bProcessing;
+ }
+
+ CProcessJob* CGlass::getProcessJob()
+ {
+ return m_pProcessJob;
+ }
+
+ void CGlass::setProcessJob(CProcessJob* pProcessJob)
+ {
+ m_pProcessJob = pProcessJob;
}
CPath* CGlass::getPath()
@@ -71,7 +108,26 @@
return m_pPath;
}
- CPath* CGlass::getPathWithEq(unsigned int nEqId, unsigned int nUnit)
+ std::string CGlass::getPathDescription() const
+ {
+ std::string strOut, strPath;
+ char szBuffer[256];
+
+ CPath* pTemp = m_pPath;
+ while (pTemp != nullptr) {
+ pTemp->getSimpleDescription(strPath);
+ if (strPath.compare("ARM1") != 0 && strPath.compare("ARM2") != 0) {
+ if (!strOut.empty()) strOut.append(" -> ");
+ strOut.append(strPath);
+ }
+
+ pTemp = pTemp->getNext();
+ }
+
+ return strOut;
+ }
+
+ CPath* CGlass::getPathWithEq(unsigned int nEqId, unsigned int nUnit) const
{
CPath* pTemp = m_pPath;
while (pTemp != nullptr) {
@@ -85,9 +141,9 @@
return nullptr;
}
- void CGlass::addPath(unsigned int nEqId, unsigned int nUnit)
+ void CGlass::addPath(unsigned int nEqId, unsigned int nUnit, unsigned int slot)
{
- CPath* pPath = new CPath(nEqId, nUnit);
+ CPath* pPath = new CPath(nEqId, nUnit, slot);
if (m_pPath == nullptr) {
m_pPath = pPath;
}
@@ -103,6 +159,9 @@
Lock();
ar << (int)m_type;
WriteString(ar, m_strID);
+ ar << m_nOriginPort;
+ ar << m_nOriginSlot;
+ ar << m_bScheduledForProcessing;
ar << (ULONGLONG)m_pPath;
if (m_pPath != nullptr) {
m_pPath->serialize(ar);
@@ -123,6 +182,9 @@
ar >> type;
m_type = (MaterialsType)type;
ReadString(ar, m_strID);
+ ar >> m_nOriginPort;
+ ar >> m_nOriginSlot;
+ ar >> m_bScheduledForProcessing;
ar >> ullPath;
if (ullPath != 0) {
m_pPath = new CPath();
@@ -140,6 +202,11 @@
void CGlass::setJobDataS(CJobDataS* pJobDataS)
{
m_jobDataS.copy(pJobDataS);
+ }
+
+ void CGlass::updateJobDataS(CJobDataS* pJobDataS)
+ {
+ m_jobDataS.update(pJobDataS);
}
CJobDataS* CGlass::getJobDataS()
@@ -172,17 +239,23 @@
return m_pBuddy;
}
- std::string& CGlass::getBuddyId()
+ const std::string& CGlass::getBuddyId() const
{
return m_strBuddyId;
}
- void CGlass::processEnd(unsigned int nEqId, unsigned int nUnit)
+ void CGlass::setBuddyId(std::string& strId)
+ {
+ m_strBuddyId = strId;
+ }
+
+ int CGlass::processEnd(unsigned int nEqId, unsigned int nUnit)
{
CPath* pPath = getPathWithEq(nEqId, nUnit);
- if (pPath != nullptr) {
- pPath->processEnd();
- }
+ if (pPath == nullptr) return -1;
+
+ pPath->processEnd();
+ return 0;
}
BOOL CGlass::isProcessed(unsigned int nEqId, unsigned int nUnit)
@@ -192,4 +265,169 @@
return pPath->isProcessEnd();
}
+
+ int CGlass::setInspResult(unsigned int nEqId, unsigned int nUnit, InspResult result)
+ {
+ CPath* pPath = getPathWithEq(nEqId, nUnit);
+ if (pPath == nullptr) return -1;
+
+ pPath->setInspResult(result);
+ return 0;
+ }
+
+ InspResult CGlass::getInspResult(unsigned int nEqId, unsigned int nUnit) const
+ {
+ CPath* pPath = getPathWithEq(nEqId, nUnit);
+ if (pPath == nullptr) return InspResult::NotInspected;
+
+ return pPath->getInspResult();
+ }
+
+ InspResult CGlass::getAOIInspResult() const
+ {
+ return getInspResult(EQ_ID_MEASUREMENT, 0);
+ }
+
+ std::string CGlass::getStateText()
+ {
+ switch (m_state)
+ {
+ case SERVO::GlsState::NoState:
+ return "NoState";
+ break;
+ case SERVO::GlsState::Queued:
+ return "Queued";
+ break;
+ case SERVO::GlsState::InProcess:
+ return "InProcess";
+ break;
+ case SERVO::GlsState::Paused:
+ return "Queued";
+ break;
+ case SERVO::GlsState::Completed:
+ return "Queued";
+ break;
+ case SERVO::GlsState::Aborted:
+ return "Aborted";
+ break;
+ case SERVO::GlsState::Failed:
+ return "Failed";
+ break;
+ default:
+ break;
+ }
+
+ return "";
+ }
+
+ bool CGlass::queue() {
+ if (m_state != GlsState::NoState) return false;
+ markQueued();
+ return true;
+ }
+
+ bool CGlass::start() {
+ if (m_state != GlsState::Queued && m_state != GlsState::Paused)
+ return false;
+ if (!m_tStart.has_value()) markStart();
+ m_state = GlsState::InProcess;
+ return true;
+ }
+
+ bool CGlass::pause() {
+ if (m_state != GlsState::InProcess) return false;
+ m_state = GlsState::Paused;
+ return true;
+ }
+
+ bool CGlass::resume() {
+ if (m_state != GlsState::Paused) return false;
+ m_state = GlsState::InProcess;
+ return true;
+ }
+
+ bool CGlass::complete() {
+ if (m_state != GlsState::InProcess && m_state != GlsState::Paused) return false;
+ m_state = GlsState::Completed;
+ markEnd();
+ return true;
+ }
+
+ bool CGlass::abort() {
+ if (m_state == GlsState::Completed || m_state == GlsState::Aborted || m_state == GlsState::Failed)
+ return false;
+ m_state = GlsState::Aborted;
+ markEnd();
+ return true;
+ }
+
+ bool CGlass::fail(std::string reason)
+ {
+ m_failReason = trimCopy(reason);
+ clampString(m_failReason, 128);
+ m_state = GlsState::Failed;
+ markEnd();
+ return true;
+ }
+
+ std::string CGlass::trimCopy(std::string s)
+ {
+ auto notspace = [](int ch) { return !std::isspace(ch); };
+ s.erase(s.begin(), std::find_if(s.begin(), s.end(), notspace));
+ s.erase(std::find_if(s.rbegin(), s.rend(), notspace).base(), s.end());
+ return s;
+ }
+
+ void CGlass::clampString(std::string& s, size_t maxLen)
+ {
+ if (s.size() > maxLen) s.resize(maxLen);
+ }
+
+ // —— 时间戳 & 工具 ——
+ void CGlass::markQueued()
+ {
+ m_state = GlsState::Queued;
+ m_tQueued = std::chrono::system_clock::now();
+ }
+
+ void CGlass::markStart()
+ {
+ m_state = GlsState::InProcess;
+ m_tStart = std::chrono::system_clock::now();
+ }
+
+ void CGlass::markEnd()
+ {
+ m_state = GlsState::Completed;
+ m_tEnd = std::chrono::system_clock::now();
+ }
+
+ void CGlass::addParams(std::vector<CParam>& params)
+ {
+ m_params.insert(m_params.end(), params.begin(), params.end());
+ }
+
+ std::vector<CParam>& CGlass::getParams()
+ {
+ return m_params;
+ }
+
+ std::string CGlass::getParamsDescription() const
+ {
+ std::string strOut;
+
+ char szBuffer[256];
+ for (auto p : m_params) {
+ if (!strOut.empty()) strOut.append(",");
+ if (p.getValueType() == PVT_INT) {
+ sprintf_s(szBuffer, 256, "%s:%d", p.getName().c_str(), p.getIntValue());
+ }
+ else if (p.getValueType() == PVT_DOUBLE) {
+ sprintf_s(szBuffer, 256, "%s:%f", p.getName().c_str(), p.getDoubleValue());
+ }
+ strOut.append(szBuffer);
+ }
+
+ return strOut;
+ }
}
--
Gitblit v1.9.3