| | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsDeletePPID(const std::vector<std::string>& ppids) |
| | | { |
| | | IMessage* pMessage = nullptr; |
| | | int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 7 | REPLY, 17, ++m_nSystemByte); |
| | | if (nRet != 0 || pMessage == nullptr) return -1; |
| | | ISECS2Item* pBody = pMessage->getBody(); |
| | | for (const auto& ppid : ppids) { |
| | | pBody->addItem(ppid.c_str(), "PPID"); |
| | | } |
| | | m_pActive->sendMessage(pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsCarrierActionRequest(unsigned int DATAID, |
| | | const char* pszCarrierAction, |
| | | const char* pszCarrierId, |
| | |
| | | |
| | | // 查询PPID List |
| | | int hsmsQueryPPIDList(); |
| | | int hsmsDeletePPID(const std::vector<std::string>& ppids); // S7F17 |
| | | |
| | | // S3F17 |
| | | // 卡匣动作请求 |
| | |
| | | ON_BN_CLICKED(IDC_BUTTON_TRANSMIT_SPOOLED_DATA, &CEAPSimulatorDlg::OnBnClickedButtonTransmitSpooledData) |
| | | ON_BN_CLICKED(IDC_BUTTON_PURGE_SPOOLED_DATA, &CEAPSimulatorDlg::OnBnClickedButtonPurgeSpooledData) |
| | | ON_BN_CLICKED(IDC_BUTTON_QUERY_PPID_LIST, &CEAPSimulatorDlg::OnBnClickedButtonQueryPpidList) |
| | | ON_BN_CLICKED(IDC_BUTTON_DELETE_PPID, &CEAPSimulatorDlg::OnBnClickedButtonDeletePpid) |
| | | ON_BN_CLICKED(IDC_BUTTON_PROCEED_WITH_CARRIER, &CEAPSimulatorDlg::OnBnClickedButtonProceedWithCarrier) |
| | | ON_BN_CLICKED(IDC_BUTTON_PROCEED_WITH_SLOTMAP, &CEAPSimulatorDlg::OnBnClickedButtonProceedWithSlotMap) |
| | | ON_BN_CLICKED(IDC_BUTTON_CARRIER_RELEASE, &CEAPSimulatorDlg::OnBnClickedButtonCarrierRelease) |
| | |
| | | GetDlgItem(IDC_BUTTON_TRANSMIT_SPOOLED_DATA)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_PURGE_SPOOLED_DATA)->EnableWindow(enabled); |
| | | GetDlgItem(IDC_BUTTON_QUERY_PPID_LIST)->EnableWindow(enabled); |
| | | if (GetDlgItem(IDC_BUTTON_DELETE_PPID) != nullptr) { |
| | | GetDlgItem(IDC_BUTTON_DELETE_PPID)->EnableWindow(enabled); |
| | | } |
| | | if (GetDlgItem(IDC_EDIT_DELETE_PPID) != nullptr) { |
| | | GetDlgItem(IDC_EDIT_DELETE_PPID)->EnableWindow(enabled); |
| | | } |
| | | GetDlgItem(IDC_BUTTON_PROCEED_WITH_CARRIER)->EnableWindow(enabled); |
| | | if (GetDlgItem(IDC_BUTTON_PROCEED_WITH_SLOTMAP) != nullptr) { |
| | | GetDlgItem(IDC_BUTTON_PROCEED_WITH_SLOTMAP)->EnableWindow(enabled); |
| | |
| | | theApp.m_model.m_pHsmsActive->hsmsQueryPPIDList(); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonDeletePpid() |
| | | { |
| | | CString strPPID; |
| | | GetDlgItemText(IDC_EDIT_DELETE_PPID, strPPID); |
| | | strPPID.Trim(); |
| | | std::vector<std::string> ppids; |
| | | if (!strPPID.IsEmpty()) { |
| | | CString upper = strPPID; |
| | | upper.MakeUpper(); |
| | | if (upper != _T("ALL")) { |
| | | int start = 0; |
| | | CString token = strPPID.Tokenize(_T(","), start); |
| | | while (!token.IsEmpty()) { |
| | | token.Trim(); |
| | | if (!token.IsEmpty()) { |
| | | ppids.push_back(std::string((LPTSTR)(LPCTSTR)token)); |
| | | } |
| | | token = strPPID.Tokenize(_T(","), start); |
| | | } |
| | | } |
| | | } |
| | | // L:0 if ppids empty -> delete all |
| | | theApp.m_model.m_pHsmsActive->hsmsDeletePPID(ppids); |
| | | } |
| | | |
| | | static int DATAID = 1; |
| | | void CEAPSimulatorDlg::OnBnClickedButtonProceedWithCarrier() |
| | | { |
| | |
| | | afx_msg void OnBnClickedButtonTransmitSpooledData(); |
| | | afx_msg void OnBnClickedButtonPurgeSpooledData(); |
| | | afx_msg void OnBnClickedButtonQueryPpidList(); |
| | | afx_msg void OnBnClickedButtonDeletePpid(); |
| | | afx_msg void OnBnClickedButtonProceedWithCarrier(); |
| | | afx_msg void OnBnClickedButtonProceedWithSlotMap(); |
| | | afx_msg void OnBnClickedButtonCarrierRelease(); |
| | |
| | | #define IDC_BUTTON_QUERY_PROCESS_STATE 1047 |
| | | #define IDC_BUTTON_QUERY_ALL_SVID 1048 |
| | | #define IDC_BUTTON_QUERY_ALL_CEID 1049 |
| | | #define IDC_EDIT_DELETE_PPID 1050 |
| | | #define IDC_BUTTON_DELETE_PPID 1051 |
| | | |
| | | // Next default values for new objects |
| | | // |
| | | #ifdef APSTUDIO_INVOKED |
| | | #ifndef APSTUDIO_READONLY_SYMBOLS |
| | | #define _APS_NEXT_RESOURCE_VALUE 143 |
| | | #define _APS_NEXT_RESOURCE_VALUE 144 |
| | | #define _APS_NEXT_COMMAND_VALUE 32771 |
| | | #define _APS_NEXT_CONTROL_VALUE 1050 |
| | | #define _APS_NEXT_CONTROL_VALUE 1052 |
| | | #define _APS_NEXT_SYMED_VALUE 101 |
| | | #endif |
| | | #endif |
| | |
| | | else if (nStream == 7 && pHeader->function == 19) { |
| | | replyQueryPPIDList(pMessage); |
| | | } |
| | | else if (nStream == 7 && pHeader->function == 17) { |
| | | replyDeletePPID(pMessage); |
| | | } |
| | | else if (nStream == 10 && pHeader->function == 3) { |
| | | replyTerminalDisplay(pMessage); |
| | | } |
| | |
| | | return 0; |
| | | } |
| | | |
| | | // S7F17 Delete Process Program (PPID list) / S7F18 |
| | | int CHsmsPassive::replyDeletePPID(IMessage* pRecv) |
| | | { |
| | | if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) { |
| | | return ER_NOTSELECT; |
| | | } |
| | | |
| | | bool allOk = true; |
| | | const bool deleteAll = (pRecv->getBody() == nullptr || pRecv->getBody()->getSubItemSize() == 0); |
| | | std::vector<std::string> ppids; |
| | | ISECS2Item* pBody = pRecv->getBody(); |
| | | const int nCount = pBody ? pBody->getSubItemSize() : 0; |
| | | for (int i = 0; i < nCount; ++i) { |
| | | const char* pszPPID = nullptr; |
| | | if (pBody->getSubItemString(i, pszPPID) && pszPPID != nullptr) { |
| | | ppids.emplace_back(pszPPID); |
| | | } |
| | | else { |
| | | allOk = false; |
| | | } |
| | | } |
| | | |
| | | if (deleteAll || !ppids.empty()) { |
| | | if (m_listener.onDeletePPID != nullptr) { |
| | | allOk = m_listener.onDeletePPID(this, ppids); |
| | | } |
| | | else { |
| | | // no handler provided; treat as failure |
| | | allOk = false; |
| | | LOGW("<HSMS>DeletePPID request ignored: no onDeletePPID listener"); |
| | | } |
| | | } |
| | | |
| | | |
| | | replyAck(7, 18, pRecv->getHeader()->systemBytes, allOk ? BYTE(0) : BYTE(1), "ACKC7"); |
| | | return 0; |
| | | } |
| | | |
| | | // S7F19 |
| | | int CHsmsPassive::replyQueryPPIDList(IMessage* pRecv) |
| | | { |
| | |
| | | #define ER_UNLINK_EVENT_REPORT -5 |
| | | #define ER_NO_PPID_LIST -6 |
| | | #define ER_NOT_SUPPORTED -7 |
| | | #define ER_CREATED_MESSAGE -8 |
| | | |
| | | |
| | | |
| | | /* CAACK */ |
| | |
| | | std::string& strErrorTxt)> CARRIERACTION; |
| | | typedef std::function<int(void* pFrom, std::vector<SERVO::CProcessJob*>& pjs)> PRJOBMULTICREATE; |
| | | typedef std::function<int(void* pFrom, SERVO::CControlJob& controlJob)> CONTROLJOBCREATE; |
| | | typedef std::function<bool(void* pFrom, const std::vector<std::string>& ppids)> DELETEPPID; |
| | | typedef struct _SECSListener |
| | | { |
| | | SECSEQOFFLINE onEQOffLine; |
| | |
| | | EDEVENTREPORT onEnableDisableEventReport; |
| | | EDALARMREPORT onEnableDisableAlarmReport; |
| | | QUERYPPIDLIST onQueryPPIDList; |
| | | DELETEPPID onDeletePPID; |
| | | CARRIERACTION onCarrierAction; |
| | | PRJOBMULTICREATE onPRJobMultiCreate; |
| | | CONTROLJOBCREATE onControlJobCreate; |
| | |
| | | int replyEanbleDisableAlarmReport(IMessage* pRecv); |
| | | int replyPurgeSpooledData(IMessage* pRecv); |
| | | int replyQueryPPIDList(IMessage* pRecv); |
| | | int replyDeletePPID(IMessage* pRecv); // S7F17/S7F18 |
| | | int replyTerminalDisplay(IMessage* pRecv); |
| | | int replyCreateObj(IMessage* pRecv); |
| | | int replyPRJobMultiCreate(IMessage* pRecv); |
| | |
| | | m_master.enableEventReport(bEnable); |
| | | } |
| | | }; |
| | | listener.onDeletePPID = [&](void* pFrom, const std::vector<std::string>& ppids) -> bool { |
| | | (void)pFrom; |
| | | bool allOk = true; |
| | | std::vector<std::string> targets = ppids; |
| | | if (targets.empty()) { |
| | | // L:0 => delete all PPIDs |
| | | targets = RecipeManager::getInstance().getAllPPID(); |
| | | } |
| | | for (auto& ppid : targets) { |
| | | bool ok = RecipeManager::getInstance().deleteRecipeByPPID(ppid); |
| | | allOk = allOk && ok; |
| | | LOGI("<CModel>DeletePPID: %s, result=%s", ppid.c_str(), ok ? "OK" : "FAIL"); |
| | | } |
| | | return allOk; |
| | | }; |
| | | listener.onEnableDisableAlarmReport = [&](void* pFrom, bool bEnable, unsigned int id) -> void { |
| | | LOGI("onEnableDisableAlarmReport bEnable:%s, id:%d", bEnable ? _T("YES") : _T("NO"), id); |
| | | if (id == 0) { |
| | |
| | | // 遍历数据并插入到CListCtrl中 |
| | | for (int i = 0; i < static_cast<int>(vecRecipe.size()); ++i) { |
| | | const RecipeInfo& recipe = vecRecipe[i]; |
| | | // 原程序要求PPID有子配方,先注释 |
| | | /* |
| | | if (recipe.vecDeviceList.empty() || recipe.vecDeviceList.size() > 6){ |
| | | continue; |
| | | } |
| | | */ |
| | | |
| | | m_listPPID.InsertItem(i, _T("")); // 第0列空白 |
| | | |