| | |
| | | readCache(); |
| | | loadState(); |
| | | if (m_listener.onControlJobChanged) { |
| | | m_listener.onControlJobChanged(this); |
| | | notifyControlJobChanged(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | this->saveState(); |
| | | if (m_listener.onControlJobChanged) { |
| | | m_listener.onControlJobChanged(this); |
| | | notifyControlJobChanged(); |
| | | } |
| | | |
| | | return (int)m_processJobs.size(); |
| | |
| | | m_pControlJob->setPJs(temps); |
| | | this->saveState(); |
| | | if (m_listener.onControlJobChanged) { |
| | | m_listener.onControlJobChanged(this); |
| | | notifyControlJobChanged(); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | if (pausedAny && m_listener.onControlJobChanged) { |
| | | // 通知应用层刷新 UI/按钮状态 |
| | | m_listener.onControlJobChanged(this); |
| | | notifyControlJobChanged(); |
| | | } |
| | | if (pausedAny && !m_bPauseAlarmRaised) { |
| | | std::string desc = CToolUnits::formatString("<PauseEvent CEID=%u>", ceid); |
| | |
| | | |
| | | saveState(); |
| | | if (m_listener.onControlJobChanged) { |
| | | m_listener.onControlJobChanged(this); |
| | | notifyControlJobChanged(); |
| | | } |
| | | |
| | | return true; |
| | |
| | | |
| | | saveState(); |
| | | if (m_listener.onControlJobChanged) { |
| | | m_listener.onControlJobChanged(this); |
| | | notifyControlJobChanged(); |
| | | } |
| | | |
| | | return true; |
| | |
| | | private: |
| | | Collector* m_pCollector = nullptr; |
| | | void CreateDAQBridgeServer(); |
| | | inline void notifyControlJobChanged() { |
| | | if (m_listener.onControlJobChanged) { |
| | | m_listener.onControlJobChanged(this); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | |
| | | for (auto p : pjs) { |
| | | LOGI("<Model>onPRJobMultiCreate %s %s", p->id().c_str(), p->recipeSpec().c_str()); |
| | | } |
| | | |
| | | auto rejectAll = [&](uint32_t code, const std::string& msg) -> int { |
| | | LOGW("<Model>onPRJobMultiCreate rejected: %s", msg.c_str()); |
| | | for (auto p : pjs) { |
| | | if (p != nullptr) p->addIssue(code, msg); |
| | | } |
| | | return -1; |
| | | }; |
| | | |
| | | // 单 PJ 模式:只接受 1 条且当前无在制 PJ |
| | | if (pjs.size() != 1) { |
| | | return rejectAll(1200, "Only 1 ProcessJob supported (single-PJ mode)"); |
| | | } |
| | | if (!m_master.isProcessJobsEmpty()) { |
| | | return rejectAll(1201, "ProcessJob exists, cannot create new in single-PJ mode"); |
| | | } |
| | | |
| | | int nRet = m_master.setProcessJobs(pjs); |
| | | auto processJobs = m_master.getProcessJobs(); |
| | | std::vector<SERVO::CVariable> vars; |
| | |
| | | return m_issues; |
| | | } |
| | | |
| | | void CProcessJob::addIssue(uint32_t code, const std::string& msg) |
| | | { |
| | | m_issues.push_back({ code, msg }); |
| | | } |
| | | |
| | | bool CProcessJob::validate(const IResourceView& rv) |
| | | { |
| | | m_issues.clear(); |
| | |
| | | auto add = [&](uint32_t code, std::string msg) { |
| | | m_issues.push_back({ code, std::move(msg) }); |
| | | }; |
| | | |
| | | if (!rv.isProcessJobsEmpty()) { |
| | | add(1000, "ProcessJobs Conflict!"); |
| | | } |
| | | |
| | | // —— 基本 / 标识 —— |
| | | if (m_pjId.empty()) add(1001, "PJID empty"); |
| | |
| | | // 返回问题清单(空=通过) |
| | | bool validate(const IResourceView& rv); |
| | | const std::vector<ValidationIssue>& issues() const; |
| | | void addIssue(uint32_t code, const std::string& msg); |
| | | |
| | | // —— 状态机(带守卫)—— |
| | | bool queue(); // NoState -> Queued |