1.结批处理;
2.Process Job修复未绑定context的问题;
| | |
| | | pItem->MoveWindow(rcClient.right - 12 - rcItem.Width(), |
| | | y - rcItem.Height(), |
| | | rcItem.Width(), rcItem.Height()); |
| | | |
| | | |
| | | // 结批按钮 |
| | | pItem = GetDlgItem(IDC_BUTTON_COMPLETION_BATH); |
| | | pItem->GetClientRect(&rcItem); |
| | | pItem->MoveWindow(12, y - rcItem.Height(), |
| | | rcItem.Width(), rcItem.Height()); |
| | | y -= rcItem.Height(); |
| | | y -= 12; |
| | | |
| | | |
| | | // 线 |
| | | pItem = GetDlgItem(IDC_LINE1); |
| | |
| | | csi.carrierId = pPort->getCassetteId(); |
| | | for (int i = 0; i < 8; i++) { |
| | | if (item.checkSlot[i]) { |
| | | csi.slots.push_back(i); |
| | | SERVO::CGlass* pGlass = pPort->getGlassFromSlot(i+1); |
| | | if (pGlass != nullptr) { |
| | | csi.slots.push_back(i + 1); |
| | | } |
| | | } |
| | | } |
| | | carriers.push_back(csi); |
| | |
| | | temp.push_back(p); |
| | | } |
| | | } |
| | | |
| | | m_processJobs = temp; |
| | | |
| | | |
| | | // 更新context |
| | | std::vector<uint8_t> newSlots; |
| | | std::vector<void*> newContexts; |
| | | for (auto pj : m_processJobs) { |
| | | for (auto& c : pj->carriers()) { |
| | | auto pPort = getPortWithCarrierId(c.carrierId); |
| | | if (pPort == nullptr) continue; |
| | | |
| | | for (auto s : c.slots) { |
| | | auto pGlass = pPort->getGlassFromSlot(s); |
| | | if (pGlass == nullptr) continue; |
| | | |
| | | newSlots.push_back(s); |
| | | newContexts.push_back(pGlass); |
| | | } |
| | | |
| | | pj->setCarrierSlotsAndContexts(c.carrierId, newSlots, newContexts); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | this->saveState(); |
| | | |
| | | return (int)m_processJobs.size(); |
| | |
| | | } |
| | | } |
| | | |
| | | bool CProcessJob::setCarrierSlotsAndContexts(std::string carrierId, std::vector<uint8_t> slots, std::vector<void*> contexts) |
| | | { |
| | | for (auto& c : m_carriers) { |
| | | if (c.carrierId.compare(carrierId) == 0) { |
| | | c.slots = std::move(slots); |
| | | c.contexts = std::move(contexts); |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | // --------- 核心:serialize/deserialize --------- |
| | | void CProcessJob::serialize(std::ostream& os) const { |
| | | // ͷ |
| | |
| | | // 追加一个载具 |
| | | void addCarrier(std::string carrierId, std::vector<uint8_t> slots); |
| | | |
| | | // 设置载具slots和contexts |
| | | bool setCarrierSlotsAndContexts(std::string carrierId, std::vector<uint8_t> slots, std::vector<void*> contexts); |
| | | |
| | | // 访问器 |
| | | const std::vector<CarrierSlotInfo>& carriers() const noexcept { return m_carriers; } |
| | | CarrierSlotInfo* getCarrier(const std::string& strId); |