LAPTOP-SNT8I5JK\Boounion
2025-05-27 e42e8364112e97d89eeaecd13f043dff42179949
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#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"));
    }
 
    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;
    }
}