mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
Merge branch 'merge-task-and-verController' into bugfix-version-info
This commit is contained in:
@@ -24,10 +24,13 @@ add_library(DataBaseLMS SHARED
|
|||||||
task.h
|
task.h
|
||||||
classroom.cpp
|
classroom.cpp
|
||||||
classroom.h
|
classroom.h
|
||||||
|
tasksAmmFim.cpp
|
||||||
|
tasksAmmFim.h
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(DataBaseLMS PRIVATE Qt5::Widgets)
|
target_link_libraries(DataBaseLMS PRIVATE Qt5::Widgets)
|
||||||
target_link_libraries(DataBaseLMS PRIVATE Qt5::Sql)
|
target_link_libraries(DataBaseLMS PRIVATE Qt5::Sql)
|
||||||
|
target_link_libraries(DataBaseLMS PRIVATE Qt5::Xml)
|
||||||
|
|
||||||
target_compile_definitions(DataBaseLMS PRIVATE DATABASELMS_LIBRARY)
|
target_compile_definitions(DataBaseLMS PRIVATE DATABASELMS_LIBRARY)
|
||||||
|
|
||||||
|
|||||||
@@ -447,6 +447,28 @@ int DataBaseLMS::updateGroup(Group group)
|
|||||||
return queryExecInt(queryStr);
|
return queryExecInt(queryStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DataBaseLMS::insertTaskAMM(int id_trainee)
|
||||||
|
{
|
||||||
|
QString queryStr = QString("INSERT INTO public.tasks_amm (title, dm_code, trainee_task) "
|
||||||
|
"VALUES (DEFAULT, DEFAULT, %1) "
|
||||||
|
"RETURNING tasks_amm.task_id").arg(
|
||||||
|
QString::number(id_trainee));
|
||||||
|
|
||||||
|
return queryExecInt(queryStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DataBaseLMS::updateTaskAMM(TaskAmmFim task)
|
||||||
|
{
|
||||||
|
QString queryStr = QString("UPDATE public.tasks_amm SET title = '%1', dm_code = '%2' "
|
||||||
|
"WHERE task_id = %3 "
|
||||||
|
"RETURNING tasks_amm.task_id").arg(
|
||||||
|
task.ammProcedure.title,
|
||||||
|
task.ammProcedure.dmCode,
|
||||||
|
QString::number(task.getID()) );
|
||||||
|
|
||||||
|
return queryExecInt(queryStr);
|
||||||
|
}
|
||||||
|
|
||||||
Trainee DataBaseLMS::selectTrainee(int id_trainee)
|
Trainee DataBaseLMS::selectTrainee(int id_trainee)
|
||||||
{
|
{
|
||||||
Trainee trainee;
|
Trainee trainee;
|
||||||
@@ -735,6 +757,7 @@ QList<Task> DataBaseLMS::selectTasksOfTrainee(int trainee_id)
|
|||||||
{
|
{
|
||||||
QList<Task> tasks;
|
QList<Task> tasks;
|
||||||
|
|
||||||
|
/*
|
||||||
QString queryStr = QString("SELECT tasks.task_id, tasks.name "
|
QString queryStr = QString("SELECT tasks.task_id, tasks.name "
|
||||||
"FROM public.trainees "
|
"FROM public.trainees "
|
||||||
"JOIN public.trainees_tasks ON trainees_tasks.trainee_id = trainees.trainee_id "
|
"JOIN public.trainees_tasks ON trainees_tasks.trainee_id = trainees.trainee_id "
|
||||||
@@ -755,6 +778,7 @@ QList<Task> DataBaseLMS::selectTasksOfTrainee(int trainee_id)
|
|||||||
tasks.append(task);
|
tasks.append(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return tasks;
|
return tasks;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "instructor.h"
|
#include "instructor.h"
|
||||||
#include "trainee.h"
|
#include "trainee.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
|
#include "tasksAmmFim.h"
|
||||||
|
|
||||||
class DataBaseLMS
|
class DataBaseLMS
|
||||||
{
|
{
|
||||||
@@ -52,6 +53,10 @@ protected:
|
|||||||
int deleteGroup(int group_id);
|
int deleteGroup(int group_id);
|
||||||
int updateGroup(Group group);
|
int updateGroup(Group group);
|
||||||
|
|
||||||
|
//Задача
|
||||||
|
int insertTaskAMM(int id_trainee);
|
||||||
|
int updateTaskAMM(TaskAmmFim task);
|
||||||
|
|
||||||
//Обучаемый
|
//Обучаемый
|
||||||
Trainee selectTrainee(int id_trainee);
|
Trainee selectTrainee(int id_trainee);
|
||||||
QList<Trainee> selectAllTraineesInGroup(int id_group);
|
QList<Trainee> selectAllTraineesInGroup(int id_group);
|
||||||
|
|||||||
@@ -281,6 +281,21 @@ int InterfaceDataBaseLMS::editGroup(Group group)
|
|||||||
return updateGroup(group);
|
return updateGroup(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int InterfaceDataBaseLMS::newTaskAMM(int id_trainee)
|
||||||
|
{
|
||||||
|
return insertTaskAMM(id_trainee);
|
||||||
|
}
|
||||||
|
|
||||||
|
int InterfaceDataBaseLMS::delTaskAMM(int id)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int InterfaceDataBaseLMS::editTaskAMM(TaskAmmFim task)
|
||||||
|
{
|
||||||
|
return updateTaskAMM(task);
|
||||||
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::newTrainee(int id_group)
|
int InterfaceDataBaseLMS::newTrainee(int id_group)
|
||||||
{
|
{
|
||||||
return insertTrainee(id_group);
|
return insertTrainee(id_group);
|
||||||
|
|||||||
@@ -69,6 +69,10 @@ public:
|
|||||||
int delGroup(int id);
|
int delGroup(int id);
|
||||||
int editGroup(Group group);
|
int editGroup(Group group);
|
||||||
|
|
||||||
|
int newTaskAMM(int id_trainee);
|
||||||
|
int delTaskAMM(int id);
|
||||||
|
int editTaskAMM(TaskAmmFim task);
|
||||||
|
|
||||||
int newTrainee(int id_group);
|
int newTrainee(int id_group);
|
||||||
int delTrainee(int id);
|
int delTrainee(int id);
|
||||||
int editTrainee(Trainee trainee);
|
int editTrainee(Trainee trainee);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
int TaskAmmFim::lastID = 1;
|
||||||
|
|
||||||
void TaskAmmFim::initialize(int id, QString type, QString title, QString status, QString created_date, QString changed_date)
|
void TaskAmmFim::initialize(int id, QString type, QString title, QString status, QString created_date, QString changed_date)
|
||||||
{
|
{
|
||||||
@@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include "DataBaseLMS_global.h"
|
||||||
|
|
||||||
class ProcedureID
|
class DATABASELMS_EXPORT ProcedureID
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ProcedureID(){};
|
ProcedureID(){};
|
||||||
@@ -16,7 +17,7 @@ public:
|
|||||||
QString result; // "" - нет результата, "viewed" - процедура изучена (просмотрена при отсутствующем сценарии), "completed" - выполнена (в т.ч. режим "контроль" сценария)
|
QString result; // "" - нет результата, "viewed" - процедура изучена (просмотрена при отсутствующем сценарии), "completed" - выполнена (в т.ч. режим "контроль" сценария)
|
||||||
};
|
};
|
||||||
|
|
||||||
class MalfunctionSign // признак неисправности
|
class DATABASELMS_EXPORT MalfunctionSign // признак неисправности
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MalfunctionSign(){};
|
MalfunctionSign(){};
|
||||||
@@ -29,7 +30,7 @@ public:
|
|||||||
QString description; // описание (напр. "ЭРРД, 25, DOOR_FAIL_TO_CLOSE" - для БСТО)
|
QString description; // описание (напр. "ЭРРД, 25, DOOR_FAIL_TO_CLOSE" - для БСТО)
|
||||||
};
|
};
|
||||||
|
|
||||||
class Malfunction // неисправность
|
class DATABASELMS_EXPORT Malfunction // неисправность
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Malfunction(){};
|
Malfunction(){};
|
||||||
@@ -44,7 +45,7 @@ public:
|
|||||||
QList<MalfunctionSign> malfunctionSigns;// список соответствующих неисправности признаков
|
QList<MalfunctionSign> malfunctionSigns;// список соответствующих неисправности признаков
|
||||||
};
|
};
|
||||||
|
|
||||||
class FIMReportItem
|
class DATABASELMS_EXPORT FIMReportItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FIMReportItem(){};
|
FIMReportItem(){};
|
||||||
@@ -54,7 +55,7 @@ public:
|
|||||||
ProcedureID procedure; // ссылка на процедуру, при необходимости
|
ProcedureID procedure; // ссылка на процедуру, при необходимости
|
||||||
};
|
};
|
||||||
|
|
||||||
class FIMReport
|
class DATABASELMS_EXPORT FIMReport
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FIMReport(){};
|
FIMReport(){};
|
||||||
@@ -63,7 +64,7 @@ public:
|
|||||||
QList<FIMReportItem> itemList;
|
QList<FIMReportItem> itemList;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TaskAmmFim
|
class DATABASELMS_EXPORT TaskAmmFim
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TaskAmmFim(){};
|
TaskAmmFim(){};
|
||||||
@@ -71,6 +72,10 @@ public:
|
|||||||
public:
|
public:
|
||||||
void initialize(int id, QString type, QString title, QString status, QString created_date, QString changed_date);
|
void initialize(int id, QString type, QString title, QString status, QString created_date, QString changed_date);
|
||||||
void addMalfunction(Malfunction malfunction);
|
void addMalfunction(Malfunction malfunction);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void setID(int id){this->id = id;};
|
||||||
|
int getID(){return id;};
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int id; // для идентификации в БД
|
int id; // для идентификации в БД
|
||||||
@@ -97,6 +102,8 @@ public:
|
|||||||
// fim:
|
// fim:
|
||||||
QList<Malfunction> malfunctionList; // список неисправностей
|
QList<Malfunction> malfunctionList; // список неисправностей
|
||||||
FIMReport report; // отчет по выполнению "fim"
|
FIMReport report; // отчет по выполнению "fim"
|
||||||
|
|
||||||
|
static int lastID;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TASKSAMMFIM_H
|
#endif // TASKSAMMFIM_H
|
||||||
@@ -78,8 +78,8 @@ add_library(InstructorsAndTrainees SHARED
|
|||||||
tasks/fimtaskswidget.cpp
|
tasks/fimtaskswidget.cpp
|
||||||
tasks/fimtaskswidget.h
|
tasks/fimtaskswidget.h
|
||||||
tasks/fimtaskswidget.ui
|
tasks/fimtaskswidget.ui
|
||||||
tasks/tasksAmmFim.cpp
|
#tasks/tasksAmmFim.cpp
|
||||||
tasks/tasksAmmFim.h
|
#tasks/tasksAmmFim.h
|
||||||
widgets/newversionwidget.cpp
|
widgets/newversionwidget.cpp
|
||||||
widgets/newversionwidget.h
|
widgets/newversionwidget.h
|
||||||
widgets/newversionwidget.ui
|
widgets/newversionwidget.ui
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "instructor.h"
|
#include "instructor.h"
|
||||||
#include "trainee.h"
|
#include "trainee.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
|
#include "tasksAmmFim.h"
|
||||||
#include "streamingversiondata.h"
|
#include "streamingversiondata.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -171,6 +172,23 @@ void DataParser::createQueryToDBMessage(ClientQueryToDB *queryToDB, int id, void
|
|||||||
xmlWriter.writeAttribute("name", group->getName());
|
xmlWriter.writeAttribute("name", group->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(queryToDB->typeQuery == TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE)
|
||||||
|
{
|
||||||
|
TaskAmmFim* task = (TaskAmmFim*)data;
|
||||||
|
if(task)
|
||||||
|
{
|
||||||
|
xmlWriter.writeAttribute("title", task->ammProcedure.title);
|
||||||
|
xmlWriter.writeAttribute("dmCode", task->ammProcedure.dmCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(queryToDB->typeQuery == TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE)
|
||||||
|
{
|
||||||
|
TaskAmmFim* task = (TaskAmmFim*)data;
|
||||||
|
if(task)
|
||||||
|
{
|
||||||
|
xmlWriter.writeAttribute("title", task->title);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
xmlWriter.writeEndElement();
|
||||||
|
|||||||
@@ -52,7 +52,9 @@ enum TypeQueryToDB{
|
|||||||
TYPE_QUERY_EDIT_GROUP,
|
TYPE_QUERY_EDIT_GROUP,
|
||||||
TYPE_QUERY_NEW_TRAINEE,
|
TYPE_QUERY_NEW_TRAINEE,
|
||||||
TYPE_QUERY_DEL_TRAINEE,
|
TYPE_QUERY_DEL_TRAINEE,
|
||||||
TYPE_QUERY_EDIT_TRAINEE
|
TYPE_QUERY_EDIT_TRAINEE,
|
||||||
|
TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE,
|
||||||
|
TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE
|
||||||
};
|
};
|
||||||
|
|
||||||
class ClientQueryToDB{
|
class ClientQueryToDB{
|
||||||
|
|||||||
@@ -43,6 +43,13 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
|
|||||||
|
|
||||||
connect(connectorToServer,&ConnectorToServer::signal_ConnectedToServer,this,&InstructorsAndTraineesWidget::slot_ConnectedToServer);
|
connect(connectorToServer,&ConnectorToServer::signal_ConnectedToServer,this,&InstructorsAndTraineesWidget::slot_ConnectedToServer);
|
||||||
|
|
||||||
|
ammTasksWidget = new AMMtasksWidget(connectorToServer, this);
|
||||||
|
fimTasksWidget = new FIMtasksWidget(connectorToServer, this);
|
||||||
|
|
||||||
|
connect(connectorToServer, &ConnectorToServer::signal_UpdateTasksFIM, fimTasksWidget, &FIMtasksWidget::slot_NeedUpdateUI);
|
||||||
|
connect(connectorToServer, &ConnectorToServer::signal_UpdateTasksAMM, ammTasksWidget, &AMMtasksWidget::slot_NeedUpdateUI);
|
||||||
|
connect(viewerTrainees, &ViewerTrainees::signal_traineeSelected, fimTasksWidget, &FIMtasksWidget::slot_traineeSelected);
|
||||||
|
connect(viewerTrainees, &ViewerTrainees::signal_traineeSelected, ammTasksWidget, &AMMtasksWidget::slot_traineeSelected);
|
||||||
|
|
||||||
messangerWidget = new MessangerWidget(this);
|
messangerWidget = new MessangerWidget(this);
|
||||||
connect(connectorToServer,&ConnectorToServer::signal_InitMessanger,messangerWidget,&MessangerWidget::slot_InitMessanger);
|
connect(connectorToServer,&ConnectorToServer::signal_InitMessanger,messangerWidget,&MessangerWidget::slot_InitMessanger);
|
||||||
@@ -52,12 +59,6 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
|
|||||||
connect(connectorToServer,&ConnectorToServer::signal_msgFromClientReady,messangerWidget,&MessangerWidget::slot_msgFromClientReady);
|
connect(connectorToServer,&ConnectorToServer::signal_msgFromClientReady,messangerWidget,&MessangerWidget::slot_msgFromClientReady);
|
||||||
|
|
||||||
|
|
||||||
ammTasksWidget = new AMMtasksWidget(connectorToServer, this);
|
|
||||||
fimTasksWidget = new FIMtasksWidget(connectorToServer, this);
|
|
||||||
|
|
||||||
connect(connectorToServer, &ConnectorToServer::signal_UpdateTasksFIM, fimTasksWidget, &FIMtasksWidget::slot_NeedUpdateUI);
|
|
||||||
connect(connectorToServer, &ConnectorToServer::signal_UpdateTasksAMM, ammTasksWidget, &AMMtasksWidget::slot_NeedUpdateUI);
|
|
||||||
|
|
||||||
ui->horizontalLayout_3->addWidget(viewerTrainees);
|
ui->horizontalLayout_3->addWidget(viewerTrainees);
|
||||||
ui->horizontalLayout_3->addWidget(messangerWidget);
|
ui->horizontalLayout_3->addWidget(messangerWidget);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, QWidget *parent) :
|
AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::AMMtasksWidget),
|
ui(new Ui::AMMtasksWidget),
|
||||||
connectorToServer(connectorToServer)
|
connectorToServer(connectorToServer),
|
||||||
|
loginTraineeSelected("")
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
@@ -18,6 +19,8 @@ AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, QWidget *pa
|
|||||||
connect(treeWidget, &QTreeWidget::currentItemChanged, this, &AMMtasksWidget::on_treeWidget_currentItemChanged);
|
connect(treeWidget, &QTreeWidget::currentItemChanged, this, &AMMtasksWidget::on_treeWidget_currentItemChanged);
|
||||||
|
|
||||||
preparationTreeWidget();
|
preparationTreeWidget();
|
||||||
|
|
||||||
|
ui->btnAssignTaskToTrainee->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
AMMtasksWidget::~AMMtasksWidget()
|
AMMtasksWidget::~AMMtasksWidget()
|
||||||
@@ -45,17 +48,21 @@ void AMMtasksWidget::on_treeWidget_currentItemChanged(QTreeWidgetItem *current,
|
|||||||
PM* PMmodul = static_cast<PM*>(module);
|
PM* PMmodul = static_cast<PM*>(module);
|
||||||
type = "PM";
|
type = "PM";
|
||||||
code = PMmodul->pmCode();
|
code = PMmodul->pmCode();
|
||||||
|
ui->btnAssignTaskToTrainee->setEnabled(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DM* DMmodul = static_cast<DM*>(module);
|
DM* DMmodul = static_cast<DM*>(module);
|
||||||
type = "DM";
|
type = "DM";
|
||||||
code = DMmodul->dmCode();
|
code = DMmodul->dmCode();
|
||||||
|
ui->btnAssignTaskToTrainee->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->label->setText(type + " Code");
|
ui->label->setText(type + " Code");
|
||||||
ui->editCode->setText(code);
|
ui->editCode->setText(code);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
ui->btnAssignTaskToTrainee->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMMtasksWidget::slot_NeedUpdateUI()
|
void AMMtasksWidget::slot_NeedUpdateUI()
|
||||||
@@ -63,6 +70,11 @@ void AMMtasksWidget::slot_NeedUpdateUI()
|
|||||||
loadTasksAMM();
|
loadTasksAMM();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AMMtasksWidget::slot_traineeSelected(QString login)
|
||||||
|
{
|
||||||
|
loginTraineeSelected = login;
|
||||||
|
}
|
||||||
|
|
||||||
void AMMtasksWidget::loadTasksAMM()
|
void AMMtasksWidget::loadTasksAMM()
|
||||||
{
|
{
|
||||||
//Обновление дерева
|
//Обновление дерева
|
||||||
@@ -291,3 +303,35 @@ void AMMtasksWidget::on_btnUpdateTasks_clicked()
|
|||||||
{
|
{
|
||||||
connectorToServer->sendQueryTasksXML("amm");
|
connectorToServer->sendQueryTasksXML("amm");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AMMtasksWidget::on_btnAssignTaskToTrainee_clicked()
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *current = treeWidget->currentItem();
|
||||||
|
|
||||||
|
if(current == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int id = current->text(ColumnsTree::clmn_ID).toInt();
|
||||||
|
|
||||||
|
Module* module = searchModuleByID(id);
|
||||||
|
|
||||||
|
if(module)
|
||||||
|
{
|
||||||
|
if(module->getType() == ModuleType::TYPE_DM)
|
||||||
|
{
|
||||||
|
QString dmCode = "";
|
||||||
|
QString techName = "";
|
||||||
|
DM* DMmodul = static_cast<DM*>(module);
|
||||||
|
dmCode = DMmodul->dmCode();
|
||||||
|
techName = DMmodul->getLangStructRus().techName;
|
||||||
|
|
||||||
|
int trainee_id = connectorToServer->getIdTraineeByLogin(loginTraineeSelected);
|
||||||
|
|
||||||
|
TaskAmmFim taskNew;
|
||||||
|
taskNew.ammProcedure.title = techName;
|
||||||
|
taskNew.ammProcedure.dmCode = dmCode;
|
||||||
|
|
||||||
|
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE, trainee_id, &taskNew);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,9 +29,13 @@ private Q_SLOTS:
|
|||||||
void on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
void on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||||
void on_btnUpdateTasks_clicked();
|
void on_btnUpdateTasks_clicked();
|
||||||
|
|
||||||
|
void on_btnAssignTaskToTrainee_clicked();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
//Слот обработки сигнала необходимости обновления интерфейса
|
//Слот обработки сигнала необходимости обновления интерфейса
|
||||||
void slot_NeedUpdateUI();
|
void slot_NeedUpdateUI();
|
||||||
|
//слот обработки сигнала о выборе обучаемого
|
||||||
|
void slot_traineeSelected(QString login);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadAMMtasksFromXML(QByteArray array);
|
void loadAMMtasksFromXML(QByteArray array);
|
||||||
@@ -54,6 +58,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QList<Module*> listAllModules;
|
QList<Module*> listAllModules;
|
||||||
|
QString loginTraineeSelected;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AMMTASKSWIDGET_H
|
#endif // AMMTASKSWIDGET_H
|
||||||
|
|||||||
@@ -54,7 +54,14 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="btnUpdateTasks">
|
<widget class="QToolButton" name="btnUpdateTasks">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>Update List</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="btnAssignTaskToTrainee">
|
||||||
|
<property name="text">
|
||||||
|
<string>Assign task</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -9,24 +9,55 @@
|
|||||||
FIMtasksWidget::FIMtasksWidget(ConnectorToServer* connectorToServer, QWidget *parent) :
|
FIMtasksWidget::FIMtasksWidget(ConnectorToServer* connectorToServer, QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::FIMtasksWidget),
|
ui(new Ui::FIMtasksWidget),
|
||||||
connectorToServer(connectorToServer)
|
connectorToServer(connectorToServer),
|
||||||
|
loginTraineeSelected("")
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
treeWidget = new QTreeWidget();
|
treeWidget = new QTreeWidget();
|
||||||
ui->horizontalLayout_1->addWidget(treeWidget);
|
ui->horizontalLayout_1->addWidget(treeWidget);
|
||||||
|
|
||||||
|
connect(treeWidget, &QTreeWidget::currentItemChanged, this, &FIMtasksWidget::on_treeWidget_currentItemChanged);
|
||||||
|
|
||||||
preparationTreeWidget();
|
preparationTreeWidget();
|
||||||
|
|
||||||
|
ui->btnAssignTaskToTrainee->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
FIMtasksWidget::~FIMtasksWidget()
|
FIMtasksWidget::~FIMtasksWidget()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
deleteAllTaskAmmFim();
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FIMtasksWidget::on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||||
|
{
|
||||||
|
if(current == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QString code = "";
|
||||||
|
|
||||||
|
QTreeWidgetItem *treeItemParent = current->parent();
|
||||||
|
if(treeItemParent == nullptr)
|
||||||
|
{//Выбрана задача
|
||||||
|
int id = current->text(ColumnsTree::clmn_ID).toInt();
|
||||||
|
|
||||||
|
TaskAmmFim* task = getTaskByID(id);
|
||||||
|
|
||||||
|
code = task->title;
|
||||||
|
|
||||||
|
ui->btnAssignTaskToTrainee->setEnabled(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ui->btnAssignTaskToTrainee->setEnabled(false);
|
||||||
|
|
||||||
|
ui->editCode->setText(code);
|
||||||
|
}
|
||||||
|
|
||||||
void FIMtasksWidget::loadFIMtasksFromXML(QByteArray array)
|
void FIMtasksWidget::loadFIMtasksFromXML(QByteArray array)
|
||||||
{
|
{
|
||||||
listTaskAmmFim.clear();
|
deleteAllTaskAmmFim();
|
||||||
|
|
||||||
QDomDocument docTasksDOM;
|
QDomDocument docTasksDOM;
|
||||||
|
|
||||||
@@ -47,9 +78,10 @@ void FIMtasksWidget::loadFIMtasksFromXML(QByteArray array)
|
|||||||
|
|
||||||
if(name == "task")
|
if(name == "task")
|
||||||
{
|
{
|
||||||
TaskAmmFim task;
|
TaskAmmFim* task = nullptr;
|
||||||
|
task = new TaskAmmFim();
|
||||||
|
|
||||||
task.initialize(nodeMap.namedItem("id").nodeValue().toInt(),
|
task->initialize(/*nodeMap.namedItem("id").nodeValue().toInt()*/ TaskAmmFim::lastID++,
|
||||||
nodeMap.namedItem("type").nodeValue(),
|
nodeMap.namedItem("type").nodeValue(),
|
||||||
nodeMap.namedItem("title").nodeValue(),
|
nodeMap.namedItem("title").nodeValue(),
|
||||||
nodeMap.namedItem("status").nodeValue(),
|
nodeMap.namedItem("status").nodeValue(),
|
||||||
@@ -92,7 +124,7 @@ void FIMtasksWidget::loadFIMtasksFromXML(QByteArray array)
|
|||||||
|
|
||||||
}while(! (signElement = signElement.nextSiblingElement()).isNull());
|
}while(! (signElement = signElement.nextSiblingElement()).isNull());
|
||||||
}
|
}
|
||||||
task.addMalfunction(malfunction);
|
task->addMalfunction(malfunction);
|
||||||
}
|
}
|
||||||
}while(! (malfunctionElement = malfunctionElement.nextSiblingElement()).isNull());
|
}while(! (malfunctionElement = malfunctionElement.nextSiblingElement()).isNull());
|
||||||
}
|
}
|
||||||
@@ -107,21 +139,21 @@ void FIMtasksWidget::fillTree()
|
|||||||
{
|
{
|
||||||
for(int i = 0; i < listTaskAmmFim.count(); i++)
|
for(int i = 0; i < listTaskAmmFim.count(); i++)
|
||||||
{/*Задачи*/
|
{/*Задачи*/
|
||||||
TaskAmmFim task = listTaskAmmFim.at(i);
|
TaskAmmFim* task = listTaskAmmFim.at(i);
|
||||||
|
|
||||||
QTreeWidgetItem* itemTask = new QTreeWidgetItem();
|
QTreeWidgetItem* itemTask = new QTreeWidgetItem();
|
||||||
|
|
||||||
itemTask->setText(0, task.title);
|
itemTask->setText(0, task->title);
|
||||||
itemTask->setText(1, QString::number(task.id));
|
itemTask->setText(1, QString::number(task->id));
|
||||||
itemTask->setFlags(itemTask->flags() | Qt::ItemIsUserCheckable);
|
itemTask->setFlags(itemTask->flags() | Qt::ItemIsUserCheckable);
|
||||||
itemTask->setCheckState(0, Qt::Checked);
|
itemTask->setCheckState(0, Qt::Checked);
|
||||||
itemTask->setIcon(0, QIcon(":/resources/icons/procedure.png"));
|
itemTask->setIcon(0, QIcon(":/resources/icons/procedure.png"));
|
||||||
|
|
||||||
treeWidget->addTopLevelItem(itemTask);
|
treeWidget->addTopLevelItem(itemTask);
|
||||||
|
|
||||||
for (int j = 0; j < task.malfunctionList.count(); j++)
|
for (int j = 0; j < task->malfunctionList.count(); j++)
|
||||||
{/*Неисправности*/
|
{/*Неисправности*/
|
||||||
Malfunction malfunction = task.malfunctionList.at(j);
|
Malfunction malfunction = task->malfunctionList.at(j);
|
||||||
|
|
||||||
QTreeWidgetItem* itemMalfunction = new QTreeWidgetItem();
|
QTreeWidgetItem* itemMalfunction = new QTreeWidgetItem();
|
||||||
|
|
||||||
@@ -172,6 +204,11 @@ void FIMtasksWidget::slot_NeedUpdateUI()
|
|||||||
loadTasksFIM();
|
loadTasksFIM();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FIMtasksWidget::slot_traineeSelected(QString login)
|
||||||
|
{
|
||||||
|
loginTraineeSelected = login;
|
||||||
|
}
|
||||||
|
|
||||||
void FIMtasksWidget::loadTasksFIM()
|
void FIMtasksWidget::loadTasksFIM()
|
||||||
{
|
{
|
||||||
//Обновление дерева
|
//Обновление дерева
|
||||||
@@ -184,7 +221,49 @@ void FIMtasksWidget::loadTasksFIM()
|
|||||||
fillTree();
|
fillTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TaskAmmFim* FIMtasksWidget::getTaskByID(int id)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < listTaskAmmFim.count(); i++)
|
||||||
|
{/*Задачи*/
|
||||||
|
TaskAmmFim* task = listTaskAmmFim.at(i);
|
||||||
|
if(task->id == id)
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FIMtasksWidget::deleteAllTaskAmmFim()
|
||||||
|
{
|
||||||
|
for(TaskAmmFim* task: listTaskAmmFim)
|
||||||
|
delete task;
|
||||||
|
|
||||||
|
listTaskAmmFim.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void FIMtasksWidget::on_btnUpdateTasks_clicked()
|
void FIMtasksWidget::on_btnUpdateTasks_clicked()
|
||||||
{
|
{
|
||||||
connectorToServer->sendQueryTasksXML("fim");
|
connectorToServer->sendQueryTasksXML("fim");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FIMtasksWidget::on_btnAssignTaskToTrainee_clicked()
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *current = treeWidget->currentItem();
|
||||||
|
|
||||||
|
if(current == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int id = current->text(ColumnsTree::clmn_ID).toInt();
|
||||||
|
|
||||||
|
TaskAmmFim* task = getTaskByID(id);
|
||||||
|
|
||||||
|
if(task)
|
||||||
|
{
|
||||||
|
int trainee_id = connectorToServer->getIdTraineeByLogin(loginTraineeSelected);
|
||||||
|
|
||||||
|
TaskAmmFim taskNew;
|
||||||
|
taskNew.title = task->title;
|
||||||
|
|
||||||
|
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE, trainee_id, &taskNew);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -25,11 +25,16 @@ public:
|
|||||||
~FIMtasksWidget();
|
~FIMtasksWidget();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
void on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||||
void on_btnUpdateTasks_clicked();
|
void on_btnUpdateTasks_clicked();
|
||||||
|
|
||||||
|
void on_btnAssignTaskToTrainee_clicked();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
//Слот обработки сигнала необходимости обновления интерфейса
|
//Слот обработки сигнала необходимости обновления интерфейса
|
||||||
void slot_NeedUpdateUI();
|
void slot_NeedUpdateUI();
|
||||||
|
//слот обработки сигнала о выборе обучаемого
|
||||||
|
void slot_traineeSelected(QString login);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadFIMtasksFromXML(QByteArray array);
|
void loadFIMtasksFromXML(QByteArray array);
|
||||||
@@ -41,6 +46,9 @@ private:
|
|||||||
|
|
||||||
void loadTasksFIM();
|
void loadTasksFIM();
|
||||||
|
|
||||||
|
TaskAmmFim* getTaskByID(int id);
|
||||||
|
void deleteAllTaskAmmFim();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::FIMtasksWidget *ui;
|
Ui::FIMtasksWidget *ui;
|
||||||
ConnectorToServer* connectorToServer;
|
ConnectorToServer* connectorToServer;
|
||||||
@@ -48,7 +56,8 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QString userName;
|
QString userName;
|
||||||
QList<TaskAmmFim> listTaskAmmFim;
|
QList<TaskAmmFim*> listTaskAmmFim;
|
||||||
|
QString loginTraineeSelected;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FIMTASKSWIDGET_H
|
#endif // FIMTASKSWIDGET_H
|
||||||
|
|||||||
@@ -27,7 +27,14 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="btnUpdateTasks">
|
<widget class="QToolButton" name="btnUpdateTasks">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>Update List</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="btnAssignTaskToTrainee">
|
||||||
|
<property name="text">
|
||||||
|
<string>Assign task</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -71,7 +71,9 @@ enum TypeQueryToDB{
|
|||||||
TYPE_QUERY_EDIT_GROUP,
|
TYPE_QUERY_EDIT_GROUP,
|
||||||
TYPE_QUERY_NEW_TRAINEE,
|
TYPE_QUERY_NEW_TRAINEE,
|
||||||
TYPE_QUERY_DEL_TRAINEE,
|
TYPE_QUERY_DEL_TRAINEE,
|
||||||
TYPE_QUERY_EDIT_TRAINEE
|
TYPE_QUERY_EDIT_TRAINEE,
|
||||||
|
TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE,
|
||||||
|
TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE
|
||||||
};
|
};
|
||||||
|
|
||||||
class ClientQueryToDB{
|
class ClientQueryToDB{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "processparser.h"
|
#include "processparser.h"
|
||||||
|
#include "tasksAmmFim.h"
|
||||||
|
|
||||||
ProcessParser::ProcessParser(QObject *parent) : QObject(parent)
|
ProcessParser::ProcessParser(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
@@ -162,6 +163,7 @@ void ProcessParser::queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client)
|
|||||||
Instructor instructor;
|
Instructor instructor;
|
||||||
Trainee trainee;
|
Trainee trainee;
|
||||||
Group group;
|
Group group;
|
||||||
|
TaskAmmFim task;
|
||||||
void* data = nullptr;
|
void* data = nullptr;
|
||||||
|
|
||||||
/*Перебираем все атрибуты тега*/
|
/*Перебираем все атрибуты тега*/
|
||||||
@@ -228,6 +230,17 @@ void ProcessParser::queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client)
|
|||||||
else if(name == "name")
|
else if(name == "name")
|
||||||
group.setName(value);
|
group.setName(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE:
|
||||||
|
if(name == "title")
|
||||||
|
task.ammProcedure.title = value;
|
||||||
|
else if(name == "dmCode")
|
||||||
|
task.ammProcedure.dmCode = value;
|
||||||
|
break;
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE:
|
||||||
|
if(name == "title")
|
||||||
|
task.title = value;
|
||||||
|
break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -246,6 +259,10 @@ void ProcessParser::queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client)
|
|||||||
case TypeQueryToDB::TYPE_QUERY_EDIT_GROUP:
|
case TypeQueryToDB::TYPE_QUERY_EDIT_GROUP:
|
||||||
data = &group;
|
data = &group;
|
||||||
break;
|
break;
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE:
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE:
|
||||||
|
data = &task;
|
||||||
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
processingSystem->processingClientQueryToDB(client, queryToDB, id, data);
|
processingSystem->processingClientQueryToDB(client, queryToDB, id, data);
|
||||||
|
|||||||
@@ -227,6 +227,19 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
|
|||||||
emit sigAuthChanged();
|
emit sigAuthChanged();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE:
|
||||||
|
{
|
||||||
|
int id_new;
|
||||||
|
id_new = providerDBLMS->newTaskAMM(id);
|
||||||
|
if(id_new)
|
||||||
|
{
|
||||||
|
(*(TaskAmmFim*)data).setID(id_new);
|
||||||
|
providerDBLMS->editTaskAMM(*(TaskAmmFim*)data);
|
||||||
|
}
|
||||||
|
//emit sigTasksChanged();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB_LIST_INSTRUCTORS);
|
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB_LIST_INSTRUCTORS);
|
||||||
|
|||||||
@@ -299,3 +299,18 @@ int ProviderDBLMS::editGroup(Group group)
|
|||||||
{
|
{
|
||||||
return dbLMS->editGroup(group);
|
return dbLMS->editGroup(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ProviderDBLMS::newTaskAMM(int id_trainee)
|
||||||
|
{
|
||||||
|
return dbLMS->newTaskAMM(id_trainee);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProviderDBLMS::delTaskAMM(int id)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProviderDBLMS::editTaskAMM(TaskAmmFim task)
|
||||||
|
{
|
||||||
|
return dbLMS->editTaskAMM(task);
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "interfacedatabaselms.h"
|
#include "interfacedatabaselms.h"
|
||||||
|
#include "tasksAmmFim.h"
|
||||||
|
|
||||||
class ProviderDBLMS : public QObject
|
class ProviderDBLMS : public QObject
|
||||||
{
|
{
|
||||||
@@ -41,6 +42,10 @@ public:
|
|||||||
int delGroup(int id);
|
int delGroup(int id);
|
||||||
int editGroup(Group group);
|
int editGroup(Group group);
|
||||||
|
|
||||||
|
int newTaskAMM(int id_trainee);
|
||||||
|
int delTaskAMM(int id);
|
||||||
|
int editTaskAMM(TaskAmmFim task);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
//сигнал о блокировке авторизации
|
//сигнал о блокировке авторизации
|
||||||
void signal_BlockAutorization(bool block);
|
void signal_BlockAutorization(bool block);
|
||||||
|
|||||||
Reference in New Issue
Block a user