| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include "stdafx.h" |
| | | #include "CEventEditDlg.h" |
| | | #include "Servo.h" |
| | | #include "resource.h" |
| | | #include <algorithm> |
| | | |
| | | IMPLEMENT_DYNAMIC(CEventEditDlg, CDialogEx) |
| | | |
| | | CEventEditDlg::CEventEditDlg(const CString& title, int eventId, const CString& name, const CString& desc, const std::vector<unsigned int>& rptIds, CWnd* pParent) |
| | | : CDialogEx(IDD_DIALOG_EVENT_EDIT, pParent) |
| | | , m_strTitle(title) |
| | | , m_eventId(eventId) |
| | | , m_strName(name) |
| | | , m_strDesc(desc) |
| | | , m_rptIds(rptIds) |
| | | { |
| | | } |
| | | |
| | | CEventEditDlg::~CEventEditDlg() |
| | | { |
| | | } |
| | | |
| | | void CEventEditDlg::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialogEx::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_EDIT_EVT_ID, m_editId); |
| | | DDX_Control(pDX, IDC_EDIT_EVT_NAME, m_editName); |
| | | DDX_Control(pDX, IDC_EDIT_EVT_DESC, m_editDesc); |
| | | DDX_Control(pDX, IDC_LIST_EVT_RPTS, m_listRpt); |
| | | } |
| | | |
| | | BEGIN_MESSAGE_MAP(CEventEditDlg, CDialogEx) |
| | | END_MESSAGE_MAP() |
| | | |
| | | BOOL CEventEditDlg::OnInitDialog() |
| | | { |
| | | CDialogEx::OnInitDialog(); |
| | | SetWindowText(m_strTitle); |
| | | |
| | | CString strId; |
| | | strId.Format(_T("%d"), m_eventId); |
| | | m_editId.SetWindowText(strId); |
| | | m_editId.SetReadOnly(TRUE); |
| | | m_editName.SetWindowText(m_strName); |
| | | m_editDesc.SetWindowText(m_strDesc); |
| | | |
| | | m_listRpt.SetExtendedStyle(m_listRpt.GetExtendedStyle() | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_CHECKBOXES); |
| | | m_listRpt.InsertColumn(0, _T("RPT ID"), LVCFMT_LEFT, 120); |
| | | m_listRpt.InsertColumn(1, _T("VIDs"), LVCFMT_LEFT, 240); |
| | | |
| | | auto& reports = theApp.m_model.m_hsmsPassive.getReports(); |
| | | for (int i = 0; i < (int)reports.size(); ++i) { |
| | | auto rpt = reports[i]; |
| | | if (rpt == nullptr) continue; |
| | | int idx = m_listRpt.InsertItem(m_listRpt.GetItemCount(), std::to_string(rpt->getReportId()).c_str()); |
| | | m_listRpt.SetItemText(idx, 1, rpt->getVariablesIdsText().c_str()); |
| | | m_listRpt.SetItemData(idx, (DWORD_PTR)rpt->getReportId()); |
| | | if (std::find(m_rptIds.begin(), m_rptIds.end(), rpt->getReportId()) != m_rptIds.end()) { |
| | | m_listRpt.SetCheck(idx, TRUE); |
| | | } |
| | | } |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | void CEventEditDlg::OnOK() |
| | | { |
| | | CString name, desc; |
| | | m_editName.GetWindowText(name); |
| | | m_editDesc.GetWindowText(desc); |
| | | name.Trim(); |
| | | desc.Trim(); |
| | | if (name.IsEmpty()) { |
| | | AfxMessageBox(_T("åç§°ä¸è½ä¸ºç©º")); |
| | | return; |
| | | } |
| | | |
| | | std::vector<unsigned int> selected; |
| | | int count = m_listRpt.GetItemCount(); |
| | | for (int i = 0; i < count; ++i) { |
| | | if (m_listRpt.GetCheck(i)) { |
| | | selected.push_back((unsigned int)m_listRpt.GetItemData(i)); |
| | | } |
| | | } |
| | | if (selected.empty()) { |
| | | AfxMessageBox(_T("è³å°éæ©ä¸ä¸ªReport")); |
| | | return; |
| | | } |
| | | |
| | | m_strName = name; |
| | | m_strDesc = desc; |
| | | m_rptIds.swap(selected); |
| | | CDialogEx::OnOK(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | #include "afxdialogex.h" |
| | | #include <vector> |
| | | |
| | | // äºä»¶ç¼è¾å¯¹è¯æ¡ï¼æ°å¢/ç¼è¾å
±ç¨ï¼å¾éReportï¼ |
| | | class CEventEditDlg : public CDialogEx |
| | | { |
| | | DECLARE_DYNAMIC(CEventEditDlg) |
| | | |
| | | public: |
| | | CEventEditDlg(const CString& title, int eventId, const CString& name, const CString& desc, const std::vector<unsigned int>& rptIds, CWnd* pParent = nullptr); |
| | | virtual ~CEventEditDlg(); |
| | | |
| | | int GetEventId() const { return m_eventId; } |
| | | CString GetNameText() const { return m_strName; } |
| | | CString GetDescText() const { return m_strDesc; } |
| | | const std::vector<unsigned int>& GetSelectedRptIds() const { return m_rptIds; } |
| | | |
| | | protected: |
| | | virtual BOOL OnInitDialog() override; |
| | | virtual void DoDataExchange(CDataExchange* pDX) override; |
| | | afx_msg void OnOK(); |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | |
| | | private: |
| | | CString m_strTitle; |
| | | int m_eventId; |
| | | CString m_strName; |
| | | CString m_strDesc; |
| | | std::vector<unsigned int> m_rptIds; |
| | | |
| | | CEdit m_editId; |
| | | CEdit m_editName; |
| | | CEdit m_editDesc; |
| | | CListCtrl m_listRpt; |
| | | }; |
| | |
| | | #include "Servo.h" |
| | | #include "CPageCollectionEvent.h" |
| | | #include "afxdialogex.h" |
| | | #include "CEventEditDlg.h" |
| | | |
| | | |
| | | // CPageCollectionEvent å¯¹è¯æ¡ |
| | |
| | | void CPageCollectionEvent::OnClickedBtn(const char* btnName) |
| | | { |
| | | ASSERT(btnName); |
| | | if (_strcmpi(btnName, "å é¤") == 0) { |
| | | if (_strcmpi(btnName, "æ°å¢") == 0) { |
| | | int rc = UX_CanExecute(L"addEvents"); |
| | | if (rc != 1) { |
| | | AfxMessageBox("æä½æéä¸è¶³ï¼è¯·è系管ç人åï¼"); |
| | | return; |
| | | } |
| | | unsigned int newId = theApp.m_model.m_hsmsPassive.getMaxCollectionEventId() + 1; |
| | | std::vector<unsigned int> rptIds; |
| | | CEventEditDlg dlg(_T("æ°å¢äºä»¶"), (int)newId, _T(""), _T(""), rptIds, this); |
| | | if (dlg.DoModal() != IDOK) return; |
| | | |
| | | int ret = theApp.m_model.m_hsmsPassive.addCollectionEvent(newId, CT2A(dlg.GetNameText()), CT2A(dlg.GetDescText()), dlg.GetSelectedRptIds()); |
| | | if (ret == 0) { |
| | | UX_RecordAction(L"addEvents"); |
| | | m_listCtrl.DeleteAllItems(); |
| | | loadCollectionEvents(); |
| | | if (CButton* pDel = GetBtnByName("å é¤")) pDel->EnableWindow(FALSE); |
| | | if (CButton* pEdit = GetBtnByName("ç¼è¾")) pEdit->EnableWindow(FALSE); |
| | | } |
| | | else { |
| | | AfxMessageBox(_T("æ°å¢äºä»¶å¤±è´¥ï¼å¯è½IDé夿åå
¥å¤±è´¥ï¼")); |
| | | } |
| | | } |
| | | else if (_strcmpi(btnName, "å é¤") == 0) { |
| | | POSITION pos = m_listCtrl.GetFirstSelectedItemPosition(); |
| | | if (pos == nullptr) return; |
| | | int nItem = m_listCtrl.GetNextSelectedItem(pos); |
| | |
| | | AfxMessageBox(_T("å é¤äºä»¶å¤±è´¥")); |
| | | } |
| | | } |
| | | else if (_strcmpi(btnName, "ç¼è¾") == 0) { |
| | | POSITION pos = m_listCtrl.GetFirstSelectedItemPosition(); |
| | | if (pos == nullptr) return; |
| | | int nItem = m_listCtrl.GetNextSelectedItem(pos); |
| | | auto pEvent = reinterpret_cast<SERVO::CCollectionEvent*>(m_listCtrl.GetItemData(nItem)); |
| | | if (pEvent == nullptr) return; |
| | | |
| | | int rc = UX_CanExecute(L"editEvents"); |
| | | if (rc != 1) { |
| | | AfxMessageBox("æä½æéä¸è¶³ï¼è¯·è系管ç人åï¼"); |
| | | return; |
| | | } |
| | | |
| | | CString name = pEvent->getName().c_str(); |
| | | CString desc = pEvent->getDescription().c_str(); |
| | | auto rptIds = pEvent->getReportIds(); |
| | | CEventEditDlg dlg(_T("ç¼è¾äºä»¶"), (int)pEvent->getEventId(), name, desc, rptIds, this); |
| | | if (dlg.DoModal() != IDOK) return; |
| | | |
| | | int ret = theApp.m_model.m_hsmsPassive.updateCollectionEvent(pEvent->getEventId(), CT2A(dlg.GetNameText()), CT2A(dlg.GetDescText()), dlg.GetSelectedRptIds()); |
| | | if (ret == 0) { |
| | | UX_RecordAction(L"editEvents"); |
| | | m_listCtrl.DeleteAllItems(); |
| | | loadCollectionEvents(); |
| | | if (CButton* pDel = GetBtnByName("å é¤")) pDel->EnableWindow(FALSE); |
| | | if (CButton* pEdit = GetBtnByName("ç¼è¾")) pEdit->EnableWindow(FALSE); |
| | | } |
| | | else { |
| | | AfxMessageBox(_T("ç¼è¾äºä»¶å¤±è´¥ï¼å¯è½åå
¥å¤±è´¥ï¼")); |
| | | } |
| | | } |
| | | } |
| | |
| | | UX_DefineAction(L"addReports", L"æ°å¢Report", L"PE"); |
| | | UX_DefineAction(L"editReports", L"ç¼è¾Report", L"PE"); |
| | | UX_DefineAction(L"delReports", L"å é¤Report", L"PE"); |
| | | UX_DefineAction(L"addEvents", L"æ°å¢Event", L"PE"); |
| | | UX_DefineAction(L"editEvents", L"ç¼è¾Event", L"PE"); |
| | | UX_DefineAction(L"delEvents", L"å é¤Event", L"PE"); |
| | | } |
| | | // ç¡®ä¿æéå®ä¹åå¨ï¼å¹çï¼ |
| | | UX_DefineAction(L"addVarialbles", L"æ°å¢åé", L"PE"); |
| | |
| | | UX_DefineAction(L"editReports", L"ç¼è¾Report", L"PE"); |
| | | UX_DefineAction(L"delReports", L"å é¤Report", L"PE"); |
| | | UX_DefineAction(L"delEvents", L"å é¤Event", L"PE"); |
| | | UX_DefineAction(L"addEvents", L"æ°å¢Event", L"PE"); |
| | | UX_DefineAction(L"editEvents", L"ç¼è¾Event", L"PE"); |
| | | } |
| | | |
| | | bool CUserManager2::login(const char* pszAccount, const char* pszPwd) |
| | |
| | | return m_collectionEvents; |
| | | } |
| | | |
| | | unsigned int CHsmsPassive::getMaxCollectionEventId() const |
| | | { |
| | | unsigned int maxId = 0; |
| | | for (auto item : m_collectionEvents) { |
| | | if (item && item->getEventId() > maxId) { |
| | | maxId = item->getEventId(); |
| | | } |
| | | } |
| | | return maxId; |
| | | } |
| | | |
| | | int CHsmsPassive::deleteCollectionEvent(unsigned short CEID) |
| | | { |
| | | for (auto iter = m_collectionEvents.begin(); iter != m_collectionEvents.end(); ++iter) { |
| | |
| | | return -1; |
| | | } |
| | | |
| | | int CHsmsPassive::addCollectionEvent(unsigned int CEID, const char* name, const char* desc, const std::vector<unsigned int>& rptids) |
| | | { |
| | | if (getEvent((unsigned short)CEID) != nullptr) { |
| | | return -1; |
| | | } |
| | | auto* pEvent = new SERVO::CCollectionEvent(CEID, name, desc, const_cast<std::vector<unsigned int>&>(rptids)); |
| | | for (auto rptid : rptids) { |
| | | SERVO::CReport* pReport = getReport((int)rptid); |
| | | if (pReport != nullptr) { |
| | | pEvent->addReport(pReport); |
| | | } |
| | | } |
| | | m_collectionEvents.push_back(pEvent); |
| | | return writeCollectionEventsToFile(m_strCollectionEventFilepath); |
| | | } |
| | | |
| | | int CHsmsPassive::updateCollectionEvent(unsigned int CEID, const char* name, const char* desc, const std::vector<unsigned int>& rptids) |
| | | { |
| | | for (auto iter = m_collectionEvents.begin(); iter != m_collectionEvents.end(); ++iter) { |
| | | if ((*iter)->getEventId() == CEID) { |
| | | delete (*iter); |
| | | auto* pEvent = new SERVO::CCollectionEvent(CEID, name, desc, const_cast<std::vector<unsigned int>&>(rptids)); |
| | | for (auto rptid : rptids) { |
| | | SERVO::CReport* pReport = getReport((int)rptid); |
| | | if (pReport != nullptr) { |
| | | pEvent->addReport(pReport); |
| | | } |
| | | } |
| | | *iter = pEvent; |
| | | return writeCollectionEventsToFile(m_strCollectionEventFilepath); |
| | | } |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | void CHsmsPassive::clearAllCollectionEvent() |
| | | { |
| | | for (auto item : m_collectionEvents) { |
| | |
| | | |
| | | // åå¾CCollectionEventå表 |
| | | std::vector<SERVO::CCollectionEvent*>& getCollectionEvents(); |
| | | unsigned int getMaxCollectionEventId() const; |
| | | |
| | | // åæ¶/å 餿æCollectionEvent |
| | | void clearAllCollectionEvent(); |
| | | int deleteCollectionEvent(unsigned short CEID); |
| | | int addCollectionEvent(unsigned int CEID, const char* name, const char* desc, const std::vector<unsigned int>& rptids); |
| | | int updateCollectionEvent(unsigned int CEID, const char* name, const char* desc, const std::vector<unsigned int>& rptids); |
| | | |
| | | // åå¾CCollectionEvent |
| | | SERVO::CCollectionEvent* getEvent(unsigned short CEID); |
| | |
| | | PUSHBUTTON "åæ¶",IDCANCEL,230,200,50,14 |
| | | END |
| | | |
| | | IDD_DIALOG_EVENT_EDIT DIALOGEX 0, 0, 340, 220 |
| | | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU |
| | | CAPTION "äºä»¶" |
| | | FONT 8, "MS Shell Dlg", 400, 0, 0x1 |
| | | BEGIN |
| | | LTEXT "äºä»¶IDï¼",IDC_STATIC,12,12,50,8 |
| | | EDITTEXT IDC_EDIT_EVT_ID,70,10,170,14,ES_AUTOHSCROLL | ES_READONLY |
| | | LTEXT "åç§°ï¼",IDC_STATIC,12,32,50,8 |
| | | EDITTEXT IDC_EDIT_EVT_NAME,70,30,260,14,ES_AUTOHSCROLL |
| | | LTEXT "æè¿°ï¼",IDC_STATIC,12,52,50,8 |
| | | EDITTEXT IDC_EDIT_EVT_DESC,70,50,260,34,ES_AUTOHSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL |
| | | LTEXT "éæ©Reportï¼",IDC_STATIC_SELECT_VARS,12,90,70,8 |
| | | CONTROL "",IDC_LIST_EVT_RPTS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,12,100,316,90 |
| | | DEFPUSHBUTTON "ç¡®å®",IDOK,200,196,50,14 |
| | | PUSHBUTTON "åæ¶",IDCANCEL,260,196,50,14 |
| | | END |
| | | |
| | | IDD_PAGE_LINK_SIGNAL DIALOGEX 0, 0, 543, 239 |
| | | STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU |
| | | FONT 8, "MS Shell Dlg", 400, 0, 0x1 |
| | |
| | | <ClInclude Include="CControlJobManagerDlg.h" /> |
| | | <ClInclude Include="CCustomCheckBox.h" /> |
| | | <ClInclude Include="CCollectionEvent.h" /> |
| | | <ClInclude Include="CEventEditDlg.h" /> |
| | | <ClInclude Include="CEquipmentPage3.h" /> |
| | | <ClInclude Include="CExpandableListCtrl.h" /> |
| | | <ClInclude Include="CGlassPool.h" /> |
| | |
| | | <ClCompile Include="CControlJobManagerDlg.cpp" /> |
| | | <ClCompile Include="CCustomCheckBox.cpp" /> |
| | | <ClCompile Include="CCollectionEvent.cpp" /> |
| | | <ClCompile Include="CEventEditDlg.cpp" /> |
| | | <ClCompile Include="CEquipmentPage3.cpp" /> |
| | | <ClCompile Include="CExpandableListCtrl.cpp" /> |
| | | <ClCompile Include="CGlassPool.cpp" /> |
| | |
| | | <ClCompile Include="RecipeDeviceBindDlg.cpp" /> |
| | | <ClCompile Include="CCustomCheckBox.cpp" /> |
| | | <ClCompile Include="CCollectionEvent.cpp" /> |
| | | <ClCompile Include="CEventEditDlg.cpp"> |
| | | <Filter>Source Files</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="CReport.cpp" /> |
| | | <ClCompile Include="CReportEditDlg.cpp"> |
| | | <Filter>Source Files</Filter> |
| | |
| | | <ClInclude Include="RecipeDeviceBindDlg.h" /> |
| | | <ClInclude Include="CCustomCheckBox.h" /> |
| | | <ClInclude Include="CCollectionEvent.h" /> |
| | | <ClInclude Include="CEventEditDlg.h"> |
| | | <Filter>Header Files</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="CReport.h" /> |
| | | <ClInclude Include="CReportEditDlg.h"> |
| | | <Filter>Header Files</Filter> |
| | |
| | | #define IDD_DIALOG_INPUT 164 |
| | | #define IDD_DIALOG_VARIABLE_EDIT2 186 |
| | | #define IDD_DIALOG_REPORT_EDIT 187 |
| | | #define IDD_DIALOG_EVENT_EDIT 188 |
| | | #define IDD_PAGE_LINK_SIGNAL 165 |
| | | #define IDD_DIALOG_SYSTEM_LOG_MANAGER 166 |
| | | #define IDD_DIALOG_RECIPE_DEVICE_BIND 167 |
| | |
| | | #define IDC_EDIT_VAR_REMARK 1238 |
| | | #define IDC_EDIT_RPT_ID 1239 |
| | | #define IDC_EDIT_RPT_VIDS 1240 |
| | | #define IDC_EDIT_EVT_ID 1243 |
| | | #define IDC_EDIT_EVT_NAME 1244 |
| | | #define IDC_EDIT_EVT_DESC 1245 |
| | | #define IDC_LIST_EVT_RPTS 1246 |
| | | #define IDC_EDIT_VAR_ID 1235 |
| | | #define IDC_COMBO_VAR_TYPE 1236 |
| | | #define IDC_EDIT_VAR_NAME 1237 |
| | | #define IDC_EDIT_VAR_REMARK 1238 |
| | | #define ID_MENU_HELP_ABOUT 32771 |
| | | #define ID_MENU_FILE_EXIT 32772 |
| | | #define ID_MENU_FILE_SECSTEST 32773 |
| | |
| | | #define ID_EQSGRAPHITEM_TEST6 32798 |
| | | #define ID_MENU_PROJECT_VARIABLE_LIST 32800 |
| | | #define ID_MENU_TOOLS_CLIENT_LIST 32801 |
| | | |
| | | // Next default values for new objects |
| | | // |
| | | #ifdef APSTUDIO_INVOKED |
| | | #ifndef APSTUDIO_READONLY_SYMBOLS |
| | | #define _APS_NEXT_RESOURCE_VALUE 188 |
| | | #define _APS_NEXT_RESOURCE_VALUE 189 |
| | | #define _APS_NEXT_COMMAND_VALUE 32802 |
| | | #define _APS_NEXT_CONTROL_VALUE 1243 |
| | | #define _APS_NEXT_CONTROL_VALUE 1247 |
| | | #define _APS_NEXT_SYMED_VALUE 101 |
| | | #endif |
| | | #endif |
| | |
| | | 50008,Port_Unload_Ready,,(50008) |
| | | 50009,Port_Load_Ready,,(50009) |
| | | 50010,Port_Blocked,,(50010) |
| | | |
| | | 50011,TestEvent,TestEvent,æµè¯ä¸ä¸,(50011) |