LAPTOP-SNT8I5JK\Boounion
2025-03-21 ef6c229b7dd70ef82a068ae198f23bc9a44dfad2
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include "stdafx.h"
#include "CLoadPort.h"
 
 
namespace SERVO {
    CLoadPort::CLoadPort() : CEquipment()
    {
 
    }
 
    CLoadPort::~CLoadPort()
    {
 
    }
 
    const char* CLoadPort::getClassName()
    {
        static char* pszName = "CLoadPort";
        return pszName;
    }
 
    void CLoadPort::init()
    {
        CEquipment::init();
    }
 
    void CLoadPort::term()
    {
        CEquipment::term();
    }
 
    // ±ØÐëҪʵÏÖµÄÐ麯Êý£¬Ôڴ˳õʼ»¯PinÁбí
    void CLoadPort::initPins()
    {
        // ¼ÓÈëPin³õʼ»¯´úÂë
        LOGI("<CLoadPort>initPins");
        addPin(SERVO::PinType::INPUT, _T("In"));
        addPin(SERVO::PinType::OUTPUT, _T("Out1"));
        addPin(SERVO::PinType::OUTPUT, _T("Out2"));
    }
 
    void CLoadPort::onTimer(UINT nTimerid)
    {
        CEquipment::onTimer(nTimerid);
    }
 
    void CLoadPort::serialize(CArchive& ar)
    {
        CEquipment::serialize(ar);
    }
 
    void CLoadPort::getAttributeVector(CAttributeVector& attrubutes)
    {
        __super::getAttributeVector(attrubutes);
 
        for (auto item : m_inputPins) {
            attrubutes.addAttribute(new CAttribute(item->getName().c_str(),
                std::to_string((int)item->getType()).c_str(), ""));
        }
 
        for (auto item : m_outputPins) {
            attrubutes.addAttribute(new CAttribute(item->getName().c_str(),
                std::to_string((int)item->getType()).c_str(), ""));
        }
 
        for (auto item : m_panelList) {
            attrubutes.addAttribute(new CAttribute("Panel",
                item->getID().c_str(), ""));
        }
    }
 
    void CLoadPort::outputPanel()
    {
        CPin* pOutPin = getPin("Out");
 
 
        // Èç¹ûÁбíÖÐûÓÐPanel,Ä£ÄâÉú³É10ÕÅ
        if (m_panelList.empty()) {
            static int ii = 0;
            char szBuffer[64];
            LOGI("<CLoadPort>Ä£ÄâÉú³É10ÕÅPANEL");
            for (int i = 0; i < 10; i++) {
                sprintf_s(szBuffer, "P20250320A1A%d", ++ii);
                CPanel* pPanel = new CPanel();
                pPanel->setID(szBuffer);
                addPanelToList(pPanel);
            }
        }
 
 
        // Ä£ÄâÈ¡³öµÚÒ»ÕÅPanel,´«Ë͵½ÏÂÒ»»·½Ú
        Lock();
        CPanel* pContext = m_panelList.front();
        pContext->addRef();
 
        CIntent intent(FLOW_MOVE_MATERIAL, "", pContext);
        int nRet = pOutPin->sendIntent(&intent);
        if (nRet == FLOW_REJECT) {
            AfxMessageBox("¶Ô·½¾Ü¾ø½ÓÊÜ");
        }
        else if (nRet == FLOW_ACCEPT) {
            m_panelList.pop_front();
            pContext->release();        // Ìí¼Óµ½ÁжÓʱaddRef, È¡³öʱrelease
        }
 
        pContext->release();
        Unlock();
    }
}