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:
@@ -530,11 +530,14 @@ int DataBaseLMS::insertTaskAMM(TaskAmmFim task, int id_trainee)
|
||||
|
||||
int DataBaseLMS::updateTaskAMM(TaskAmmFim task)
|
||||
{
|
||||
QString queryStr = QString("UPDATE public.tasks_amm SET title = '%1', dm_code = '%2' "
|
||||
"WHERE task_id = %3 "
|
||||
task.ammProcedure.title = task.ammProcedure.title.replace("'", "''"); //Задваиваем одинарные кавычки
|
||||
|
||||
QString queryStr = QString("UPDATE public.tasks_amm SET title = '%1', dm_code = '%2', status = '%3' "
|
||||
"WHERE task_id = %4 "
|
||||
"RETURNING tasks_amm.task_id").arg(
|
||||
task.ammProcedure.title,
|
||||
task.ammProcedure.dmCode,
|
||||
task.status,
|
||||
QString::number(task.getID()) );
|
||||
|
||||
return queryExecInt(queryStr);
|
||||
@@ -662,10 +665,13 @@ int DataBaseLMS::insertTaskFIM(TaskAmmFim task, int id_trainee)
|
||||
|
||||
int DataBaseLMS::updateTaskFIM(TaskAmmFim task)
|
||||
{
|
||||
QString queryStr = QString("UPDATE public.tasks_fim SET title = '%1' "
|
||||
"WHERE task_id = %2 "
|
||||
task.title = task.title.replace("'", "''"); //Задваиваем одинарные кавычки
|
||||
|
||||
QString queryStr = QString("UPDATE public.tasks_fim SET title = '%1', status = '%2' "
|
||||
"WHERE task_id = %3 "
|
||||
"RETURNING tasks_fim.task_id").arg(
|
||||
task.title,
|
||||
task.status,
|
||||
QString::number(task.getID()) );
|
||||
|
||||
return queryExecInt(queryStr);
|
||||
|
||||
@@ -20,7 +20,9 @@ enum TypeQueryToDB{
|
||||
TYPE_QUERY_GET_TASKS_FIM_FOR_TRAINEE,
|
||||
|
||||
TYPE_QUERY_DEL_TASK_AMM_TO_TRAINEE,
|
||||
TYPE_QUERY_DEL_TASK_FIM_TO_TRAINEE
|
||||
TYPE_QUERY_DEL_TASK_FIM_TO_TRAINEE,
|
||||
TYPE_QUERY_EDIT_TASK_AMM_TO_TRAINEE,
|
||||
TYPE_QUERY_EDIT_TASK_FIM_TO_TRAINEE
|
||||
};
|
||||
|
||||
#endif // TYPEQUERYTODB_H
|
||||
|
||||
@@ -63,6 +63,22 @@ void ProcessParser::read(ClientHandler *client, QByteArray array)
|
||||
{
|
||||
clientDataInfo(xmlReader,client);
|
||||
}
|
||||
else if(xmlReader.name() == "ListTasksAMM")
|
||||
{
|
||||
//TODO
|
||||
if(client->getClient()->getIsUnity())
|
||||
{//Отчет по задаче АММ от Юнити-клиента
|
||||
clientUnityTaskAMMreport(xmlReader,client, array);
|
||||
}
|
||||
}
|
||||
else if(xmlReader.name() == "ListTasksFIM")
|
||||
{
|
||||
//TODO
|
||||
if(client->getClient()->getIsUnity())
|
||||
{//Отчет по задаче FIM от Юнити-клиента
|
||||
clientUnityTaskFIMreport(xmlReader,client, array);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
emit sigLogMessage("XmlParser: unrecognized tag");
|
||||
@@ -93,6 +109,85 @@ void ProcessParser::clientDataInfo(QXmlStreamReader &xmlReader,ClientHandler *cl
|
||||
|
||||
}
|
||||
|
||||
void ProcessParser::clientUnityTaskAMMreport(QXmlStreamReader &xmlReader, ClientHandler *client, QByteArray array)
|
||||
{
|
||||
QDomDocument commonDOM;
|
||||
commonDOM.setContent(array);
|
||||
|
||||
QList<TaskAmmFim> listTasks;
|
||||
int trainee_id = 0;
|
||||
QDomNode listNode = commonDOM.namedItem("ListTasksAMM");
|
||||
trainee_id = listNode.toElement().attribute("trainee_id").toInt();
|
||||
|
||||
for(int i = 0; i < listNode.childNodes().count(); i++)
|
||||
{
|
||||
QDomNode taskNode = listNode.childNodes().at(i);
|
||||
if(taskNode.nodeName() == "taskAMM")
|
||||
{//Задача
|
||||
TaskAmmFim task;
|
||||
task.setID(taskNode.toElement().attribute("task_id").toInt());
|
||||
task.ammProcedure.title = taskNode.toElement().attribute("title");
|
||||
task.ammProcedure.dmCode = taskNode.toElement().attribute("dmCode");
|
||||
task.status = taskNode.toElement().attribute("status");
|
||||
|
||||
listTasks.append(task);
|
||||
|
||||
//Изменение задачи
|
||||
void* data = nullptr;
|
||||
data = &task;
|
||||
ClientQueryToDB queryToDB;
|
||||
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_EDIT_TASK_AMM_TO_TRAINEE;
|
||||
processingSystem->processingClientQueryToDB(client, queryToDB, trainee_id, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessParser::clientUnityTaskFIMreport(QXmlStreamReader &xmlReader, ClientHandler *client, QByteArray array)
|
||||
{
|
||||
QDomDocument commonDOM;
|
||||
commonDOM.setContent(array);
|
||||
|
||||
QList<TaskAmmFim> listTasks;
|
||||
int trainee_id = 0;
|
||||
QDomNode listNode = commonDOM.namedItem("ListTasksFIM");
|
||||
trainee_id = listNode.toElement().attribute("trainee_id").toInt();
|
||||
|
||||
for(int i = 0; i < listNode.childNodes().count(); i++)
|
||||
{//Задачи
|
||||
QDomNode taskNode = listNode.childNodes().at(i);
|
||||
if(taskNode.nodeName() == "taskFIM")
|
||||
{
|
||||
TaskAmmFim task;
|
||||
task.setID(taskNode.toElement().attribute("task_id").toInt());
|
||||
task.title = taskNode.toElement().attribute("title");
|
||||
task.status = taskNode.toElement().attribute("status");
|
||||
|
||||
for(int j = 0; j < taskNode.childNodes().count(); j++)
|
||||
{//Неисправности
|
||||
QDomNode malfunctionNode = taskNode.childNodes().at(j);
|
||||
if(malfunctionNode.nodeName() == "malfunction")
|
||||
{
|
||||
Malfunction malfunction;
|
||||
malfunction.num = malfunctionNode.toElement().attribute("num");
|
||||
malfunction.dmCode = malfunctionNode.toElement().attribute("dmCode");
|
||||
malfunction.description = malfunctionNode.toElement().attribute("description");
|
||||
|
||||
task.malfunctionList.append(malfunction);
|
||||
}
|
||||
}
|
||||
|
||||
listTasks.append(task);
|
||||
|
||||
//Изменение задачи
|
||||
void* data = nullptr;
|
||||
data = &task;
|
||||
ClientQueryToDB queryToDB;
|
||||
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_EDIT_TASK_FIM_TO_TRAINEE;
|
||||
processingSystem->processingClientQueryToDB(client, queryToDB, trainee_id, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TaskAmmFim ProcessParser::xmlParserQueryToDB_ASSIGN_TASK_FIM_TO_TRAINEE(QByteArray array)
|
||||
{
|
||||
TaskAmmFim task;
|
||||
|
||||
@@ -27,6 +27,8 @@ private:
|
||||
void clientMessage(QXmlStreamReader &xmlReader,ClientHandler *client);
|
||||
void clientNotify(QXmlStreamReader &xmlReader,ClientHandler *client);
|
||||
void clientDataInfo(QXmlStreamReader &xmlReader, ClientHandler *client);
|
||||
void clientUnityTaskAMMreport(QXmlStreamReader &xmlReader,ClientHandler *client, QByteArray array = QByteArray());
|
||||
void clientUnityTaskFIMreport(QXmlStreamReader &xmlReader,ClientHandler *client, QByteArray array = QByteArray());
|
||||
|
||||
TaskAmmFim xmlParserQueryToDB_ASSIGN_TASK_FIM_TO_TRAINEE(QByteArray array);
|
||||
};
|
||||
|
||||
@@ -328,6 +328,43 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case TypeQueryToDB::TYPE_QUERY_EDIT_TASK_AMM_TO_TRAINEE:
|
||||
{
|
||||
if(int id_trainee = providerDBLMS->editTaskAMM(*(TaskAmmFim*)data))
|
||||
{
|
||||
//Отправка списка задач AMM клиенту GUI
|
||||
//sendListTasksAMMofTraineetoClient(client, id_trainee);
|
||||
//Извещаем об изменениях в авторизации
|
||||
//emit sigListTasksAMMofTraineetoClientChanged();
|
||||
//TODO
|
||||
|
||||
//Отправка списка задач AMM клиенту Юнити
|
||||
if(ClientHandler* clientUnity = getUnityClientById(id_trainee))
|
||||
{//Есть такой
|
||||
sendListTasksAMMofTraineetoClient(clientUnity, id_trainee);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_EDIT_TASK_FIM_TO_TRAINEE:
|
||||
{
|
||||
if(int id_trainee = providerDBLMS->editTaskFIM(*(TaskAmmFim*)data))
|
||||
{
|
||||
//Отправка списка задач FIM клиенту GUI
|
||||
//sendListTasksFIMofTraineetoClient(client, id_trainee);
|
||||
//Извещаем об изменениях в авторизации
|
||||
//emit sigListTasksFIMofTraineetoClientChanged();
|
||||
//TODO
|
||||
|
||||
//Отправка списка задач FIM клиенту Юнити
|
||||
if(ClientHandler* clientUnity = getUnityClientById(id_trainee))
|
||||
{//Есть такой
|
||||
sendListTasksFIMofTraineetoClient(clientUnity, id_trainee);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user