From 8de338246a5c70210077ce1162e926cef5f39c70 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期二, 25 三月 2025 17:09:16 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang

---
 SourceCode/Bond/Servo/Servo.vcxproj         |    4 
 SourceCode/Bond/Servo/CVacuumBake.cpp       |   10 +
 SourceCode/Bond/Servo/CFliper.cpp           |   10 +
 SourceCode/Bond/Servo/CGlass.h              |    7 
 SourceCode/Bond/Servo/CEFEM.h               |    1 
 SourceCode/Bond/Servo/CMaster.h             |    6 
 SourceCode/Bond/Servo/CBakeCooling.cpp      |   10 +
 SourceCode/Bond/Servo/EqsGraphWnd.cpp       |   17 ++
 SourceCode/Bond/Servo/CBakeCooling.h        |    1 
 SourceCode/Bond/Servo/CEquipment.cpp        |   62 ++++++--
 SourceCode/Bond/Servo/CAligner.h            |    1 
 SourceCode/Bond/Servo/CMaster.cpp           |   52 +++++++
 SourceCode/Bond/Servo/CBonder.h             |    1 
 SourceCode/Bond/Servo/CPageGraph2.cpp       |   25 +--
 SourceCode/Bond/Servo/EqsGraphWnd.h         |    1 
 SourceCode/Bond/Servo/CGlass.cpp            |   57 ++++++++
 SourceCode/Bond/Servo/CLoadPort.h           |    1 
 SourceCode/Bond/Servo/Model.cpp             |    8 +
 SourceCode/Bond/Servo/CLoadPort.cpp         |   18 ++
 SourceCode/Bond/Servo/CMeasurement.h        |    1 
 SourceCode/Bond/Servo/CVacuumBake.h         |    1 
 SourceCode/Bond/Servo/ServoDlg.cpp          |    4 
 /dev/null                                   |   41 -----
 SourceCode/Bond/Servo/CMeasurement.cpp      |   10 +
 SourceCode/Bond/Servo/Servo.vcxproj.filters |    4 
 SourceCode/Bond/Servo/CAligner.cpp          |   10 +
 SourceCode/Bond/Servo/CEFEM.cpp             |   10 +
 SourceCode/Bond/Servo/CEquipment.h          |   10 
 SourceCode/Bond/Servo/CBonder.cpp           |   10 +
 SourceCode/Bond/Servo/CFliper.h             |    1 
 30 files changed, 297 insertions(+), 97 deletions(-)

diff --git a/SourceCode/Bond/Servo/CAligner.cpp b/SourceCode/Bond/Servo/CAligner.cpp
index 6b76fd9..dc4a93b 100644
--- a/SourceCode/Bond/Servo/CAligner.cpp
+++ b/SourceCode/Bond/Servo/CAligner.cpp
@@ -58,4 +58,14 @@
 	{
 		return __super::recvIntent(pPin, pIntent);
 	}
+
+	BOOL CAligner::glassWillArrive(CGlass* pGlass)
+	{
+		BOOL bRet = __super::glassWillArrive(pGlass);
+		if (!bRet) {
+			return FALSE;
+		}
+
+		return m_glassList.empty();
+	}
 }
diff --git a/SourceCode/Bond/Servo/CAligner.h b/SourceCode/Bond/Servo/CAligner.h
index 8a6be18..acf53e1 100644
--- a/SourceCode/Bond/Servo/CAligner.h
+++ b/SourceCode/Bond/Servo/CAligner.h
@@ -19,6 +19,7 @@
         virtual void serialize(CArchive& ar);
         virtual void getAttributeVector(CAttributeVector& attrubutes);
         virtual int recvIntent(CPin* pPin, CIntent* pIntent);
+        virtual BOOL glassWillArrive(CGlass* pGlass);
 	};
 }
 
diff --git a/SourceCode/Bond/Servo/CBakeCooling.cpp b/SourceCode/Bond/Servo/CBakeCooling.cpp
index 1dcbc72..5e374ab 100644
--- a/SourceCode/Bond/Servo/CBakeCooling.cpp
+++ b/SourceCode/Bond/Servo/CBakeCooling.cpp
@@ -58,4 +58,14 @@
 	{
 		return __super::recvIntent(pPin, pIntent);
 	}
+
+	BOOL CBakeCooling::glassWillArrive(CGlass* pGlass)
+	{
+		BOOL bRet = __super::glassWillArrive(pGlass);
+		if (!bRet) {
+			return FALSE;
+		}
+
+		return (m_glassList.size() < 4);
+	}
 }
diff --git a/SourceCode/Bond/Servo/CBakeCooling.h b/SourceCode/Bond/Servo/CBakeCooling.h
index 22f3c14..6d85350 100644
--- a/SourceCode/Bond/Servo/CBakeCooling.h
+++ b/SourceCode/Bond/Servo/CBakeCooling.h
@@ -19,6 +19,7 @@
         virtual void serialize(CArchive& ar);
         virtual void getAttributeVector(CAttributeVector& attrubutes);
         virtual int recvIntent(CPin* pPin, CIntent* pIntent);
+        virtual BOOL glassWillArrive(CGlass* pGlass);
 	};
 }
 
diff --git a/SourceCode/Bond/Servo/CBonder.cpp b/SourceCode/Bond/Servo/CBonder.cpp
index f9f27b9..1bb185f 100644
--- a/SourceCode/Bond/Servo/CBonder.cpp
+++ b/SourceCode/Bond/Servo/CBonder.cpp
@@ -57,4 +57,14 @@
 	{
 		return __super::recvIntent(pPin, pIntent);
 	}
+
+	BOOL CBonder::glassWillArrive(CGlass* pGlass)
+	{
+		BOOL bRet = __super::glassWillArrive(pGlass);
+		if (!bRet) {
+			return FALSE;
+		}
+
+		return m_glassList.empty();
+	}
 }
diff --git a/SourceCode/Bond/Servo/CBonder.h b/SourceCode/Bond/Servo/CBonder.h
index 1785a5c..e6f9843 100644
--- a/SourceCode/Bond/Servo/CBonder.h
+++ b/SourceCode/Bond/Servo/CBonder.h
@@ -19,6 +19,7 @@
         virtual void serialize(CArchive& ar);
         virtual void getAttributeVector(CAttributeVector& attrubutes);
         virtual int recvIntent(CPin* pPin, CIntent* pIntent);
+        virtual BOOL glassWillArrive(CGlass* pGlass);
     };
 }
 
diff --git a/SourceCode/Bond/Servo/CEFEM.cpp b/SourceCode/Bond/Servo/CEFEM.cpp
index e68f73f..6b0548f 100644
--- a/SourceCode/Bond/Servo/CEFEM.cpp
+++ b/SourceCode/Bond/Servo/CEFEM.cpp
@@ -55,4 +55,14 @@
 	{
 		return __super::recvIntent(pPin, pIntent);
 	}
+
+	BOOL CEFEM::glassWillArrive(CGlass* pGlass)
+	{
+		BOOL bRet = __super::glassWillArrive(pGlass);
+		if (!bRet) {
+			return FALSE;
+		}
+
+		return m_glassList.empty();
+	}
 }
diff --git a/SourceCode/Bond/Servo/CEFEM.h b/SourceCode/Bond/Servo/CEFEM.h
index 76b0ded..35d8db2 100644
--- a/SourceCode/Bond/Servo/CEFEM.h
+++ b/SourceCode/Bond/Servo/CEFEM.h
@@ -19,6 +19,7 @@
         virtual void serialize(CArchive& ar);
         virtual void getAttributeVector(CAttributeVector& attrubutes);
         virtual int recvIntent(CPin* pPin, CIntent* pIntent);
+        virtual BOOL glassWillArrive(CGlass* pGlass);
     };
 }
 
diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index ad4a356..393191b 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -22,6 +22,11 @@
 
 	CEquipment::~CEquipment()
 	{
+		for (auto item : m_glassList) {
+			item->release();
+		}
+		m_glassList.clear();
+
 		for (auto item : m_mapStep) {
 			delete item.second;
 		}
@@ -201,8 +206,8 @@
 				std::to_string((int)item->getType()).c_str(), ""));
 		}
 
-		for (auto item : m_panelList) {
-			attrubutes.addAttribute(new CAttribute("Panel",
+		for (auto item : m_glassList) {
+			attrubutes.addAttribute(new CAttribute("Glass",
 				item->getID().c_str(), ""));
 		}
 	}
@@ -253,7 +258,26 @@
 
 	void CEquipment::serialize(CArchive& ar)
 	{
-
+		if (ar.IsStoring()) {
+			Lock();
+			int count = (int)m_glassList.size();
+			ar << count;
+			for (auto item : m_glassList) {
+				item->serialize(ar);
+			}
+			Unlock();
+		}
+		else {
+			Lock();
+			int count;
+			ar >> count;
+			for (int i = 0; i < count; i++) {
+				CGlass* pGlass = new CGlass();
+				pGlass->serialize(ar);
+				addGlassToList(pGlass);
+			}
+			Unlock();
+		}
 	}
 
 	void CEquipment::onReceiveLBData(const char* pszData, size_t size)
@@ -492,12 +516,12 @@
 
 		// 物料
 		if (code == FLOW_MOVE_MATERIAL) {
-			CPanel* pPanel = (CPanel*)pIntent->getContext();
-			ASSERT(pPanel);
-			if (!glassWillArrive(pPanel)) {
+			CGlass* pGlass = (CGlass*)pIntent->getContext();
+			ASSERT(pGlass);
+			if (!glassWillArrive(pGlass)) {
 				return FLOW_REJECT;
 			}
-			return glassArrived(pPanel);
+			return glassArrived(pGlass);
 		}
 
 
@@ -524,7 +548,11 @@
 
 		// 模拟取出第一张Panel,传送到下一环节
 		Lock();
-		CPanel* pContext = m_panelList.front();
+		if (m_glassList.empty()) {
+			Unlock();
+			return -2;
+		}
+		CGlass* pContext = m_glassList.front();
 		pContext->addRef();
 
 		CIntent intent(FLOW_MOVE_MATERIAL, "", pContext);
@@ -533,7 +561,7 @@
 			LOGE("<CEquipment>对方拒绝接收Intent.");
 		}
 		else if (nRet == FLOW_ACCEPT) {
-			m_panelList.pop_front();
+			m_glassList.pop_front();
 			pContext->release();		// 添加到列队时addRef, 取出时release
 		}
 
@@ -543,27 +571,27 @@
 		return 0;
 	}
 
-	BOOL CEquipment::glassWillArrive(CPanel* pPanel)
+	BOOL CEquipment::glassWillArrive(CGlass* pGlass)
 	{
 		return TRUE;
 	}
 
-	int CEquipment::glassArrived(CPanel* pPanel)
+	int CEquipment::glassArrived(CGlass* pGlass)
 	{
 		Lock();
-		pPanel->addRef();
-		m_panelList.push_back(pPanel);
+		pGlass->addRef();
+		m_glassList.push_back(pGlass);
 		Unlock();
 		return FLOW_ACCEPT;
 	}
 
-	void CEquipment::addPanelToList(CPanel* pPanel)
+	void CEquipment::addGlassToList(CGlass* pGlass)
 	{
-		ASSERT(pPanel);
+		ASSERT(pGlass);
 
 		Lock();
-		pPanel->addRef();
-		m_panelList.push_back(pPanel);
+		pGlass->addRef();
+		m_glassList.push_back(pGlass);
 		Unlock();
 	}
 }
diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index 0ada23c..576adaa 100644
--- a/SourceCode/Bond/Servo/CEquipment.h
+++ b/SourceCode/Bond/Servo/CEquipment.h
@@ -16,7 +16,7 @@
 #include <vector>
 #include <map>
 #include <list>
-#include "CPanel.h"
+#include "CGlass.h"
 
 
 namespace SERVO {
@@ -89,9 +89,9 @@
 		std::vector<CPin*>& CEquipment::getInputPins();
 		std::vector<CPin*>& CEquipment::getOutputPins();
 		virtual int recvIntent(CPin* pPin, CIntent* pIntent);
-		virtual BOOL glassWillArrive(CPanel* pPanel);
+		virtual BOOL glassWillArrive(CGlass* pGlass);
 		virtual int outputGlass(int port);
-		virtual int glassArrived(CPanel* pPanel);
+		virtual int glassArrived(CGlass* pGlass);
 
 	// 以下为从CC-Link读取到的Bit标志位检测函数
 	public:
@@ -111,7 +111,7 @@
 	protected:
 		inline void Lock() { EnterCriticalSection(&m_criticalSection); }
 		inline void Unlock() { LeaveCriticalSection(&m_criticalSection); }
-		void addPanelToList(CPanel* pPanel);
+		void addGlassToList(CGlass* pGlass);
 
 	protected:
 		EquipmentListener m_listener;
@@ -124,7 +124,7 @@
 		MemoryBlock m_blockWriteBit;
 		std::vector<CPin*> m_inputPins;
 		std::vector<CPin*> m_outputPins;
-		std::list<CPanel*> m_panelList;
+		std::list<CGlass*> m_glassList;
 
 
 		// 以下为从CC-Link读取到的Bit标志位
diff --git a/SourceCode/Bond/Servo/CFliper.cpp b/SourceCode/Bond/Servo/CFliper.cpp
index cbf9a53..acd7654 100644
--- a/SourceCode/Bond/Servo/CFliper.cpp
+++ b/SourceCode/Bond/Servo/CFliper.cpp
@@ -57,4 +57,14 @@
 	{
 		return __super::recvIntent(pPin, pIntent);
 	}
+
+	BOOL CFliper::glassWillArrive(CGlass* pGlass)
+	{
+		BOOL bRet = __super::glassWillArrive(pGlass);
+		if (!bRet) {
+			return FALSE;
+		}
+
+		return m_glassList.empty();
+	}
 }
diff --git a/SourceCode/Bond/Servo/CFliper.h b/SourceCode/Bond/Servo/CFliper.h
index 2bb285f..a010953 100644
--- a/SourceCode/Bond/Servo/CFliper.h
+++ b/SourceCode/Bond/Servo/CFliper.h
@@ -19,6 +19,7 @@
         virtual void serialize(CArchive& ar);
         virtual void getAttributeVector(CAttributeVector& attrubutes);
         virtual int recvIntent(CPin* pPin, CIntent* pIntent);
+        virtual BOOL glassWillArrive(CGlass* pGlass);
 	};
 }
 
diff --git a/SourceCode/Bond/Servo/CGlass.cpp b/SourceCode/Bond/Servo/CGlass.cpp
new file mode 100644
index 0000000..e9847f9
--- /dev/null
+++ b/SourceCode/Bond/Servo/CGlass.cpp
@@ -0,0 +1,57 @@
+#include "stdafx.h"
+#include "CGlass.h"
+
+
+namespace SERVO {
+	CGlass::CGlass()
+	{
+
+	}
+
+	CGlass::~CGlass()
+	{
+
+	}
+
+	std::string& CGlass::getClassName()
+	{
+		static std::string strName = "CGlass";
+		return strName;
+	}
+
+	std::string CGlass::toString()
+	{
+		std::string strText;
+		strText += "CGlass[";
+		strText += ("ID:" + m_strID + ";");
+		strText += "]";
+
+		return strText;
+	}
+
+	void CGlass::setID(const char* pszID)
+	{
+		m_strID = pszID;
+	}
+
+	std::string& CGlass::getID()
+	{
+		return m_strID;
+	}
+
+	void CGlass::serialize(CArchive& ar)
+	{
+		if (ar.IsStoring())
+		{
+			Lock();
+			WriteString(ar, m_strID);
+			Unlock();
+		}
+		else
+		{
+			Lock();
+			ReadString(ar, m_strID);
+			Unlock();
+		}
+	}
+}
diff --git a/SourceCode/Bond/Servo/CPanel.h b/SourceCode/Bond/Servo/CGlass.h
similarity index 73%
rename from SourceCode/Bond/Servo/CPanel.h
rename to SourceCode/Bond/Servo/CGlass.h
index bc9c51a..fe5a704 100644
--- a/SourceCode/Bond/Servo/CPanel.h
+++ b/SourceCode/Bond/Servo/CGlass.h
@@ -4,17 +4,18 @@
 
 
 namespace SERVO {
-	class CPanel : public CContext
+	class CGlass : public CContext
 	{
 	public:
-		CPanel();
-		virtual ~CPanel();
+		CGlass();
+		virtual ~CGlass();
 
 	public:
 		virtual std::string& getClassName();
 		virtual std::string toString();
 		void setID(const char* pszID);
 		std::string& getID();
+		void serialize(CArchive& ar);
 
 	private:
 		std::string m_strID;
diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index 079b3f2..b881e5a 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -62,18 +62,28 @@
 	int CLoadPort::outputGlass(int port)
 	{
 		// 如果列表中没有Panel,模拟生成10张
-		if (m_panelList.empty()) {
+		if (m_glassList.empty()) {
 			static int ii = 0;
 			char szBuffer[64];
 			LOGI("<CLoadPort>模拟生成10张PANEL");
 			for (int i = 0; i < 10; i++) {
 				sprintf_s(szBuffer, "P20250320A1A%d", ++ii);
-				CPanel* pPanel = new CPanel();
-				pPanel->setID(szBuffer);
-				addPanelToList(pPanel);
+				CGlass* pGlass = new CGlass();
+				pGlass->setID(szBuffer);
+				addGlassToList(pGlass);
 			}
 		}
 
 		return __super::outputGlass(port);
 	}
+
+	BOOL CLoadPort::glassWillArrive(CGlass* pGlass)
+	{
+		BOOL bRet = __super::glassWillArrive(pGlass);
+		if (!bRet) {
+			return FALSE;
+		}
+
+		return (m_glassList.size() < 8);
+	}
 }
diff --git a/SourceCode/Bond/Servo/CLoadPort.h b/SourceCode/Bond/Servo/CLoadPort.h
index 355bd1d..3fa8afd 100644
--- a/SourceCode/Bond/Servo/CLoadPort.h
+++ b/SourceCode/Bond/Servo/CLoadPort.h
@@ -19,6 +19,7 @@
 		virtual void serialize(CArchive& ar);
 		virtual void getAttributeVector(CAttributeVector& attrubutes);
 		virtual int recvIntent(CPin* pPin, CIntent* pIntent);
+		virtual BOOL glassWillArrive(CGlass* pGlass);
 
 	public:
 		virtual int outputGlass(int port);
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 8c4f87d..0975cde 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -85,6 +85,10 @@
 		addBakeCooling(listener);
 		connectEquipments();
 
+		
+		// 读缓存数据
+		readCache();
+
 
 		// 定时器
 		g_pMaster = this;
@@ -101,6 +105,8 @@
 		for (auto item : m_listEquipment) {
 			item->term();
 		}
+		saveCache();
+
 
 		return 0;
 	}
@@ -569,6 +575,10 @@
 				}
 			}
 		}
+
+
+		// 自动保存缓存
+		saveCache();
 	}
 
 	void CMaster::connectEquipments()
@@ -643,4 +653,46 @@
 			LOGE("连接BakeCooling-LoadPort4失败");
 		}
 	}
+
+	int CMaster::saveCache()
+	{
+		CFile file;
+		if (!file.Open(m_strFilepath.c_str(), CFile::modeCreate | CFile::modeWrite)) {
+			return -1;
+		}
+
+		CArchive ar(&file, CArchive::store);
+		serialize(ar);
+		ar.Close();
+		file.Close();
+
+		return 0;
+	}
+
+	void CMaster::setCacheFilepath(const char* pszFilepath)
+	{
+		m_strFilepath = pszFilepath;
+	}
+
+	int CMaster::readCache()
+	{
+		CFile file;
+		if (!file.Open(m_strFilepath.c_str(), CFile::modeRead)) {
+			return -1;
+		}
+
+		CArchive ar(&file, CArchive::load);
+		serialize(ar);
+		ar.Close();
+		file.Close();
+
+		return 0;
+	}
+
+	void CMaster::serialize(CArchive& ar)
+	{
+		for (auto item : m_listEquipment) {
+			item->serialize(ar);
+		}
+	}
 }
diff --git a/SourceCode/Bond/Servo/CMaster.h b/SourceCode/Bond/Servo/CMaster.h
index 12b8de3..adf5059 100644
--- a/SourceCode/Bond/Servo/CMaster.h
+++ b/SourceCode/Bond/Servo/CMaster.h
@@ -35,6 +35,7 @@
         void onTimer(UINT nTimerid);
         std::list<CEquipment*>& getEquipmentList();
         CEquipment* getEquipment(int id);
+        void setCacheFilepath(const char* pszFilepath);
 
     private:
         int addToEquipmentList(CEquipment* pEquipment);
@@ -46,12 +47,15 @@
         int addBonder(int index, StepListener& listener);
         int addBakeCooling(StepListener& listener);
         void connectEquipments();
-
+        int saveCache();
+        int readCache();
+        void serialize(CArchive& ar);
 
     private:
         MasterListener m_listener;
         CCCLinkIEControl m_cclink;
         std::list<CEquipment*> m_listEquipment;
+        std::string m_strFilepath;
     };
 }
 
diff --git a/SourceCode/Bond/Servo/CMeasurement.cpp b/SourceCode/Bond/Servo/CMeasurement.cpp
index 217e092..34ff4e6 100644
--- a/SourceCode/Bond/Servo/CMeasurement.cpp
+++ b/SourceCode/Bond/Servo/CMeasurement.cpp
@@ -54,4 +54,14 @@
 	{
 		return __super::recvIntent(pPin, pIntent);
 	}
+
+	BOOL CMeasurement::glassWillArrive(CGlass* pGlass)
+	{
+		BOOL bRet = __super::glassWillArrive(pGlass);
+		if (!bRet) {
+			return FALSE;
+		}
+
+		return m_glassList.empty();
+	}
 }
diff --git a/SourceCode/Bond/Servo/CMeasurement.h b/SourceCode/Bond/Servo/CMeasurement.h
index 9b13681..28812a1 100644
--- a/SourceCode/Bond/Servo/CMeasurement.h
+++ b/SourceCode/Bond/Servo/CMeasurement.h
@@ -19,6 +19,7 @@
         virtual void serialize(CArchive& ar);
         virtual void getAttributeVector(CAttributeVector& attrubutes);
         virtual int recvIntent(CPin* pPin, CIntent* pIntent);
+        virtual BOOL glassWillArrive(CGlass* pGlass);
 	};
 }
 
diff --git a/SourceCode/Bond/Servo/CPageGraph2.cpp b/SourceCode/Bond/Servo/CPageGraph2.cpp
index 00e7b4c..f29a3bb 100644
--- a/SourceCode/Bond/Servo/CPageGraph2.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -54,11 +54,6 @@
 		ASSERT(pPin1->pData);
 		ASSERT(pPin2->pData);
 
-		//int nRet = ((IPin*)pPin1->pData)->checkConnectPin((IPin*)pPin2->pData);
-		//if (nRet >= 0) {
-		//	return true;
-		//}
-
 		return false;
 	};
 	listener.onConnectPin = [](PIN* pPin1, PIN* pPin2) -> bool {
@@ -67,29 +62,18 @@
 		ASSERT(pPin1->pData);
 		ASSERT(pPin2->pData);
 
-		//int nRet = ((IPin*)pPin1->pData)->connectPin((IPin*)pPin2->pData);
-		//if (nRet >= 0) {
-		//	return true;
-		//}
-
 		return false;
 	};
 	listener.onDisconnectPin = [](PIN* pPin) -> bool {
 		ASSERT(pPin);
 		ASSERT(pPin->pData);
 
-		//int nRet = ((IPin*)pPin->pData)->disconnect();
-		//if (nRet >= 0) {
-		//	return true;
-		//}
-
 		return false;
 	};
 	listener.onDeleteEqItem = [&](EQITEM* pItem) -> bool {
 		ASSERT(pItem);
 		ASSERT(pItem->pData);
-		return true;
-		// return _filterManager.unload((CFilter*)pFilter->pData) >= 0;
+		return false;
 	};
 	listener.onEqItemPosChanged = [&](EQITEM* pItem, int x, int y) -> void {
 		ASSERT(pItem);
@@ -150,6 +134,13 @@
 
 		return true;
 	};
+	listener.onSelectEqItem = [&](EQITEM* pItem) -> bool {
+		ASSERT(pItem);
+		SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
+		theApp.m_model.notifyPtr(RX_CODE_SELECT_EQUIPMENT, pEquipment);
+
+		return true;
+	};
 
 	m_pEqsGraphWnd = CEqsGraphWnd::FromHandle(GetDlgItem(IDC_EQSGRAPHWND1)->m_hWnd);
 	m_pEqsGraphWnd->SetBkgndColor(m_crBkgnd);
diff --git a/SourceCode/Bond/Servo/CPanel.cpp b/SourceCode/Bond/Servo/CPanel.cpp
deleted file mode 100644
index 00b3b46..0000000
--- a/SourceCode/Bond/Servo/CPanel.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "stdafx.h"
-#include "CPanel.h"
-
-
-namespace SERVO {
-	CPanel::CPanel()
-	{
-
-	}
-
-	CPanel::~CPanel()
-	{
-
-	}
-
-	std::string& CPanel::getClassName()
-	{
-		static std::string strName = "CPanel";
-		return strName;
-	}
-
-	std::string CPanel::toString()
-	{
-		std::string strText;
-		strText += "CPanel[";
-		strText += ("ID:" + m_strID + ";");
-		strText += "]";
-
-		return strText;
-	}
-
-	void CPanel::setID(const char* pszID)
-	{
-		m_strID = pszID;
-	}
-
-	std::string& CPanel::getID()
-	{
-		return m_strID;
-	}
-}
diff --git a/SourceCode/Bond/Servo/CVacuumBake.cpp b/SourceCode/Bond/Servo/CVacuumBake.cpp
index 3a8a984..556d029 100644
--- a/SourceCode/Bond/Servo/CVacuumBake.cpp
+++ b/SourceCode/Bond/Servo/CVacuumBake.cpp
@@ -57,4 +57,14 @@
 	{
 		return __super::recvIntent(pPin, pIntent);
 	}
+
+	BOOL CVacuumBake::glassWillArrive(CGlass* pGlass)
+	{
+		BOOL bRet = __super::glassWillArrive(pGlass);
+		if (!bRet) {
+			return FALSE;
+		}
+
+		return m_glassList.empty();
+	}
 }
diff --git a/SourceCode/Bond/Servo/CVacuumBake.h b/SourceCode/Bond/Servo/CVacuumBake.h
index 6bd084e..f8b4bff 100644
--- a/SourceCode/Bond/Servo/CVacuumBake.h
+++ b/SourceCode/Bond/Servo/CVacuumBake.h
@@ -19,6 +19,7 @@
         virtual void serialize(CArchive& ar);
         virtual void getAttributeVector(CAttributeVector& attrubutes);
         virtual int recvIntent(CPin* pPin, CIntent* pIntent);
+        virtual BOOL glassWillArrive(CGlass* pGlass);
 	};
 }
 
diff --git a/SourceCode/Bond/Servo/EqsGraphWnd.cpp b/SourceCode/Bond/Servo/EqsGraphWnd.cpp
index 8b8d441..50d569d 100644
--- a/SourceCode/Bond/Servo/EqsGraphWnd.cpp
+++ b/SourceCode/Bond/Servo/EqsGraphWnd.cpp
@@ -42,6 +42,7 @@
 	m_listener.onEqItemPosChanged = nullptr;
 	m_listener.onDblckEqItem = nullptr;
 	m_listener.onRclickEqItem = nullptr;
+	m_listener.onSelectEqItem = nullptr;
 	m_crItemBackground[0] = RGB(218, 218, 218);
 	m_crItemBackground[1] = RGB(193, 208, 227);
 	m_crItemFrame[0] = RGB(128, 128, 128);
@@ -492,6 +493,7 @@
 	m_listener.onEqItemPosChanged = listener.onEqItemPosChanged;
 	m_listener.onDblckEqItem = listener.onDblckEqItem;
 	m_listener.onRclickEqItem = listener.onRclickEqItem;
+	m_listener.onSelectEqItem = listener.onSelectEqItem;
 }
 
 BOOL CEqsGraphWnd::SetCurSel(int nSel)
@@ -1286,6 +1288,7 @@
 	PIN *pLastPin = m_pCurPin;
 	PIN *pLastSelLineOutPin = m_pSelLineOutPin;
 	BOOL bChanged = FALSE;
+	BOOL bSelectChanged = FALSE;
 	EQITEM* pHitItem = NULL;
 	PIN *pHitPin = NULL;
 	PIN *pPin2 = NULL;
@@ -1309,8 +1312,11 @@
 	}
 
 	if (nRet == HT_ITEM) {
-		m_pCurItem = pHitItem;
-		m_pCurItem->bHighlight = TRUE;
+		if (m_pCurItem != pHitItem) {
+			m_pCurItem = pHitItem;
+			m_pCurItem->bHighlight = TRUE;
+			bSelectChanged = TRUE;
+		}
 	}
 	else if (nRet == HT_PIN) {
 		m_pCurPin = pHitPin;
@@ -1558,6 +1564,13 @@
 	}
 
 
+	if (bSelectChanged) {
+		if (m_listener.onSelectEqItem != nullptr) {
+			m_listener.onSelectEqItem(m_pCurItem);
+		}
+	}
+
+
 	return ::DefWindowProc(m_hWnd, WM_LBUTTONDOWN, wParam, lParam);
 }
 
diff --git a/SourceCode/Bond/Servo/EqsGraphWnd.h b/SourceCode/Bond/Servo/EqsGraphWnd.h
index 1c4ff41..89b56f5 100644
--- a/SourceCode/Bond/Servo/EqsGraphWnd.h
+++ b/SourceCode/Bond/Servo/EqsGraphWnd.h
@@ -89,6 +89,7 @@
 	ONEQITEMPOSCHANGED		onEqItemPosChanged;
 	ONDELETEEQITEM			onDblckEqItem;
 	ONDELETEEQITEM			onRclickEqItem;
+	ONDELETEEQITEM			onSelectEqItem;
 } EqsGraphListener;
 
 class CEqsGraphWnd
diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index 114fe5d..a757adc 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -36,7 +36,7 @@
 	m_configuration.getUnitId(strUnitId);
 
 	// 机器型号和软件版本号应从配置中读取,当前先固定值
-	CString strModeType = _T("Bond2860");
+	CString strModeType = _T("Master");
 	CString strSoftRev = _T("1.0.2");
 
 
@@ -166,6 +166,12 @@
 	m_master.setListener(masterListener);
 
 
+	// master 设置缓存文件
+	CString strMasterDataFile;
+	strMasterDataFile.Format(_T("%s\\Master.dat"), (LPTSTR)(LPCTSTR)m_strWorkDir);
+	m_master.setCacheFilepath((LPTSTR)(LPCTSTR)strMasterDataFile);
+
+
 	// 加载警告信息
 	AlarmManager& alarmManager = AlarmManager::getInstance();
 	char szBuffer[MAX_PATH];
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj b/SourceCode/Bond/Servo/Servo.vcxproj
index 8b33129..1278d72 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj
+++ b/SourceCode/Bond/Servo/Servo.vcxproj
@@ -217,12 +217,12 @@
     <ClInclude Include="CEqStatusStep.h" />
     <ClInclude Include="CEqVCREnableStep.h" />
     <ClInclude Include="CFliper.h" />
+    <ClInclude Include="CGlass.h" />
     <ClInclude Include="CLoadPort.h" />
     <ClInclude Include="CMeasurement.h" />
     <ClInclude Include="ColorTransfer.h" />
     <ClInclude Include="CPageGraph1.h" />
     <ClInclude Include="CPageGraph2.h" />
-    <ClInclude Include="CPanel.h" />
     <ClInclude Include="CPanelAttributes.h" />
     <ClInclude Include="CPanelEquipment.h" />
     <ClInclude Include="CPanelMaster.h" />
@@ -285,12 +285,12 @@
     <ClCompile Include="CEqStatusStep.cpp" />
     <ClCompile Include="CEqVCREnableStep.cpp" />
     <ClCompile Include="CFliper.cpp" />
+    <ClCompile Include="CGlass.cpp" />
     <ClCompile Include="CLoadPort.cpp" />
     <ClCompile Include="CMeasurement.cpp" />
     <ClCompile Include="ColorTransfer.cpp" />
     <ClCompile Include="CPageGraph1.cpp" />
     <ClCompile Include="CPageGraph2.cpp" />
-    <ClCompile Include="CPanel.cpp" />
     <ClCompile Include="CPanelAttributes.cpp" />
     <ClCompile Include="CPanelEquipment.cpp" />
     <ClCompile Include="CPanelMaster.cpp" />
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj.filters b/SourceCode/Bond/Servo/Servo.vcxproj.filters
index ae66fd9..ef39ee3 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj.filters
+++ b/SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -67,13 +67,13 @@
     <ClCompile Include="CBakeCooling.cpp" />
     <ClCompile Include="CVacuumBake.cpp" />
     <ClCompile Include="Intent.cpp" />
-    <ClCompile Include="CPanel.cpp" />
     <ClCompile Include="EqsGraphWnd.cpp" />
     <ClCompile Include="ColorTransfer.cpp" />
     <ClCompile Include="MapPosWnd.cpp" />
     <ClCompile Include="HmTab.cpp" />
     <ClCompile Include="CPageGraph1.cpp" />
     <ClCompile Include="CPageGraph2.cpp" />
+    <ClCompile Include="CGlass.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="AlarmManager.h" />
@@ -139,13 +139,13 @@
     <ClInclude Include="CBakeCooling.h" />
     <ClInclude Include="CVacuumBake.h" />
     <ClInclude Include="Intent.h" />
-    <ClInclude Include="CPanel.h" />
     <ClInclude Include="EqsGraphWnd.h" />
     <ClInclude Include="ColorTransfer.h" />
     <ClInclude Include="MapPosWnd.h" />
     <ClInclude Include="HmTab.h" />
     <ClInclude Include="CPageGraph1.h" />
     <ClInclude Include="CPageGraph2.h" />
+    <ClInclude Include="CGlass.h" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="Servo.rc" />
diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index cfc6034..5d96844 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -234,8 +234,8 @@
 	CHmTab* m_pTab = CHmTab::Hook(GetDlgItem(IDC_TAB1)->m_hWnd);
 	m_pTab->SetPaddingLeft(20);
 	m_pTab->SetItemMarginLeft(18);
-	m_pTab->AddItem("报表", FALSE);
-	m_pTab->AddItem("日志", TRUE);
+	m_pTab->AddItem("状态图", FALSE);
+	m_pTab->AddItem("连接图", TRUE);
 	m_pTab->SetCurSel(0);
 	m_pTab->SetBkgndColor(RGB(222, 222, 222));
 	ShowChildPage(0);

--
Gitblit v1.9.3