| | |
| | | #include "CControlJobManagerDlg.h" |
| | | #include "CUserManager2.h" |
| | | #include "CUserManager2Dlg.h" |
| | | #include "CUserXLogDlg.h" |
| | | |
| | | |
| | | #ifdef _DEBUG |
| | |
| | | LRESULT CServoDlg::OnToolbarBtnClicked(WPARAM wParam, LPARAM lParam) |
| | | { |
| | | int id = (int)lParam; |
| | | if (id == IDC_BUTTON_RUN || id == IDC_BUTTON_STOP) { |
| | | UserRole emRole = UserManager::getInstance().getCurrentUserRole(); |
| | | if (emRole != UserRole::SuperAdmin) { |
| | | AfxMessageBox(_T("当前用户并非管理员!!!")); |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | if (id == IDC_BUTTON_RUN) { |
| | | int rc = UX_CanExecute(L"start"); |
| | | if (rc != 1) { |
| | | AfxMessageBox("操作权限不足,请联系管理人员!"); |
| | | return 0; |
| | | } |
| | | UX_RecordAction(L"start"); |
| | | |
| | | if (theApp.m_model.getMaster().getState() == SERVO::MASTERSTATE::MSERROR) { |
| | | AfxMessageBox("当前有机台发生错误,不能启动,请确认解决问题后再尝试重新启动!"); |
| | | } |
| | |
| | | } |
| | | } |
| | | else if (id == IDC_BUTTON_STOP) { |
| | | int rc = UX_CanExecute(L"stop"); |
| | | if (rc != 1) { |
| | | AfxMessageBox("操作权限不足,请联系管理人员!"); |
| | | return 0; |
| | | } |
| | | UX_RecordAction(L"stop"); |
| | | |
| | | if (theApp.m_model.getMaster().stop() == 0) { |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE); |
| | | } |
| | |
| | | CUserManager2Dlg dlg; |
| | | dlg.DoModal(); |
| | | } |
| | | else if (menuId == 1) { |
| | | CUserXLogDlg dlg; |
| | | dlg.DoModal(); |
| | | } |
| | | else if (menuId == 2) { |
| | | CLoginDlg2 dlg; |
| | | if (dlg.DoModal() != IDOK) { |
| | | PostMessage(WM_CLOSE); |
| | | } |
| | | else { |
| | | if (dlg.DoModal() == IDOK) { |
| | | bool bRet = CUserManager2::getInstance().login((LPTSTR)(LPCTSTR)dlg.m_strUsername, |
| | | (LPTSTR)(LPCTSTR)dlg.m_strPassword); |
| | | if (!bRet) { |