From a6451d0261dcb69e8db6e2eb353a34e2dbee5fc2 Mon Sep 17 00:00:00 2001 From: krivoshein Date: Mon, 2 Feb 2026 14:57:09 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=B0=D0=BD=20=D0=BF=D0=BE=D1=80=D1=8F=D0=B4=D0=BE?= =?UTF-8?q?=D0=BA=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D1=87=D0=B8=20?= =?UTF-8?q?=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=BE=D0=B2=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LibDataBaseInterface/typeQueryToDB.h | 3 + .../instructorsandtraineeswidget.cpp | 40 ++++++- .../instructorsandtraineeswidget.h | 5 + LibServer/Systems/commonclienthandler.cpp | 75 ++++++++++++- LibServer/Systems/commonclienthandler.h | 5 +- LibServer/Systems/processingsystem.cpp | 84 +++++++++++--- LibServer/Systems/processingsystem.h | 5 +- translations/RRJServer_ru_RU.ts | 106 +++++++++--------- 8 files changed, 252 insertions(+), 71 deletions(-) diff --git a/LibDataBaseInterface/typeQueryToDB.h b/LibDataBaseInterface/typeQueryToDB.h index 1bf1107..a69a30e 100644 --- a/LibDataBaseInterface/typeQueryToDB.h +++ b/LibDataBaseInterface/typeQueryToDB.h @@ -5,6 +5,9 @@ enum TypeQueryToDB{ TYPE_QUERY_GET_ALL_LISTS, + TYPE_QUERY_GET_ALL_INSTRUCTORS, + TYPE_QUERY_GET_ALL_TRAINEES, + TYPE_QUERY_GET_ALL_GROUPS, TYPE_QUERY_NEW_INSTRUCTOR, TYPE_QUERY_DEL_INSTRUCTOR, TYPE_QUERY_EDIT_INSTRUCTOR, diff --git a/LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp b/LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp index 3a54eb4..dc63f85 100644 --- a/LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp +++ b/LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp @@ -29,6 +29,8 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) : flTryConnectToServer(false), cntTryConnectToServer(0), flTryLogin(false), + flTryReceiveFIM(false), + flTryReceiveAMM(false), language(languageENG), versionStr("..."), ui(new Ui::InstructorsAndTraineesWidget) @@ -58,6 +60,10 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) : connect(connectorToServer, &ConnectorToServer::signal_AnswerDocsChanged,this, &InstructorsAndTraineesWidget::slot_AnswerDocsChanged); connect(connectorToServer, &ConnectorToServer::signal_ServerBlockState, this, &InstructorsAndTraineesWidget::slot_ServerBlockState); + + connect(connectorToServer, &ConnectorToServer::signal_UpdateTasksFIM, this, &InstructorsAndTraineesWidget::slot_UpdateTasksFIM); + connect(connectorToServer, &ConnectorToServer::signal_UpdateTasksAMM, this, &InstructorsAndTraineesWidget::slot_UpdateTasksAMM); + messangerController = new MessangerController(connectorToServer, this); viewerTrainees = new ViewerTrainees(connectorToServer, messangerController, this); @@ -244,13 +250,15 @@ void InstructorsAndTraineesWidget::slot_checkLoginResult(ServerAuthorization *se messangerController->setUserLocalGUI_ID(serverAuth->Id.toInt()); + /* connectorToServer->sendQueryTasksXML("fim"); connectorToServer->sendQueryTasksXML("amm"); + */ viewerTrainees->activate(); viewerInstructors->activate(); - waitAnimationWidget->hideWithStop(); + //waitAnimationWidget->hideWithStop(); flTryLogin = false; } @@ -258,6 +266,8 @@ void InstructorsAndTraineesWidget::slot_checkLoginResult(ServerAuthorization *se { //waitAnimationWidget->hideWithStop(); //ui->btnAuthorizationInstructor->setChecked(false); + flTryReceiveFIM = false; + flTryReceiveAMM = false; } } @@ -300,6 +310,8 @@ void InstructorsAndTraineesWidget::slot_ServerBlocked() if(flTryLogin) { flTryLogin = false; + flTryReceiveFIM = false; + flTryReceiveAMM = false; waitAnimationWidget->hideWithStop(); ui->btnAuthorizationInstructor->setChecked(false); @@ -312,6 +324,8 @@ void InstructorsAndTraineesWidget::slot_ErrorAuth(QString error) if(flTryLogin) { flTryLogin = false; + flTryReceiveFIM = false; + flTryReceiveAMM = false; waitAnimationWidget->hideWithStop(); ui->btnAuthorizationInstructor->setChecked(false); @@ -441,6 +455,8 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state) updateLabelServer(); flTryLogin = false; + flTryReceiveFIM = false; + flTryReceiveAMM = false; } } @@ -501,6 +517,26 @@ void InstructorsAndTraineesWidget::slot_needShowWait(bool flNeed) waitAnimationWidget->hideWithStop(); } +void InstructorsAndTraineesWidget::slot_UpdateTasksAMM() +{ + if(flTryReceiveAMM) + { + flTryReceiveAMM = false; + if(!flTryReceiveAMM && !flTryReceiveFIM) + waitAnimationWidget->hideWithStop(); + } +} + +void InstructorsAndTraineesWidget::slot_UpdateTasksFIM() +{ + if(flTryReceiveFIM) + { + flTryReceiveFIM = false; + if(!flTryReceiveAMM && !flTryReceiveFIM) + waitAnimationWidget->hideWithStop(); + } +} + bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent) { dlgAuthorization = new DialogAuthorization(parent); @@ -528,6 +564,8 @@ bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent waitAnimationWidget->showWithPlay(); flTryLogin = true; + flTryReceiveFIM = true; + flTryReceiveAMM = true; connectorToServer->sendAuthorizationInstructorLocal(login, password); diff --git a/LibInstructorsAndTrainees/instructorsandtraineeswidget.h b/LibInstructorsAndTrainees/instructorsandtraineeswidget.h index c4520fa..9fb753f 100644 --- a/LibInstructorsAndTrainees/instructorsandtraineeswidget.h +++ b/LibInstructorsAndTrainees/instructorsandtraineeswidget.h @@ -72,6 +72,9 @@ public Q_SLOTS: void slot_needShowWait(bool flNeed); + void slot_UpdateTasksAMM(); + void slot_UpdateTasksFIM(); + Q_SIGNALS: //сигнал смены языка void signal_LanguageChanged(QString language); @@ -118,6 +121,8 @@ private: int cntTryConnectToServer; bool flTryLogin; + bool flTryReceiveFIM; + bool flTryReceiveAMM; QTranslator qtLanguageTranslator; QString language; diff --git a/LibServer/Systems/commonclienthandler.cpp b/LibServer/Systems/commonclienthandler.cpp index fb4b93c..c827e0f 100644 --- a/LibServer/Systems/commonclienthandler.cpp +++ b/LibServer/Systems/commonclienthandler.cpp @@ -36,7 +36,32 @@ void CommonClientHandler::sendCurrentVersionToAllClient() } } -void CommonClientHandler::slot_ListsInstructorsTraineesChanged() +void CommonClientHandler::slot_ListsInstructorsTraineesChanged_forUserID(int id_user) +{ + //Проходим все открытые сокеты + foreach(int idSocket, clientsMap->keys()) + { + ClientHandler *handler = clientsMap->value(idSocket); + //Проверяем, есть ли клиенты TYPE_GUI с нужным ID + if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI && + handler->getClient()->getId() == QString::number(id_user)) + {//Отправляем этому клиенту обновление списков + ClientQueryToDB queryToDB; + queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_ALL_LISTS; + processingSystem->processingClientQueryToDB(handler, queryToDB); + } + + /* + if(handler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT) + { + ClientQueryToDB queryToDB; + queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_CONTACT_LIST; + processingSystem->processingClientQueryToDB(handler, queryToDB); + }*/ + } +} + +void CommonClientHandler::slot_ListInstructorsChanged() { //Проходим все открытые сокеты foreach(int idSocket, clientsMap->keys()) @@ -46,7 +71,53 @@ void CommonClientHandler::slot_ListsInstructorsTraineesChanged() if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI) {//Отправляем этому клиенту обновление списков ClientQueryToDB queryToDB; - queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_ALL_LISTS; + queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_ALL_INSTRUCTORS; + processingSystem->processingClientQueryToDB(handler, queryToDB); + } + + if(handler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT) + { + ClientQueryToDB queryToDB; + queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_CONTACT_LIST; + processingSystem->processingClientQueryToDB(handler, queryToDB); + } + } +} + +void CommonClientHandler::slot_ListTraineesChanged() +{ + //Проходим все открытые сокеты + foreach(int idSocket, clientsMap->keys()) + { + ClientHandler *handler = clientsMap->value(idSocket); + //Проверяем, есть ли клиенты TYPE_GUI + if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI) + {//Отправляем этому клиенту обновление списков + ClientQueryToDB queryToDB; + queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_ALL_TRAINEES; + processingSystem->processingClientQueryToDB(handler, queryToDB); + } + + if(handler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT) + { + ClientQueryToDB queryToDB; + queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_CONTACT_LIST; + processingSystem->processingClientQueryToDB(handler, queryToDB); + } + } +} + +void CommonClientHandler::slot_ListGroupsChanged() +{ + //Проходим все открытые сокеты + foreach(int idSocket, clientsMap->keys()) + { + ClientHandler *handler = clientsMap->value(idSocket); + //Проверяем, есть ли клиенты TYPE_GUI + if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI) + {//Отправляем этому клиенту обновление списков + ClientQueryToDB queryToDB; + queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_ALL_GROUPS; processingSystem->processingClientQueryToDB(handler, queryToDB); } diff --git a/LibServer/Systems/commonclienthandler.h b/LibServer/Systems/commonclienthandler.h index e32be8b..2e48f94 100644 --- a/LibServer/Systems/commonclienthandler.h +++ b/LibServer/Systems/commonclienthandler.h @@ -19,7 +19,10 @@ public: void sendNewVersionListToAllClient(); void sendCurrentVersionToAllClient(); - void slot_ListsInstructorsTraineesChanged(); + void slot_ListsInstructorsTraineesChanged_forUserID(int id_user); + void slot_ListInstructorsChanged(); + void slot_ListTraineesChanged(); + void slot_ListGroupsChanged(); void slot_StatusTasksAMMofTraineeChanged(int trainee_id); void slot_StatusTasksFIMofTraineeChanged(int trainee_id); diff --git a/LibServer/Systems/processingsystem.cpp b/LibServer/Systems/processingsystem.cpp index 4a3a084..daf40ac 100644 --- a/LibServer/Systems/processingsystem.cpp +++ b/LibServer/Systems/processingsystem.cpp @@ -27,7 +27,10 @@ void ProcessingSystem::initialize(MultiThreadServer *server, DataParser *dataPar this->updateController = updateController; this->chatSystem = chatSystem; - connect(this,&ProcessingSystem::sigListsInstructorsTraineesChanged,commonClientHandler, &CommonClientHandler::slot_ListsInstructorsTraineesChanged,Qt::AutoConnection); + connect(this,&ProcessingSystem::sigListsInstructorsTraineesChanged_forUserID,commonClientHandler, &CommonClientHandler::slot_ListsInstructorsTraineesChanged_forUserID,Qt::AutoConnection); + connect(this,&ProcessingSystem::sigListInstructorsChanged,commonClientHandler, &CommonClientHandler::slot_ListInstructorsChanged,Qt::AutoConnection); + connect(this,&ProcessingSystem::sigListTraineesChanged,commonClientHandler, &CommonClientHandler::slot_ListTraineesChanged,Qt::AutoConnection); + connect(this,&ProcessingSystem::sigListGroupsChanged,commonClientHandler, &CommonClientHandler::slot_ListGroupsChanged,Qt::AutoConnection); connect(this,&ProcessingSystem::sigStatusTasksAMMofTraineeChanged,commonClientHandler, &CommonClientHandler::slot_StatusTasksAMMofTraineeChanged,Qt::AutoConnection); connect(this,&ProcessingSystem::sigStatusTasksFIMofTraineeChanged,commonClientHandler, &CommonClientHandler::slot_StatusTasksFIMofTraineeChanged,Qt::AutoConnection); @@ -98,6 +101,18 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien { client->sendVersion(); + + if(clientAutorization.TypeClient == TypeClientAutorization::TYPE_GUI) + {//Отправляем этому клиенту обновление ВСЕХ списков + emit sigListsInstructorsTraineesChanged_forUserID(clientID); + + ClientQueryTasksXML clientQueryTasksXML; + clientQueryTasksXML.Type = "fim"; + processingClientQueryTasksXML(client, clientQueryTasksXML); + clientQueryTasksXML.Type = "amm"; + processingClientQueryTasksXML(client, clientQueryTasksXML); + } + //Отправляем состояние блокировки /* if(server->getStateBlockAutorization() == EStateBlockAutorization::blocked) @@ -110,7 +125,13 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien //client->sendPacketType(PacketType::FREE); //Извещаем об изменениях в авторизации - emit sigListsInstructorsTraineesChanged(); + if(client->getClient()->getAccessType() == UserType::INSTRUCTOR) + { + //emit sigListGroupsChanged(); + emit sigListInstructorsChanged(); + } + else if(client->getClient()->getAccessType() == UserType::TRAINEE) + emit sigListTraineesChanged(); } else { @@ -169,7 +190,7 @@ void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, Cli client->sendXmlAnswer(arrayAnswer); //Извещаем об изменениях в авторизации - emit sigListsInstructorsTraineesChanged(); + emit sigListTraineesChanged(); } else if(providerDBLMS->deAuthorizationInstructor(clientDeAutorization.Login)) {//ДеАвторизуется инструктор @@ -187,7 +208,7 @@ void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, Cli providerDBLMS->signal_BlockAutorization(false, fullName, "DeAuthorizationInstructor"); //Извещаем об изменениях в авторизации - emit sigListsInstructorsTraineesChanged(); + emit sigListInstructorsChanged(); } else {//Никто не ДеАвторизовался @@ -311,6 +332,43 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu break; } + case TypeQueryToDB::TYPE_QUERY_GET_ALL_INSTRUCTORS: + { + QList listInstructors = providerDBLMS->GetListAllInstructors(); + + QByteArray arrayAnswer; + + arrayAnswer = dataParser->DbAnswer()->listInstructors(true, &listInstructors); + //client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS); + client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS); + + break; + } + case TypeQueryToDB::TYPE_QUERY_GET_ALL_TRAINEES: + { + QList listTrainees = providerDBLMS->GetListAllTrainees(); + + QByteArray arrayAnswer; + + arrayAnswer = dataParser->DbAnswer()->listTrainees(true, &listTrainees); + //client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES); + client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES); + + break; + } + case TypeQueryToDB::TYPE_QUERY_GET_ALL_GROUPS: + { + QList listGroups = providerDBLMS->GetListAllGroups(); + + QByteArray arrayAnswer; + + arrayAnswer = dataParser->DbAnswer()->listGroups(true, &listGroups); + //client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_GROUPS); + client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_GROUPS); + + break; + } + case TypeQueryToDB::TYPE_QUERY_NEW_INSTRUCTOR: { int id_new; @@ -320,19 +378,19 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu (*(Instructor*)data).setID(id_new); providerDBLMS->editInstructor(*(Instructor*)data); } - emit sigListsInstructorsTraineesChanged(); + emit sigListInstructorsChanged(); break; } case TypeQueryToDB::TYPE_QUERY_DEL_INSTRUCTOR: { providerDBLMS->delInstructor(id); - emit sigListsInstructorsTraineesChanged(); + emit sigListInstructorsChanged(); break; } case TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR: { providerDBLMS->editInstructor(*(Instructor*)data); - emit sigListsInstructorsTraineesChanged(); + emit sigListInstructorsChanged(); break; } @@ -345,19 +403,19 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu (*(Trainee*)data).setID(id_new); providerDBLMS->editTrainee(*(Trainee*)data); } - emit sigListsInstructorsTraineesChanged(); + emit sigListTraineesChanged(); break; } case TypeQueryToDB::TYPE_QUERY_DEL_TRAINEE: { providerDBLMS->delTrainee(id); - emit sigListsInstructorsTraineesChanged(); + emit sigListTraineesChanged(); break; } case TypeQueryToDB::TYPE_QUERY_EDIT_TRAINEE: { providerDBLMS->editTrainee(*(Trainee*)data); - emit sigListsInstructorsTraineesChanged(); + emit sigListTraineesChanged(); break; } @@ -370,19 +428,19 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu (*(Group*)data).setID(id_new); providerDBLMS->editGroup(*(Group*)data); } - emit sigListsInstructorsTraineesChanged(); + emit sigListGroupsChanged(); break; } case TypeQueryToDB::TYPE_QUERY_DEL_GROUP: { providerDBLMS->delGroup(id); - emit sigListsInstructorsTraineesChanged(); + emit sigListGroupsChanged(); break; } case TypeQueryToDB::TYPE_QUERY_EDIT_GROUP: { providerDBLMS->editGroup(*(Group*)data); - emit sigListsInstructorsTraineesChanged(); + emit sigListGroupsChanged(); break; } diff --git a/LibServer/Systems/processingsystem.h b/LibServer/Systems/processingsystem.h index 65e1ace..36ca024 100644 --- a/LibServer/Systems/processingsystem.h +++ b/LibServer/Systems/processingsystem.h @@ -65,7 +65,10 @@ public: void processingExitUnityClient(ClientHandler *client); signals: void sigUpdateListClients(); - void sigListsInstructorsTraineesChanged(); + void sigListsInstructorsTraineesChanged_forUserID(int id_user); + void sigListInstructorsChanged(); + void sigListTraineesChanged(); + void sigListGroupsChanged(); void sigStatusTasksAMMofTraineeChanged(int trainee_id); void sigStatusTasksFIMofTraineeChanged(int trainee_id); void sigAddToMessanger(QString login,QString text); diff --git a/translations/RRJServer_ru_RU.ts b/translations/RRJServer_ru_RU.ts index f5ab72f..80300cd 100644 --- a/translations/RRJServer_ru_RU.ts +++ b/translations/RRJServer_ru_RU.ts @@ -34,56 +34,56 @@ Удалить - + actual актуально - + update required требуется обновление - - + + DM code DM код - - + + ID ID - - + + Procedure AMM Процедура AMM - - + + Canplay Режимы - - + + Status Статус - + The deletion will be irrevocable. Delete it anyway? Удаление будет безвозвратным. Всё равно удалить? - - + + Assign this task? Назначить эту задачу? @@ -238,67 +238,67 @@ The status will be set: CommonView - + Name Имя - + Login Логин - + Password Пароль - + Class Класс - + Computer Компьютер - + IP address IP адрес - + Administrator Администратор - + Archived Архивный - + Tasks AMM Задачи AMM - + Tasks FIM Задачи FIM - + Online В сети - + ID ID - + Messages Сообщения @@ -804,47 +804,47 @@ Please try again later. Обновить Docs - + Driver PostgreSQL is not installed! Драйвер PostgreSQL не установлен! - + Superuser PostgreSQL authorization Авторизация суперпользователя PostgreSQL - - + + Error connecting to PostgreSQL! Ошибка соединения с PostgreSQL! - - + + Possible reasons: Возможные причины: - - + + superuser PostgreSQL login or password is incorrect; неверный логин или пароль суперпользователя PostgreSQL; - - + + port is incorrect; порт некорректен; - + PostgreSQL is not installed. PostgreSQL не установлен. - + file 'pg_hba.conf' does not contain an entry for the IP address: файл 'pg_hba.conf' не содержит запись для IP-адреса: @@ -1188,38 +1188,38 @@ The changes will not be accepted. Удалить - - + + ID ID - - + + Status Статус - - + + Procedure FIM Процедура FIM - - + + Device Устройство - + The deletion will be irrevocable. Delete it anyway? Удаление будет безвозвратным. Всё равно удалить? - + Assign this task? Назначить эту задачу? @@ -1431,7 +1431,7 @@ Please reconnect to the server. - + DM code DM код @@ -1446,12 +1446,12 @@ Please reconnect to the server. Назначить - + Subprocedure Подпроцедура - + Canplay Режимы