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:
@@ -457,6 +457,8 @@ int DataBaseLMS::updateGroup(Group group)
|
|||||||
|
|
||||||
int DataBaseLMS::insertTaskAMM(TaskAmmFim task, int id_trainee)
|
int DataBaseLMS::insertTaskAMM(TaskAmmFim task, int id_trainee)
|
||||||
{
|
{
|
||||||
|
task.ammProcedure.title = task.ammProcedure.title.replace("'", "''"); //Задваиваем одинарные кавычки
|
||||||
|
|
||||||
QString queryStr = QString("INSERT INTO public.tasks_amm (title, dm_code, trainee_task) "
|
QString queryStr = QString("INSERT INTO public.tasks_amm (title, dm_code, trainee_task) "
|
||||||
"VALUES ('%1', '%2', %3) "
|
"VALUES ('%1', '%2', %3) "
|
||||||
"RETURNING tasks_amm.task_id").arg(
|
"RETURNING tasks_amm.task_id").arg(
|
||||||
@@ -526,6 +528,8 @@ int DataBaseLMS::insertTaskFIM(TaskAmmFim task, int id_trainee)
|
|||||||
|
|
||||||
resBool = db->transaction();
|
resBool = db->transaction();
|
||||||
|
|
||||||
|
task.title = task.title.replace("'", "''"); //Задваиваем одинарные кавычки
|
||||||
|
|
||||||
queryStr = QString("INSERT INTO public.tasks_fim (title, trainee_task) "
|
queryStr = QString("INSERT INTO public.tasks_fim (title, trainee_task) "
|
||||||
"VALUES ('%1', %2) "
|
"VALUES ('%1', %2) "
|
||||||
"RETURNING tasks_fim.task_id").arg(
|
"RETURNING tasks_fim.task_id").arg(
|
||||||
@@ -541,6 +545,8 @@ int DataBaseLMS::insertTaskFIM(TaskAmmFim task, int id_trainee)
|
|||||||
|
|
||||||
for(Malfunction malfanction : task.malfunctionList)
|
for(Malfunction malfanction : task.malfunctionList)
|
||||||
{
|
{
|
||||||
|
malfanction.description = malfanction.description.replace("'", "''"); //Задваиваем одинарные кавычки
|
||||||
|
|
||||||
queryStr = QString("INSERT INTO public.malfunctions (num, dm_code, description, task_fim_malf) "
|
queryStr = QString("INSERT INTO public.malfunctions (num, dm_code, description, task_fim_malf) "
|
||||||
"VALUES ('%1', '%2', '%3', %4) "
|
"VALUES ('%1', '%2', '%3', %4) "
|
||||||
"RETURNING malfunctions.malfunction_id").arg(
|
"RETURNING malfunctions.malfunction_id").arg(
|
||||||
|
|||||||
@@ -233,6 +233,11 @@ QString InterfaceDataBaseLMS::getNameTraineeByLogin(QString login)
|
|||||||
return selectTraineeNameByLogin(login);
|
return selectTraineeNameByLogin(login);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int InterfaceDataBaseLMS::getIdTraineeByLogin(QString login)
|
||||||
|
{
|
||||||
|
return selectTraineeID(login);
|
||||||
|
}
|
||||||
|
|
||||||
QList<Trainee> InterfaceDataBaseLMS::getListTraineesInGroup(int id)
|
QList<Trainee> InterfaceDataBaseLMS::getListTraineesInGroup(int id)
|
||||||
{
|
{
|
||||||
return selectAllTraineesInGroup(id);
|
return selectAllTraineesInGroup(id);
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public:
|
|||||||
Trainee getTraineeOnComputer(QString computer_name);
|
Trainee getTraineeOnComputer(QString computer_name);
|
||||||
|
|
||||||
QString getNameTraineeByLogin(QString login);
|
QString getNameTraineeByLogin(QString login);
|
||||||
|
int getIdTraineeByLogin(QString login);
|
||||||
|
|
||||||
QList<Trainee> getListTraineesInGroup(int id);
|
QList<Trainee> getListTraineesInGroup(int id);
|
||||||
QList<Group> getListGroups();
|
QList<Group> getListGroups();
|
||||||
|
|||||||
@@ -86,6 +86,23 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien
|
|||||||
client->sendXmlAnswer(arrayAnswer);
|
client->sendXmlAnswer(arrayAnswer);
|
||||||
client->sendVersion();
|
client->sendVersion();
|
||||||
|
|
||||||
|
//Отправка списка задач клиенту Юнити
|
||||||
|
if(client->getClient()->getIsUnity())
|
||||||
|
{
|
||||||
|
QString login = client->getClient()->getLogin();
|
||||||
|
int id_trainee = providerDBLMS->getIdTraineeByLogin(login);
|
||||||
|
|
||||||
|
//AMM
|
||||||
|
QList<TaskAmmFim> listTasksAMM = providerDBLMS->GetListTasksAMMofTrainee(id_trainee);
|
||||||
|
QByteArray arrayAnswerTasksAMM = dataParser->DbAnswer()->listTasksAMMofTrainee(true, &listTasksAMM, id_trainee);
|
||||||
|
client->sendXmlAnswer(arrayAnswerTasksAMM, PacketType::TYPE_XMLANSWER_QUERY_TASKS_AMM_FOR_TRAINEE);
|
||||||
|
|
||||||
|
//FIM
|
||||||
|
QList<TaskAmmFim> listTasksFIM = providerDBLMS->GetListTasksFIMofTrainee(id_trainee);
|
||||||
|
QByteArray arrayAnswerFIM = dataParser->DbAnswer()->listTasksFIMofTrainee(true, &listTasksFIM, id_trainee);
|
||||||
|
client->sendXmlAnswer(arrayAnswerFIM, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_FOR_TRAINEE);
|
||||||
|
}
|
||||||
|
|
||||||
QString str = QString(arrayAnswer);
|
QString str = QString(arrayAnswer);
|
||||||
//logger->addTextToLogger("To Client: " + str);
|
//logger->addTextToLogger("To Client: " + str);
|
||||||
|
|
||||||
|
|||||||
@@ -222,6 +222,24 @@ bool ProviderDBLMS::deAuthorizationAll()
|
|||||||
return res1 && res2;
|
return res1 && res2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ProviderDBLMS::getIdTraineeByLogin(QString login)
|
||||||
|
{
|
||||||
|
int id_trainee = 0;
|
||||||
|
qDebug() << "ProviderDBLMS " << QThread::currentThreadId();
|
||||||
|
mtxAccess.lock();
|
||||||
|
|
||||||
|
if(! dbLMS->DBisConnected())
|
||||||
|
{
|
||||||
|
mtxAccess.unlock();
|
||||||
|
return id_trainee;
|
||||||
|
}
|
||||||
|
|
||||||
|
id_trainee = dbLMS->getIdTraineeByLogin(login);
|
||||||
|
|
||||||
|
mtxAccess.unlock();
|
||||||
|
return id_trainee;
|
||||||
|
}
|
||||||
|
|
||||||
QList<Instructor> ProviderDBLMS::GetListAllInstructors()
|
QList<Instructor> ProviderDBLMS::GetListAllInstructors()
|
||||||
{
|
{
|
||||||
QList<Instructor> listInstructors;
|
QList<Instructor> listInstructors;
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public:
|
|||||||
bool deAuthorizationAll();
|
bool deAuthorizationAll();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
int getIdTraineeByLogin(QString login);
|
||||||
|
|
||||||
QList<Instructor> GetListAllInstructors();
|
QList<Instructor> GetListAllInstructors();
|
||||||
QList<Trainee> GetListAllTrainees();
|
QList<Trainee> GetListAllTrainees();
|
||||||
QList<Group> GetListAllGroups();
|
QList<Group> GetListAllGroups();
|
||||||
|
|||||||
Reference in New Issue
Block a user