| | |
| | | |
| | | |
| | | // 解释数据,得到CProcessJob |
| | | // 容量前置检查:当前实现仅支持单批 PJ 集合,如果已有 PJ/CJ,直接返回 ACKA=false |
| | | if (m_pModel != nullptr && !m_pModel->getMaster().isProcessJobsEmpty()) { |
| | | IMessage* pMessage = NULL; |
| | | HSMS_Create1Message(pMessage, m_nSessionId, 16, 16, ++m_nSystemByte); |
| | | ASSERT(pMessage); |
| | | pMessage->getBody()->addItem(); // PRJOBID list 为空 |
| | | ISECS2Item* pItemErrors = pMessage->getBody()->addItem(); |
| | | pItemErrors->addBoolItem(false, "ACKA"); |
| | | ISECS2Item* pItemErrors2 = pItemErrors->addItem(); |
| | | auto err = pItemErrors2->addItem(); |
| | | err->addU4Item(1000, "ERRCODE"); |
| | | err->addItem("PJobSpace=0 (existing ProcessJob/ControlJob)", "ERRTEXT"); |
| | | m_pPassive->sendMessage(pMessage); |
| | | LOGI("<HSMS>[SEND]sessionId:%d, sType:%d systemBytes:%d", |
| | | pMessage->getHeader()->sessionId, pMessage->getHeader()->sType, pMessage->getHeader()->systemBytes); |
| | | LogSecsMessageBrief("<HSMS>[SEND]", pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | return 0; |
| | | } |
| | | |
| | | ISECS2Item* pItemPjs, * pItemPj,* pItemCarriers, * pItemCarrier, *pItemSlots, *pItemRecipes; |
| | | unsigned short DATAID; |
| | | const char* pszPrjobid, *pszMF, *pszCarrierId, *pszRecipeName; |
| | |
| | | } |
| | | |
| | | |
| | | // 回复报文 |
| | | ASSERT(m_listener.onPRJobMultiCreate != nullptr); |
| | | int nRet = m_listener.onPRJobMultiCreate(this, pjs); |
| | | |
| | | |
| | | // 回复报文(在校验/落库后再回复,以便带上真实的 issues) |
| | | IMessage* pMessage = NULL; |
| | | HSMS_Create1Message(pMessage, m_nSessionId, 16, 16, ++m_nSystemByte); |
| | | ASSERT(pMessage); |
| | |
| | | } |
| | | } |
| | | } |
| | | else { |
| | | pItemErrors->addBoolItem(true, "ACKA"); |
| | | pItemErrors->addItem(); // 空列表 |
| | | } |
| | | m_pPassive->sendMessage(pMessage); |
| | | LOGI("<HSMS>[SEND]sessionId:%d, sType:%d systemBytes:%d", |
| | | pMessage->getHeader()->sessionId, pMessage->getHeader()->sType, pMessage->getHeader()->systemBytes); |
| | | LogSecsMessageBrief("<HSMS>[SEND]", pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | |
| | | ASSERT(m_listener.onPRJobMultiCreate != nullptr); |
| | | int nRet = m_listener.onPRJobMultiCreate(this, pjs); |
| | | |
| | | |
| | | // 释放有问题(未添加到master)的内存 |
| | |
| | | // 真正的“开始”由 ProceedWithSlotMap 决策触发。 |
| | | // 仅当未开启 CompareMapsBeforeProceeding 时,才沿用旧逻辑直接 Start。 |
| | | LOGI("<CModel>ProceedWithCarrier"); |
| | | if (m_master.getControlJob() == nullptr || m_master.isProcessJobsEmpty()) { |
| | | strErrorTxt = "rejected - ControlJob/ProcessJob not ready"; |
| | | LOGW("<CModel>ProceedWithCarrier rejected: no CJ/PJ, port=%d", portIndex + 1); |
| | | return CAACK_5; |
| | | } |
| | | if (pLoadPort == nullptr || !pLoadPort->isCompareMapsBeforeProceeding()) { |
| | | m_master.proceedWithCarrier(portIndex); |
| | | } |
| | |
| | | { |
| | | int selPort = (0 <= m_nCurSelPort && m_nCurSelPort <= 3) ? m_nCurSelPort |
| | | : m_comboPort.GetCurSel(); |
| | | if (selPort < 0 || selPort >= 4) return; |
| | | m_pPort[selPort]->sendCassetteCtrlCmd(CCC_PROCESS_START, nullptr, 0, 0, 0, nullptr, nullptr); |
| | | if (selPort < 0 || selPort >= 4) { |
| | | LOGE("ProcessStart invalid port index: %d", selPort); |
| | | return; |
| | | } |
| | | |
| | | SERVO::CLoadPort* pPort = m_pPort[selPort]; |
| | | if (pPort == nullptr) { |
| | | LOGE("ProcessStart port pointer is null, index: %d", selPort); |
| | | return; |
| | | } |
| | | |
| | | constexpr short cmd = CCC_PROCESS_START; |
| | | LOGI("ProcessStart request: port=%d, cmd=%d", selPort + 1, cmd); |
| | | int ret = pPort->sendCassetteCtrlCmd(cmd, nullptr, 0, 0, 0, nullptr, |
| | | [selPort](int code) -> int { |
| | | if (code == WOK) { |
| | | LOGI("ProcessStart write complete: port=%d, code=WOK", selPort + 1); |
| | | } |
| | | else { |
| | | LOGE("ProcessStart write failed: port=%d, code=%d", selPort + 1, code); |
| | | } |
| | | return 0; |
| | | }); |
| | | if (ret != 0) { |
| | | LOGE("ProcessStart sendCassetteCtrlCmd immediate failure: port=%d, ret=%d", selPort + 1, ret); |
| | | } |
| | | else { |
| | | LOGI("ProcessStart sendCassetteCtrlCmd dispatched: port=%d", selPort + 1); |
| | | } |
| | | } |
| | | |
| | | void CPortConfigurationDlg::OnBnClickedButtonProcessCancel() |
| | | { |
| | | int selPort = (0 <= m_nCurSelPort && m_nCurSelPort <= 3) ? m_nCurSelPort |
| | | : m_comboPort.GetCurSel(); |
| | | if (selPort < 0 || selPort >= 4) return; |
| | | m_pPort[selPort]->sendCassetteCtrlCmd(CCC_PROCESS_CANCEL, nullptr, 0, 0, 0, nullptr, nullptr); |
| | | if (selPort < 0 || selPort >= 4) { |
| | | LOGE("ProcessCancel invalid port index: %d", selPort); |
| | | return; |
| | | } |
| | | |
| | | SERVO::CLoadPort* pPort = m_pPort[selPort]; |
| | | if (pPort == nullptr) { |
| | | LOGE("ProcessCancel port pointer is null, index: %d", selPort); |
| | | return; |
| | | } |
| | | |
| | | constexpr short cmd = CCC_PROCESS_CANCEL; |
| | | LOGI("ProcessCancel request: port=%d, cmd=%d", selPort + 1, cmd); |
| | | int ret = pPort->sendCassetteCtrlCmd(cmd, nullptr, 0, 0, 0, nullptr, |
| | | [selPort](int code) -> int { |
| | | if (code == WOK) { |
| | | LOGI("ProcessCancel write complete: port=%d, code=WOK", selPort + 1); |
| | | } |
| | | else { |
| | | LOGE("ProcessCancel write failed: port=%d, code=%d", selPort + 1, code); |
| | | } |
| | | return 0; |
| | | }); |
| | | if (ret != 0) { |
| | | LOGE("ProcessCancel sendCassetteCtrlCmd immediate failure: port=%d, ret=%d", selPort + 1, ret); |
| | | } |
| | | else { |
| | | LOGI("ProcessCancel sendCassetteCtrlCmd dispatched: port=%d", selPort + 1); |
| | | } |
| | | } |