From 7a20b6f44d2ea3f23ef8d228ec4c1424925e5dfb Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 22 八月 2025 17:55:28 +0800
Subject: [PATCH] 1.增加Job模式,如果不是Job模式,沿用原来的调度方式,否则为批处理模式;

---
 SourceCode/Bond/Servo/Configuration.h   |    1 +
 SourceCode/Bond/Servo/CEquipment.cpp    |    3 ++-
 SourceCode/Bond/Servo/CMaster.cpp       |   14 ++++++++++----
 SourceCode/Bond/Servo/Configuration.cpp |    5 +++++
 SourceCode/Bond/Servo/CMaster.h         |    5 ++++-
 SourceCode/Bond/Servo/Model.cpp         |    1 +
 SourceCode/Bond/Servo/CEquipment.h      |    2 +-
 7 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index 7560957..f71d7d9 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -1325,7 +1325,7 @@
 		return nullptr;
 	}
 
-	CSlot* CEquipment::getProcessedSlot(MaterialsType putSlotType)
+	CSlot* CEquipment::getProcessedSlot(MaterialsType putSlotType, BOOL bJobMode/* = FALSE*/)
 	{
 		for (int i = 0; i < SLOT_MAX; i++) {
 			if (!m_slot[i].isEnable()) continue;
@@ -1334,6 +1334,7 @@
 			if (!isSlotProcessed(i)) continue;
 			if (pGlass == nullptr) continue;
 			if (!pGlass->isScheduledForProcessing()) continue;
+			if (bJobMode && pGlass->getProcessJob() == nullptr) continue;
 			if(pGlass->getInspResult(m_nID, 0) == InspResult::Fail) continue;
 			int lsPath = m_slot[i].getLinkSignalPath();
 			if(!m_bLinkSignalToUpstream[lsPath][SIGNAL_UPSTREAM_INLINE]
diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index ce75a56..27a448e 100644
--- a/SourceCode/Bond/Servo/CEquipment.h
+++ b/SourceCode/Bond/Servo/CEquipment.h
@@ -185,7 +185,7 @@
 		CSlot* getNonEmptySlot(MaterialsType type);
 
 		// 获取一个指定物料类型(G1,G2,G1&G2)的且已经加工处理的槽位
-		CSlot* getProcessedSlot(MaterialsType putSlotType);
+		CSlot* getProcessedSlot(MaterialsType putSlotType, BOOL bJobMode = FALSE);
 		CSlot* getProcessedSlot2(MaterialsType putSlotType, const std::vector<int>& candidates);
 		CSlot* getInspFailSlot();
 		CSlot* getProcessedSlotCt(unsigned int slot);
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index e01b180..b10d2f6 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -55,6 +55,7 @@
 		m_pActiveRobotTask = nullptr;
 		m_nLastError = 0;
 		m_isCompareMapsBeforeProceeding = FALSE;
+		m_bJobMode = FALSE;
 		m_bEnableEventReport = true;
 		m_bEnableAlarmReport = true;
 		m_bContinuousTransfer = false;
@@ -684,7 +685,7 @@
 					if (!rmd.armState[0] && pLoadPorts[s]->isEnable()
 						&& (pt == PortType::Loading || pt == PortType::Both)
 						&& pLoadPorts[s]->getPortStatus() == PORT_INUSE) {
-						m_pActiveRobotTask = createTransferTask(pLoadPorts[s], pAligner, primaryType, secondaryType);
+						m_pActiveRobotTask = createTransferTask(pLoadPorts[s], pAligner, primaryType, secondaryType, m_bJobMode);
 						if (m_pActiveRobotTask != nullptr) {
 							pEFEM->setContext(m_pActiveRobotTask->getContext());
 							goto PORT_GET;
@@ -1567,7 +1568,7 @@
 	static int taskSeqNo = 0;
 	CRobotTask* CMaster::createTransferTask(CEquipment* pSrcEq, CEquipment* pTarEq,
 		MaterialsType primaryType/* = MaterialsType::G1*/, MaterialsType secondaryType/* = MaterialsType::G2*/,
-		int armNo/* = 1*/)
+		int armNo/* = 1*/, BOOL bJobMode/* = FALSE*/)
 	{
 		if (!pSrcEq->IsEnabled()) { 
 			return nullptr;
@@ -1576,10 +1577,10 @@
 		CRobotTask* pTask = nullptr;
 		CSlot* pSrcSlot, * pTarSlot;
 		pTarSlot = pTarEq->getAvailableSlotForGlass(primaryType);
-		pSrcSlot = pSrcEq->getProcessedSlot(primaryType);
+		pSrcSlot = pSrcEq->getProcessedSlot(primaryType, bJobMode);
 		if (pSrcSlot == nullptr || nullptr == pTarSlot) {
 			pTarSlot = pTarEq->getAvailableSlotForGlass(secondaryType);
-			pSrcSlot = pSrcEq->getProcessedSlot(secondaryType);
+			pSrcSlot = pSrcEq->getProcessedSlot(secondaryType, bJobMode);
 		}
 
 
@@ -1821,6 +1822,11 @@
 		m_isCompareMapsBeforeProceeding = bCompare;
 	}
 
+	void CMaster::setJobMode(BOOL bJobMode)
+	{
+		m_bJobMode = bJobMode;
+	}
+
 	void CMaster::datetimeSync(SYSTEMTIME& time)
 	{
 		for (auto item : m_listEquipment) {
diff --git a/SourceCode/Bond/Servo/CMaster.h b/SourceCode/Bond/Servo/CMaster.h
index e8c7236..41d4fb0 100644
--- a/SourceCode/Bond/Servo/CMaster.h
+++ b/SourceCode/Bond/Servo/CMaster.h
@@ -98,6 +98,7 @@
         void setPortCassetteType(unsigned int index, SERVO::CassetteType type);
         void setPortEnable(unsigned int index, BOOL bEnable);
         void setCompareMapsBeforeProceeding(BOOL bCompare);
+        void setJobMode(BOOL bJobMode);
         void datetimeSync(SYSTEMTIME& time);
         void enableEventReport(bool bEnable);
         void enableAlarmReport(bool bEnable);
@@ -137,7 +138,7 @@
         void setState(MASTERSTATE state);
         CRobotTask* createTransferTask(CEquipment* pSrcEq, CEquipment* pTarEq,
             MaterialsType primaryType = MaterialsType::G1, MaterialsType secondaryType = MaterialsType::G2,
-            int armNo = 1);
+            int armNo = 1, BOOL bJobMode = FALSE);
         CRobotTask* createTransferTask_bonder_to_bakecooling(CEquipment* pSrcEq, CEquipment* pTarEq);
         CRobotTask* createTransferTask_bake_to_cooling(CEquipment* pSrcEq);
         CRobotTask* createTransferTask_bakecooling_to_measurement(CEquipment* pSrcEq, CEquipment* pTarEq);
@@ -189,6 +190,8 @@
 
         // 在开始工艺前是否先需要先比较map
         BOOL m_isCompareMapsBeforeProceeding;
+        BOOL m_bJobMode;
+
 
         // 千传圈数计数
         int m_nContinuousTransferCount;
diff --git a/SourceCode/Bond/Servo/Configuration.cpp b/SourceCode/Bond/Servo/Configuration.cpp
index 18ee806..c853bba 100644
--- a/SourceCode/Bond/Servo/Configuration.cpp
+++ b/SourceCode/Bond/Servo/Configuration.cpp
@@ -160,6 +160,11 @@
 	return GetPrivateProfileInt(_T("Master"), _T("CompareMapsBeforeProceeding"), 0, m_strFilepath);
 }
 
+BOOL CConfiguration::isJobMode()
+{
+	return GetPrivateProfileInt(_T("Master"), _T("JobMode"), 0, m_strFilepath);
+}
+
 void CConfiguration::setContinuousTransferCount(int round)
 {
 	WritePrivateProfileString(_T("Master"), _T("CTRound"),
diff --git a/SourceCode/Bond/Servo/Configuration.h b/SourceCode/Bond/Servo/Configuration.h
index 96f0e7f..a1e06da 100644
--- a/SourceCode/Bond/Servo/Configuration.h
+++ b/SourceCode/Bond/Servo/Configuration.h
@@ -27,6 +27,7 @@
 	BOOL setPortCassetteType(unsigned int index, int cassetteType);
 	BOOL setPortEnable(unsigned int index, BOOL bEnable);
 	BOOL isCompareMapsBeforeProceeding();
+	BOOL isJobMode();
 	void setContinuousTransferCount(int round);
 	int getContinuousTransferCount();
 
diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index 8b854ee..dcc5e70 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -396,6 +396,7 @@
 	strMasterDataFile.Format(_T("%s\\Master.dat"), (LPTSTR)(LPCTSTR)m_strWorkDir);
 	m_master.setCacheFilepath((LPTSTR)(LPCTSTR)strMasterDataFile);
 	m_master.setCompareMapsBeforeProceeding(m_configuration.isCompareMapsBeforeProceeding());
+	m_master.setJobMode(m_configuration.isJobMode());
 
 	// 加截Job
 	strMasterDataFile.Format(_T("%s\\MasterState.dat"), (LPTSTR)(LPCTSTR)m_strWorkDir);

--
Gitblit v1.9.3