| | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsActive::hsmsProcessProgramRequest(const char* pszPPID) |
| | | { |
| | | if (pszPPID == nullptr || strlen(pszPPID) == 0) return -1; |
| | | IMessage* pMessage = nullptr; |
| | | if (HSMS_Create1Message(pMessage, m_nSessionId, 7 | REPLY, 5, ++m_nSystemByte) != 0 || pMessage == nullptr) { |
| | | return -1; |
| | | } |
| | | pMessage->getBody()->setString(pszPPID, "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 |
| | | int hsmsProcessProgramRequest(const char* pszPPID); // S7F5 |
| | | |
| | | // S3F17 |
| | | // 卡匣动作请求 |
| | |
| | | "\r\n" |
| | | "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)\r\n" |
| | | "LANGUAGE 4, 2\r\n" |
| | | "#include ""res\\EAPSimulator.rc2"" // 闈?Microsoft Visual C++ 缂栬緫鐨勮祫婧?\n" |
| | | "#include ""l.CHS\\afxres.rc"" // 鏍囧噯缁勪欢\r\n" |
| | | "#include ""res\\EAPSimulator.rc2"" // 闂?Microsoft Visual C++ 缂傛牞绶惃鍕カ濠?\n" |
| | | "#include ""l.CHS\\afxres.rc"" // 閺嶅洤鍣紒鍕\r\n" |
| | | "#if !defined(_AFXDLL)\r\n" |
| | | "#include ""l.CHS\\afxribbon.rc"" // MFC 鍔熻兘鍖哄拰鎺у埗鏉¤祫婧?\n" |
| | | "#include ""l.CHS\\afxribbon.rc"" // MFC 閸旂喕鍏橀崠鍝勬嫲閹貉冨煑閺壜ょカ濠?\n" |
| | | "#endif\r\n" |
| | | "#endif\r\n" |
| | | "\0" |
| | |
| | | PUSHBUTTON "S1F3_QueryPJSpace",IDC_BUTTON_QUERY_PJ_SPACE,350,82,108,14 |
| | | PUSHBUTTON "S16F15_Create PJ",IDC_BUTTON_CREATE_PJ,350,101,108,14 |
| | | PUSHBUTTON "S14F9_Create CJ",IDC_BUTTON_CREATE_CJ,14,120,108,14 |
| | | EDITTEXT IDC_EDIT_DELETE_PPID,283,152,79,14,ES_AUTOHSCROLL |
| | | EDITTEXT IDC_EDIT_PPID_REQ,284,170,78,14,ES_AUTOHSCROLL |
| | | PUSHBUTTON "S7F5_Request PP",IDC_BUTTON_PP_REQUEST,364,170,95,14 |
| | | EDITTEXT IDC_EDIT_DELETE_PPID,284,152,78,14,ES_AUTOHSCROLL |
| | | PUSHBUTTON "S7F17_Delete PPID",IDC_BUTTON_DELETE_PPID,364,152,95,14 |
| | | END |
| | | |
| | |
| | | ON_BN_CLICKED(IDC_BUTTON_QUERY_ALL_SVID, &CEAPSimulatorDlg::OnBnClickedButtonQueryAllSvid) |
| | | ON_BN_CLICKED(IDC_BUTTON_QUERY_ALL_CEID, &CEAPSimulatorDlg::OnBnClickedButtonQueryAllCeid) |
| | | ON_BN_CLICKED(IDC_BUTTON_QUERY_CURRENT_RECIPE, &CEAPSimulatorDlg::OnBnClickedButtonQueryCurrentRecipe) |
| | | ON_BN_CLICKED(IDC_BUTTON_PP_REQUEST, &CEAPSimulatorDlg::OnBnClickedButtonPpRequest) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | |
| | | ::SendMessage(hCombo, CB_SETCURSEL, 0, 0); |
| | | } |
| | | |
| | | CRect rcBtn(140, 168, 14 + 140 + 140, 168 + 14); |
| | | CRect rcBtn(140, 168, 14 + 140 + 118, 168 + 14); |
| | | MapDialogRect(&rcBtn); |
| | | HWND hBtn = ::CreateWindow(_T("BUTTON"), _T("S1F3_CurrentRecipe"), |
| | | WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, |
| | |
| | | |
| | | theApp.m_model.m_pHsmsActive->hsmsSelectedEquipmentStatusRequest(svid); |
| | | } |
| | | |
| | | void CEAPSimulatorDlg::OnBnClickedButtonPpRequest() |
| | | { |
| | | CString strPPID; |
| | | GetDlgItemText(IDC_EDIT_PPID_REQ, strPPID); |
| | | strPPID.Trim(); |
| | | std::string ppid = CT2A(strPPID); |
| | | if (ppid.empty()) { |
| | | AfxMessageBox(_T("请输入 PPID")); |
| | | return; |
| | | } |
| | | theApp.m_model.m_pHsmsActive->hsmsProcessProgramRequest(ppid.c_str()); |
| | | } |
| | |
| | | afx_msg void OnBnClickedButtonQueryAllSvid(); |
| | | afx_msg void OnBnClickedButtonQueryAllCeid(); |
| | | afx_msg void OnBnClickedButtonQueryCurrentRecipe(); |
| | | afx_msg void OnBnClickedButtonPpRequest(); |
| | | }; |
| | |
| | | #define IDC_BUTTON_DELETE_PPID 1051 |
| | | #define IDC_COMBO_EQ_FOR_RECIPE 1052 |
| | | #define IDC_BUTTON_QUERY_CURRENT_RECIPE 1053 |
| | | #define IDC_EDIT_PPID_REQ 1054 |
| | | #define IDC_BUTTON_PP_REQUEST 1055 |
| | | |
| | | // Next default values for new objects |
| | | // |
| | | #ifdef APSTUDIO_INVOKED |
| | | #ifndef APSTUDIO_READONLY_SYMBOLS |
| | | #define _APS_NEXT_RESOURCE_VALUE 145 |
| | | #define _APS_NEXT_RESOURCE_VALUE 146 |
| | | #define _APS_NEXT_COMMAND_VALUE 32771 |
| | | #define _APS_NEXT_CONTROL_VALUE 1054 |
| | | #define _APS_NEXT_CONTROL_VALUE 1056 |
| | | #define _APS_NEXT_SYMED_VALUE 101 |
| | | #endif |
| | | #endif |
| | |
| | | #include "Log.h" |
| | | #include "Model.h" |
| | | #include "Common.h" |
| | | #include "RecipeManager.h" |
| | | #include <time.h> |
| | | #include <iostream> |
| | | #include <time.h> |
| | |
| | | #include <algorithm> |
| | | #include <set> |
| | | #include <regex> |
| | | #include <sstream> |
| | | |
| | | // ControlState values (keep in sync with Model::ControlState / VariableList.txt) |
| | | static constexpr uint8_t kControlStateOnlineRemote = 5; |
| | |
| | | Lock(); |
| | | int maxId = 0; |
| | | for (auto v : m_variabels) { |
| | | if (v != nullptr && v->getVarialbleId() > maxId) { |
| | | maxId = v->getVarialbleId(); |
| | | if (v != nullptr && static_cast<int>(v->getVarialbleId()) > maxId) { |
| | | maxId = static_cast<int>(v->getVarialbleId()); |
| | | } |
| | | } |
| | | outId = maxId + 1; |
| | |
| | | else if (nStream == 7 && pHeader->function == 17) { |
| | | replyDeletePPID(pMessage); |
| | | } |
| | | else if (nStream == 7 && pHeader->function == 5) { |
| | | replyProcessProgramRequest(pMessage); |
| | | } |
| | | else if (nStream == 10 && pHeader->function == 3) { |
| | | replyTerminalDisplay(pMessage); |
| | | } |
| | |
| | | return -1; |
| | | } |
| | | |
| | | int nBufSize = file.GetLength(); |
| | | ULONGLONG len = file.GetLength(); |
| | | if (len > INT_MAX) { |
| | | file.Close(); |
| | | return -1; |
| | | } |
| | | int nBufSize = static_cast<int>(len); |
| | | char* pszBuffer = new char[nBufSize]; |
| | | file.Read(pszBuffer, nBufSize); |
| | | file.Close(); |
| | |
| | | return 0; |
| | | } |
| | | |
| | | // S7F5 Process Program Request -> reply S7F6 with PPID + PPBODY |
| | | int CHsmsPassive::replyProcessProgramRequest(IMessage* pRecv) |
| | | { |
| | | if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) { |
| | | return ER_NOTSELECT; |
| | | } |
| | | ISECS2Item* pBody = pRecv->getBody(); |
| | | const char* pszPPID = nullptr; |
| | | if (pBody == nullptr || !pBody->getString(pszPPID) || pszPPID == nullptr) { |
| | | return ER_PARAM_ERROR; |
| | | } |
| | | std::string ppid(pszPPID); |
| | | std::string ppbody; |
| | | // 简单聚合:从 RecipeManager 取设备配方,拼成文本 |
| | | auto recipeInfo = RecipeManager::getInstance().getRecipeByPPID(ppid); |
| | | if (!recipeInfo.strPPID.empty()) { |
| | | for (const auto& dev : recipeInfo.vecDeviceList) { |
| | | if (!ppbody.empty()) ppbody.append("\n"); |
| | | ppbody.append(dev.strDeviceName); |
| | | ppbody.append(","); |
| | | ppbody.append(std::to_string(dev.nRecipeID)); |
| | | ppbody.append(","); |
| | | ppbody.append(dev.strRecipeName); |
| | | // 附加参数大小信息(目前缺少具体参数列表) |
| | | ppbody.append(",paramsSize="); |
| | | ppbody.append(std::to_string(dev.paramsRawData.size())); |
| | | } |
| | | } |
| | | |
| | | IMessage* pMessage = nullptr; |
| | | if (HSMS_Create1Message(pMessage, m_nSessionId, 7, 6, pRecv->getHeader()->systemBytes) != 0 || pMessage == nullptr) { |
| | | return ER_CREATED_MESSAGE; |
| | | } |
| | | ISECS2Item* pRspBody = pMessage->getBody(); // top-level L:2 |
| | | pRspBody->addItem(ppid.c_str(), "PPID"); |
| | | pRspBody->addItem(ppbody.c_str(), "PPBODY"); |
| | | m_pPassive->sendMessage(pMessage); |
| | | LogSecsMessageBrief("<HSMS>[SEND]", pMessage); |
| | | HSMS_Destroy1Message(pMessage); |
| | | return 0; |
| | | } |
| | | |
| | | // S7F19 |
| | | int CHsmsPassive::replyQueryPPIDList(IMessage* pRecv) |
| | | { |
| | |
| | | int replyPurgeSpooledData(IMessage* pRecv); |
| | | int replyQueryPPIDList(IMessage* pRecv); |
| | | int replyDeletePPID(IMessage* pRecv); // S7F17/S7F18 |
| | | int replyProcessProgramRequest(IMessage* pRecv); // S7F5/S7F6 |
| | | int replyTerminalDisplay(IMessage* pRecv); |
| | | int replyCreateObj(IMessage* pRecv); |
| | | int replyPRJobMultiCreate(IMessage* pRecv); |