mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
Merge branch 'DEV' into bugfix-create-directory
This commit is contained in:
@@ -14,7 +14,6 @@ kanban-plugin: board
|
||||
|
||||
## feature
|
||||
|
||||
- [ ] отправка таски поштучно, при обновления статуса (проверка и тд)
|
||||
- [ ] регистрация времени включения и выключения тренажера (по приходу уходу пакета is unity) с регистрацие БД
|
||||
- [ ] Подсчет учебного времени - дельта между включением и выключением
|
||||
- [ ] Сервер при сворачивании превращается в трей
|
||||
@@ -32,6 +31,7 @@ kanban-plugin: board
|
||||
(от 18 фимов) или при кривом назначении задачи(назначить 2-3 подряд гуи перестает обновлятся)
|
||||
- [ ] Убрать ошибки QObject::moveToThread: Cannot move objects with a parent
|
||||
- [ ] /RRJ-95NEW-100/tasksAMM.xml заменить получение на docs
|
||||
- [ ] отправка таски поштучно, при обновления статуса (проверка и тд)
|
||||
|
||||
|
||||
## backlog
|
||||
|
||||
@@ -90,6 +90,11 @@ QString InterfaceDataBaseLMS::getNameInstructorByLogin(QString login)
|
||||
return selectInstructorNameByLogin(login);
|
||||
}
|
||||
|
||||
int InterfaceDataBaseLMS::getIdInstructorByLogin(QString login)
|
||||
{
|
||||
return selectInstructorID(login);
|
||||
}
|
||||
|
||||
QList<Instructor> InterfaceDataBaseLMS::getListInstructors()
|
||||
{
|
||||
return selectAllInstructors();
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
bool deAuthorizationAllInstructors();
|
||||
|
||||
QString getNameInstructorByLogin(QString login);
|
||||
int getIdInstructorByLogin(QString login);
|
||||
|
||||
QList<Instructor> getListInstructors();
|
||||
Instructor getInstructor(int id);
|
||||
|
||||
@@ -265,6 +265,12 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
||||
emit sigAnimationActivated(false);
|
||||
}
|
||||
|
||||
if(packetType == PacketType::HASH_READY)
|
||||
{
|
||||
//connectorToServer->sendQueryTasksXML("fim");
|
||||
//connectorToServer->sendQueryTasksXML("amm");
|
||||
}
|
||||
|
||||
//xml-ответы на запросы к БД
|
||||
switch(packetType)
|
||||
{
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnSend">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -92,7 +92,7 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>65</width>
|
||||
<height>44</height>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
|
||||
@@ -40,6 +40,7 @@ AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, TypeListTre
|
||||
connect(this, &AMMtasksWidget::signal_prepareAMMListItems, taskTreePreparation, &TaskAMMFIMTreePreparation::slot_prepareAMMListItems);
|
||||
connect(this, &AMMtasksWidget::signal_prepareAMMListItemsForTrainee, taskTreePreparation, &TaskAMMFIMTreePreparation::slot_prepareAMMListItemsForTrainee);
|
||||
connect(taskTreePreparation, &TaskAMMFIMTreePreparation::signal_listAMMItemsReady, this, &AMMtasksWidget::slot_AMMlistItemsReady);
|
||||
connect(this, &AMMtasksWidget::signal_stopParserPreparation, taskTreePreparation, &TaskAMMFIMTreePreparation::slot_stopParserPreparation);
|
||||
|
||||
waitAnimationWidget = new WaitAnimationWidget;
|
||||
QMovie *movie = new QMovie(":/resources/icons/762.gif");
|
||||
@@ -80,7 +81,7 @@ AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, TypeListTre
|
||||
AMMtasksWidget::~AMMtasksWidget()
|
||||
{
|
||||
waitAnimationWidget->hideWithStop();
|
||||
taskTreePreparation->stopParser();
|
||||
emit signal_stopParserPreparation();
|
||||
|
||||
threadPreparation->quit();
|
||||
threadPreparation->wait();
|
||||
@@ -163,34 +164,10 @@ void AMMtasksWidget::on_treeWidget_currentItemChanged(QTreeWidgetItem *current,
|
||||
|
||||
int id = current->text(ColumnsTreeAMM::clmnAMM_ID).toInt();
|
||||
|
||||
Module* module = taskTreePreparation->getModuleAMMbyID(id);
|
||||
|
||||
if(module)
|
||||
{
|
||||
QString type = "Code";
|
||||
QString code = "";
|
||||
|
||||
if(module->getType() == ModuleType::TYPE_PM)
|
||||
{
|
||||
PM* PMmodul = static_cast<PM*>(module);
|
||||
type = "PM";
|
||||
code = PMmodul->pmCode();
|
||||
|
||||
ui->btnAssignTask->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
DM* DMmodul = static_cast<DM*>(module);
|
||||
type = "DM";
|
||||
code = DMmodul->dmCode();
|
||||
|
||||
ui->btnAssignTask->setEnabled(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(taskTreePreparation->getTypeModuleAMMbyID(id) == ModuleType::TYPE_PM)
|
||||
ui->btnAssignTask->setEnabled(false);
|
||||
}
|
||||
else
|
||||
ui->btnAssignTask->setEnabled(true);
|
||||
}
|
||||
|
||||
void AMMtasksWidget::slot_NeedUpdateUI()
|
||||
@@ -292,27 +269,14 @@ void AMMtasksWidget::assignTaskAMMtoTrainee()
|
||||
|
||||
int id = current->text(ColumnsTreeAMM::clmnAMM_ID).toInt();
|
||||
|
||||
Module* module = taskTreePreparation->getModuleAMMbyID(id);
|
||||
TaskAmmFim taskNew = taskTreePreparation->getTaskAMMbyID(id);
|
||||
|
||||
if(module)
|
||||
if(taskNew.getID())
|
||||
{
|
||||
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);
|
||||
|
||||
int trainee_id = connectorToServer->getIdTraineeByLogin(loginTraineeSelected);
|
||||
|
||||
TaskAmmFim taskNew;
|
||||
taskNew.ammProcedure.title = techName;
|
||||
taskNew.ammProcedure.dmCode = dmCode;
|
||||
|
||||
emit signal_AssignedTask();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE, trainee_id, &taskNew);
|
||||
}
|
||||
emit signal_AssignedTask();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE, trainee_id, &taskNew);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,10 +310,14 @@ void AMMtasksWidget::on_btnCheck_clicked()
|
||||
|
||||
int id = treeItemCurrent->text(ColumnsTreeAMM::clmnAMM_ID).toInt();
|
||||
|
||||
TaskAmmFim task = taskTreePreparation->getTaskAMMbyID(id);
|
||||
|
||||
if(!task.getID())
|
||||
return;
|
||||
|
||||
DialogCheckTask dlg(connectorToServer, "amm", this);
|
||||
|
||||
//dlg.setTask(task);
|
||||
dlg.setIDTask(id);
|
||||
dlg.setTask(&task);
|
||||
|
||||
QDialog* dialog = new QDialog(this);
|
||||
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
||||
|
||||
@@ -57,6 +57,8 @@ Q_SIGNALS:
|
||||
|
||||
void signal_AssignedTask();
|
||||
|
||||
void signal_stopParserPreparation();
|
||||
|
||||
public Q_SLOTS:
|
||||
void slot_AMMlistItemsReady(QList<QTreeWidgetItem*> listItems);
|
||||
|
||||
|
||||
@@ -31,12 +31,16 @@ DialogCheckTask::DialogCheckTask(ConnectorToServer* connectorToServer, QString t
|
||||
ui->btnRight->setText(tr("Completed"));
|
||||
ui->btnWrong->setText(tr("New"));
|
||||
ui->btnWrong->setIcon(QIcon(QStringLiteral(":/resources/icons/circleGray.png")));
|
||||
|
||||
ui->btnRight->setEnabled(false);
|
||||
ui->btnWrong->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
DialogCheckTask::~DialogCheckTask()
|
||||
{
|
||||
delete fimTasksWidget;
|
||||
if(fimTasksWidget)
|
||||
delete fimTasksWidget;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -45,11 +49,21 @@ void DialogCheckTask::setTask(TaskAmmFim* task)
|
||||
this->task = *task;
|
||||
id_task = task->getID();
|
||||
|
||||
//Задача
|
||||
fimTasksWidget->setOneTaskFim(&this->task);
|
||||
if(type == "fim")
|
||||
{
|
||||
//Задача
|
||||
fimTasksWidget->setOneTaskFim(&this->task);
|
||||
|
||||
//Репорт
|
||||
outReport(this->task.report);
|
||||
//Репорт
|
||||
outReport(this->task.report);
|
||||
}
|
||||
else if(type == "amm")
|
||||
{
|
||||
if(this->task.status == "new")
|
||||
ui->btnRight->setEnabled(true);
|
||||
else
|
||||
ui->btnWrong->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
TaskAmmFim DialogCheckTask::getTask()
|
||||
@@ -57,6 +71,12 @@ TaskAmmFim DialogCheckTask::getTask()
|
||||
return this->task;
|
||||
}
|
||||
|
||||
void DialogCheckTask::setModule(Module *module)
|
||||
{
|
||||
this->module = *module;
|
||||
id_task = this->module.getID();
|
||||
}
|
||||
|
||||
void DialogCheckTask::outReport(FIMReport report)
|
||||
{
|
||||
QString str;
|
||||
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
TaskAmmFim getTask();
|
||||
bool getFlChanged(){return flChanged;}
|
||||
void setIDTask(int id){id_task = id;}
|
||||
void setModule(Module* module);
|
||||
|
||||
private slots:
|
||||
void on_btnWrong_clicked();
|
||||
@@ -32,6 +33,7 @@ private:
|
||||
|
||||
private:
|
||||
TaskAmmFim task;
|
||||
Module module;
|
||||
|
||||
private:
|
||||
Ui::DialogCheckTask *ui;
|
||||
|
||||
@@ -41,6 +41,7 @@ FIMtasksWidget::FIMtasksWidget(ConnectorToServer* connectorToServer, TypeListTre
|
||||
connect(this, &FIMtasksWidget::signal_prepareFIMListItems, taskTreePreparation, &TaskAMMFIMTreePreparation::slot_prepareFIMListItems);
|
||||
connect(this, &FIMtasksWidget::signal_prepareFIMListItemsForTrainee, taskTreePreparation, &TaskAMMFIMTreePreparation::slot_prepareFIMListItemsForTrainee);
|
||||
connect(taskTreePreparation, &TaskAMMFIMTreePreparation::signal_listFIMItemsReady, this, &FIMtasksWidget::slot_FIMlistItemsReady);
|
||||
connect(this, &FIMtasksWidget::signal_stopParserPreparation, taskTreePreparation, &TaskAMMFIMTreePreparation::slot_stopParserPreparation);
|
||||
|
||||
waitAnimationWidget = new WaitAnimationWidget;
|
||||
QMovie *movie = new QMovie(":/resources/icons/762.gif");
|
||||
@@ -83,7 +84,7 @@ FIMtasksWidget::FIMtasksWidget(ConnectorToServer* connectorToServer, TypeListTre
|
||||
FIMtasksWidget::~FIMtasksWidget()
|
||||
{
|
||||
waitAnimationWidget->hideWithStop();
|
||||
taskTreePreparation->stopParser();
|
||||
emit signal_stopParserPreparation();
|
||||
|
||||
threadPreparation->quit();
|
||||
threadPreparation->wait();
|
||||
@@ -166,9 +167,9 @@ void FIMtasksWidget::on_treeWidget_currentItemChanged(QTreeWidgetItem *current,
|
||||
{//Выбрана задача
|
||||
int id = current->text(ColumnsTreeFIM::clmnFIM_ID).toInt();
|
||||
|
||||
TaskAmmFim* task = taskTreePreparation->getTaskFIMbyID(id);
|
||||
TaskAmmFim task = taskTreePreparation->getTaskFIMbyID(id);
|
||||
|
||||
if(task == nullptr)
|
||||
if(!task.getID())
|
||||
{
|
||||
ui->btnAssignTask->setEnabled(false);
|
||||
|
||||
@@ -176,13 +177,13 @@ void FIMtasksWidget::on_treeWidget_currentItemChanged(QTreeWidgetItem *current,
|
||||
ui->btnCheck->setEnabled(false);
|
||||
}
|
||||
|
||||
code = task->title;
|
||||
code = task.title;
|
||||
|
||||
ui->btnAssignTask->setEnabled(true);
|
||||
|
||||
ui->btnDelete->setEnabled(true);
|
||||
|
||||
if(task->status != "new")
|
||||
if(task.status != "new")
|
||||
ui->btnCheck->setEnabled(true);
|
||||
else
|
||||
ui->btnCheck->setEnabled(false);
|
||||
@@ -298,14 +299,14 @@ void FIMtasksWidget::assignTaskFIMtoTrainee()
|
||||
|
||||
int id = current->text(ColumnsTreeFIM::clmnFIM_ID).toInt();
|
||||
|
||||
TaskAmmFim* task = taskTreePreparation->getTaskFIMbyID(id);
|
||||
TaskAmmFim task = taskTreePreparation->getTaskFIMbyID(id);
|
||||
|
||||
if(task)
|
||||
if(task.getID())
|
||||
{
|
||||
int trainee_id = connectorToServer->getIdTraineeByLogin(loginTraineeSelected);
|
||||
|
||||
TaskAmmFim taskNew;
|
||||
taskNew.title = task->title;
|
||||
taskNew.title = task.title;
|
||||
|
||||
//Назначенные неисправности
|
||||
for (int i = 0; i < current->childCount(); i++)
|
||||
@@ -314,7 +315,7 @@ void FIMtasksWidget::assignTaskFIMtoTrainee()
|
||||
|
||||
if(itemMalfunction->checkState(0) == Qt::Checked)
|
||||
{
|
||||
Malfunction malfunction = task->malfunctionList.at(i);
|
||||
Malfunction malfunction = task.malfunctionList.at(i);
|
||||
taskNew.malfunctionList.append(malfunction);
|
||||
}
|
||||
}
|
||||
@@ -359,11 +360,14 @@ void FIMtasksWidget::on_btnCheck_clicked()
|
||||
|
||||
int id = treeItemCurrent->text(ColumnsTreeFIM::clmnFIM_ID).toInt();
|
||||
|
||||
TaskAmmFim* task = taskTreePreparation->getTaskFIMbyID(id);
|
||||
TaskAmmFim task = taskTreePreparation->getTaskFIMbyID(id);
|
||||
|
||||
if(!task.getID())
|
||||
return;
|
||||
|
||||
DialogCheckTask dlg(connectorToServer, "fim", this);
|
||||
|
||||
dlg.setTask(task);
|
||||
dlg.setTask(&task);
|
||||
|
||||
QDialog* dialog = new QDialog(this);
|
||||
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
||||
|
||||
@@ -59,6 +59,8 @@ Q_SIGNALS:
|
||||
|
||||
void signal_AssignedTask();
|
||||
|
||||
void signal_stopParserPreparation();
|
||||
|
||||
public Q_SLOTS:
|
||||
void slot_FIMlistItemsReady(QList<QTreeWidgetItem*> listItems);
|
||||
|
||||
|
||||
@@ -13,37 +13,68 @@ TaskAMMFIMTreePreparation::TaskAMMFIMTreePreparation(TypeListTreeAMMFIM type, QO
|
||||
|
||||
TaskAMMFIMTreePreparation::~TaskAMMFIMTreePreparation()
|
||||
{
|
||||
mtxAccess.lock();
|
||||
deleteAllModulsAMM();
|
||||
deleteAllTaskFIM();
|
||||
mtxAccess.unlock();
|
||||
}
|
||||
|
||||
void TaskAMMFIMTreePreparation::stopParser()
|
||||
void TaskAMMFIMTreePreparation::slot_stopParserPreparation()
|
||||
{
|
||||
flagStop = true;
|
||||
}
|
||||
|
||||
TaskAmmFim* TaskAMMFIMTreePreparation::getTaskFIMbyID(int id)
|
||||
TaskAmmFim TaskAMMFIMTreePreparation::getTaskFIMbyID(int id)
|
||||
{
|
||||
for(int i = 0; i < listTaskFIM.count(); i++)
|
||||
mtxAccess.lock();
|
||||
for(int i = 0; i < listTasksFIM.count(); i++)
|
||||
{/*Задачи*/
|
||||
TaskAmmFim* task = listTaskFIM.at(i);
|
||||
if(task->id == id)
|
||||
TaskAmmFim task = listTasksFIM.at(i);
|
||||
if(task.id == id)
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return task;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
mtxAccess.unlock();
|
||||
return TaskAmmFim();
|
||||
}
|
||||
|
||||
Module* TaskAMMFIMTreePreparation::getModuleAMMbyID(int id)
|
||||
TaskAmmFim TaskAMMFIMTreePreparation::getTaskAMMbyID(int id)
|
||||
{
|
||||
mtxAccess.lock();
|
||||
for(int i = 0; i < listTasksAMM.count(); i++)
|
||||
{/*Задачи*/
|
||||
TaskAmmFim task = listTasksAMM.at(i);
|
||||
if(task.id == id)
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return task;
|
||||
}
|
||||
}
|
||||
mtxAccess.unlock();
|
||||
return TaskAmmFim();
|
||||
}
|
||||
|
||||
ModuleType TaskAMMFIMTreePreparation::getTypeModuleAMMbyID(int id)
|
||||
{
|
||||
ModuleType type = ModuleType::TYPE_PM;
|
||||
Module* ptrModule = nullptr;
|
||||
|
||||
mtxAccess.lock();
|
||||
for(Module* module: listAllModulesAMM)
|
||||
{
|
||||
ptrModule = module->getModuleByID(id);
|
||||
if(ptrModule)
|
||||
return ptrModule;
|
||||
{
|
||||
type = ptrModule->getType();
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
mtxAccess.unlock();
|
||||
return type;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *TaskAMMFIMTreePreparation::addModuleToTreeWidgetAMM(Module *module, bool flOnlyActive, QTreeWidgetItem *parentItem)
|
||||
@@ -97,7 +128,10 @@ QTreeWidgetItem *TaskAMMFIMTreePreparation::addModuleToTreeWidgetAMM(Module *mod
|
||||
|
||||
void TaskAMMFIMTreePreparation::loadAMMtasksFromXML(QByteArray array)
|
||||
{
|
||||
mtxAccess.lock();
|
||||
|
||||
deleteAllModulsAMM();
|
||||
listTasksAMM.clear();
|
||||
|
||||
QDomDocument docTasksDOM;
|
||||
|
||||
@@ -105,14 +139,21 @@ void TaskAMMFIMTreePreparation::loadAMMtasksFromXML(QByteArray array)
|
||||
|
||||
QDomElement manifestElement = docTasksDOM.firstChildElement("manifest");
|
||||
if(manifestElement.isNull())
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
domElementParserAMM(manifestElement, nullptr);
|
||||
|
||||
mtxAccess.unlock();
|
||||
}
|
||||
|
||||
void TaskAMMFIMTreePreparation::loadFIMtasksFromXML(QByteArray array)
|
||||
{
|
||||
deleteAllTaskFIM();
|
||||
mtxAccess.lock();
|
||||
|
||||
listTasksFIM.clear();
|
||||
|
||||
QDomDocument docTasksDOM;
|
||||
|
||||
@@ -120,17 +161,26 @@ void TaskAMMFIMTreePreparation::loadFIMtasksFromXML(QByteArray array)
|
||||
|
||||
QDomElement RRJTasksElement = docTasksDOM.firstChildElement("RRJTasks");
|
||||
if(RRJTasksElement.isNull())
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
QDomElement taskElement = RRJTasksElement.firstChildElement();
|
||||
if(taskElement.isNull())
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
do
|
||||
{/*task*/
|
||||
|
||||
if(flagStop)
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
QString name = taskElement.nodeName();
|
||||
QDomNamedNodeMap nodeMap = taskElement.attributes();
|
||||
@@ -187,21 +237,15 @@ void TaskAMMFIMTreePreparation::loadFIMtasksFromXML(QByteArray array)
|
||||
}
|
||||
}while(! (malfunctionElement = malfunctionElement.nextSiblingElement()).isNull());
|
||||
}
|
||||
listTaskFIM.append(task);
|
||||
listTasksFIM.append(*task);
|
||||
delete task;
|
||||
}
|
||||
}while (! (taskElement = taskElement.nextSiblingElement()).isNull());
|
||||
|
||||
mtxAccess.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
void TaskAMMFIMTreePreparation::deleteAllTaskFIM()
|
||||
{
|
||||
for(TaskAmmFim* task: listTaskFIM)
|
||||
delete task;
|
||||
|
||||
listTaskFIM.clear();
|
||||
}
|
||||
|
||||
void TaskAMMFIMTreePreparation::deleteAllModulsAMM()
|
||||
{
|
||||
for(Module* module: listAllModulesAMM)
|
||||
@@ -306,7 +350,8 @@ void TaskAMMFIMTreePreparation::domElementParserAMM(QDomElement element, Module*
|
||||
nodeMap.namedItem("xml").nodeValue());
|
||||
|
||||
//Активность
|
||||
if(nodeMap.namedItem("canplay").nodeValue() == "1")
|
||||
QString canplay = nodeMap.namedItem("canplay").nodeValue();
|
||||
if(canplay.contains("+"))
|
||||
DMmodulParent->setIsActiveTrue();
|
||||
}
|
||||
else
|
||||
@@ -325,6 +370,19 @@ void TaskAMMFIMTreePreparation::domElementParserAMM(QDomElement element, Module*
|
||||
if(moduleParent == nullptr)
|
||||
listAllModulesAMM.append(module);
|
||||
|
||||
if(module)
|
||||
if(module->getType() == ModuleType::TYPE_DM)
|
||||
{
|
||||
TaskAmmFim* task = nullptr;
|
||||
task = new TaskAmmFim();
|
||||
task->setID(module->getID());
|
||||
task->ammProcedure.title = static_cast<DM*>(module)->getLangStructRus().techName;
|
||||
task->ammProcedure.dmCode = static_cast<DM*>(module)->dmCode();
|
||||
|
||||
listTasksAMM.append(*task);
|
||||
delete task;
|
||||
}
|
||||
|
||||
}while (! (childElement = childElement.nextSiblingElement()).isNull());
|
||||
}
|
||||
|
||||
@@ -345,13 +403,17 @@ void TaskAMMFIMTreePreparation::slot_prepareAMMListItems(QByteArray array, bool
|
||||
Q_EMIT signal_listAMMItemsReady(listItems);
|
||||
}
|
||||
|
||||
void TaskAMMFIMTreePreparation::slot_prepareAMMListItemsForTrainee(QList<TaskAmmFim> listTask)
|
||||
void TaskAMMFIMTreePreparation::slot_prepareAMMListItemsForTrainee(QList<TaskAmmFim> listTasks)
|
||||
{
|
||||
qDebug() << "TaskAMMFIMTreePreparation::slot_prepareAMMListItemsForTrainee thread ID " << QThread::currentThreadId();
|
||||
|
||||
listItems.clear();
|
||||
|
||||
for(TaskAmmFim task : listTask)
|
||||
mtxAccess.lock();
|
||||
|
||||
this->listTasksAMM = listTasks;
|
||||
|
||||
for(TaskAmmFim task : listTasks)
|
||||
{
|
||||
QTreeWidgetItem* item = nullptr;
|
||||
|
||||
@@ -393,6 +455,8 @@ void TaskAMMFIMTreePreparation::slot_prepareAMMListItemsForTrainee(QList<TaskAmm
|
||||
listItems.append(item);
|
||||
}
|
||||
|
||||
mtxAccess.unlock();
|
||||
|
||||
Q_EMIT signal_listAMMItemsReady(listItems);
|
||||
}
|
||||
|
||||
@@ -404,9 +468,11 @@ void TaskAMMFIMTreePreparation::slot_prepareFIMListItems(QByteArray array)
|
||||
|
||||
listItems.clear();
|
||||
|
||||
for(TaskAmmFim* taskPtr : listTaskFIM)
|
||||
mtxAccess.lock();
|
||||
|
||||
for(TaskAmmFim taskPtr : listTasksFIM)
|
||||
{/*Задачи*/
|
||||
TaskAmmFim task = *taskPtr;
|
||||
TaskAmmFim task = taskPtr;
|
||||
|
||||
QTreeWidgetItem* itemTask = new QTreeWidgetItem();
|
||||
|
||||
@@ -477,22 +543,27 @@ void TaskAMMFIMTreePreparation::slot_prepareFIMListItems(QByteArray array)
|
||||
listItems.append(itemTask);
|
||||
}
|
||||
|
||||
mtxAccess.unlock();
|
||||
|
||||
Q_EMIT signal_listFIMItemsReady(listItems);
|
||||
}
|
||||
|
||||
void TaskAMMFIMTreePreparation::slot_prepareFIMListItemsForTrainee(QList<TaskAmmFim> listTask)
|
||||
void TaskAMMFIMTreePreparation::slot_prepareFIMListItemsForTrainee(QList<TaskAmmFim> listTasks)
|
||||
{
|
||||
qDebug() << "TaskAMMFIMTreePreparation::slot_prepareFIMListItemsForTrainee thread ID " << QThread::currentThreadId();
|
||||
|
||||
listItems.clear();
|
||||
|
||||
for(TaskAmmFim task : listTask)
|
||||
mtxAccess.lock();
|
||||
this->listTasksFIM = listTasks;
|
||||
|
||||
for(TaskAmmFim task : listTasks)
|
||||
{/*Задачи*/
|
||||
//TaskAmmFim* task = listTaskAmmFim.at(i);
|
||||
TaskAmmFim* taskNew = nullptr;
|
||||
taskNew = new TaskAmmFim();
|
||||
*taskNew = task;
|
||||
listTaskFIM.append(taskNew);
|
||||
//TaskAmmFim* taskNew = nullptr;
|
||||
//taskNew = new TaskAmmFim();
|
||||
//*taskNew = task;
|
||||
//listTaskFIM.append(taskNew);
|
||||
|
||||
QTreeWidgetItem* itemTask = new QTreeWidgetItem();
|
||||
|
||||
@@ -564,5 +635,7 @@ void TaskAMMFIMTreePreparation::slot_prepareFIMListItemsForTrainee(QList<TaskAmm
|
||||
listItems.append(itemTask);
|
||||
}
|
||||
|
||||
mtxAccess.unlock();
|
||||
|
||||
Q_EMIT signal_listFIMItemsReady(listItems);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <QObject>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QDomElement>
|
||||
#include <QMutex>
|
||||
#include "module.h"
|
||||
#include "tasksAmmFim.h"
|
||||
|
||||
@@ -38,40 +39,45 @@ public:
|
||||
~TaskAMMFIMTreePreparation();
|
||||
|
||||
public:
|
||||
void stopParser();
|
||||
TaskAmmFim getTaskFIMbyID(int id);
|
||||
TaskAmmFim getTaskAMMbyID(int id);
|
||||
|
||||
TaskAmmFim* getTaskFIMbyID(int id);
|
||||
Module* getModuleAMMbyID(int id);
|
||||
ModuleType getTypeModuleAMMbyID(int id);
|
||||
|
||||
private:
|
||||
QTreeWidgetItem* addModuleToTreeWidgetAMM(Module* module, bool flOnlyActive = false, QTreeWidgetItem* parentItem = nullptr);
|
||||
|
||||
void loadAMMtasksFromXML(QByteArray array);
|
||||
void domElementParserAMM(QDomElement element, Module* moduleParent);
|
||||
void deleteAllModulsAMM();
|
||||
|
||||
void loadFIMtasksFromXML(QByteArray array);
|
||||
void deleteAllTaskFIM();
|
||||
|
||||
public Q_SLOTS:
|
||||
void slot_prepareAMMListItems(QByteArray array, bool flOnlyActive);
|
||||
void slot_prepareAMMListItemsForTrainee(QList<TaskAmmFim> listTask);
|
||||
void slot_prepareAMMListItemsForTrainee(QList<TaskAmmFim> listTasks);
|
||||
|
||||
void slot_prepareFIMListItems(QByteArray array);
|
||||
void slot_prepareFIMListItemsForTrainee(QList<TaskAmmFim> listTask);
|
||||
void slot_prepareFIMListItemsForTrainee(QList<TaskAmmFim> listTasks);
|
||||
|
||||
void slot_stopParserPreparation();
|
||||
|
||||
Q_SIGNALS:
|
||||
void signal_listAMMItemsReady(QList<QTreeWidgetItem*> listItemsAMM);
|
||||
|
||||
void signal_listFIMItemsReady(QList<QTreeWidgetItem*> listItemsFIM);
|
||||
|
||||
private:
|
||||
QList<QTreeWidgetItem*> listItems;
|
||||
|
||||
QList<Module*> listAllModulesAMM;
|
||||
QList<TaskAmmFim*> listTaskFIM;
|
||||
|
||||
QList<TaskAmmFim> listTasksFIM;
|
||||
QList<TaskAmmFim> listTasksAMM;
|
||||
|
||||
bool flagStop;
|
||||
TypeListTreeAMMFIM type;
|
||||
|
||||
QMutex mtxAccess;
|
||||
};
|
||||
|
||||
#endif // TASKTREEPREPARATION_H
|
||||
|
||||
@@ -10,7 +10,7 @@ void ClientAnswerParser::initialize(DataParser *dataParser)
|
||||
this->dataParser = dataParser;
|
||||
}
|
||||
|
||||
QByteArray ClientAnswerParser::authorization(bool result, QString instructorName,QString clientName, QString accessType, QString login)
|
||||
QByteArray ClientAnswerParser::authorization(bool result, QString instructorName,QString clientName, QString accessType, QString login, int id)
|
||||
{
|
||||
|
||||
QList<SXmlAnswerTag> listTag;
|
||||
@@ -20,7 +20,8 @@ QByteArray ClientAnswerParser::authorization(bool result, QString instructorName
|
||||
SAttribute attribute3 = {"ClientName", clientName};
|
||||
SAttribute attribute4 = {"AccessType", accessType};
|
||||
SAttribute attribute5 = {"Login", login};
|
||||
QList<SAttribute> listAttr = {attribute1, attribute2, attribute3, attribute4, attribute5};
|
||||
SAttribute attribute6 = {"id_client", QString::number(id)};
|
||||
QList<SAttribute> listAttr = {attribute1, attribute2, attribute3, attribute4, attribute5, attribute6};
|
||||
SXmlAnswerTag tag = {"ServerAuthorization", listAttr};
|
||||
|
||||
listTag.append(tag);
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
explicit ClientAnswerParser(QObject *parent = nullptr);
|
||||
void initialize(DataParser *dataParser);
|
||||
|
||||
QByteArray authorization(bool result, QString instructorName, QString clientName, QString accessType, QString login);
|
||||
QByteArray authorization(bool result, QString instructorName, QString clientName, QString accessType, QString login, int id);
|
||||
QByteArray deAuthorization(bool result, QString login);
|
||||
QByteArray message(QString text, QString login = "");
|
||||
QByteArray task(QString text);
|
||||
|
||||
@@ -51,6 +51,7 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien
|
||||
QString instructorName;
|
||||
QString traineeName;
|
||||
QByteArray arrayAnswer;
|
||||
int clientID = 0;
|
||||
|
||||
|
||||
if(providerDBLMS->authorizationInstructor(clientAutorization.Login, clientAutorization.Password))
|
||||
@@ -61,8 +62,9 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien
|
||||
emit sigUpdateListClients();
|
||||
|
||||
instructorName = providerDBLMS->getNameInstructorByLogin(clientAutorization.Login);
|
||||
clientID = providerDBLMS->getIdInstructorByLogin(clientAutorization.Login);
|
||||
|
||||
arrayAnswer = dataParser->ClientAnswer()->authorization(true, instructorName, instructorName, "instructor", clientAutorization.Login);
|
||||
arrayAnswer = dataParser->ClientAnswer()->authorization(true, instructorName, instructorName, "instructor", clientAutorization.Login, clientID);
|
||||
}
|
||||
else if(clientAutorization.TypeClient != TypeClientAutorization::TYPE_GUI)
|
||||
{
|
||||
@@ -75,17 +77,18 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien
|
||||
//KAV redact
|
||||
instructorName = providerDBLMS->getMainInstructorName();
|
||||
traineeName = providerDBLMS->getNameTraineeByLogin(clientAutorization.Login);
|
||||
clientID = providerDBLMS->getIdTraineeByLogin(clientAutorization.Login);
|
||||
|
||||
arrayAnswer = dataParser->ClientAnswer()->authorization(true, instructorName, traineeName, "trainee", clientAutorization.Login);
|
||||
arrayAnswer = dataParser->ClientAnswer()->authorization(true, instructorName, traineeName, "trainee", clientAutorization.Login, clientID);
|
||||
}
|
||||
else
|
||||
{//Никто не авторизовался
|
||||
arrayAnswer = dataParser->ClientAnswer()->authorization(false, "", "", "", "");
|
||||
arrayAnswer = dataParser->ClientAnswer()->authorization(false, "", "", "", "", 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{//Никто не авторизовался
|
||||
arrayAnswer = dataParser->ClientAnswer()->authorization(false, "", "", "", "");
|
||||
arrayAnswer = dataParser->ClientAnswer()->authorization(false, "", "", "", "", 0);
|
||||
}
|
||||
client->sendXmlAnswer(arrayAnswer);
|
||||
client->sendVersion();
|
||||
@@ -527,6 +530,7 @@ void ProcessingSystem::sendListTasksFIMofTraineetoClient(ClientHandler *client,
|
||||
|
||||
void ProcessingSystem::sendListTasksAMMofTraineeByIDtoClient(ClientHandler *client, int id_trainee, QList<int> listID)
|
||||
{
|
||||
QList<TaskAmmFim> listTasksNeed;
|
||||
QList<TaskAmmFim> listTasks = providerDBLMS->GetListTasksAMMofTrainee(id_trainee);
|
||||
|
||||
for(int i = 0; i < listTasks.count(); i++)
|
||||
@@ -541,17 +545,18 @@ void ProcessingSystem::sendListTasksAMMofTraineeByIDtoClient(ClientHandler *clie
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!flNeed)
|
||||
listTasks.removeAt(i);
|
||||
if(flNeed)
|
||||
listTasksNeed.append(listTasks.at(i));
|
||||
}
|
||||
|
||||
QByteArray arrayAnswer = dataParser->DbAnswer()->listTasksAMMofTrainee(true, &listTasks, id_trainee, false);
|
||||
QByteArray arrayAnswer = dataParser->DbAnswer()->listTasksAMMofTrainee(true, &listTasksNeed, id_trainee, false);
|
||||
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE);
|
||||
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE);
|
||||
}
|
||||
|
||||
void ProcessingSystem::sendListTasksFIMofTraineeByIDtoClient(ClientHandler *client, int id_trainee, QList<int> listID)
|
||||
{
|
||||
QList<TaskAmmFim> listTasksNeed;
|
||||
QList<TaskAmmFim> listTasks = providerDBLMS->GetListTasksFIMofTrainee(id_trainee);
|
||||
|
||||
for(int i = 0; i < listTasks.count(); i++)
|
||||
@@ -566,11 +571,11 @@ void ProcessingSystem::sendListTasksFIMofTraineeByIDtoClient(ClientHandler *clie
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!flNeed)
|
||||
listTasks.removeAt(i);
|
||||
if(flNeed)
|
||||
listTasksNeed.append(listTasks.at(i));
|
||||
}
|
||||
|
||||
QByteArray arrayAnswer = dataParser->DbAnswer()->listTasksFIMofTrainee(true, &listTasks, id_trainee, false);
|
||||
QByteArray arrayAnswer = dataParser->DbAnswer()->listTasksFIMofTrainee(true, &listTasksNeed, id_trainee, false);
|
||||
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE);
|
||||
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE);
|
||||
}
|
||||
|
||||
@@ -240,6 +240,24 @@ int ProviderDBLMS::getIdTraineeByLogin(QString login)
|
||||
return id_trainee;
|
||||
}
|
||||
|
||||
int ProviderDBLMS::getIdInstructorByLogin(QString login)
|
||||
{
|
||||
int id_instructor = 0;
|
||||
qDebug() << "ProviderDBLMS " << QThread::currentThreadId();
|
||||
mtxAccess.lock();
|
||||
|
||||
if(! dbLMS->DBisConnected())
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return id_instructor;
|
||||
}
|
||||
|
||||
id_instructor = dbLMS->getIdInstructorByLogin(login);
|
||||
|
||||
mtxAccess.unlock();
|
||||
return id_instructor;
|
||||
}
|
||||
|
||||
QString ProviderDBLMS::getLoginTraineeById(int id_trainee)
|
||||
{
|
||||
QString login = "";
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
|
||||
//
|
||||
int getIdTraineeByLogin(QString login);
|
||||
int getIdInstructorByLogin(QString login);
|
||||
QString getLoginTraineeById(int id_trainee);
|
||||
|
||||
QList<Instructor> GetListAllInstructors();
|
||||
|
||||
Reference in New Issue
Block a user