1.车间测试部分功能;
2.警告测试,修复未能显示警告到报表中的问题。
| | |
| | | |
| | | return result; |
| | | #else |
| | | for (AlarmDataMap::const_iterator it = m_mapCache.begin(); it != m_mapCache.end(); ++it) { |
| | | const AlarmData& alarm = it->second; |
| | | if (alarm.nId == alarmData.nId && |
| | | alarm.nDeviceId == alarmData.nDeviceId && |
| | | alarm.nUnitId == alarmData.nUnitId) { |
| | | |
| | | alarmEventId = it->first; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | // 构建插入查询并使用 RETURNING 获取插入后的 alarm_event_id |
| | | std::ostringstream query; |
| | | query << "INSERT INTO alarms (id, severity_level, device_id, unit_id, description, start_time, end_time) " |
| | |
| | | |
| | | int CEFEM::onStepEvent(CStep* pStep, int code) |
| | | { |
| | | int nRet = CEquipment::onStepEvent(pStep, code); |
| | | if (nRet > 0) return nRet; |
| | | |
| | | if (code == STEP_EVENT_READDATA) { |
| | | if (isCassetteTransferStateStep(pStep)) { |
| | | SERVO::CEqCassetteTransferStateStep* pEqCassetteStep = (SERVO::CEqCassetteTransferStateStep*)pStep; |
| | |
| | | CEquipment::CEquipment() : m_nID(0), m_strName(""), m_strDescription(""), m_station(0, 255) |
| | | { |
| | | m_listener = { nullptr, nullptr, nullptr, nullptr }; |
| | | m_alive = {FALSE, 0, FALSE}; |
| | | m_alive = { FALSE, 0, FALSE }; |
| | | m_bCimState = FALSE; |
| | | m_bUpstreamInline = FALSE; |
| | | m_bDownstreamInline = FALSE; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // CIM State |
| | | bFlag = isBitOn(pszData, size, ++index); |
| | | if (!equalBool(m_bCimState, bFlag)) { |
| | |
| | | // CIM Mode |
| | | CHECK_WRITE_STEP_SIGNAL(0x350, pszData, size); |
| | | |
| | | // EQ Mode |
| | | CHECK_WRITE_STEP_SIGNAL(0x355, pszData, size); |
| | | |
| | | // Port1 ~ Port4 |
| | | CHECK_READ_STEP_SIGNAL(0x3e0, pszData, size); |
| | |
| | | int state = pEqAlarmStep->getAlarmState(); |
| | | ASSERT(state == 0 || state == 1); |
| | | if (m_listener.onAlarm != nullptr) { |
| | | m_listener.onAlarm(this, state, |
| | | m_listener.onAlarm(this, state, |
| | | pEqAlarmStep->getAlarmId(), |
| | | pEqAlarmStep->getUnitId(), |
| | | pEqAlarmStep->getAlarmLevel()); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | |
| | | return CToolUnits::startsWith(pStep->getName(), "EQPort") |
| | | && pStep->getName().find("Cassette") != std::string::npos; |
| | | } |
| | | } |
| | | |
| | | int CEquipment::setEqMode(short mode) |
| | | { |
| | | SERVO::CEqModeChangeStep* pStep = (SERVO::CEqModeChangeStep*)getStepWithName(STEP_EQ_MODE_CHANGE); |
| | | if (pStep == nullptr) { |
| | | return -1; |
| | | } |
| | | |
| | | return pStep->setEqMode(mode); |
| | | } |
| | | |
| | | int CEquipment::setCimMode(BOOL bOn) |
| | | { |
| | | SERVO::CEqCimModeChangeStep* pStep = (SERVO::CEqCimModeChangeStep*)getStepWithName(STEP_CIM_MODE_CHANGE); |
| | | if (pStep == nullptr) { |
| | | return -1; |
| | | } |
| | | |
| | | if (bOn) |
| | | return pStep->cimOn(); |
| | | else |
| | | return pStep->cimOff(); |
| | | } |
| | | } |
| | |
| | | BOOL removeClass(CGlass* pGlass); |
| | | bool isAlarmStep(SERVO::CStep* pStep); |
| | | bool isCassetteTransferStateStep(SERVO::CStep* pStep); |
| | | |
| | | int setEqMode(short mode); |
| | | int setCimMode(BOOL bOn); |
| | | |
| | | // 以下为从CC-Link读取到的Bit标志位检测函数 |
| | | public: |
| | |
| | | |
| | | namespace SERVO { |
| | | CMaster* g_pMaster = NULL; |
| | | |
| | | unsigned __stdcall ReadBitsThreadFunction(LPVOID lpParam) |
| | | { |
| | | if (g_pMaster != NULL) { |
| | | return g_pMaster->ReadBitsProc(); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | void CALLBACK MasterTimerProc(HWND hWnd, UINT nMsg, UINT nTimerid, DWORD dwTime) |
| | | { |
| | | if (g_pMaster != NULL) { |
| | |
| | | { |
| | | m_listener = {nullptr, nullptr, nullptr}; |
| | | m_bDataModify = FALSE; |
| | | m_hEventReadBitsThreadExit[0] = ::CreateEvent(NULL, TRUE, FALSE, NULL); |
| | | m_hEventReadBitsThreadExit[1] = ::CreateEvent(NULL, TRUE, FALSE, NULL); |
| | | m_hReadBitsThreadHandle = nullptr; |
| | | m_nReadBitsThreadAddr = 0; |
| | | } |
| | | |
| | | CMaster::~CMaster() |
| | |
| | | delete item; |
| | | } |
| | | m_listEquipment.clear(); |
| | | |
| | | if (m_hEventReadBitsThreadExit[0] != nullptr) { |
| | | ::CloseHandle(m_hEventReadBitsThreadExit[0]); |
| | | m_hEventReadBitsThreadExit[0] = nullptr; |
| | | } |
| | | |
| | | if (m_hEventReadBitsThreadExit[1] != nullptr) { |
| | | ::CloseHandle(m_hEventReadBitsThreadExit[1]); |
| | | m_hEventReadBitsThreadExit[1] = nullptr; |
| | | } |
| | | } |
| | | |
| | | void CMaster::setListener(MasterListener listener) |
| | |
| | | SetTimer(NULL, 1, 250, (TIMERPROC)MasterTimerProc); |
| | | |
| | | |
| | | m_hReadBitsThreadHandle = (HANDLE)_beginthreadex(NULL, 0, SERVO::ReadBitsThreadFunction, this, |
| | | 0, &m_nReadBitsThreadAddr); |
| | | |
| | | |
| | | LOGI("<Master>初始化完成."); |
| | | return 0; |
| | | } |
| | | |
| | | int CMaster::term() |
| | | { |
| | | SetEvent(m_hEventReadBitsThreadExit[0]); |
| | | ::WaitForSingleObject(m_hEventReadBitsThreadExit[1], INFINITE); |
| | | |
| | | LOGI("<Master>正在结束程序."); |
| | | for (auto item : m_listEquipment) { |
| | | item->term(); |
| | |
| | | saveCache(); |
| | | |
| | | |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | unsigned CMaster::ReadBitsProc() |
| | | { |
| | | while (1) { |
| | | // 待退出信号或时间到 |
| | | int nRet = ::WaitForSingleObject(m_hEventReadBitsThreadExit[0], 1000); |
| | | if (nRet == WAIT_OBJECT_0) { |
| | | break; |
| | | } |
| | | |
| | | for (auto item : m_listEquipment) { |
| | | if (item->getID() == EQ_ID_Bonder1) { |
| | | const StationIdentifier& station = item->getStation(); |
| | | MemoryBlock& block = item->getReadBitBlock(); |
| | | |
| | | int nRet = m_cclink.ReadData2(station, (DeviceType)block.type, |
| | | block.start, block.size, block.buffer); |
| | | if (0 == nRet) { |
| | | item->onReceiveLBData(block.buffer, block.size); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | SetEvent(m_hEventReadBitsThreadExit[1]); |
| | | |
| | | |
| | | // _endthreadex(0); |
| | | TRACE("CMaster::ReadBitsProc 线程退出\n"); |
| | | return 0; |
| | | } |
| | | |
| | |
| | | pEquipment->setID(EQ_ID_Bonder1 + index); |
| | | pEquipment->setName(index == 0 ? "Bonder 1" : "Bonder 2"); |
| | | pEquipment->setDescription(index == 0 ? "Bonder 1." : "Bonder 2."); |
| | | pEquipment->setStation(1, index == 0 ? 3 : 4); |
| | | // pEquipment->setStation(1, index == 0 ? 3 : 4); |
| | | pEquipment->setStation(0, 255); |
| | | pEquipment->setReadBitBlock(index == 0 ? 0x4600 : 0x4c00, |
| | | index == 0 ? 0x4c00 : 0x5200); |
| | | addToEquipmentList(pEquipment); |
| | |
| | | // 按一定频率扫描LB数据 |
| | | static int i = 0; |
| | | i++; |
| | | /* |
| | | if (i % (4 * 1) == 0) { |
| | | |
| | | for (auto item : m_listEquipment) { |
| | | const StationIdentifier& station = item->getStation(); |
| | | MemoryBlock& block = item->getReadBitBlock(); |
| | | if (item->getID() == EQ_ID_Bonder1) { |
| | | const StationIdentifier& station = item->getStation(); |
| | | MemoryBlock& block = item->getReadBitBlock(); |
| | | |
| | | int nRet = m_cclink.ReadData2(station, (DeviceType)block.type, |
| | | block.start, block.size, block.buffer); |
| | | if (0 == nRet) { |
| | | item->onReceiveLBData(block.buffer, block.size); |
| | | int nRet = m_cclink.ReadData2(station, (DeviceType)block.type, |
| | | block.start, block.size, block.buffer); |
| | | if (0 == nRet) { |
| | | item->onReceiveLBData(block.buffer, block.size); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | */ |
| | | |
| | | |
| | | // 自动保存缓存 |
| | |
| | | void setListener(MasterListener listener); |
| | | int init(); |
| | | int term(); |
| | | unsigned ReadBitsProc(); |
| | | void onTimer(UINT nTimerid); |
| | | std::list<CEquipment*>& getEquipmentList(); |
| | | CEquipment* getEquipment(int id); |
| | |
| | | std::list<CEquipment*> m_listEquipment; |
| | | std::string m_strFilepath; |
| | | BOOL m_bDataModify; |
| | | |
| | | private: |
| | | HANDLE m_hEventReadBitsThreadExit[2]; |
| | | HANDLE m_hReadBitsThreadHandle; |
| | | unsigned m_nReadBitsThreadAddr; |
| | | }; |
| | | } |
| | | |
| | |
| | | UpdateDeviceStatus(INDICATE_ROBOT_ARM1, status); |
| | | UpdateDeviceStatus(INDICATE_ROBOT_ARM2, status); |
| | | } |
| | | else if(EQ_ID_Bonder1 == nID) { |
| | | DeviceStatus status = bAlive ? DeviceStatus::ONLINE : DeviceStatus::OFFLINE; |
| | | UpdateDeviceStatus(INDICATE_BONDER1, status); |
| | | } |
| | | else if (EQ_ID_Bonder2 == nID) { |
| | | DeviceStatus status = bAlive ? DeviceStatus::ONLINE : DeviceStatus::OFFLINE; |
| | | UpdateDeviceStatus(INDICATE_BONDER2, status); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | m_pGraph->AddIndicateBox(INDICATE_ROBOT_ARM2, 243, 294, 48, RGB(22, 22, 22), |
| | | RGB(255, 127, 39), EQ_BOX_OFFLINE); |
| | | m_pGraph->SetBoxText(INDICATE_ROBOT_ARM2, "6", "Robot"); |
| | | |
| | | |
| | | |
| | | |
| | | // Vacuum bake |
| | |
| | | if (1 == nIDEvent) { |
| | | KillTimer(1); |
| | | InitRxWindows(); |
| | | |
| | | // 更新状态 |
| | | { |
| | | SERVO::CEquipment* pEquipment = (SERVO::CEFEM*)theApp.m_model.m_master.getEquipment(EQ_ID_EFEM); |
| | | ASSERT(pEquipment); |
| | | DeviceStatus status = pEquipment->isAlive() ? DeviceStatus::ONLINE : DeviceStatus::OFFLINE; |
| | | UpdateDeviceStatus(INDICATE_ROBOT_ARM1, status); |
| | | UpdateDeviceStatus(INDICATE_ROBOT_ARM2, status); |
| | | } |
| | | |
| | | { |
| | | SERVO::CEquipment* pEquipment = theApp.m_model.m_master.getEquipment(EQ_ID_Bonder1); |
| | | ASSERT(pEquipment); |
| | | DeviceStatus status = pEquipment->isAlive() ? DeviceStatus::ONLINE : DeviceStatus::OFFLINE; |
| | | UpdateDeviceStatus(INDICATE_BONDER1, status); |
| | | } |
| | | |
| | | { |
| | | SERVO::CEquipment* pEquipment = theApp.m_model.m_master.getEquipment(EQ_ID_Bonder2); |
| | | ASSERT(pEquipment); |
| | | DeviceStatus status = pEquipment->isAlive() ? DeviceStatus::ONLINE : DeviceStatus::OFFLINE; |
| | | UpdateDeviceStatus(INDICATE_BONDER2, status); |
| | | } |
| | | } |
| | | |
| | | CDialogEx::OnTimer(nIDEvent); |
| | |
| | | } |
| | | else if (nCmd == ID_EQSGRAPHITEM_TEST3) { |
| | | SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData; |
| | | if (pEquipment->getID() == EQ_ID_Bonder1 |
| | | || pEquipment->getID() == EQ_ID_Bonder2) { |
| | | static int ii = 0; ii++; |
| | | pEquipment->setCimMode(ii % 2 == 0); |
| | | } |
| | | |
| | | /* |
| | | SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData; |
| | | if (pEquipment->getID() == EQ_ID_Bonder1 |
| | | || pEquipment->getID() == EQ_ID_Bonder2) { |
| | | static int ii = 0; ii++; |
| | | pEquipment->setEqMode((ii % 5) + 1); |
| | | } |
| | | */ |
| | | /* |
| | | SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData; |
| | | SERVO::CGlass* pGlass = pEquipment->getFrontGlass(); |
| | | if (pGlass != nullptr) { |
| | | std::string strDescription; |
| | |
| | | pPath = pPath->getNext(); |
| | | } |
| | | } |
| | | */ |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | // 内容 |
| | | m_logEdit.SetMaxLineCount(20); |
| | | m_logEdit.SetMaxLineCount(500); |
| | | m_logEdit.SetLimitText(-1); |
| | | |
| | | |