From 829fe6c6bc33d53fda9c31fd45a37e1df87befff Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期五, 30 一月 2026 11:16:24 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang

---
 SourceCode/Bond/Servo/CEquipment.h |   60 +++++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 35 insertions(+), 25 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index 36a05c9..0ed9452 100644
--- a/SourceCode/Bond/Servo/CEquipment.h
+++ b/SourceCode/Bond/Servo/CEquipment.h
@@ -1,4 +1,4 @@
-#pragma once
+锘�#pragma once
 #include "Log.h"
 #include "ServoCommo.h"
 #include "CCLinkIEControl.h"
@@ -55,9 +55,12 @@
 	typedef std::function<void(void* pEiuipment, void* pReport)> ONVCREVENTREPORT;
 	typedef std::function<BOOL(void* pEiuipment, int port, CJobDataB* pJobDataB)> ONPREFETCHEDOUTJOB;
 	typedef std::function<BOOL(void* pEiuipment, int port, CJobDataB* pJobDataB, short& putSlot)> ONPRESTOREDJOB;
-	typedef std::function<void(void* pEiuipment, int nSlotNo, PROCESS_STATE state)> ONPROCESSSTATE;
+	typedef std::function<void(void* pEiuipment, int nSlotNo, PROCESS_STATE prevState, PROCESS_STATE state)> ONPROCESSSTATE;
 	typedef std::function<void(void* pEiuipment, short scanMap, short downMap)> ONMAPMISMATCH;
 	typedef std::function<void(void* pEiuipment, short status, __int64 data)> ONPORTSTATUSCHANGED;
+	typedef std::function<void(void* pEiuipment, const std::vector<CParam>& params)> ONPROCESSDATAREPORT;
+	typedef std::function<void(void* pEiuipment, int port, CJobDataS* pJobDataS)> ONRECEIVEDJOB;
+	typedef std::function<void(void* pEiuipment, int port, CJobDataS* pJobDataS)> ONSENTOUTJOB;
 	
 	typedef struct _EquipmentListener
 	{
@@ -73,6 +76,9 @@
 		ONPORTSTATUSCHANGED	onPortStatusChanged;
 		ONVCREVENTREPORT	onSVDataReport;
 		ONVCREVENTREPORT	onPanelDataReport;
+		ONPROCESSDATAREPORT	onProcessDataReport;
+		ONRECEIVEDJOB		onReceivedJob;
+		ONSENTOUTJOB		onSentOutJob;
 	} EquipmentListener;
 
 
@@ -99,6 +105,8 @@
 		std::string& getName();
 		void setDescription(const char* pszDescription);
 		std::string& getDescription();
+		void setCurrentRecipe(const std::string& recipe);
+		std::string getCurrentRecipe();
 		void setStation(int network, int station);
 		const StationIdentifier& getStation();
 		virtual void getAttributeVector(CAttributeVector& attrubutes);
@@ -140,7 +148,7 @@
 		virtual int onProcessData(CProcessData* pProcessData);
 		virtual int onSendAble(int port);
 		virtual int onReceiveAble(int port);
-		virtual int onProcessStateChanged(int nSlotNo, PROCESS_STATE state);
+		virtual int onProcessStateChanged(int nSlotNo, PROCESS_STATE prevState, PROCESS_STATE state);
 		virtual int getIndexerOperationModeBaseValue();
 		virtual bool isSlotProcessed(int slot) { return true; };
 		bool isAlarmStep(SERVO::CStep* pStep);
@@ -163,47 +171,47 @@
 		void printDebugString001();
 		std::vector<SERVO::CSVData>& getSVDatas();
 
-		// 请求主配方列表
+		// 璇锋眰涓婚厤鏂瑰垪琛�
 		// unitNo: 0:local; Others:unit No
 		int masterRecipeListRequest(short unitNo, ONSYNCINGSTATECHANGED block);
 
-		// 请求配方参数
-		// masterRecipeId: 主配方id
-		// localRecipeId: 本地配方id
+		// 璇锋眰閰嶆柟鍙傛暟
+		// masterRecipeId: 涓婚厤鏂筰d
+		// localRecipeId: 鏈湴閰嶆柟id
 		// unitNo: 0:local; Others:unit No
 		int recipeParameterRequest(short masterRecipeId, short localRecipeId, short unitNo, ONSYNCINGSTATECHANGED block);
 
-		// 解析配方参数列表
+		// 瑙f瀽閰嶆柟鍙傛暟鍒楄〃
 		virtual int parsingParams(const char* pszData, size_t size, std::vector<CParam>& params) { return 0;  };
 		virtual int parsingParams(const char* pszData, size_t size, std::string& strOut);
 		virtual int parsingProcessData(const char* pszData, size_t size, std::vector<CParam>& params) { return 0; };
 		virtual int parsingSVData(const char* pszData, size_t size, std::vector<CParam>& params) { return 0; };
 
-		// 获取指定的Slot
+		// 鑾峰彇鎸囧畾鐨凷lot
 		CSlot* getSlot(int index);
 		CSlot* getSlotWithNo(int slotNo);
 
-		// 获取一个可用的槽位
+		// 鑾峰彇涓�涓彲鐢ㄧ殑妲戒綅
 		CSlot* getAvailableSlot();
 
-		// 获取一个指定物料类型(G1,G2,G1&G2)的空槽位
+		// 鑾峰彇涓�涓寚瀹氱墿鏂欑被鍨�(G1,G2,G1&G2)鐨勭┖妲戒綅
 		CSlot* getAvailableSlotForGlass(MaterialsType type);
 		CSlot* getAvailableSlotForGlassExcludeSignal(MaterialsType type);
 		CSlot* isSlotAvailable(unsigned int slot);
 
-		// 在指定的槽列表中,获取一个指定物料类型(G1,G2,G1&G2)的空槽位
+		// 鍦ㄦ寚瀹氱殑妲藉垪琛ㄤ腑锛岃幏鍙栦竴涓寚瀹氱墿鏂欑被鍨�(G1,G2,G1&G2)鐨勭┖妲戒綅
 		CSlot* getAvailableSlotForGlass2(MaterialsType type, const std::vector<int>& candidates);
 
-		// 获取一个指定物料类型(G1,G2,G1&G2)的非空槽位
+		// 鑾峰彇涓�涓寚瀹氱墿鏂欑被鍨�(G1,G2,G1&G2)鐨勯潪绌烘Ы浣�
 		CSlot* getNonEmptySlot(MaterialsType type);
 
-		// 获取一个指定物料类型(G1,G2,G1&G2)的且已经加工处理的槽位
+		// 鑾峰彇涓�涓寚瀹氱墿鏂欑被鍨�(G1,G2,G1&G2)鐨勪笖宸茬粡鍔犲伐澶勭悊鐨勬Ы浣�
 		CSlot* getProcessedSlot(MaterialsType putSlotType, BOOL bJobMode = FALSE);
 		CSlot* getProcessedSlot2(MaterialsType putSlotType, const std::vector<int>& candidates);
 		CSlot* getInspFailSlot();
 		CSlot* getProcessedSlotCt(unsigned int slot);
 
-		// 获取玻璃物料
+		// 鑾峰彇鐜荤拑鐗╂枡
 		CGlass* getGlassFromSlot(int slotNo);
 		CGlass* getGlassWithCassette(int cassetteSequenceNo, int jobSequenceNo);
 		CGlass* getAnyGlass();
@@ -211,26 +219,27 @@
 		int getAllGlass(std::vector<CGlass*>& glasses);
 		CJobDataS* getJobDataSWithCassette(int cassetteSequenceNo, int jobSequenceNo);
 
-		// 验证玻璃和槽是否匹配
+		// 楠岃瘉鐜荤拑鍜屾Ы鏄惁鍖归厤
 		BOOL ValidateGlassSlotMatch();
 
-		// 是否有玻璃
+		// 鏄惁鏈夌幓鐠�
 		BOOL hasGlass();
 		BOOL slotHasGlass(int slotIndex = 0);
 
-		// 指定槽位是否可以放置玻璃
+		// 鎸囧畾妲戒綅鏄惁鍙互鏀剧疆鐜荤拑
 		BOOL canPlaceGlassInSlot(const short slotIndex);
 
-		// 手动移除物料
+		// 鎵嬪姩绉婚櫎鐗╂枡
 		int removeGlass(int slotNo);
 
-		// 字符串检测结果转换
+		// 瀛楃涓叉娴嬬粨鏋滆浆鎹�
 		InspResult judgeStringToInspResult(std::string& strJudge);
 
+		// for test
+		void fireSetProcessState(int nSlotNo, PROCESS_STATE state) { return setProcessState(nSlotNo, state); }
 
 
-
-	// 以下为从CC-Link读取到的Bit标志位检测函数
+	// 浠ヤ笅涓轰粠CC-Link璇诲彇鍒扮殑Bit鏍囧織浣嶆娴嬪嚱鏁�
 	public:
 		BOOL isAlive();
 		BOOL isCimOn();
@@ -242,7 +251,7 @@
 		BOOL isLinkSignalUpstreamOn(unsigned int path, unsigned int signal);
 		BOOL isLinkSignalDownstreamOn(unsigned int path, unsigned int signal);
 
-		// 只在模拟测试时使用的函数,用于模拟信号
+		// 鍙湪妯℃嫙娴嬭瘯鏃朵娇鐢ㄧ殑鍑芥暟锛岀敤浜庢ā鎷熶俊鍙�
 		void setLinkSignalUpstream(unsigned int path, unsigned int signal, BOOL bOn);
 		void setLinkSignalUpstreamBlock(unsigned int path, BOOL* pSignal);
 		void setLinkSignalDownstream(unsigned int path, unsigned int signal, BOOL bOn);
@@ -271,7 +280,7 @@
 		float toFloat(const char* pszAddr);
 
 	protected:
-		// 部分优化/简化代码、暂实现部分,到时平铺开
+		// 閮ㄥ垎浼樺寲/绠�鍖栦唬鐮併�佹殏瀹炵幇閮ㄥ垎锛屽埌鏃跺钩閾哄紑
 		void addFacDataReportStep(int dataDev, int writeSignalDev, int port);
 
 
@@ -281,6 +290,7 @@
 		int m_nID;
 		std::string m_strName;
 		std::string m_strDescription;
+		std::string m_currentRecipe;
 		CRITICAL_SECTION m_criticalSection;
 		StationIdentifier m_station;
 		MemoryBlock m_blockReadBit;
@@ -289,7 +299,7 @@
 		std::vector<CPin*> m_outputPins;
 
 
-		// 以下为从CC-Link读取到的Bit标志位
+		// 浠ヤ笅涓轰粠CC-Link璇诲彇鍒扮殑Bit鏍囧織浣�
 	protected:
 		ALIVE m_alive;
 		BOOL m_bCimState;			// ON/OFF

--
Gitblit v1.9.3