From e42e8364112e97d89eeaecd13f043dff42179949 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 27 五月 2025 17:19:02 +0800
Subject: [PATCH] 1.enum修改为enum class, 理顺CLoadPort各成员变量在调度中的判定作用;

---
 SourceCode/Bond/Servo/CPagePortProperty.cpp |   16 +-
 SourceCode/Bond/Servo/Servo.vcxproj         |    2 
 SourceCode/Bond/Servo/CLoadPort.h           |   24 +-
 SourceCode/Bond/Servo/CRobotTask.cpp        |   63 +++++++++
 SourceCode/Bond/Servo/CMaster.h             |    6 
 SourceCode/Bond/Servo/CLoadPort.cpp         |   56 ++++----
 SourceCode/Bond/Servo/CRobotTask.h          |   28 ++++
 SourceCode/Bond/Servo/Servo.vcxproj.filters |    2 
 SourceCode/Bond/Servo/ToolUnits.cpp         |    5 
 SourceCode/Bond/Servo/CEquipment.cpp        |    2 
 SourceCode/Bond/Servo/CMaster.cpp           |   35 +++++
 SourceCode/Bond/Servo/CEquipment.h          |   71 ----------
 SourceCode/Bond/Servo/ServoCommo.h          |   87 +++++++++++
 13 files changed, 271 insertions(+), 126 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index e4d8c07..9a6ebfc 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -1099,7 +1099,7 @@
 			return -1;
 		}
 
-		unsigned short operationMode = (unsigned short)(mode + getIndexerOperationModeBaseValue());
+		unsigned short operationMode = (unsigned short)((unsigned short)mode + getIndexerOperationModeBaseValue());
 		LOGI("<CEquipment-%s>准备设置indexerOperationMode<%d>", m_strName.c_str(), (int)mode);
 		if (onWritedBlock != nullptr) {
 			pStep->writeShort(operationMode, onWritedBlock);
diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index 6357114..c1d73c7 100644
--- a/SourceCode/Bond/Servo/CEquipment.h
+++ b/SourceCode/Bond/Servo/CEquipment.h
@@ -1,5 +1,6 @@
 #pragma once
 #include "Log.h"
+#include "ServoCommo.h"
 #include "CCLinkIEControl.h"
 #include "CSample.h"
 #include "CPin.h"
@@ -36,10 +37,6 @@
 
 
 namespace SERVO {
-#define BLOCK_BUFFER_MAX			1024
-#define ALIVE_TIMEOUT				15
-#define VCR_MAX						1
-#define ARM_ALL						99
 
 	typedef std::function<void(void* pEiuipment, BOOL bAlive)> ONALIVE;
 	typedef std::function<void(void* pEiuipment, int code)> ONDATACHANGED;
@@ -54,78 +51,12 @@
 		ONVCREVENTREPORT	onVcrEventReport;
 	} EquipmentListener;
 
-	// Memory Block 结构体定义
-	typedef struct _MemoryBlock {
-		unsigned int type;
-		unsigned int start;
-		unsigned int end;
-		unsigned int size;
-		char buffer[BLOCK_BUFFER_MAX];
-	} MemoryBlock;
-
-	// ALIVE
-	typedef struct _ALIVE {
-		BOOL flag;
-		int count;
-		BOOL alive;
-	} ALIVE;
-
-	enum DISPATCHING_MODE {
-		EAS = 1,
-		Local = 2
-	};
-
-	enum IDNEXER_OPERATION_MODE {
-		Normal = 1,
-		Clear_Out = 2,
-		Cold_Run = 2,
-		Start = 10,
-		Stop = 11,
-		Pause = 12,
-		Resume = 13,
-		Abort = 14,
-		Cancel = 15,
-	};
-
-	enum RCMD {
-		Robot_home = 1,
-		Transfer, 
-		Move,
-		Get,
-		Put,
-		One_Action_Exchange,
-		Two_Action_Exchange,
-		Command_Clear,
-		Batch_get,
-		Batch_put
-	};
-
-	enum VCR_Reply_Code {
-		OK = 1,
-		NG,
-		Job_Data_Request,
-		VCR_Mismatch
-	};
-
-	// Robot cmd param
-#define ROBOT_CMD_PARAM_SIZE		16			/* 防止以后修改ROBOT_CMD_PARAM为不是4的整数倍 */
-	typedef struct _ROBOT_CMD_PARAM {
-		short sequenceNo;
-		short rcmd;
-		short armNo;
-		short getPosition;
-		short putPosition;
-		short getSlotNo;
-		short putSlotNo;
-		short subCmd;
-	} ROBOT_CMD_PARAM;
 
 	class CEquipment
 	{
 	public:
 		CEquipment();
 		virtual ~CEquipment();
-
 
 	public:
 		virtual const char* getClassName() = 0;
diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index 1c7becf..a61e86e 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -16,10 +16,10 @@
 	CLoadPort::CLoadPort() : CEquipment()
 	{
 		m_nIndex = 0;
-		m_nType = 1;
-		m_nMode = 1;
-		m_nCassetteType = 1;
-		m_nTransferMode = 1;
+		m_portType = PortType::Loading;
+		m_portMode = PortMode::InService;
+		m_cassetteType = CassetteType::G1;
+		m_transferMode = TransferMode::AGVMode;
 		m_bEnable = FALSE;
 		m_bAutoChangeEnable = FALSE;
 	}
@@ -88,7 +88,7 @@
 			CEqReadStep* pStep = new CEqReadStep(dev[m_nIndex], sizeof(short),
 				[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
 					if (code == ROK && pszData != nullptr && size > 0) {
-						m_nType = (unsigned int)CToolUnits::toInt16(pszData);
+						m_portType = (PortType)CToolUnits::toInt16(pszData);
 					}
 					return 0;
 				});
@@ -109,7 +109,7 @@
 			CEqReadStep* pStep = new CEqReadStep(dev[m_nIndex], sizeof(short),
 				[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
 					if (code == ROK && pszData != nullptr && size > 0) {
-						m_nMode = (unsigned int)CToolUnits::toInt16(pszData);
+						m_portMode = (PortMode)CToolUnits::toInt16(pszData);
 					}
 					return 0;
 				});
@@ -130,7 +130,7 @@
 			CEqReadStep* pStep = new CEqReadStep(dev[m_nIndex], sizeof(short),
 				[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
 					if (code == ROK && pszData != nullptr && size > 0) {
-						m_nCassetteType = (unsigned int)CToolUnits::toInt16(pszData);
+						m_cassetteType = (CassetteType)CToolUnits::toInt16(pszData);
 					}
 					return 0;
 				});
@@ -151,7 +151,7 @@
 			CEqReadStep* pStep = new CEqReadStep(dev[m_nIndex], sizeof(short),
 				[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
 					if (code == ROK && pszData != nullptr && size > 0) {
-						m_nTransferMode = (unsigned int)CToolUnits::toInt16(pszData);
+						m_transferMode = (TransferMode)CToolUnits::toInt16(pszData);
 					}
 					return 0;
 				});
@@ -358,13 +358,13 @@
 		attrubutes.addAttribute(new CAttribute("Index",
 			std::to_string(m_nIndex).c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("Type",
-			getPortTypeDescription(m_nType, strTemp).c_str(), "", weight++));
+			getPortTypeDescription(m_portType, strTemp).c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("Mode",
-			getPortModeDescription(m_nMode, strTemp).c_str(), "", weight++));
+			getPortModeDescription(m_portMode, strTemp).c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("CassetteType",
-			getPortCassetteTypeDescription(m_nCassetteType, strTemp).c_str(), "", weight++));
+			getPortCassetteTypeDescription(m_cassetteType, strTemp).c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("TransferMode",
-			getPortTransferModeDescription(m_nTransferMode, strTemp).c_str(), "", weight++));
+			getPortTransferModeDescription(m_transferMode, strTemp).c_str(), "", weight++));
 		attrubutes.addAttribute(new CAttribute("Enable",
 			m_bEnable ? "Eanble" : "Disable", "", weight++));
 		attrubutes.addAttribute(new CAttribute("Auto Change",
@@ -441,24 +441,24 @@
 		return m_bEnable;
 	}
 
-	int CLoadPort::getPortType()
+	PortType CLoadPort::getPortType()
 	{
-		return m_nType;
+		return m_portType;
 	}
 
-	int CLoadPort::getPortMode()
+	PortMode CLoadPort::getPortMode()
 	{
-		return m_nMode;
+		return m_portMode;
 	}
 
-	int CLoadPort::getCessetteType()
+	CassetteType CLoadPort::getCessetteType()
 	{
-		return m_nCassetteType;
+		return m_cassetteType;
 	}
 
-	int CLoadPort::getTransferMode()
+	TransferMode CLoadPort::getTransferMode()
 	{
-		return m_nTransferMode;
+		return m_transferMode;
 	}
 
 	BOOL CLoadPort::isAutoChange()
@@ -510,9 +510,9 @@
 	 6: Buffer Port-Un-loader in Buffer Type
 	 7: Unloading Partial Port
 	 */
-	std::string& CLoadPort::getPortTypeDescription(int portType, std::string& strDescription)
+	std::string& CLoadPort::getPortTypeDescription(PortType portType, std::string& strDescription)
 	{
-		switch (portType) {
+		switch ((int)portType) {
 		case 1:
 			strDescription = _T("Loading Port");
 			break;
@@ -550,9 +550,9 @@
 	 4: InService
 	 5: TransferReady
 	 */
-	std::string& CLoadPort::getPortModeDescription(int portMode, std::string& strDescription)
+	std::string& CLoadPort::getPortModeDescription(PortMode portMode, std::string& strDescription)
 	{
-		switch (portMode) {
+		switch ((int)portMode) {
 		case 0:
 			strDescription = _T("OutOfService");
 			break;
@@ -584,9 +584,9 @@
 	 2: G2
 	 3: G1&G2
 	 */
-	std::string& CLoadPort::getPortCassetteTypeDescription(int casseteType, std::string& strDescription)
+	std::string& CLoadPort::getPortCassetteTypeDescription(CassetteType casseteType, std::string& strDescription)
 	{
-		switch (casseteType) {
+		switch ((int)casseteType) {
 		case 1:
 			strDescription = _T("G1");
 			break;
@@ -609,9 +609,9 @@
 	 2: AGV Mode
 	 3: Stocker Inline Mode
 	 */
-	std::string& CLoadPort::getPortTransferModeDescription(int mode, std::string& strDescription)
+	std::string& CLoadPort::getPortTransferModeDescription(TransferMode mode, std::string& strDescription)
 	{
-		switch (mode) {
+		switch ((int)mode) {
 		case 1:
 			strDescription = _T("MGV Mode");
 			break;
diff --git a/SourceCode/Bond/Servo/CLoadPort.h b/SourceCode/Bond/Servo/CLoadPort.h
index 3e011fc..3156830 100644
--- a/SourceCode/Bond/Servo/CLoadPort.h
+++ b/SourceCode/Bond/Servo/CLoadPort.h
@@ -36,10 +36,10 @@
 		void setIndex(unsigned int index);
 		unsigned int getIndex();
 		BOOL isEnable();
-		int getPortType();
-		int getPortMode();
-		int getCessetteType();
-		int getTransferMode();
+		PortType getPortType();
+		PortMode getPortMode();
+		CassetteType getCessetteType();
+		TransferMode getTransferMode();
 		BOOL isAutoChange();
 		int getPortStatus();
 		int getCassetteSequenceNo();
@@ -51,10 +51,10 @@
 		int testGenerateGlassList(MaterialsType type, int count, const char* pszPrefix, int startSuffix);
 
 	public:
-		static std::string& getPortTypeDescription(int portType, std::string& strDescription);
-		static std::string& getPortModeDescription(int portMode, std::string& strDescription);
-		static std::string& getPortCassetteTypeDescription(int casseteType, std::string& strDescription);
-		static std::string& getPortTransferModeDescription(int mode, std::string& strDescription);
+		static std::string& getPortTypeDescription(PortType portType, std::string& strDescription);
+		static std::string& getPortModeDescription(PortMode portMode, std::string& strDescription);
+		static std::string& getPortCassetteTypeDescription(CassetteType casseteType, std::string& strDescription);
+		static std::string& getPortTransferModeDescription(TransferMode mode, std::string& strDescription);
 		static std::string& getEnableModeDescription(int mode, std::string& strDescription);
 		static std::string& getPortStatusDescription(int portStatus, std::string& strDescription);
 		static std::string& getLoadingCassetteTypeDescription(int type, std::string& strDescription);
@@ -77,10 +77,10 @@
 
 	private:
 		unsigned int m_nIndex;
-		int m_nType;
-		int m_nMode;
-		int m_nCassetteType;
-		int m_nTransferMode;
+		PortType m_portType;
+		PortMode m_portMode;
+		CassetteType m_cassetteType;
+		TransferMode m_transferMode;
 		BOOL m_bEnable;
 		BOOL m_bAutoChangeEnable;
 		CPortStatusReport m_portStatusReport;
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 9cdef60..3bd5d26 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -47,6 +47,7 @@
 		m_ullStartTime = 0;
 		m_ullRunTime = 0;
 		m_state = MASTERSTATE::READY;
+		m_pActiveRobotTask = nullptr;
 		InitializeCriticalSection(&m_criticalSection);
 	}
 
@@ -88,6 +89,11 @@
 		m_listener.onEqAlarm = listener.onEqAlarm;
 		m_listener.onEqVcrEventReport = listener.onEqVcrEventReport;
 		m_listener.onEqDataChanged = listener.onEqDataChanged;
+	}
+
+	CRobotTask* CMaster::getActiveRobotTask()
+	{
+		return m_pActiveRobotTask;
 	}
 
 	int CMaster::init()
@@ -305,6 +311,35 @@
 				unlock();
 				LOGI("调度处理中...");
 				Sleep(1000);
+
+
+				// LoadPort -> Fliper(G2)
+
+
+				// LoadPort -> VacuumBake(G1)
+
+
+				// Fliper(G2) -> Aligner
+
+
+				// VacuumBake(G1) -> Aligner
+
+
+				// Aligner -> Bonder
+
+
+				// Bonder -> BakeCooling
+
+
+				// BakeCooling ->Measurement
+
+
+				// Measurement -> LoadPort
+
+
+
+
+
 			}
 			unlock();
 		}
diff --git a/SourceCode/Bond/Servo/CMaster.h b/SourceCode/Bond/Servo/CMaster.h
index be53515..e6cf6fa 100644
--- a/SourceCode/Bond/Servo/CMaster.h
+++ b/SourceCode/Bond/Servo/CMaster.h
@@ -12,6 +12,7 @@
 #include "CArm.h"
 #include "CArmTray.h"
 #include "CCLinkIEControl.h"
+#include "CRobotTask.h"
 
 
 namespace SERVO {
@@ -47,6 +48,7 @@
 
     public:
         void setListener(MasterListener listener);
+        CRobotTask* getActiveRobotTask();
         int init();
         int term();
         int start();
@@ -105,6 +107,10 @@
         ULONGLONG m_ullStartTime;
         ULONGLONG m_ullRunTime;
         MASTERSTATE m_state;
+
+        // 当前任务和已完成任务列表
+        CRobotTask* m_pActiveRobotTask;
+        std::list< CRobotTask* > m_listTask;
     };
 }
 
diff --git a/SourceCode/Bond/Servo/CPagePortProperty.cpp b/SourceCode/Bond/Servo/CPagePortProperty.cpp
index b163d01..2ce463e 100644
--- a/SourceCode/Bond/Servo/CPagePortProperty.cpp
+++ b/SourceCode/Bond/Servo/CPagePortProperty.cpp
@@ -60,36 +60,36 @@
 	
 	pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_PORT_TYPE);
 	for (int i = 1; i <= 7; i++) {
-		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortTypeDescription(i, strTemp).c_str());
+		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortTypeDescription((SERVO::PortType)i, strTemp).c_str());
 	}
-	int portType = m_pPort->getPortType();
+	int portType = (int)m_pPort->getPortType();
 	if (1 <= portType && portType <= 7) {
 		pComboBox->SetCurSel(portType - 1);
 	}
 
 	pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_PORT_MODE);
 	for (int i = 0; i <= 5; i++) {
-		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortModeDescription(i, strTemp).c_str());
+		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortModeDescription((SERVO::PortMode)i, strTemp).c_str());
 	}
-	int portMode = m_pPort->getPortMode();
+	int portMode = (int)m_pPort->getPortMode();
 	if (0 <= portMode && portMode <= 5) {
 		pComboBox->SetCurSel(portMode);
 	}
 
 	pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_PORT_CASSERT_TYPE);
 	for (int i = 1; i <= 3; i++) {
-		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortCassetteTypeDescription(i, strTemp).c_str());
+		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortCassetteTypeDescription((SERVO::CassetteType)i, strTemp).c_str());
 	}
-	int cessetteType = m_pPort->getCessetteType();
+	int cessetteType = (int)m_pPort->getCessetteType();
 	if (1 <= cessetteType && cessetteType <= 3) {
 		pComboBox->SetCurSel(cessetteType - 1);
 	}
 
 	pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_PORT_TRANSFER_MODE);
 	for (int i = 1; i <= 3; i++) {
-		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortTransferModeDescription(i, strTemp).c_str());
+		pComboBox->InsertString(i - 1, SERVO::CLoadPort::getPortTransferModeDescription((SERVO::TransferMode)i, strTemp).c_str());
 	}
-	int transferMode = m_pPort->getTransferMode();
+	int transferMode = (int)m_pPort->getTransferMode();
 	if (1 <= transferMode && transferMode <= 3) {
 		pComboBox->SetCurSel(transferMode - 1);
 	}
diff --git a/SourceCode/Bond/Servo/CRobotTask.cpp b/SourceCode/Bond/Servo/CRobotTask.cpp
new file mode 100644
index 0000000..26017c7
--- /dev/null
+++ b/SourceCode/Bond/Servo/CRobotTask.cpp
@@ -0,0 +1,63 @@
+#include "stdafx.h"
+#include "CRobotTask.h"
+#include "ToolUnits.h"
+
+
+namespace SERVO {
+	CRobotTask::CRobotTask()
+	{
+		generateId(m_strId);
+		m_timeCreate = CToolUnits::getTimestamp();
+	}
+
+	CRobotTask::~CRobotTask()
+	{
+
+	}
+
+	std::string& CRobotTask::generateId(std::string& out)
+	{
+		char szBuffer[256];
+		CTime time = CTime::GetCurrentTime();
+		__int64 nTick = 0;
+		QueryPerformanceCounter((LARGE_INTEGER*)&nTick);
+		sprintf_s(szBuffer, 256, "%d%02d%02d%02d%02d%02d%010llu", time.GetYear(),
+			time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond(),
+			nTick % 10000000000);
+		out = szBuffer;
+
+		return out;
+	}
+
+	std::string& CRobotTask::getId()
+	{
+		return m_strId;
+	}
+
+	void CRobotTask::setRobotTransferParam(int seq, int armNo, int fromPos, int toPos, int fromSlot, int toSlot)
+	{
+		m_robotCmdParam = {};
+		m_robotCmdParam.sequenceNo = static_cast<short>(seq);
+		m_robotCmdParam.rcmd = static_cast<short>(SERVO::RCMD::Transfer);
+		m_robotCmdParam.armNo = static_cast<short>(armNo);
+		m_robotCmdParam.getPosition = static_cast<short>(fromPos);
+		m_robotCmdParam.getSlotNo = static_cast<short>(fromSlot);
+		m_robotCmdParam.putPosition = static_cast<short>(toPos);
+		m_robotCmdParam.putSlotNo = static_cast<short>(toSlot);
+	}
+
+	ROBOT_CMD_PARAM& CRobotTask::getRobotCmdParam()
+	{
+		return m_robotCmdParam;
+	}
+
+	time_t CRobotTask::getCreateTime()
+	{
+		return m_timeCreate;
+	}
+
+	time_t CRobotTask::getFinishTime()
+	{
+		return m_timeFinish;
+	}
+}
diff --git a/SourceCode/Bond/Servo/CRobotTask.h b/SourceCode/Bond/Servo/CRobotTask.h
new file mode 100644
index 0000000..1f109a3
--- /dev/null
+++ b/SourceCode/Bond/Servo/CRobotTask.h
@@ -0,0 +1,28 @@
+#pragma once
+#include "ServoCommo.h"
+
+
+namespace SERVO {
+	class CRobotTask
+	{
+	public:
+		CRobotTask();
+		~CRobotTask();
+
+	public:
+		std::string& getId();
+		void setRobotTransferParam(int seq, int armNo, int fromPos, int toPos, int fromSlot, int toSlot);
+		ROBOT_CMD_PARAM& getRobotCmdParam();
+		time_t getCreateTime();
+		time_t getFinishTime();
+
+	private:
+		static std::string& generateId(std::string& out);
+
+	public:
+		std::string m_strId;
+		time_t m_timeCreate;						/* 创建时间 */
+		time_t m_timeFinish;						/* 结束时间 */
+		ROBOT_CMD_PARAM m_robotCmdParam;			/* 参数 */
+	};
+}
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj b/SourceCode/Bond/Servo/Servo.vcxproj
index 1d72e67..795cd89 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj
+++ b/SourceCode/Bond/Servo/Servo.vcxproj
@@ -205,6 +205,7 @@
     <ClInclude Include="CRobotCmdTestDlg.h" />
     <ClInclude Include="CPagePortStatus.h" />
     <ClInclude Include="CPortStatusReport.h" />
+    <ClInclude Include="CRobotTask.h" />
     <ClInclude Include="HorizontalLine.h" />
     <ClInclude Include="JobSlotGrid.h" />
     <ClInclude Include="MsgDlg.h" />
@@ -315,6 +316,7 @@
     <ClCompile Include="CRobotCmdTestDlg.cpp" />
     <ClCompile Include="CPagePortStatus.cpp" />
     <ClCompile Include="CPortStatusReport.cpp" />
+    <ClCompile Include="CRobotTask.cpp" />
     <ClCompile Include="HorizontalLine.cpp" />
     <ClCompile Include="JobSlotGrid.cpp" />
     <ClCompile Include="MsgDlg.cpp" />
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj.filters b/SourceCode/Bond/Servo/Servo.vcxproj.filters
index 391e792..368a060 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj.filters
+++ b/SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -115,6 +115,7 @@
     <ClCompile Include="TopToolbar.cpp" />
     <ClCompile Include="HorizontalLine.cpp" />
     <ClCompile Include="CMyStatusbar.cpp" />
+    <ClCompile Include="CRobotTask.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="AlarmManager.h" />
@@ -229,6 +230,7 @@
     <ClInclude Include="TopToolbar.h" />
     <ClInclude Include="HorizontalLine.h" />
     <ClInclude Include="CMyStatusbar.h" />
+    <ClInclude Include="CRobotTask.h" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="Servo.rc" />
diff --git a/SourceCode/Bond/Servo/ServoCommo.h b/SourceCode/Bond/Servo/ServoCommo.h
index 959a8a1..5cfc30d 100644
--- a/SourceCode/Bond/Servo/ServoCommo.h
+++ b/SourceCode/Bond/Servo/ServoCommo.h
@@ -2,7 +2,12 @@
 
 
 namespace SERVO {
-	enum PortType {
+#define BLOCK_BUFFER_MAX			1024
+#define ALIVE_TIMEOUT				15
+#define VCR_MAX						1
+#define ARM_ALL						99
+
+	enum class PortType {
 		Loading = 1,
 		Unloading,
 		Both,
@@ -12,7 +17,7 @@
 		UnloadingPartial
 	};
 
-	enum PortMode {
+	enum class PortMode {
 		OutOfService = 0,
 		TransferBlocked,
 		ReadyToLoad,
@@ -21,17 +26,91 @@
 		TransferReady
 	};
 
-	enum MaterialsType {
+	enum class MaterialsType {
 		G1 = 0,
 		G2 = 1,
 		G1G2 = 2
 	};
 	typedef MaterialsType CassetteType;
 
-	enum TransferMode {
+	enum class TransferMode {
 		MGVMode = 1,
 		AGVMode,
 		StockerInlineMode
 	};
+
+	// Memory Block 结构体定义
+	typedef struct _MemoryBlock {
+		unsigned int type;
+		unsigned int start;
+		unsigned int end;
+		unsigned int size;
+		char buffer[BLOCK_BUFFER_MAX];
+	} MemoryBlock;
+
+	// ALIVE
+	typedef struct _ALIVE {
+		BOOL flag;
+		int count;
+		BOOL alive;
+	} ALIVE;
+
+	enum class DISPATCHING_MODE {
+		EAS = 1,
+		Local = 2
+	};
+
+	enum class IDNEXER_OPERATION_MODE {
+		Normal = 1,
+		Clear_Out = 2,
+		Cold_Run = 2,
+		Start = 10,
+		Stop = 11,
+		Pause = 12,
+		Resume = 13,
+		Abort = 14,
+		Cancel = 15,
+	};
+
+	enum class VCR_Reply_Code {
+		OK = 1,
+		NG,
+		Job_Data_Request,
+		VCR_Mismatch
+	};
+
+	// Robot cmd param
+#define ROBOT_CMD_PARAM_SIZE		16			/* 防止以后修改ROBOT_CMD_PARAM为不是4的整数倍 */
+	typedef struct _ROBOT_CMD_PARAM {
+		short sequenceNo;
+		short rcmd;
+		short armNo;
+		short getPosition;
+		short putPosition;
+		short getSlotNo;
+		short putSlotNo;
+		short subCmd;
+	} ROBOT_CMD_PARAM;
+
+	enum class RCMD {
+		Robot_home = 1,
+		Transfer,
+		Move,
+		Get,
+		Put,
+		One_Action_Exchange,
+		Two_Action_Exchange,
+		Command_Clear,
+		Batch_get,
+		Batch_put
+	};
+
+	enum class ROBOT_TASK_STATE {
+		Ready = 0,
+		Running,
+		Error,
+		Abort,
+		Completed
+	};
 }
 
diff --git a/SourceCode/Bond/Servo/ToolUnits.cpp b/SourceCode/Bond/Servo/ToolUnits.cpp
index f3a88bc..2964355 100644
--- a/SourceCode/Bond/Servo/ToolUnits.cpp
+++ b/SourceCode/Bond/Servo/ToolUnits.cpp
@@ -75,9 +75,8 @@
 ULONGLONG CToolUnits::getTimestamp()
 {
 	auto now = std::chrono::system_clock::now();
-	auto duration_in_milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch());
-	uint64_t timestamp = duration_in_milliseconds.count();
-	return timestamp;
+	auto ms = std::chrono::time_point_cast<std::chrono::milliseconds>(now);
+	return static_cast<ULONGLONG>(ms.time_since_epoch().count());
 }
 
 void CToolUnits::createDir(const char* pszDir)

--
Gitblit v1.9.3