From 405bd36e812c3645e8d9d84700777e2eaeb036ec Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 30 五月 2025 16:18:17 +0800
Subject: [PATCH] Merge branch 'clh'
---
SourceCode/Bond/Servo/CEquipment.h | 116 ++++++++++++++++-----------------------------------------
1 files changed, 33 insertions(+), 83 deletions(-)
diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index 6357114..df7e015 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"
@@ -33,18 +34,18 @@
#include "CJobDataS.h"
#include "CProcessData.h"
#include "CPortStatusReport.h"
+#include "CSlot.h"
namespace SERVO {
-#define BLOCK_BUFFER_MAX 1024
-#define ALIVE_TIMEOUT 15
-#define VCR_MAX 1
-#define ARM_ALL 99
+#define SLOT_MAX 12
typedef std::function<void(void* pEiuipment, BOOL bAlive)> ONALIVE;
typedef std::function<void(void* pEiuipment, int code)> ONDATACHANGED;
typedef std::function<void(void* pEiuipment, int state, int alarmId, int unitId, int level)> ONALARM;
typedef std::function<void(void* pEiuipment, void* pReport)> ONVCREVENTREPORT;
+ typedef std::function<BOOL(void* pEiuipment, CJobDataB* pJobDataB)> ONPREFETCHEDOUTJOB;
+ typedef std::function<BOOL(void* pEiuipment, CJobDataB* pJobDataB, short& putSlot)> ONPRESTOREDJOB;
typedef struct _EquipmentListener
{
ONALIVE onAlive;
@@ -52,80 +53,16 @@
ONALARM onAlarm;
ONDATACHANGED onDataChanged;
ONVCREVENTREPORT onVcrEventReport;
+ ONPREFETCHEDOUTJOB onPreFethedOutJob;
+ ONPRESTOREDJOB onPreStoredJob;
} 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;
@@ -158,6 +95,7 @@
virtual void term();
virtual void initPins() = 0;
virtual void initSteps();
+ virtual void initSlots() = 0;
virtual void onTimer(UINT nTimerid);
virtual void serialize(CArchive& ar);
virtual void onReceiveLBData(const char* pszData, size_t size);
@@ -167,23 +105,16 @@
std::vector<CPin*>& CEquipment::getInputPins();
std::vector<CPin*>& CEquipment::getOutputPins();
virtual int recvIntent(CPin* pPin, CIntent* pIntent);
- virtual BOOL glassWillArrive(CGlass* pGlass);
- virtual int outputGlass(int port);
- virtual int glassArrived(CGlass* pGlass);
virtual int fetchedOutJob(CJobDataB* pJobDataB);
- virtual int storedJob(CJobDataB* pJobDataB);
+ virtual int storedJob(CJobDataB* pJobDataB, short& putSlot);
virtual int onReceivedJob(int port, CJobDataS* pJobDataS);
virtual int onSentOutJob(int port, CJobDataS* pJobDataS);
virtual BOOL onPreFetchedOutJob(int port, CJobDataB* pJobDataB);
virtual int onFetchedOutJob(int port, CJobDataB* pJobDataB);
- virtual BOOL onPreStoredJob(int port, CJobDataB* pJobDataB);
+ virtual BOOL onPreStoredJob(int port, CJobDataB* pJobDataB, short& putSlot);
virtual int onStoredJob(int port, CJobDataB* pJobDataB);
virtual int onProcessData(CProcessData* pProcessData);
virtual int getIndexerOperationModeBaseValue();
- void getGlassList(std::list<CGlass*>& list);
- CGlass* getGlassFromList(const char* pszId);
- CGlass* getFrontGlass();
- BOOL removeClass(CGlass* pGlass);
bool isAlarmStep(SERVO::CStep* pStep);
bool isVcrEventStep(SERVO::CStep* pStep);
bool isCassetteTransferStateStep(SERVO::CStep* pStep);
@@ -214,8 +145,27 @@
// unitNo: 0:local; Others:unit No
int recipeParameterRequest(short masterRecipeId, short localRecipeId, short unitNo);
- public:
- BOOL isGlassListEmpty();
+ // 获取一个可用的槽位
+ CSlot* getAvailableSlot();
+
+ // 获取一个指定物料类型(G1,G2,G1&G2)的空槽位
+ CSlot* getAvailableSlotForGlass(MaterialsType type);
+
+ // 获取一个指定物料类型(G1,G2,G1&G2)的非空槽位
+ CSlot* getNonEmptySlot(MaterialsType type);
+
+ // 获取玻璃物料
+ CGlass* getGlassFromSlot(int slotNo);
+ CGlass* getAnyGlass();
+
+ // 验证玻璃和槽是否匹配
+ BOOL ValidateGlassSlotMatch();
+
+ // 是否有玻璃
+ BOOL hasGlass();
+
+ // 指定槽位是否可以放置玻璃
+ BOOL canPlaceGlassInSlot(const short slotIndex);
// 以下为从CC-Link读取到的Bit标志位检测函数
@@ -233,7 +183,6 @@
inline void Unlock() { LeaveCriticalSection(&m_criticalSection); }
BOOL isBitOn(const char* pszData, size_t size, int index);
inline BOOL equalBool(BOOL b1, BOOL b2);
- void addGlassToList(CGlass* pGlass);
short decodeRecipeListReport(const char* pszData, size_t size);
short decodeRecipeParameterReport(const char* pszData, size_t size);
int decodeProcessDataReport(CStep* pStep, const char* pszData, size_t size);
@@ -248,6 +197,7 @@
int addJobDataS(CJobDataS* pJobDataS);
int removeJobDataS(int nCassetteSequenceNo, int nJobSequenceNo);
CJobDataS* getJobDataS(int nCassetteSequenceNo, int nJobSequenceNo);
+ BOOL compareJobDataB(CJobDataB* pJobDataB1, CJobDataB* pJobDataB2);
protected:
EquipmentListener m_listener;
@@ -260,7 +210,6 @@
MemoryBlock m_blockWriteBit;
std::vector<CPin*> m_inputPins;
std::vector<CPin*> m_outputPins;
- std::list<CGlass*> m_glassList;
// 以下为从CC-Link读取到的Bit标志位
@@ -278,6 +227,7 @@
std::map<unsigned int, CStep*> m_mapStep;
int m_nBaseAlarmId;
CRecipesManager m_recipesManager;
+ CSlot m_slot[SLOT_MAX];
private:
CEquipment* m_pArm;
--
Gitblit v1.9.3