#include "stdafx.h"
|
#include "CFliper.h"
|
|
namespace SERVO {
|
CFliper::CFliper() : CEquipment()
|
{
|
|
}
|
|
CFliper::~CFliper()
|
{
|
|
}
|
|
const char* CFliper::getClassName()
|
{
|
static char* pszName = "CFliper";
|
return pszName;
|
}
|
|
void CFliper::init()
|
{
|
CEquipment::init();
|
}
|
|
void CFliper::term()
|
{
|
CEquipment::term();
|
}
|
|
// ±ØÐëҪʵÏÖµÄÐ麯Êý£¬Ôڴ˳õʼ»¯PinÁбí
|
void CFliper::initPins()
|
{
|
// ¼ÓÈëPin³õʼ»¯´úÂë
|
LOGI("<CFliper>initPins");
|
addPin(SERVO::PinType::INPUT, _T("In1"));
|
addPin(SERVO::PinType::INPUT, _T("In2"));
|
addPin(SERVO::PinType::OUTPUT, _T("Out"));
|
}
|
|
// ±ØÐëҪʵÏÖµÄÐ麯Êý£¬Ôڴ˳õʼ»¯SlotÐÅÏ¢
|
void CFliper::initSlots()
|
{
|
m_slot[0].enable();
|
m_slot[0].setPosition(m_nID);
|
m_slot[0].setNo(1);
|
m_slot[0].setName("Slot 1(G2)");
|
m_slot[0].setType(MaterialsType::G2);
|
}
|
|
void CFliper::onTimer(UINT nTimerid)
|
{
|
CEquipment::onTimer(nTimerid);
|
}
|
|
void CFliper::serialize(CArchive& ar)
|
{
|
CEquipment::serialize(ar);
|
}
|
|
void CFliper::getAttributeVector(CAttributeVector& attrubutes)
|
{
|
__super::getAttributeVector(attrubutes);
|
}
|
|
int CFliper::recvIntent(CPin* pPin, CIntent* pIntent)
|
{
|
return __super::recvIntent(pPin, pIntent);
|
}
|
|
BOOL CFliper::glassWillArrive(CGlass* pGlass)
|
{
|
BOOL bRet = __super::glassWillArrive(pGlass);
|
if (!bRet) {
|
return FALSE;
|
}
|
|
return m_glassList.empty();
|
}
|
|
BOOL CFliper::onPreStoredJob(int port, CJobDataB* pJobDataB)
|
{
|
CJobDataS* pJobDataS = getJobDataS(pJobDataB->getCassetteSequenceNo(), pJobDataB->getJobSequenceNo());
|
if (pJobDataS == nullptr) {
|
LOGE("<CFliper-%s>onPreFetchedOutJob,ÕÒ²»µ½¶ÔÓ¦µÄJobDataS(CassetteSequenceNo:%d, JobSequenceNo:%d), ×¢ÒâÅŲé·çÏÕ!", m_strName.c_str(),
|
pJobDataB->getCassetteSequenceNo(), pJobDataB->getJobSequenceNo());
|
return FALSE;
|
}
|
|
// µ±Ç°²»ÄÜÓÐÈκβ£Á§£¬ÇÒµ±Ç°×¼±¸½øµÄƬÊÇG2
|
Lock();
|
if (!m_glassList.empty()) {
|
Unlock();
|
LOGE("<CFliper-%s>onPreFetchedOutJob,µ±Ç°»úÆ÷»òµ¥Ôª´æÔÚ²£Á§Æ¬£¬²»ÄܽøÁÏ£¬Çë×¢Òâ·çÏÕ£¡", m_strName.c_str());
|
return FALSE;
|
}
|
|
if (pJobDataS->getMaterialsType() != (int)MaterialsType::G2) {
|
LOGE("<CFliper-%s>onPreFetchedOutJob,µ±Ç°»úÆ÷»òµ¥ÔªÖ»ÄܽøG2²£Á§Æ¬£¬Çë×¢Òâ·çÏÕ£¡", m_strName.c_str());
|
return FALSE;
|
}
|
|
return TRUE;
|
}
|
}
|