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:
@@ -690,13 +690,48 @@ int DataBaseLMS::updateTaskFIM(TaskAmmFim task)
|
|||||||
|
|
||||||
int DataBaseLMS::updateStatusTaskFIM(int task_id, QString status)
|
int DataBaseLMS::updateStatusTaskFIM(int task_id, QString status)
|
||||||
{
|
{
|
||||||
QString queryStr = QString("UPDATE public.tasks_fim SET status = '%1' "
|
QString queryStr;
|
||||||
|
bool resBool = false;
|
||||||
|
int id_trainee = 0;
|
||||||
|
|
||||||
|
resBool = db->transaction();
|
||||||
|
|
||||||
|
queryStr = QString("SELECT trainees.trainee_id "
|
||||||
|
"FROM public.trainees JOIN public.tasks_fim ON trainees.trainee_id = tasks_fim.trainee_task "
|
||||||
|
"WHERE tasks_fim.task_id = %1 "
|
||||||
|
"ORDER BY trainees.trainee_id ASC").arg(
|
||||||
|
QString::number(task_id));
|
||||||
|
|
||||||
|
QSqlQuery query = QSqlQuery(*db);
|
||||||
|
|
||||||
|
if(queryExec(queryStr, &query))
|
||||||
|
{
|
||||||
|
if (query.first())
|
||||||
|
{//Обучаемый
|
||||||
|
id_trainee = query.value(0).toInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!id_trainee)
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
queryStr = QString("UPDATE public.tasks_fim SET status = '%1' "
|
||||||
"WHERE task_id = %2 "
|
"WHERE task_id = %2 "
|
||||||
"RETURNING tasks_fim.task_id").arg(
|
"RETURNING tasks_fim.task_id").arg(
|
||||||
status,
|
status,
|
||||||
QString::number(task_id) );
|
QString::number(task_id) );
|
||||||
|
|
||||||
return queryExecInt(queryStr);
|
QSqlQuery query1 = QSqlQuery(*db);
|
||||||
|
if(!queryExec(queryStr, &query1))
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
resBool = db->commit();
|
||||||
|
return id_trainee;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DataBaseLMS::deleteTaskFIM(int id_task)
|
int DataBaseLMS::deleteTaskFIM(int id_task)
|
||||||
|
|||||||
@@ -338,11 +338,6 @@ int InterfaceDataBaseLMS::editTaskFIM(TaskAmmFim task)
|
|||||||
return updateTaskFIM(task);
|
return updateTaskFIM(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::editStatusTaskFIM(int task_id, QString status)
|
|
||||||
{
|
|
||||||
return updateStatusTaskFIM(task_id, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::replaceReportFIM(TaskAmmFim task)
|
int InterfaceDataBaseLMS::replaceReportFIM(TaskAmmFim task)
|
||||||
{
|
{
|
||||||
deleteReportFIM(task.getID());
|
deleteReportFIM(task.getID());
|
||||||
@@ -356,6 +351,11 @@ int InterfaceDataBaseLMS::replaceReportFIM(TaskAmmFim task)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int InterfaceDataBaseLMS::changeStatusTaskFIM(int id_task, QString status)
|
||||||
|
{
|
||||||
|
return updateStatusTaskFIM(id_task, status);
|
||||||
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::newTrainee(int id_group)
|
int InterfaceDataBaseLMS::newTrainee(int id_group)
|
||||||
{
|
{
|
||||||
return insertTrainee(id_group);
|
return insertTrainee(id_group);
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ public:
|
|||||||
int newTaskFIM(TaskAmmFim task, int id_trainee);
|
int newTaskFIM(TaskAmmFim task, int id_trainee);
|
||||||
int delTaskFIM(int id);
|
int delTaskFIM(int id);
|
||||||
int editTaskFIM(TaskAmmFim task);
|
int editTaskFIM(TaskAmmFim task);
|
||||||
int editStatusTaskFIM(int task_id, QString status);
|
|
||||||
int replaceReportFIM(TaskAmmFim task);
|
int replaceReportFIM(TaskAmmFim task);
|
||||||
|
int changeStatusTaskFIM(int id_task, QString status);
|
||||||
|
|
||||||
int newTrainee(int id_group);
|
int newTrainee(int id_group);
|
||||||
int delTrainee(int id);
|
int delTrainee(int id);
|
||||||
|
|||||||
@@ -40,19 +40,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="btnEditorInstructors">
|
<widget class="QToolButton" name="btnEditorInstructors">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ void DialogCheckTask::on_btnWrong_clicked()
|
|||||||
if(QMessageBox::warning(this, tr("Attention!"), tr("Change task status?\nThe status will be set: 'failed'"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
|
if(QMessageBox::warning(this, tr("Attention!"), tr("Change task status?\nThe status will be set: 'failed'"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
|
||||||
{
|
{
|
||||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE, id, (void*)&status);
|
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE, id, (void*)&status);
|
||||||
|
//this->close();
|
||||||
|
this->parentWidget()->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,5 +97,7 @@ void DialogCheckTask::on_btnRight_clicked()
|
|||||||
if(QMessageBox::warning(this, tr("Attention!"), tr("Change task status?\nThe status will be set: 'completed'"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
|
if(QMessageBox::warning(this, tr("Attention!"), tr("Change task status?\nThe status will be set: 'completed'"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
|
||||||
{
|
{
|
||||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE, id, (void*)&status);
|
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE, id, (void*)&status);
|
||||||
|
//this->close();
|
||||||
|
this->parentWidget()->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ ViewerTrainees::ViewerTrainees(ConnectorToServer* connectorToServer, QWidget *pa
|
|||||||
|
|
||||||
connect(treeWidget, &QTreeWidget::currentItemChanged, this, &ViewerTrainees::on_treeWidget_currentItemChanged);
|
connect(treeWidget, &QTreeWidget::currentItemChanged, this, &ViewerTrainees::on_treeWidget_currentItemChanged);
|
||||||
|
|
||||||
ui->horizontalLayout_1->addWidget(treeWidget);
|
ui->horizontalLayout_11->addWidget(treeWidget);
|
||||||
|
|
||||||
ammTasksWidget = new AMMtasksWidget(connectorToServer, AMMtasksWidget::TypeList::listForTrainee, this);
|
ammTasksWidget = new AMMtasksWidget(connectorToServer, AMMtasksWidget::TypeList::listForTrainee, this);
|
||||||
fimTasksWidget = new FIMtasksWidget(connectorToServer, FIMtasksWidget::TypeList::listForTrainee, this);
|
fimTasksWidget = new FIMtasksWidget(connectorToServer, FIMtasksWidget::TypeList::listForTrainee, this);
|
||||||
|
|||||||
@@ -36,26 +36,23 @@
|
|||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_1"/>
|
<layout class="QHBoxLayout" name="horizontalLayout_1">
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="widget" native="true">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_11"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2"/>
|
<layout class="QVBoxLayout" name="verticalLayout_2"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="btnEditorTrainees">
|
<widget class="QToolButton" name="btnEditorTrainees">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
|||||||
@@ -319,6 +319,7 @@ void ProcessParser::queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client,
|
|||||||
Trainee trainee;
|
Trainee trainee;
|
||||||
Group group;
|
Group group;
|
||||||
TaskAmmFim task;
|
TaskAmmFim task;
|
||||||
|
QString status = "";
|
||||||
void* data = nullptr;
|
void* data = nullptr;
|
||||||
|
|
||||||
/*Перебираем все атрибуты тега*/
|
/*Перебираем все атрибуты тега*/
|
||||||
@@ -402,6 +403,11 @@ void ProcessParser::queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client,
|
|||||||
//if(name == "title")
|
//if(name == "title")
|
||||||
//task.title = value;
|
//task.title = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE:
|
||||||
|
if(name == "status")
|
||||||
|
status = value;
|
||||||
|
break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -424,6 +430,9 @@ void ProcessParser::queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client,
|
|||||||
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE:
|
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE:
|
||||||
data = &task;
|
data = &task;
|
||||||
break;
|
break;
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE:
|
||||||
|
data = &status;
|
||||||
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
processingSystem->processingClientQueryToDB(client, queryToDB, id, data);
|
processingSystem->processingClientQueryToDB(client, queryToDB, id, data);
|
||||||
|
|||||||
@@ -353,6 +353,23 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE:
|
||||||
|
{
|
||||||
|
QString* status = (QString*)data;
|
||||||
|
if(int id_trainee = providerDBLMS->changeStatusTaskFIM(id, *status))
|
||||||
|
{
|
||||||
|
//Отправка списка задач FIM клиенту GUI
|
||||||
|
sendListTasksFIMofTraineetoClient(client, id_trainee);
|
||||||
|
|
||||||
|
//Отправка списка задач FIM клиенту Юнити
|
||||||
|
if(ClientHandler* clientUnity = getUnityClientById(id_trainee))
|
||||||
|
{//Есть такой
|
||||||
|
sendListTasksFIMofTraineetoClient(clientUnity, id_trainee);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -392,16 +392,16 @@ int ProviderDBLMS::editTaskFIM(TaskAmmFim task)
|
|||||||
return dbLMS->editTaskFIM(task);
|
return dbLMS->editTaskFIM(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ProviderDBLMS::editStatusTaskFIM(int task_id, QString status)
|
|
||||||
{
|
|
||||||
return dbLMS->editStatusTaskFIM(task_id, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
int ProviderDBLMS::replaceReportFIM(TaskAmmFim task)
|
int ProviderDBLMS::replaceReportFIM(TaskAmmFim task)
|
||||||
{
|
{
|
||||||
return dbLMS->replaceReportFIM(task);
|
return dbLMS->replaceReportFIM(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ProviderDBLMS::changeStatusTaskFIM(int id_task, QString status)
|
||||||
|
{
|
||||||
|
return dbLMS->changeStatusTaskFIM(id_task, status);
|
||||||
|
}
|
||||||
|
|
||||||
QList<TaskAmmFim> ProviderDBLMS::GetListTasksAMMofTrainee(int id_trainee)
|
QList<TaskAmmFim> ProviderDBLMS::GetListTasksAMMofTrainee(int id_trainee)
|
||||||
{
|
{
|
||||||
QList<TaskAmmFim> listTasks;
|
QList<TaskAmmFim> listTasks;
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ public:
|
|||||||
int newTaskFIM(TaskAmmFim task, int id_trainee);
|
int newTaskFIM(TaskAmmFim task, int id_trainee);
|
||||||
int delTaskFIM(int id);
|
int delTaskFIM(int id);
|
||||||
int editTaskFIM(TaskAmmFim task);
|
int editTaskFIM(TaskAmmFim task);
|
||||||
int editStatusTaskFIM(int task_id, QString status);
|
|
||||||
int replaceReportFIM(TaskAmmFim task);
|
int replaceReportFIM(TaskAmmFim task);
|
||||||
|
int changeStatusTaskFIM(int id_task, QString status);
|
||||||
|
|
||||||
QList<TaskAmmFim> GetListTasksAMMofTrainee(int id_trainee);
|
QList<TaskAmmFim> GetListTasksAMMofTrainee(int id_trainee);
|
||||||
QList<TaskAmmFim> GetListTasksFIMofTrainee(int id_trainee);
|
QList<TaskAmmFim> GetListTasksFIMofTrainee(int id_trainee);
|
||||||
|
|||||||
Reference in New Issue
Block a user