mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Тайминг. Работает. Предварительно.
This commit is contained in:
@@ -25,6 +25,8 @@ add_library(DataBaseLMS SHARED
|
|||||||
tasksAmmFim.cpp
|
tasksAmmFim.cpp
|
||||||
tasksAmmFim.h
|
tasksAmmFim.h
|
||||||
typeQueryToDB.h
|
typeQueryToDB.h
|
||||||
|
timingoftrainee.cpp
|
||||||
|
timingoftrainee.h
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(DataBaseLMS PRIVATE Qt5::Widgets)
|
target_link_libraries(DataBaseLMS PRIVATE Qt5::Widgets)
|
||||||
|
|||||||
@@ -1691,6 +1691,58 @@ int DataBaseLMS::updateTrainee(Trainee trainee)
|
|||||||
return queryExecInt(queryStr);
|
return queryExecInt(queryStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DataBaseLMS::insertTimingTrainee(int id_trainee)
|
||||||
|
{
|
||||||
|
QString queryStr = QString("INSERT INTO public.timings (entry_time, exit_time, operating_time, timing_trainee) "
|
||||||
|
"VALUES (DEFAULT, DEFAULT, DEFAULT, %1) "
|
||||||
|
"RETURNING timings.timing_id").arg(
|
||||||
|
QString::number(id_trainee));
|
||||||
|
|
||||||
|
return queryExecInt(queryStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DataBaseLMS::updateTimingTrainee(int id_trainee, TimingOfTrainee timing)
|
||||||
|
{
|
||||||
|
QString queryStr = QString("UPDATE public.timings "
|
||||||
|
"SET entry_time = '%1', exit_time = '%2', operating_time = '%3', timing_trainee = %4 "
|
||||||
|
"WHERE timing_id = %5 "
|
||||||
|
"RETURNING timings.timing_id").arg(
|
||||||
|
timing.getEntryTime(),
|
||||||
|
timing.getExitTime(),
|
||||||
|
timing.getOperatingTime(),
|
||||||
|
QString::number(id_trainee),
|
||||||
|
QString::number(timing.getID()) );
|
||||||
|
|
||||||
|
return queryExecInt(queryStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
TimingOfTrainee DataBaseLMS::selectTimingTrainee(int id_trainee)
|
||||||
|
{
|
||||||
|
TimingOfTrainee timing;
|
||||||
|
|
||||||
|
QString queryStr;
|
||||||
|
|
||||||
|
queryStr = QString("SELECT timings.timing_id, timings.entry_time, timings.exit_time, timings.operating_time, timings.timing_trainee "
|
||||||
|
"FROM public.timings "
|
||||||
|
"WHERE timing_trainee = '%1'").arg(id_trainee);
|
||||||
|
|
||||||
|
QSqlQuery querySel = QSqlQuery(*db);
|
||||||
|
|
||||||
|
if(queryExec(queryStr, &querySel))
|
||||||
|
{
|
||||||
|
if (querySel.first())
|
||||||
|
{//Тайминг
|
||||||
|
timing.setID(querySel.value(0).toInt());
|
||||||
|
timing.setEntryTime(querySel.value(1).toDateTime().toString());
|
||||||
|
timing.setExitTime(querySel.value(2).toDateTime().toString());
|
||||||
|
timing.setOperatingTime(querySel.value(3).toTime().toString());
|
||||||
|
timing.setTraineeID(querySel.value(4).toInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return timing;
|
||||||
|
}
|
||||||
|
|
||||||
int DataBaseLMS::queryExecInt(QString queryStr)
|
int DataBaseLMS::queryExecInt(QString queryStr)
|
||||||
{
|
{
|
||||||
QSqlQuery query = QSqlQuery(*db);
|
QSqlQuery query = QSqlQuery(*db);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "trainee.h"
|
#include "trainee.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "tasksAmmFim.h"
|
#include "tasksAmmFim.h"
|
||||||
|
#include "timingoftrainee.h"
|
||||||
|
|
||||||
class DataBaseSettings
|
class DataBaseSettings
|
||||||
{
|
{
|
||||||
@@ -101,6 +102,11 @@ protected:
|
|||||||
int deleteTrainee(int id_trainee);
|
int deleteTrainee(int id_trainee);
|
||||||
int updateTrainee(Trainee trainee);
|
int updateTrainee(Trainee trainee);
|
||||||
|
|
||||||
|
//Тайминг
|
||||||
|
int insertTimingTrainee(int id_trainee);
|
||||||
|
int updateTimingTrainee(int id_trainee, TimingOfTrainee timing);
|
||||||
|
TimingOfTrainee selectTimingTrainee(int id_trainee);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DataBaseSettings getDataBaseSettings();
|
DataBaseSettings getDataBaseSettings();
|
||||||
int queryExecInt(QString queryStr);
|
int queryExecInt(QString queryStr);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QSqlError>
|
#include <QSqlError>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QTime>
|
||||||
#include "interfacedatabaselms.h"
|
#include "interfacedatabaselms.h"
|
||||||
|
|
||||||
InterfaceDataBaseLMS::InterfaceDataBaseLMS(QWidget* parent):
|
InterfaceDataBaseLMS::InterfaceDataBaseLMS(QWidget* parent):
|
||||||
@@ -218,6 +220,86 @@ bool InterfaceDataBaseLMS::deAuthorizationAllTrainees()
|
|||||||
return updateAllTraineesLoggedIn(false);
|
return updateAllTraineesLoggedIn(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int InterfaceDataBaseLMS::entryTraineeOnSimulator(int id_trainee)
|
||||||
|
{
|
||||||
|
TimingOfTrainee timing;
|
||||||
|
|
||||||
|
QDateTime dataTime_entry = QDateTime::currentDateTime();
|
||||||
|
QDateTime dataTime_exit;
|
||||||
|
int interval;
|
||||||
|
|
||||||
|
QString dataTimeStr_entry = dataTime_entry.toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||||
|
QString dataTimeStr_exit = "";
|
||||||
|
QString intervalStr = "";
|
||||||
|
|
||||||
|
timing = selectTimingTrainee(id_trainee);
|
||||||
|
|
||||||
|
if(timing.getID())
|
||||||
|
{//Запись уже есть в базе
|
||||||
|
dataTime_exit = QDateTime::fromString(timing.getExitTime());
|
||||||
|
dataTimeStr_exit = dataTime_exit.toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||||
|
intervalStr = timing.getOperatingTime();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//Еще нет записи
|
||||||
|
int timing_id = insertTimingTrainee(id_trainee);
|
||||||
|
timing.setID(timing_id);
|
||||||
|
|
||||||
|
dataTime_exit = dataTime_entry;
|
||||||
|
interval = dataTime_entry.secsTo(dataTime_exit);
|
||||||
|
dataTimeStr_exit = dataTime_exit.toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||||
|
intervalStr = QString::number(interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
timing.setTraineeID(id_trainee);
|
||||||
|
timing.setEntryTime(dataTimeStr_entry);
|
||||||
|
timing.setExitTime(dataTimeStr_exit);
|
||||||
|
timing.setOperatingTime(intervalStr);
|
||||||
|
|
||||||
|
return updateTimingTrainee(id_trainee, timing);
|
||||||
|
}
|
||||||
|
|
||||||
|
int InterfaceDataBaseLMS::exitTraineeFromSimulator(int id_trainee)
|
||||||
|
{
|
||||||
|
TimingOfTrainee timing;
|
||||||
|
|
||||||
|
QDateTime dataTime_entry;
|
||||||
|
QDateTime dataTime_exit = QDateTime::currentDateTime();
|
||||||
|
int interval;
|
||||||
|
|
||||||
|
QString dataTimeStr_entry = "";
|
||||||
|
QString dataTimeStr_exit = dataTime_exit.toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||||
|
QString intervalStr = "";
|
||||||
|
|
||||||
|
timing = selectTimingTrainee(id_trainee);
|
||||||
|
|
||||||
|
if(timing.getID())
|
||||||
|
{//Запись уже есть в базе
|
||||||
|
dataTime_entry = QDateTime::fromString(timing.getEntryTime());
|
||||||
|
dataTimeStr_entry = dataTime_entry.toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||||
|
interval = QTime::fromString(timing.getOperatingTime()).second() + dataTime_entry.secsTo(dataTime_exit);
|
||||||
|
//interval = dataTime_entry.secsTo(dataTime_exit);
|
||||||
|
intervalStr = QString::number(interval);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//Еще нет записи
|
||||||
|
int timing_id = insertTimingTrainee(id_trainee);
|
||||||
|
timing.setID(timing_id);
|
||||||
|
|
||||||
|
dataTime_entry = dataTime_exit;
|
||||||
|
interval = dataTime_entry.secsTo(dataTime_exit);
|
||||||
|
dataTimeStr_entry = dataTime_entry.toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||||
|
intervalStr = QString::number(interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
timing.setTraineeID(id_trainee);
|
||||||
|
timing.setEntryTime(dataTimeStr_entry);
|
||||||
|
timing.setExitTime(dataTimeStr_exit);
|
||||||
|
timing.setOperatingTime(intervalStr);
|
||||||
|
|
||||||
|
return updateTimingTrainee(id_trainee, timing);
|
||||||
|
}
|
||||||
|
|
||||||
QString InterfaceDataBaseLMS::getNameTraineeOnComputer(QString computer_name)
|
QString InterfaceDataBaseLMS::getNameTraineeOnComputer(QString computer_name)
|
||||||
{
|
{
|
||||||
return selectTraineeNameOnComputer(computer_name);
|
return selectTraineeNameOnComputer(computer_name);
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ public:
|
|||||||
bool deAuthorizationTrainee(QString login);
|
bool deAuthorizationTrainee(QString login);
|
||||||
bool deAuthorizationAllTrainees();
|
bool deAuthorizationAllTrainees();
|
||||||
|
|
||||||
|
//Регистрация тайминга Обучаемого
|
||||||
|
int entryTraineeOnSimulator(int id_trainee);
|
||||||
|
int exitTraineeFromSimulator(int id_trainee);
|
||||||
|
|
||||||
|
|
||||||
//void setTasks(QString login, QStringList tasks);
|
//void setTasks(QString login, QStringList tasks);
|
||||||
|
|
||||||
QString getNameTraineeOnComputer(QString computer_name);
|
QString getNameTraineeOnComputer(QString computer_name);
|
||||||
|
|||||||
6
DataBaseLMS/timingoftrainee.cpp
Normal file
6
DataBaseLMS/timingoftrainee.cpp
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include "timingoftrainee.h"
|
||||||
|
|
||||||
|
TimingOfTrainee::TimingOfTrainee()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
34
DataBaseLMS/timingoftrainee.h
Normal file
34
DataBaseLMS/timingoftrainee.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#ifndef TIMINGOFTRAINEE_H
|
||||||
|
#define TIMINGOFTRAINEE_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class TimingOfTrainee
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TimingOfTrainee();
|
||||||
|
|
||||||
|
void setID(int timing_id){this->timing_id = timing_id;}
|
||||||
|
int getID(){return timing_id;}
|
||||||
|
|
||||||
|
void setEntryTime(QString entry_time){this->entry_time = entry_time;}
|
||||||
|
QString getEntryTime(){return entry_time;}
|
||||||
|
|
||||||
|
void setExitTime(QString exit_time){this->exit_time = exit_time;}
|
||||||
|
QString getExitTime(){return exit_time;}
|
||||||
|
|
||||||
|
void setOperatingTime(QString operating_time){this->operating_time = operating_time;}
|
||||||
|
QString getOperatingTime(){return operating_time;}
|
||||||
|
|
||||||
|
void setTraineeID(int trainee_id){this->trainee_id = trainee_id;}
|
||||||
|
int getTraineeID(){return trainee_id;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
int timing_id = 0;
|
||||||
|
QString entry_time = "";
|
||||||
|
QString exit_time = "";
|
||||||
|
QString operating_time = "";
|
||||||
|
int trainee_id = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TIMINGOFTRAINEE_H
|
||||||
@@ -96,6 +96,16 @@ public:
|
|||||||
isLoggedIn = value;
|
isLoggedIn = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setAccessType(QString type)
|
||||||
|
{
|
||||||
|
accessType = type;
|
||||||
|
}
|
||||||
|
QString getAccessType()
|
||||||
|
{
|
||||||
|
return accessType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString name;
|
QString name;
|
||||||
@@ -109,6 +119,7 @@ private:
|
|||||||
bool isUnity = false;
|
bool isUnity = false;
|
||||||
|
|
||||||
TypeClientAutorization TypeClient;
|
TypeClientAutorization TypeClient;
|
||||||
|
QString accessType = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLIENT_H
|
#endif // CLIENT_H
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ enum PacketType
|
|||||||
TYPE_FILESIZE = 20,
|
TYPE_FILESIZE = 20,
|
||||||
TYPE_BIGXML = 21,
|
TYPE_BIGXML = 21,
|
||||||
|
|
||||||
TYPE_XMLANSWER_MESSAGE_FOR_GUI = 90,
|
TYPE_XMLANSWER_MESSAGE_FOR_GUI = 90,
|
||||||
|
|
||||||
//xml-ответы на запросы к БД
|
//xml-ответы на запросы к БД
|
||||||
TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS = 100,
|
TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS = 100,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ void ProcessParser::initialize(ProcessingSystem *processingSystem)
|
|||||||
this->processingSystem = processingSystem;
|
this->processingSystem = processingSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessParser::read(ClientHandler *client, QByteArray array)
|
void ProcessParser::slot_read(ClientHandler *client, QByteArray array)
|
||||||
{
|
{
|
||||||
QXmlStreamReader xmlReader(array);
|
QXmlStreamReader xmlReader(array);
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,9 @@ class ProcessParser : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit ProcessParser(QObject *parent = nullptr);
|
explicit ProcessParser(QObject *parent = nullptr);
|
||||||
void initialize(ProcessingSystem *processingSystem);
|
void initialize(ProcessingSystem *processingSystem);
|
||||||
void read(ClientHandler *client, QByteArray array);
|
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void slot_read(ClientHandler *client, QByteArray array);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigLogMessage(QString text);
|
void sigLogMessage(QString text);
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien
|
|||||||
{//Авторизуется инструктор
|
{//Авторизуется инструктор
|
||||||
|
|
||||||
client->getClient()->setLogin(clientAutorization.Login);
|
client->getClient()->setLogin(clientAutorization.Login);
|
||||||
|
client->getClient()->setAccessType("instructor");
|
||||||
client->getClient()->setTypeClient(clientAutorization.TypeClient);
|
client->getClient()->setTypeClient(clientAutorization.TypeClient);
|
||||||
emit sigUpdateListClients();
|
emit sigUpdateListClients();
|
||||||
|
|
||||||
@@ -72,6 +73,7 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien
|
|||||||
{//Авторизуется обучаемый
|
{//Авторизуется обучаемый
|
||||||
|
|
||||||
client->getClient()->setLogin(clientAutorization.Login);
|
client->getClient()->setLogin(clientAutorization.Login);
|
||||||
|
client->getClient()->setAccessType("trainee");
|
||||||
emit sigUpdateListClients();
|
emit sigUpdateListClients();
|
||||||
|
|
||||||
//KAV redact
|
//KAV redact
|
||||||
@@ -120,6 +122,7 @@ void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, Cli
|
|||||||
{//ДеАвторизуется обучаемый
|
{//ДеАвторизуется обучаемый
|
||||||
|
|
||||||
client->getClient()->setLogin("");
|
client->getClient()->setLogin("");
|
||||||
|
client->getClient()->setAccessType("");
|
||||||
emit sigUpdateListClients();
|
emit sigUpdateListClients();
|
||||||
|
|
||||||
arrayAnswer = dataParser->ClientAnswer()->deAuthorization(true, clientDeAutorization.Login);
|
arrayAnswer = dataParser->ClientAnswer()->deAuthorization(true, clientDeAutorization.Login);
|
||||||
@@ -128,6 +131,7 @@ void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, Cli
|
|||||||
{//ДеАвторизуется инструктор
|
{//ДеАвторизуется инструктор
|
||||||
|
|
||||||
client->getClient()->setLogin("");
|
client->getClient()->setLogin("");
|
||||||
|
client->getClient()->setAccessType("");
|
||||||
emit sigUpdateListClients();
|
emit sigUpdateListClients();
|
||||||
|
|
||||||
arrayAnswer = dataParser->ClientAnswer()->deAuthorization(true, clientDeAutorization.Login);
|
arrayAnswer = dataParser->ClientAnswer()->deAuthorization(true, clientDeAutorization.Login);
|
||||||
@@ -160,6 +164,38 @@ void ProcessingSystem::processingClientDeAutorization(QString login)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProcessingSystem::processingEntryUnityClient(ClientHandler *client)
|
||||||
|
{
|
||||||
|
QString login = client->getClient()->getLogin();
|
||||||
|
QString accessType = client->getClient()->getAccessType();
|
||||||
|
|
||||||
|
if(accessType == "trainee")
|
||||||
|
{
|
||||||
|
int id_trainee = providerDBLMS->getIdTraineeByLogin(login);
|
||||||
|
providerDBLMS->entryTraineeOnSimulator(id_trainee);
|
||||||
|
}
|
||||||
|
else if(accessType == "instructor")
|
||||||
|
{
|
||||||
|
//Здесь пока ничего не происходит
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProcessingSystem::processingExitUnityClient(ClientHandler *client)
|
||||||
|
{
|
||||||
|
QString login = client->getClient()->getLogin();
|
||||||
|
QString accessType = client->getClient()->getAccessType();
|
||||||
|
|
||||||
|
if(accessType == "trainee")
|
||||||
|
{
|
||||||
|
int id_trainee = providerDBLMS->getIdTraineeByLogin(login);
|
||||||
|
providerDBLMS->exitTraineeFromSimulator(id_trainee);
|
||||||
|
}
|
||||||
|
else if(accessType == "instructor")
|
||||||
|
{
|
||||||
|
//Здесь пока ничего не происходит
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id, void* data)
|
void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id, void* data)
|
||||||
{
|
{
|
||||||
qDebug() << "ProcessingQueryThread " << QThread::currentThreadId();
|
qDebug() << "ProcessingQueryThread " << QThread::currentThreadId();
|
||||||
@@ -477,9 +513,24 @@ void ProcessingSystem::processingClientNotify(ClientHandler *client, ClientNotif
|
|||||||
sendTaskListToUnity(client);
|
sendTaskListToUnity(client);
|
||||||
client->getSocket()->flush();
|
client->getSocket()->flush();
|
||||||
}
|
}
|
||||||
|
else if(clientNotify.Code == commandStartTimerClient)
|
||||||
|
{
|
||||||
|
//Фиксируем время входа Юнити-клиента
|
||||||
|
if (client->getClient()->getIsUnity())
|
||||||
|
{
|
||||||
|
processingEntryUnityClient(client);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(clientNotify.Code == commandDisableClient)
|
else if(clientNotify.Code == commandDisableClient)
|
||||||
{
|
{
|
||||||
qDebug() << "processing thread: " << QThread::currentThreadId();
|
qDebug() << "processing thread: " << QThread::currentThreadId();
|
||||||
|
|
||||||
|
//Фиксируем время выхода Юнити-клиента
|
||||||
|
if (client->getClient()->getIsUnity())
|
||||||
|
{
|
||||||
|
processingExitUnityClient(client);
|
||||||
|
}
|
||||||
|
|
||||||
client->sendDisable();
|
client->sendDisable();
|
||||||
}
|
}
|
||||||
else if(clientNotify.Code == commandGetServerDataList)
|
else if(clientNotify.Code == commandGetServerDataList)
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ public:
|
|||||||
|
|
||||||
ClientHandler* getUnityClientById(int id);
|
ClientHandler* getUnityClientById(int id);
|
||||||
void processingClientDeAutorization(QString login);
|
void processingClientDeAutorization(QString login);
|
||||||
|
|
||||||
|
void processingEntryUnityClient(ClientHandler *client);
|
||||||
|
void processingExitUnityClient(ClientHandler *client);
|
||||||
signals:
|
signals:
|
||||||
void sigUpdateListClients();
|
void sigUpdateListClients();
|
||||||
void sigListsInstructorsTraineesChanged();
|
void sigListsInstructorsTraineesChanged();
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ void RecognizeSystem::initialize(UpdateController *updateController,DataParser*
|
|||||||
connect(this,&RecognizeSystem::sigChangeVersion,updateController,&UpdateController::changeAssetVersion,Qt::AutoConnection);
|
connect(this,&RecognizeSystem::sigChangeVersion,updateController,&UpdateController::changeAssetVersion,Qt::AutoConnection);
|
||||||
connect(this,&RecognizeSystem::sigDeleteVersion,updateController,&UpdateController::deleteAssetVersion,Qt::AutoConnection);
|
connect(this,&RecognizeSystem::sigDeleteVersion,updateController,&UpdateController::deleteAssetVersion,Qt::AutoConnection);
|
||||||
connect(this,&RecognizeSystem::sigCopyVersion,updateController,&UpdateController::createCopyVersion,Qt::AutoConnection);
|
connect(this,&RecognizeSystem::sigCopyVersion,updateController,&UpdateController::createCopyVersion,Qt::AutoConnection);
|
||||||
connect(this,&RecognizeSystem::sigXmlParser,dataParser->getProcessParser(),&ProcessParser::read,Qt::DirectConnection);
|
connect(this,&RecognizeSystem::sigXmlParser,dataParser->getProcessParser(),&ProcessParser::slot_read,Qt::DirectConnection);
|
||||||
|
|
||||||
qDebug() << "Recognize init thread ID " << QThread::currentThreadId();
|
qDebug() << "Recognize init thread ID " << QThread::currentThreadId();
|
||||||
}
|
}
|
||||||
@@ -455,6 +455,7 @@ void RecognizeSystem::packetTypeInit(PacketType packet,Client *client)
|
|||||||
else if (packet == PacketType::TYPE_UNITY)
|
else if (packet == PacketType::TYPE_UNITY)
|
||||||
{
|
{
|
||||||
client->setUnity(true);
|
client->setUnity(true);
|
||||||
|
//Фиксируем время входа Юнити-клиента
|
||||||
}
|
}
|
||||||
|
|
||||||
isPackageTypeInited = true;
|
isPackageTypeInited = true;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ private:
|
|||||||
bool isPackageTypeInited;
|
bool isPackageTypeInited;
|
||||||
|
|
||||||
void packetTypeInit(PacketType packet,Client *client);
|
void packetTypeInit(PacketType packet,Client *client);
|
||||||
void packetTypeInit(PacketType type);
|
//void packetTypeInit(PacketType type);
|
||||||
|
|
||||||
bool checkIsChangeable();
|
bool checkIsChangeable();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ static const QString commandGetServerDataList = "GETSERVERDATALIST";
|
|||||||
static const QString commandCheckVersionList = "CHECKVERSIONLIST";
|
static const QString commandCheckVersionList = "CHECKVERSIONLIST";
|
||||||
static const QString commandReadyClient = "READY";
|
static const QString commandReadyClient = "READY";
|
||||||
static const QString commandDisableClient = "DISABLE";
|
static const QString commandDisableClient = "DISABLE";
|
||||||
|
static const QString commandStartTimerClient = "UNITYSTARTTIMER";
|
||||||
static const QString commandDuplicateVerName = "DUPLICATEVERNAME";
|
static const QString commandDuplicateVerName = "DUPLICATEVERNAME";
|
||||||
static const QString commandHashCompleteClient = "HASHSENDCOMPLETE";
|
static const QString commandHashCompleteClient = "HASHSENDCOMPLETE";
|
||||||
static const QString commandCanChangeVersion = "CANCHANGE";
|
static const QString commandCanChangeVersion = "CANCHANGE";
|
||||||
|
|||||||
@@ -222,6 +222,22 @@ bool ProviderDBLMS::deAuthorizationAll()
|
|||||||
return res1 && res2;
|
return res1 && res2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ProviderDBLMS::entryTraineeOnSimulator(int id_trainee)
|
||||||
|
{
|
||||||
|
if(dbLMS->entryTraineeOnSimulator(id_trainee))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProviderDBLMS::exitTraineeFromSimulator(int id_trainee)
|
||||||
|
{
|
||||||
|
if(dbLMS->exitTraineeFromSimulator(id_trainee))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int ProviderDBLMS::getIdTraineeByLogin(QString login)
|
int ProviderDBLMS::getIdTraineeByLogin(QString login)
|
||||||
{
|
{
|
||||||
int id_trainee = 0;
|
int id_trainee = 0;
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ public:
|
|||||||
//Общая деавторизация
|
//Общая деавторизация
|
||||||
bool deAuthorizationAll();
|
bool deAuthorizationAll();
|
||||||
|
|
||||||
|
//Регистрация тайминга Обучаемого
|
||||||
|
bool entryTraineeOnSimulator(int id_trainee);
|
||||||
|
bool exitTraineeFromSimulator(int id_trainee);
|
||||||
|
|
||||||
//
|
//
|
||||||
int getIdTraineeByLogin(QString login);
|
int getIdTraineeByLogin(QString login);
|
||||||
int getIdInstructorByLogin(QString login);
|
int getIdInstructorByLogin(QString login);
|
||||||
|
|||||||
@@ -130,16 +130,24 @@ bool ServerLMSWidget::stopServer()
|
|||||||
//Закрываем все открытые сокеты
|
//Закрываем все открытые сокеты
|
||||||
foreach(int idSocket, clientsMap.keys())
|
foreach(int idSocket, clientsMap.keys())
|
||||||
{
|
{
|
||||||
clientsMap[idSocket]->sigSendXmlAnswer(arrayAnswer,PacketType::TYPE_XMLANSWER);
|
ClientHandler* clientHandlerOpen = clientsMap[idSocket];
|
||||||
|
|
||||||
|
//Фиксируем время выхода Юнити-клиента
|
||||||
|
if(clientHandlerOpen->getClient()->getIsUnity())
|
||||||
|
{
|
||||||
|
processingSystem->processingExitUnityClient(clientHandlerOpen);
|
||||||
|
}
|
||||||
|
|
||||||
|
clientHandlerOpen->sigSendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER);
|
||||||
//while (!clientsMap[idSocket]->sigSocketFlush()) {}
|
//while (!clientsMap[idSocket]->sigSocketFlush()) {}
|
||||||
|
|
||||||
QString str = QString(arrayAnswer);
|
QString str = QString(arrayAnswer);
|
||||||
emit sigLog("To Client: " + str);
|
emit sigLog("To Client: " + str);
|
||||||
|
|
||||||
//slotDisconnectClient(clientsMap[idSocket]->get, QString peerPort)
|
//slotDisconnectClient(clientsMap[idSocket]->get, QString peerPort)
|
||||||
processingSystem->processingClientDeAutorization(clientsMap[idSocket]->getClient()->getLogin());
|
processingSystem->processingClientDeAutorization(clientHandlerOpen->getClient()->getLogin());
|
||||||
|
|
||||||
clientsMap[idSocket]->sigSocketClose();
|
clientHandlerOpen->sigSocketClose();
|
||||||
//clientsMap.remove(idSocket);
|
//clientsMap.remove(idSocket);
|
||||||
removeClient(idSocket);
|
removeClient(idSocket);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user