| | |
| | | #include "CArm.h" |
| | | #include "CGlassPool.h" |
| | | #include "Servo.h" |
| | | #include "GlassJson.h" |
| | | |
| | | |
| | | namespace SERVO { |
| | |
| | | for (int i = 0; i < SLOT_MAX; i++) { |
| | | m_slot[i].serialize(ar); |
| | | CGlass* pGlass = (CGlass *)m_slot[i].getContext(); |
| | | if (pGlass != nullptr) { |
| | | pGlass->serialize(ar); |
| | | if (pGlass != nullptr) { |
| | | const std::string pretty = GlassJson::ToPrettyString(*pGlass); |
| | | CString strPretty = CString(pretty.c_str()); |
| | | ar << strPretty; |
| | | |
| | | CGlass* pBuddy = pGlass->getBuddy(); |
| | | if (pBuddy != nullptr) { |
| | | pBuddy->serialize(ar); |
| | | const std::string prettyBuddy = GlassJson::ToPrettyString(*pBuddy); |
| | | CString strPrettyBuddy = CString(prettyBuddy.c_str()); |
| | | ar << strPrettyBuddy; |
| | | } |
| | | } |
| | | } |
| | |
| | | for (int i = 0; i < SLOT_MAX; i++) { |
| | | m_slot[i].serialize(ar); |
| | | if (m_slot[i].getTempContext() != nullptr) { |
| | | CGlass* pGlass = theApp.m_model.m_glassPool.allocaGlass(); |
| | | pGlass->serialize(ar); |
| | | m_slot[i].setContext(pGlass); |
| | | if (pGlass->getBuddy() != nullptr) { |
| | | CGlass* pBuddy = theApp.m_model.m_glassPool.allocaGlass(); |
| | | pBuddy->serialize(ar); |
| | | pGlass->forceSetBuddy(pBuddy); |
| | | CString strPretty; |
| | | std::string pretty; |
| | | ar >> strPretty; |
| | | pretty = (LPTSTR)(LPCTSTR)strPretty; |
| | | if (!pretty.empty()) { |
| | | CGlass* pGlass = theApp.m_model.m_glassPool.allocaGlass(); |
| | | GlassJson::FromString(pretty, *pGlass); |
| | | m_slot[i].setContext(pGlass); |
| | | |
| | | if (!pGlass->getBuddyId().empty()) { |
| | | CGlass* pBuddy = theApp.m_model.m_glassPool.allocaGlass(); |
| | | CString strPrettyBuddy; |
| | | std::string prettyBuddy; |
| | | ar >> strPrettyBuddy; |
| | | prettyBuddy = (LPTSTR)(LPCTSTR)strPrettyBuddy; |
| | | GlassJson::FromString(prettyBuddy, *pBuddy); |
| | | pGlass->forceSetBuddy(pBuddy); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | // 梳理各玻璃之间的绑定关系 |
| | | /* |
| | | Lock(); |
| | |
| | | return &m_slot[index]; |
| | | } |
| | | |
| | | CSlot* CEquipment::getSlotWithNo(int slotNo) |
| | | { |
| | | CSlot* pSlot = nullptr; |
| | | for (int i = 0; i < SLOT_MAX; i++) { |
| | | if (!m_slot[i].isEnable()) continue; |
| | | if (m_slot[i].getNo() != slotNo) continue; |
| | | pSlot = &m_slot[i]; |
| | | break; |
| | | } |
| | | |
| | | return pSlot; |
| | | } |
| | | |
| | | CGlass* CEquipment::getAnyGlass() |
| | | { |
| | | CSlot* pSlot = nullptr; |
| | |
| | | CGlass* pGlass = this->getGlassWithCassette(processData.getCassetteSequenceNo(), |
| | | processData.getJobSequenceNo()); |
| | | if (pGlass == nullptr) { |
| | | LOGE("<CEquipment-%s>找不到对应Glass, 关联工艺参数失败。", this->getName().c_str(), |
| | | LOGE("<CEquipment-%s>找不到对应Glass, 关联工艺参数失败。CassetteSequenceNo:%d/%d", |
| | | this->getName().c_str(), |
| | | processData.getCassetteSequenceNo(), |
| | | processData.getJobSequenceNo()); |
| | | return -1; |
| | | } |
| | | |
| | | auto rawData = processData.getParamsRawData(); |
| | | std::vector<CParam> params; |
| | | this->parsingParams((const char*)rawData.data(), rawData.size(), params); |
| | | std::vector<CParam> tempParams; |
| | | this->parsingProcessData((const char*)rawData.data(), rawData.size(), tempParams); |
| | | int n = processData.getTotalParameter(); |
| | | std::vector<CParam> params(tempParams.begin(), tempParams.begin() + min(n, (int)tempParams.size())); |
| | | pGlass->addParams(params); |
| | | |
| | | // 关联的Glass也要更新 |
| | | CGlass* pBuddy = pGlass->getBuddy(); |
| | | LOGI("<Equipment-%s>decodeProcessDataReport pBuddy=%x %s", getName().c_str(), pBuddy, pGlass->getID().c_str()); |
| | | if (pBuddy != nullptr) { |
| | | LOGI("<Equipment-%s>decodeProcessDataReport addParams pBuddy=%x %s", getName().c_str(), pBuddy, pGlass->getID().c_str()); |
| | | pBuddy->addParams(params); |
| | | } |
| | | |
| | |
| | | getName().c_str(), cassetteNo, jobSequenceNo); |
| | | return -1; |
| | | } |
| | | pGlass->setInspResult(m_nID, 0, judgeStringToInspResult(strPanelJudgeData)); |
| | | auto result = judgeStringToInspResult(strPanelJudgeData); |
| | | pGlass->setInspResult(m_nID, 0, result); |
| | | |
| | | if (m_listener.onPanelDataReport != nullptr) { |
| | | m_listener.onPanelDataReport(this, pGlass); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | |
| | | return -1; |
| | | }); |
| | | pStep->setName(STEP_EQ_FAC_DATA_REPORT); |
| | | pStep->setProp("Port", (void*)port); |
| | | pStep->setProp("Port", (void*)(__int64)port); |
| | | pStep->setWriteSignalDev(writeSignalDev); |
| | | if (addStep(STEP_ID_FAC_DATA_REPORT, pStep) != 0) { |
| | | delete pStep; |