| | |
| | | #include "Servo.h" |
| | | #include "CPageVarialbles.h" |
| | | #include "afxdialogex.h" |
| | | #include "CVariableEditDlg2.h" |
| | | |
| | | |
| | | // CPageVarialbles å¯¹è¯æ¡ |
| | |
| | | { |
| | | ASSERT(btnName); |
| | | if (_strcmpi(btnName, "æ°å¢") == 0) { |
| | | // TODO: æ°å¢é»è¾ |
| | | unsigned int newId = theApp.m_model.m_hsmsPassive.getMaxVariableId(); |
| | | int newIdInt = static_cast<int>(newId + 1); |
| | | CVariableEditDlg2 dlg(_T("æ°å¢åé"), newIdInt, _T("U1"), _T(""), _T(""), this); |
| | | if (dlg.DoModal() != IDOK) return; |
| | | CString name = dlg.GetNameText(); |
| | | CString fmt = dlg.GetTypeText(); |
| | | CString remark = dlg.GetRemark(); |
| | | |
| | | int ret = theApp.m_model.m_hsmsPassive.addVariable(CT2A(name), CT2A(fmt), CT2A(remark), newIdInt); |
| | | if (ret == 0) { |
| | | m_listCtrl.DeleteAllItems(); |
| | | loadVariables(); |
| | | } |
| | | else { |
| | | AfxMessageBox(_T("æ°å¢åéå¤±è´¥ï¼æ ¼å¼æ¯å¦æ£ç¡®ï¼(U1/U2/I2/A20/A50/L)")); |
| | | } |
| | | } |
| | | else if (_strcmpi(btnName, "å é¤") == 0) { |
| | | POSITION pos = m_listCtrl.GetFirstSelectedItemPosition(); |
| | |
| | | } |
| | | } |
| | | else if (_strcmpi(btnName, "ç¼è¾") == 0) { |
| | | // TODO: ç¼è¾é»è¾ |
| | | POSITION pos = m_listCtrl.GetFirstSelectedItemPosition(); |
| | | if (pos == nullptr) return; |
| | | int nItem = m_listCtrl.GetNextSelectedItem(pos); |
| | | auto pVar = reinterpret_cast<SERVO::CVariable*>(m_listCtrl.GetItemData(nItem)); |
| | | if (pVar == nullptr) return; |
| | | |
| | | CVariableEditDlg2 dlg(_T("ç¼è¾åé"), |
| | | pVar->getVarialbleId(), |
| | | CString(CA2T(SERVO::CVariable::formatToString(pVar->getFormat()).c_str())), |
| | | CString(CA2T(pVar->getName().c_str())), |
| | | CString(CA2T(pVar->getRemark().c_str())), |
| | | this); |
| | | if (dlg.DoModal() != IDOK) return; |
| | | CString name = dlg.GetNameText(); |
| | | CString fmt = dlg.GetTypeText(); |
| | | CString remark = dlg.GetRemark(); |
| | | |
| | | int ret = theApp.m_model.m_hsmsPassive.updateVariable(pVar->getVarialbleId(), CT2A(name), CT2A(fmt), CT2A(remark)); |
| | | if (ret == 0) { |
| | | m_listCtrl.DeleteAllItems(); |
| | | loadVariables(); |
| | | } |
| | | else { |
| | | AfxMessageBox(_T("ç¼è¾åéå¤±è´¥ï¼æ ¼å¼æ¯å¦æ£ç¡®ï¼(U1/U2/I2/A20/A50/L)")); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | namespace SERVO { |
| | | // åéæ ¼å¼ |
| | | // åéç±»å |
| | | enum class SVFromat { |
| | | U1 = 0, |
| | | U2, |
| | |
| | | std::string getValue(); |
| | | __int64 getIntValue(); |
| | | std::vector<CVariable>& getVarsValue(); |
| | | void setName(const char* pszName) { m_strName = pszName; } |
| | | void setFormat(const char* pszFmt) { m_format = toFormat(pszFmt); } |
| | | void setRemark(const char* pszRemark) { m_strRemark = pszRemark; } |
| | | |
| | | private: |
| | | unsigned int m_nVarialbeId; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "CVariableEditDlg2.h" |
| | | #include "resource.h" |
| | | |
| | | IMPLEMENT_DYNAMIC(CVariableEditDlg2, CDialogEx) |
| | | |
| | | CVariableEditDlg2::CVariableEditDlg2(const CString& title, int varId, const CString& type, const CString& name, const CString& remark, CWnd* pParent) |
| | | : CDialogEx(IDD_DIALOG_VARIABLE_EDIT2, pParent), |
| | | m_strTitle(title), |
| | | m_varId(varId), |
| | | m_strType(type), |
| | | m_strName(name), |
| | | m_strRemark(remark) |
| | | { |
| | | } |
| | | |
| | | CVariableEditDlg2::~CVariableEditDlg2() |
| | | { |
| | | } |
| | | |
| | | void CVariableEditDlg2::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_EDIT_VAR_ID, m_editId); |
| | | DDX_Control(pDX, IDC_COMBO_VAR_TYPE, m_cbType); |
| | | DDX_Control(pDX, IDC_EDIT_VAR_NAME, m_editName); |
| | | DDX_Control(pDX, IDC_EDIT_VAR_REMARK, m_editRemark); |
| | | } |
| | | |
| | | BEGIN_MESSAGE_MAP(CVariableEditDlg2, CDialogEx) |
| | | END_MESSAGE_MAP() |
| | | |
| | | BOOL CVariableEditDlg2::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | |
| | | SetWindowText(m_strTitle); |
| | | |
| | | CString strId; |
| | | strId.Format(_T("%d"), m_varId); |
| | | m_editId.SetWindowText(strId); |
| | | m_editId.SetReadOnly(TRUE); |
| | | |
| | | m_cbType.ResetContent(); |
| | | const TCHAR* fmts[] = { _T("U1"), _T("U2"), _T("I2"), _T("A20"), _T("A50"), _T("L") }; |
| | | for (auto f : fmts) { |
| | | m_cbType.AddString(f); |
| | | } |
| | | if (!m_strType.IsEmpty()) { |
| | | m_cbType.SelectString(-1, m_strType); |
| | | } |
| | | else { |
| | | m_cbType.SetCurSel(0); |
| | | } |
| | | |
| | | m_editName.SetWindowText(m_strName); |
| | | m_editRemark.SetWindowText(m_strRemark); |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | void CVariableEditDlg2::OnOK() |
| | | { |
| | | CString name, fmt, remark; |
| | | m_editName.GetWindowText(name); |
| | | m_cbType.GetWindowText(fmt); |
| | | m_editRemark.GetWindowText(remark); |
| | | |
| | | fmt.MakeUpper(); |
| | | if (name.IsEmpty()) { |
| | | AfxMessageBox(_T("åç§°ä¸è½ä¸ºç©º")); |
| | | return; |
| | | } |
| | | if (fmt.IsEmpty()) { |
| | | AfxMessageBox(_T("ç±»åä¸è½ä¸ºç©º")); |
| | | return; |
| | | } |
| | | if (fmt != _T("U1") && fmt != _T("U2") && fmt != _T("I2") |
| | | && fmt != _T("A20") && fmt != _T("A50") && fmt != _T("L")) { |
| | | AfxMessageBox(_T("ç±»åå¿
é¡»æ¯ U1/U2/I2/A20/A50/L")); |
| | | return; |
| | | } |
| | | |
| | | m_strName = name; |
| | | m_strType = fmt; |
| | | m_strRemark = remark; |
| | | |
| | | CDialogEx::OnOK(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "afxdialogex.h" |
| | | |
| | | // åéç¼è¾å¯¹è¯æ¡ï¼æ°å¢/ç¼è¾å
±ç¨ï¼ä½¿ç¨èµæºæ¨¡æ¿ï¼ |
| | | class CVariableEditDlg2 : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CVariableEditDlg2) |
| | | |
| | | public: |
| | | CVariableEditDlg2(const CString& title, int varId, const CString& type, const CString& name, const CString& remark, CWnd* pParent = nullptr); |
| | | virtual ~CVariableEditDlg2(); |
| | | |
| | | int GetVarId() const { return m_varId; } |
| | | CString GetTypeText() const { return m_strType; } |
| | | CString GetNameText() const { return m_strName; } |
| | | CString GetRemark() const { return m_strRemark; } |
| | | |
| | | protected: |
| | | virtual BOOL OnInitDialog() override; |
| | | virtual void DoDataExchange(CDataExchange* pDX) override; |
| | | afx_msg void OnOK(); |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | private: |
| | | CString m_strTitle; |
| | | int m_varId; |
| | | CString m_strType; |
| | | CString m_strName; |
| | | CString m_strRemark; |
| | | |
| | | CEdit m_editId, m_editName, m_editRemark; |
| | | CComboBox m_cbType; |
| | | }; |
| | |
| | | #include <time.h> |
| | | #include <stdlib.h> |
| | | #include <string.h> |
| | | #include <algorithm> |
| | | #include <set> |
| | | #include <regex> |
| | | |
| | | |
| | |
| | | return m_variabels; |
| | | } |
| | | |
| | | unsigned int CHsmsPassive::getMaxVariableId() const |
| | | { |
| | | unsigned int maxId = 0; |
| | | for (auto item : m_variabels) { |
| | | if (item && item->getVarialbleId() > maxId) { |
| | | maxId = item->getVarialbleId(); |
| | | } |
| | | } |
| | | return maxId; |
| | | } |
| | | |
| | | SERVO::CVariable* CHsmsPassive::getVariable(int variableId) |
| | | { |
| | | for (auto item : m_variabels) { |
| | |
| | | |
| | | if (filepath.empty()) return -2; |
| | | |
| | | // ååæä»¶ï¼ä¿æåç¼ç ï¼UTF-8 ææ¬å°ç¼ç ï¼ |
| | | return writeVariablesToFile(filepath); |
| | | } |
| | | |
| | | void CHsmsPassive::setVariableValue(const char* pszName, __int64 value) |
| | | { |
| | | auto v = getVariable(pszName); |
| | | if (v != nullptr) { |
| | | v->setValue(value); |
| | | } |
| | | } |
| | | |
| | | void CHsmsPassive::setVariableValue(const char* pszName, const char* value) |
| | | { |
| | | auto v = getVariable(pszName); |
| | | if (v != nullptr) { |
| | | v->setValue(value); |
| | | } |
| | | } |
| | | |
| | | void CHsmsPassive::setVariableValue(const char* pszName, std::vector<SERVO::CVariable>& vars) |
| | | { |
| | | auto v = getVariable(pszName); |
| | | if (v != nullptr) { |
| | | v->setValue(vars); |
| | | } |
| | | } |
| | | |
| | | static bool isValidFormat(const std::string& fmt) |
| | | { |
| | | static const std::set<std::string> allow = { "U1","U2","I2","A20","A50","L" }; |
| | | return allow.count(fmt) > 0; |
| | | } |
| | | |
| | | int CHsmsPassive::addVariable(const char* pszName, const char* pszFormat, const char* pszRemark, int& outId) |
| | | { |
| | | if (pszName == nullptr || pszFormat == nullptr) return -1; |
| | | std::string fmt = pszFormat; |
| | | std::transform(fmt.begin(), fmt.end(), fmt.begin(), ::toupper); |
| | | if (!isValidFormat(fmt)) return -2; |
| | | |
| | | Lock(); |
| | | int maxId = 0; |
| | | for (auto v : m_variabels) { |
| | | if (v != nullptr && v->getVarialbleId() > maxId) { |
| | | maxId = v->getVarialbleId(); |
| | | } |
| | | } |
| | | outId = maxId + 1; |
| | | |
| | | SERVO::CVariable* pNew = new SERVO::CVariable(std::to_string(outId).c_str(), pszName, fmt.c_str(), pszRemark ? pszRemark : ""); |
| | | m_variabels.push_back(pNew); |
| | | auto filepath = m_strVariableFilepath; |
| | | Unlock(); |
| | | |
| | | if (filepath.empty()) return -3; |
| | | return writeVariablesToFile(filepath); |
| | | } |
| | | |
| | | int CHsmsPassive::updateVariable(int variableId, const char* pszName, const char* pszFormat, const char* pszRemark) |
| | | { |
| | | if (pszName == nullptr || pszFormat == nullptr) return -1; |
| | | std::string fmt = pszFormat; |
| | | std::transform(fmt.begin(), fmt.end(), fmt.begin(), ::toupper); |
| | | if (!isValidFormat(fmt)) return -2; |
| | | |
| | | Lock(); |
| | | auto it = std::find_if(m_variabels.begin(), m_variabels.end(), [=](SERVO::CVariable* v) { |
| | | return v != nullptr && v->getVarialbleId() == variableId; |
| | | }); |
| | | if (it == m_variabels.end()) { |
| | | Unlock(); |
| | | return -4; |
| | | } |
| | | (*it)->setName(pszName); |
| | | (*it)->setFormat(fmt.c_str()); |
| | | (*it)->setRemark(pszRemark ? pszRemark : ""); |
| | | auto filepath = m_strVariableFilepath; |
| | | Unlock(); |
| | | |
| | | if (filepath.empty()) return -3; |
| | | return writeVariablesToFile(filepath); |
| | | } |
| | | |
| | | int CHsmsPassive::writeVariablesToFile(const std::string& filepath) |
| | | { |
| | | if (filepath.empty()) return -3; |
| | | |
| | | CFile file; |
| | | if (!file.Open(filepath.c_str(), CFile::modeCreate | CFile::modeWrite | CFile::shareDenyNone)) { |
| | | return -3; |
| | |
| | | file.Close(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | void CHsmsPassive::setVariableValue(const char* pszName, __int64 value) |
| | | { |
| | | auto v = getVariable(pszName); |
| | | if (v != nullptr) { |
| | | v->setValue(value); |
| | | } |
| | | } |
| | | |
| | | void CHsmsPassive::setVariableValue(const char* pszName, const char* value) |
| | | { |
| | | auto v = getVariable(pszName); |
| | | if (v != nullptr) { |
| | | v->setValue(value); |
| | | } |
| | | } |
| | | |
| | | void CHsmsPassive::setVariableValue(const char* pszName, std::vector<SERVO::CVariable>& vars) |
| | | { |
| | | auto v = getVariable(pszName); |
| | | if (v != nullptr) { |
| | | v->setValue(vars); |
| | | } |
| | | } |
| | | |
| | | int CHsmsPassive::loadReports(const char* pszFilepath) |
| | |
| | | |
| | | // åå¾CVariableå表 |
| | | std::vector<SERVO::CVariable*>& getVariables(); |
| | | unsigned int getMaxVariableId() const; |
| | | |
| | | // å徿å®Variable |
| | | SERVO::CVariable* getVariable(int variableId); |
| | | SERVO::CVariable* getVariable(const char* pszName); |
| | | int deleteVariable(int variableId); |
| | | int addVariable(const char* pszName, const char* pszFormat, const char* pszRemark, int& outId); |
| | | int updateVariable(int variableId, const char* pszName, const char* pszFormat, const char* pszRemark); |
| | | |
| | | // 设置åéå¼ |
| | | void setVariableValue(const char* pszName, __int64 value); |
| | |
| | | int onRecvMsg(IMessage* pMessage); |
| | | void clearAllVariabel(); |
| | | std::vector<unsigned int> parseVidList(CString& strNums); |
| | | int writeVariablesToFile(const std::string& filepath); |
| | | |
| | | private: |
| | | CModel* m_pModel; |
| | |
| | | <ClInclude Include="CUserEdit2Dlg.h" /> |
| | | <ClInclude Include="CUserXLogDlg.h" /> |
| | | <ClInclude Include="CVariable.h" /> |
| | | <ClInclude Include="CVariableEditDlg2.h" /> |
| | | <ClInclude Include="DeviceRecipeParamDlg.h" /> |
| | | <ClInclude Include="GlassJson.h" /> |
| | | <ClInclude Include="GlassLogDb.h" /> |
| | |
| | | <ClCompile Include="CUserEdit2Dlg.cpp" /> |
| | | <ClCompile Include="CUserXLogDlg.cpp" /> |
| | | <ClCompile Include="CVariable.cpp" /> |
| | | <ClCompile Include="CVariableEditDlg2.cpp" /> |
| | | <ClCompile Include="DeviceRecipeParamDlg.cpp" /> |
| | | <ClCompile Include="GlassJson.cpp" /> |
| | | <ClCompile Include="GlassLogDb.cpp" /> |
| | |
| | | <ClCompile Include="CUserManager2Dlg.cpp" /> |
| | | <ClCompile Include="CUserEdit2Dlg.cpp" /> |
| | | <ClCompile Include="CUserXLogDlg.cpp" /> |
| | | <ClCompile Include="CVariableEditDlg2.cpp" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="AlarmManager.h" /> |
| | |
| | | <ClInclude Include="CUserManager2Dlg.h" /> |
| | | <ClInclude Include="CUserEdit2Dlg.h" /> |
| | | <ClInclude Include="CUserXLogDlg.h" /> |
| | | <ClInclude Include="CVariableEditDlg2.h" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ResourceCompile Include="Servo.rc" /> |
| | |
| | | SVID,SV Name,SV Format,SV Remark |
| | | 100,PortTransferState,U1,0=OutOfService\r\n1=TransferBlocked\r\n2=ReadyToLoad\r\n3=ReadyToUnload\r\n4=InService\r\n5=TransferReady |
| | | 300,AccessMode,U1,1=Manual\r\n2=Auto |
| | | 100,PortTransferState,U1,0=OutOfService |
| | | 300,AccessMode,U1,1=Manual |
| | | 500,Clock,A50, |
| | | 600,CurrentControlState,U1,0:Offline:equipment\r\n1:Offline-Attempt\r\n2:Online\r\n3:Offline:host\r\n4:Online:Local\r\n5:Online:Remote |
| | | 600,CurrentControlState,U1,0:Offline:equipment |
| | | 601,PreviousControlState,U1, |
| | | 700,CurrentProcessState,U1,0:DOWN\r\n1:IDLE\r\n2.SETUP\r\n3.EXCUTING\r\n4.MAINTAIN\r\n5.ALARM |
| | | 700,CurrentProcessState,U1,0:DOWN |
| | | 701,PreviousProcessState,U1, |
| | | 800,EFEMPPExecName,A20, |
| | | 801,EQPPExecName,A20, |
| | | 2000,RbRAxisTorque,I2,æºå¨äººRè½´æç© |
| | | 2001,RbLAxisTorque,l2,æºå¨äººLè½´æç© |
| | | 2002,RbZAxisTorque,l2,æºå¨äººZè½´æç© |
| | | 2003,RbTHAxisTorque,l2,æºå¨äººTHè½´æç© |
| | | 2004,RbXAxisTorque,l2,æºå¨äººXè½´æç© |
| | | 2005,AxisX111,l2,X111ç¸æºåç§»æ ½çµæºæç© |
| | | 2006,AxisX112,l2,X112ç¸æºåç§»æ ½çµæºæç© |
| | | 2007,AxisU113,l2,U113产åæè½¬çµæºæç© |
| | | 2008,AxisX114,l2,X114产åå·¦æ´åçµæºæç© |
| | | 2009,AxisY121,l2,Y121产å峿´åçµæºæç© |
| | | 2010,AxisY122,l2,Y122产ååæ´åçµæºæç© |
| | | 2011,AxisY123,l2,Y123产ååéµåçµæºæç© |
| | | 2012,MainAir,U2,æ»è¿æ°ååå¼ |
| | | 2013,MainVacuum,l2,æ»ç空ååå¼ |
| | | 2014,RbMainVacuum,l2,æºå¨äººçç©ºå¼ |
| | | 2015,LPMainVacuum,l2,LPç空å¼#D265 |
| | | 2016,LPMainAir,U2,LPåç©ºå¼ |
| | | 2017,ALVacuum,l2,Alignerçç©ºå¼ |
| | | 2018,FFU1RPM,U2,FFU1转é |
| | | 2019,FFU2RPM,U2,FFU2转é |
| | | 2020,FFU3RPM,U2,FFU3转é |
| | | 2021,FFU4RPM,U2,FFU4转é |
| | | 2001,RbLAxisTorque,U1,æºå¨äººLè½´æç© |
| | | 2002,RbZAxisTorque,U1,æºå¨äººZè½´æç© |
| | | 2003,RbTHAxisTorque,U1,æºå¨äººTHè½´æç© |
| | | 2004,RbXAxisTorque,U1,æºå¨äººXè½´æç© |
| | | 2005,AxisX111,U1,X111ç¸æºåç§»æ ½çµæºæç© |
| | | 2006,AxisX112,U1,X112ç¸æºåç§»æ ½çµæºæç© |
| | | 2007,AxisU113,U1,U113产åæè½¬çµæºæç© |
| | | 2008,AxisX114,U1,X114产åå·¦æ´åçµæºæç© |
| | | 2009,AxisY121,U1,Y121产å峿´åçµæºæç© |
| | | 2010,AxisY122,U1,Y122产ååæ´åçµæºæç© |
| | | 2011,AxisY123,U1,Y123产ååéµåçµæºæç© |
| | | 2012,MainAir,U1,æ»è¿æ°ååå¼ |
| | | 2013,MainVacuum,U1,æ»ç空ååå¼ |
| | | 2014,RbMainVacuum,U1,æºå¨äººçç©ºå¼ |
| | | 2015,LPMainVacuum,U1,LPç空å¼#D265 |
| | | 2016,LPMainAir,U1,LPåç©ºå¼ |
| | | 2017,ALVacuum,U1,Alignerçç©ºå¼ |
| | | 2018,FFU1RPM,U1,FFU1转é |
| | | 2019,FFU2RPM,U1,FFU2转é |
| | | 2020,FFU3RPM,U1,FFU3转é |
| | | 2021,FFU4RPM,U1,FFU4转é |
| | | 2022,ESDValue,I2,éçµæ£æµå¼ |
| | | 2023,OCREnable,U2,"OCR使è½ï¼O:å¼å¯ 1ï¼å±è½" |
| | | 2024,CCDEnable,U2,"CCD使è½ï¼O:å¼å¯ 1ï¼å±è½" |
| | | 2025,FFUParameter,U2,FFU设å®å¼ |
| | | 2023,OCREnable,U1,"OCR使è½ï¼O:å¼å¯ 1ï¼å±è½" |
| | | 2024,CCDEnable,U1,"CCD使è½ï¼O:å¼å¯ 1ï¼å±è½" |
| | | 2025,FFUParameter,U1,FFU设å®å¼ |
| | | 5000,CarrierID,A20,å¡å£ID |
| | | 5001,CJobSpace,U1,CJ Space |
| | | 5002,PJobSpace,U1,PJ Space |
| | |
| | | 5007,PanelEndID,A20,PanelEndID |
| | | 5008,CJStartID,A20,CJStartID |
| | | 5009,CJEndID,A20,CJEndID |
| | | 5010,UnloadReadyPortId,U2,"Port ID" |
| | | 5011,LoadReadyPortId,U2,"Port ID" |
| | | 5012,BlockedPortId,U2,"Port ID" |
| | | 5010,UnloadReadyPortId,U1,"Port ID" |
| | | 5011,LoadReadyPortId,U1,"Port ID" |
| | | 5012,BlockedPortId,U1,"Port ID" |
| | | 5013,TestVID,U1,æµè¯æ·»å åé44 |