mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Переделано под один мега-проект LMS с общим CMakeLists.txt
This commit is contained in:
286
InstructorsAndTrainees/docTasks/doctaskswidget.cpp
Normal file
286
InstructorsAndTrainees/docTasks/doctaskswidget.cpp
Normal file
@@ -0,0 +1,286 @@
|
||||
#include <QFile>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QDomDocument>
|
||||
#include <QMessageBox>
|
||||
#include "doctaskswidget.h"
|
||||
#include "ui_doctaskswidget.h"
|
||||
|
||||
DocTasksWidget::DocTasksWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::DocTasksWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
treeWidget = new QTreeWidget();
|
||||
|
||||
connect(treeWidget, &QTreeWidget::currentItemChanged, this, &DocTasksWidget::on_treeWidget_currentItemChanged);
|
||||
|
||||
ui->horizontalLayout_2->addWidget(treeWidget);
|
||||
|
||||
preparationTreeWidget();
|
||||
|
||||
loadDocTasksFromXML();
|
||||
|
||||
updateTreeWidget();
|
||||
}
|
||||
|
||||
DocTasksWidget::~DocTasksWidget()
|
||||
{
|
||||
deleteAllModuls();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DocTasksWidget::on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||
{
|
||||
if(current == nullptr)
|
||||
return;
|
||||
|
||||
int id = current->text(ColumnsTree::clmn_ID).toInt();
|
||||
|
||||
Module* module = searchModuleByID(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();
|
||||
}
|
||||
else
|
||||
{
|
||||
DM* DMmodul = static_cast<DM*>(module);
|
||||
type = "DM";
|
||||
code = DMmodul->dmCode();
|
||||
}
|
||||
|
||||
ui->label->setText(type + " Code");
|
||||
ui->editCode->setText(code);
|
||||
}
|
||||
}
|
||||
|
||||
void DocTasksWidget::domElementParser(QDomElement element, Module* moduleParent)
|
||||
{
|
||||
QString name;
|
||||
|
||||
QDomElement childElement = element.firstChildElement();
|
||||
if(childElement.isNull())
|
||||
return;
|
||||
|
||||
Module* module = nullptr;
|
||||
|
||||
do
|
||||
{
|
||||
name = childElement.nodeName();
|
||||
|
||||
QDomNamedNodeMap nodeMap = childElement.attributes();
|
||||
|
||||
if(name == "pm")
|
||||
{
|
||||
module = new PM();
|
||||
PM* PMmodul = static_cast<PM*>(module);
|
||||
|
||||
PMmodul->initialize(nodeMap.namedItem("modelIdentCode").nodeValue(),
|
||||
nodeMap.namedItem("pmIssuer").nodeValue(),
|
||||
nodeMap.namedItem("pmNumber").nodeValue(),
|
||||
nodeMap.namedItem("pmVolume").nodeValue());
|
||||
|
||||
if(moduleParent)
|
||||
{
|
||||
PMmodul->setParentModule(moduleParent);
|
||||
|
||||
PM* PMmodulParent = static_cast<PM*>(moduleParent);
|
||||
PMmodulParent->addChildModule(module);
|
||||
}
|
||||
}
|
||||
else if(name == "dm")
|
||||
{
|
||||
module = new DM();
|
||||
DM* DMmodul = static_cast<DM*>(module);
|
||||
|
||||
DMmodul->initialize(nodeMap.namedItem("modelIdentCode").nodeValue(),
|
||||
nodeMap.namedItem("systemDiffCode").nodeValue(),
|
||||
nodeMap.namedItem("systemCode").nodeValue(),
|
||||
nodeMap.namedItem("subSystemCode").nodeValue(),
|
||||
nodeMap.namedItem("subSubSystemCode").nodeValue(),
|
||||
nodeMap.namedItem("assyCode").nodeValue(),
|
||||
nodeMap.namedItem("disassyCode").nodeValue(),
|
||||
nodeMap.namedItem("disassyCodeVariant").nodeValue(),
|
||||
nodeMap.namedItem("infoCode").nodeValue(),
|
||||
nodeMap.namedItem("infoCodeVariant").nodeValue(),
|
||||
nodeMap.namedItem("itemLocationCode").nodeValue());
|
||||
|
||||
if(moduleParent)
|
||||
{
|
||||
DMmodul->setParentModule(moduleParent);
|
||||
|
||||
PM* PMmodulParent = static_cast<PM*>(moduleParent);
|
||||
PMmodulParent->addChildModule(module);
|
||||
}
|
||||
}
|
||||
else if(name == "rus" || name == "eng")
|
||||
{
|
||||
if(moduleParent)
|
||||
{
|
||||
if(moduleParent->getType() == ModuleType::TYPE_PM)
|
||||
{//PM
|
||||
PM* PMmodulParent = static_cast<PM*>(moduleParent);
|
||||
|
||||
if(name == "rus")
|
||||
PMmodulParent->setLangStructRus(nodeMap.namedItem("title").nodeValue());
|
||||
else
|
||||
PMmodulParent->setLangStructEng(nodeMap.namedItem("title").nodeValue());
|
||||
}
|
||||
else
|
||||
{//DM
|
||||
DM* DMmodulParent = static_cast<DM*>(moduleParent);
|
||||
|
||||
if(name == "rus")
|
||||
DMmodulParent->setLangStructRus(nodeMap.namedItem("techName").nodeValue(),
|
||||
nodeMap.namedItem("infoName").nodeValue(),
|
||||
nodeMap.namedItem("pdf").nodeValue(),
|
||||
nodeMap.namedItem("bookmark").nodeValue(),
|
||||
nodeMap.namedItem("xml").nodeValue());
|
||||
else
|
||||
DMmodulParent->setLangStructEng(nodeMap.namedItem("techName").nodeValue(),
|
||||
nodeMap.namedItem("infoName").nodeValue(),
|
||||
nodeMap.namedItem("pdf").nodeValue(),
|
||||
nodeMap.namedItem("bookmark").nodeValue(),
|
||||
nodeMap.namedItem("xml").nodeValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
domElementParser(childElement, module);
|
||||
|
||||
if(moduleParent == nullptr)
|
||||
listAllModules.append(module);
|
||||
|
||||
}while (! (childElement = childElement.nextSiblingElement()).isNull());
|
||||
}
|
||||
|
||||
void DocTasksWidget::loadDocTasksFromXML()
|
||||
{
|
||||
QDomDocument docTasksDOM;
|
||||
QString xmlFileName = "./docs.xml";
|
||||
QFile xmlInFile(xmlFileName);
|
||||
if (!xmlInFile.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
QMessageBox::critical(nullptr, tr("Attention!"), tr("The file could not be opened ") + xmlFileName);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
docTasksDOM.setContent(xmlInFile.readAll());
|
||||
xmlInFile.close();
|
||||
|
||||
QDomElement manifestElement = docTasksDOM.firstChildElement("manifest");
|
||||
if(manifestElement.isNull())
|
||||
return;
|
||||
|
||||
//deleteAllModuls();
|
||||
|
||||
domElementParser(manifestElement, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void DocTasksWidget::deleteAllModuls()
|
||||
{
|
||||
for(Module* module: listAllModules)
|
||||
{
|
||||
if(module->getType() == ModuleType::TYPE_PM)
|
||||
delete static_cast<PM*>(module);
|
||||
else
|
||||
delete static_cast<DM*>(module);
|
||||
}
|
||||
listAllModules.clear();
|
||||
}
|
||||
|
||||
Module *DocTasksWidget::searchModuleByID(int id)
|
||||
{
|
||||
Module* ptrModule = nullptr;
|
||||
|
||||
for(Module* module: listAllModules)
|
||||
{
|
||||
ptrModule = module->getModuleByID(id);
|
||||
if(ptrModule)
|
||||
return ptrModule;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DocTasksWidget::preparationTreeWidget()
|
||||
{
|
||||
treeWidget->setColumnCount(2);
|
||||
|
||||
reSetHeadTreeWidget();
|
||||
|
||||
treeWidget->setColumnWidth(ColumnsTree::clmn_ID, 80);
|
||||
treeWidget->setColumnWidth(ColumnsTree::clmn_PMorDM, 900);
|
||||
|
||||
//treeWidget->setColumnHidden(ColumnsTree::clmn_ID, true);
|
||||
}
|
||||
|
||||
void DocTasksWidget::reSetHeadTreeWidget()
|
||||
{
|
||||
QStringList listHeaders = {tr("PM/DM"), tr("ID")};
|
||||
treeWidget->setHeaderLabels(listHeaders);
|
||||
}
|
||||
|
||||
void DocTasksWidget::updateTreeWidget()
|
||||
{
|
||||
//Обновление дерева
|
||||
treeWidget->clear();
|
||||
|
||||
for(Module* module : listAllModules)
|
||||
{
|
||||
addModuleToTreeWidget(module);
|
||||
}
|
||||
}
|
||||
|
||||
void DocTasksWidget::addModuleToTreeWidget(Module *module, QTreeWidgetItem* parentItem)
|
||||
{
|
||||
QTreeWidgetItem* itemModule = nullptr;
|
||||
|
||||
QString text;
|
||||
QString ID = QString::number(module->getID());
|
||||
|
||||
if(parentItem)
|
||||
{
|
||||
itemModule = new QTreeWidgetItem();
|
||||
parentItem->addChild(itemModule);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemModule = new QTreeWidgetItem(treeWidget);
|
||||
}
|
||||
|
||||
if(module->getType() == ModuleType::TYPE_PM)
|
||||
{
|
||||
PM* PMmodul = static_cast<PM*>(module);
|
||||
text = PMmodul->getLangStructRus().title;
|
||||
|
||||
for(Module* module : PMmodul->getListChildModules())
|
||||
{
|
||||
addModuleToTreeWidget(module, itemModule);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DM* DMmodul = static_cast<DM*>(module);
|
||||
text = DMmodul->getLangStructRus().techName;
|
||||
|
||||
itemModule->setFlags(itemModule->flags() | Qt::ItemIsUserCheckable);
|
||||
itemModule->setCheckState(0, Qt::Checked);
|
||||
itemModule->setIcon(0, QIcon(":/resources/icons/procedure.png"));
|
||||
}
|
||||
|
||||
itemModule->setText(ColumnsTree::clmn_PMorDM, text);
|
||||
itemModule->setText(ColumnsTree::clmn_ID, ID);
|
||||
}
|
||||
|
||||
48
InstructorsAndTrainees/docTasks/doctaskswidget.h
Normal file
48
InstructorsAndTrainees/docTasks/doctaskswidget.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef DOCTASKSWIDGET_H
|
||||
#define DOCTASKSWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTreeWidget>
|
||||
#include <QDomNode>
|
||||
#include "module.h"
|
||||
|
||||
namespace Ui {
|
||||
class DocTasksWidget;
|
||||
}
|
||||
|
||||
class DocTasksWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
enum ColumnsTree{
|
||||
clmn_PMorDM = 0,
|
||||
clmn_ID
|
||||
};
|
||||
|
||||
public:
|
||||
explicit DocTasksWidget(QWidget *parent = nullptr);
|
||||
~DocTasksWidget();
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||
|
||||
private:
|
||||
void domElementParser(QDomElement element, Module* moduleParent);
|
||||
void loadDocTasksFromXML();
|
||||
void deleteAllModuls();
|
||||
Module* searchModuleByID(int id);
|
||||
|
||||
void preparationTreeWidget();
|
||||
void reSetHeadTreeWidget();
|
||||
void updateTreeWidget();
|
||||
void addModuleToTreeWidget(Module* module, QTreeWidgetItem* parentItem = nullptr);
|
||||
|
||||
private:
|
||||
Ui::DocTasksWidget *ui;
|
||||
QTreeWidget* treeWidget;
|
||||
|
||||
QList<Module*> listAllModules;
|
||||
};
|
||||
|
||||
#endif // DOCTASKSWIDGET_H
|
||||
61
InstructorsAndTrainees/docTasks/doctaskswidget.ui
Normal file
61
InstructorsAndTrainees/docTasks/doctaskswidget.ui
Normal file
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DocTasksWidget</class>
|
||||
<widget class="QWidget" name="DocTasksWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Tahoma</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>AMM</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Code</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="editCode">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
174
InstructorsAndTrainees/docTasks/fimtaskswidget.cpp
Normal file
174
InstructorsAndTrainees/docTasks/fimtaskswidget.cpp
Normal file
@@ -0,0 +1,174 @@
|
||||
#include <QDomDocument>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QTreeWidget>
|
||||
#include "fimtaskswidget.h"
|
||||
#include "ui_fimtaskswidget.h"
|
||||
#include "tasksAmmFim.h"
|
||||
|
||||
FIMtasksWidget::FIMtasksWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::FIMtasksWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
loadTasksAmmFimFromXML();
|
||||
|
||||
preparationTreeWidget();
|
||||
|
||||
fillTree();
|
||||
}
|
||||
|
||||
FIMtasksWidget::~FIMtasksWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void FIMtasksWidget::loadTasksAmmFimFromXML()
|
||||
{
|
||||
QDomDocument docTasksDOM;
|
||||
QString xmlFileName = "./tasksFIM.xml";
|
||||
QFile xmlInFile(xmlFileName);
|
||||
if (!xmlInFile.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
QMessageBox::critical(nullptr, tr("Attention!"), tr("The file could not be opened ") + xmlFileName);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
docTasksDOM.setContent(xmlInFile.readAll());
|
||||
xmlInFile.close();
|
||||
|
||||
QDomElement RRJTasksElement = docTasksDOM.firstChildElement("RRJTasks");
|
||||
if(RRJTasksElement.isNull())
|
||||
return;
|
||||
|
||||
QDomElement taskElement = RRJTasksElement.firstChildElement();
|
||||
if(taskElement.isNull())
|
||||
return;
|
||||
|
||||
do
|
||||
{/*task*/
|
||||
QString name = taskElement.nodeName();
|
||||
QDomNamedNodeMap nodeMap = taskElement.attributes();
|
||||
|
||||
if(name == "task")
|
||||
{
|
||||
TaskAmmFim task;
|
||||
|
||||
task.initialize(nodeMap.namedItem("id").nodeValue().toInt(),
|
||||
nodeMap.namedItem("type").nodeValue(),
|
||||
nodeMap.namedItem("title").nodeValue(),
|
||||
nodeMap.namedItem("status").nodeValue(),
|
||||
nodeMap.namedItem("created").nodeValue(),
|
||||
nodeMap.namedItem("changed").nodeValue());
|
||||
|
||||
QDomElement malfunctionElement = taskElement.firstChildElement();
|
||||
if(!malfunctionElement.isNull())
|
||||
{
|
||||
do
|
||||
{/*malfunction*/
|
||||
QString name = malfunctionElement.nodeName();
|
||||
QDomNamedNodeMap nodeMap = malfunctionElement.attributes();
|
||||
|
||||
if(name == "malfunction")
|
||||
{
|
||||
Malfunction malfunction;
|
||||
|
||||
malfunction.initialize(nodeMap.namedItem("dmCode").nodeValue(),
|
||||
nodeMap.namedItem("num").nodeValue(),
|
||||
nodeMap.namedItem("description").nodeValue());
|
||||
|
||||
QDomElement signElement = malfunctionElement.firstChildElement();
|
||||
if(!signElement.isNull())
|
||||
{
|
||||
do
|
||||
{/*malfunctionSign*/
|
||||
QString name = signElement.nodeName();
|
||||
QDomNamedNodeMap nodeMap = signElement.attributes();
|
||||
|
||||
if(name == "malfunctionSign")
|
||||
{
|
||||
MalfunctionSign sign;
|
||||
|
||||
sign.initialize(nodeMap.namedItem("type").nodeValue().toInt(),
|
||||
nodeMap.namedItem("description").nodeValue());
|
||||
|
||||
malfunction.addMalfunctionSign(sign);
|
||||
}
|
||||
|
||||
}while(! (signElement = signElement.nextSiblingElement()).isNull());
|
||||
}
|
||||
task.addMalfunction(malfunction);
|
||||
}
|
||||
}while(! (malfunctionElement = malfunctionElement.nextSiblingElement()).isNull());
|
||||
}
|
||||
listTaskAmmFim.append(task);
|
||||
}
|
||||
}while (! (taskElement = taskElement.nextSiblingElement()).isNull());
|
||||
}
|
||||
}
|
||||
|
||||
void FIMtasksWidget::fillTree()
|
||||
{
|
||||
for(int i = 0; i < listTaskAmmFim.count(); i++)
|
||||
{/*Задачи*/
|
||||
TaskAmmFim task = listTaskAmmFim.at(i);
|
||||
|
||||
QTreeWidgetItem* itemTask = new QTreeWidgetItem();
|
||||
|
||||
itemTask->setText(0, task.title);
|
||||
itemTask->setText(1, QString::number(task.id));
|
||||
itemTask->setFlags(itemTask->flags() | Qt::ItemIsUserCheckable);
|
||||
itemTask->setCheckState(0, Qt::Checked);
|
||||
itemTask->setIcon(0, QIcon(":/resources/icons/procedure.png"));
|
||||
|
||||
ui->treeWidget->addTopLevelItem(itemTask);
|
||||
|
||||
for (int j = 0; j < task.malfunctionList.count(); j++)
|
||||
{/*Неисправности*/
|
||||
Malfunction malfunction = task.malfunctionList.at(j);
|
||||
|
||||
QTreeWidgetItem* itemMalfunction = new QTreeWidgetItem();
|
||||
|
||||
itemMalfunction->setText(0, malfunction.description);
|
||||
itemMalfunction->setFlags(itemMalfunction->flags() | Qt::ItemIsUserCheckable);
|
||||
itemMalfunction->setCheckState(0, Qt::Checked);
|
||||
itemMalfunction->setIcon(0, QIcon(":/resources/icons/malfunction.png"));
|
||||
|
||||
itemTask->addChild(itemMalfunction);
|
||||
|
||||
for (int k = 0; k < malfunction.malfunctionSigns.count(); k++)
|
||||
{/*Сигнализация*/
|
||||
MalfunctionSign sign = malfunction.malfunctionSigns.at(k);
|
||||
|
||||
QTreeWidgetItem* itemSign = new QTreeWidgetItem();
|
||||
|
||||
itemSign->setText(0, sign.description);
|
||||
//itemSign->setFlags(itemSign->flags() | Qt::ItemIsUserCheckable);
|
||||
//itemSign->setCheckState(0, Qt::Checked);
|
||||
itemSign->setIcon(0, QIcon(":/resources/icons/sign.png"));
|
||||
|
||||
itemMalfunction->addChild(itemSign);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FIMtasksWidget::preparationTreeWidget()
|
||||
{
|
||||
ui->treeWidget->setColumnCount(2);
|
||||
|
||||
reSetHeadTreeWidget();
|
||||
|
||||
ui->treeWidget->setColumnWidth(ColumnsTree::clmn_ID, 20);
|
||||
ui->treeWidget->setColumnWidth(ColumnsTree::clmn_Title, 500);
|
||||
|
||||
//ui->treeWidget->setColumnHidden(ColumnsTree::clmn_ID, true);
|
||||
}
|
||||
|
||||
void FIMtasksWidget::reSetHeadTreeWidget()
|
||||
{
|
||||
QStringList listHeaders = {tr("Title"), tr("ID")};
|
||||
ui->treeWidget->setHeaderLabels(listHeaders);
|
||||
}
|
||||
40
InstructorsAndTrainees/docTasks/fimtaskswidget.h
Normal file
40
InstructorsAndTrainees/docTasks/fimtaskswidget.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef FIMTASKSWIDGET_H
|
||||
#define FIMTASKSWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "tasksAmmFim.h"
|
||||
|
||||
namespace Ui {
|
||||
class FIMtasksWidget;
|
||||
}
|
||||
|
||||
class FIMtasksWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
enum ColumnsTree{
|
||||
clmn_Title = 0,
|
||||
clmn_ID
|
||||
};
|
||||
|
||||
public:
|
||||
explicit FIMtasksWidget(QWidget *parent = nullptr);
|
||||
~FIMtasksWidget();
|
||||
|
||||
private:
|
||||
void loadTasksAmmFimFromXML();
|
||||
void fillTree();
|
||||
void preparationTreeWidget();
|
||||
void reSetHeadTreeWidget();
|
||||
|
||||
|
||||
public:
|
||||
QString userName;
|
||||
QList<TaskAmmFim> listTaskAmmFim;
|
||||
|
||||
private:
|
||||
Ui::FIMtasksWidget *ui;
|
||||
};
|
||||
|
||||
#endif // FIMTASKSWIDGET_H
|
||||
50
InstructorsAndTrainees/docTasks/fimtaskswidget.ui
Normal file
50
InstructorsAndTrainees/docTasks/fimtaskswidget.ui
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FIMtasksWidget</class>
|
||||
<widget class="QWidget" name="FIMtasksWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>472</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>FIM</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="4" column="0">
|
||||
<widget class="QTreeWidget" name="treeWidget">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>List of tasks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
178
InstructorsAndTrainees/docTasks/module.cpp
Normal file
178
InstructorsAndTrainees/docTasks/module.cpp
Normal file
@@ -0,0 +1,178 @@
|
||||
#include "module.h"
|
||||
|
||||
int Module::lastID = 0;
|
||||
|
||||
Module::Module():
|
||||
type (ModuleType::TYPE_PM),
|
||||
parentModule(nullptr),
|
||||
ID(0)
|
||||
{
|
||||
ID = ++lastID;
|
||||
}
|
||||
|
||||
Module::~Module()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Module *Module::getModuleByID(int id)
|
||||
{
|
||||
if(getID() == id)
|
||||
return this;
|
||||
|
||||
if(this->getType() == ModuleType::TYPE_PM)
|
||||
{
|
||||
PM* PMmodul = static_cast<PM*>(this);
|
||||
|
||||
Module* ptrModule = nullptr;
|
||||
|
||||
for(Module* module: PMmodul->getListChildModules())
|
||||
{
|
||||
ptrModule = module->getModuleByID(id);
|
||||
|
||||
if(ptrModule)
|
||||
return ptrModule;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PM::PM():
|
||||
modelIdentCode (),
|
||||
pmIssuer (),
|
||||
pmNumber (),
|
||||
pmVolume ()
|
||||
{
|
||||
type = ModuleType::TYPE_PM;
|
||||
|
||||
langRus.title = "";
|
||||
langEng.title = "";
|
||||
}
|
||||
|
||||
PM::~PM()
|
||||
{
|
||||
for(Module* module: listChildModules)
|
||||
{
|
||||
if(module->getType() == ModuleType::TYPE_PM)
|
||||
delete static_cast<PM*>(module);
|
||||
else
|
||||
delete static_cast<DM*>(module);
|
||||
}
|
||||
listChildModules.clear();
|
||||
}
|
||||
|
||||
void PM::initialize(QString modelIdentCode, QString pmIssuer, QString pmNumber, QString pmVolume)
|
||||
{
|
||||
this->modelIdentCode = modelIdentCode;
|
||||
this->pmIssuer = pmIssuer;
|
||||
this->pmNumber = pmNumber;
|
||||
this->pmVolume = pmVolume;
|
||||
}
|
||||
|
||||
void PM::setLangStructRus(QString title)
|
||||
{
|
||||
langRus.title = title;
|
||||
}
|
||||
|
||||
PM::pmLangStruct PM::getLangStructRus()
|
||||
{
|
||||
return langRus;
|
||||
}
|
||||
|
||||
void PM::setLangStructEng(QString title)
|
||||
{
|
||||
langEng.title = title;
|
||||
}
|
||||
|
||||
void PM::addChildModule(Module *childModule)
|
||||
{
|
||||
listChildModules.append(childModule);
|
||||
}
|
||||
|
||||
QList<Module *> PM::getListChildModules()
|
||||
{
|
||||
return listChildModules;
|
||||
}
|
||||
|
||||
QString PM::pmCode()
|
||||
{
|
||||
return (modelIdentCode + "-" + pmIssuer + "-" + pmNumber + "-" + pmVolume).toUpper();
|
||||
}
|
||||
|
||||
|
||||
|
||||
DM::DM():
|
||||
modelIdentCode (),
|
||||
systemDiffCode (),
|
||||
systemCode (),
|
||||
subSystemCode (),
|
||||
subSubSystemCode (),
|
||||
assyCode (),
|
||||
disassyCode (),
|
||||
disassyCodeVariant (),
|
||||
infoCode (),
|
||||
infoCodeVariant (),
|
||||
itemLocationCode ()
|
||||
{
|
||||
type = ModuleType::TYPE_DM;
|
||||
|
||||
setLangStructRus("", "", "", "", "");
|
||||
setLangStructEng("", "", "", "", "");
|
||||
}
|
||||
|
||||
DM::~DM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DM::initialize(QString modelIdentCode, QString systemDiffCode, QString systemCode,
|
||||
QString subSystemCode, QString subSubSystemCode, QString assyCode,
|
||||
QString disassyCode, QString disassyCodeVariant, QString infoCode,
|
||||
QString infoCodeVariant, QString itemLocationCode)
|
||||
{
|
||||
this->modelIdentCode = modelIdentCode;
|
||||
this->systemDiffCode = systemDiffCode;
|
||||
this->systemCode = systemCode;
|
||||
this->subSystemCode = subSystemCode;
|
||||
this->subSubSystemCode = subSubSystemCode;
|
||||
this->assyCode = assyCode;
|
||||
this->disassyCode = disassyCode;
|
||||
this->disassyCodeVariant = disassyCodeVariant;
|
||||
this->infoCode = infoCode;
|
||||
this->infoCodeVariant = infoCodeVariant;
|
||||
this->itemLocationCode = itemLocationCode;
|
||||
}
|
||||
|
||||
void DM::setLangStructRus(QString techName, QString infoName, QString pdf, QString bookmark, QString xml)
|
||||
{
|
||||
langRus.techName = techName;
|
||||
langRus.infoName = infoName;
|
||||
langRus.pdf = pdf;
|
||||
langRus.bookmark = bookmark;
|
||||
langRus.xml = xml;
|
||||
}
|
||||
|
||||
DM::dmLangStruct DM::getLangStructRus()
|
||||
{
|
||||
return langRus;
|
||||
}
|
||||
|
||||
void DM::setLangStructEng(QString techName, QString infoName, QString pdf, QString bookmark, QString xml)
|
||||
{
|
||||
langEng.techName = techName;
|
||||
langEng.infoName = infoName;
|
||||
langEng.pdf = pdf;
|
||||
langEng.bookmark = bookmark;
|
||||
langEng.xml = xml;
|
||||
}
|
||||
|
||||
QString DM::dmCode()
|
||||
{
|
||||
return (modelIdentCode + "-" + systemDiffCode + "-" + systemCode + "-" +
|
||||
subSystemCode + subSubSystemCode + "-" + assyCode + "-" +
|
||||
disassyCode + disassyCodeVariant + "-" + infoCode +
|
||||
infoCodeVariant + "-" + itemLocationCode).toUpper();
|
||||
}
|
||||
115
InstructorsAndTrainees/docTasks/module.h
Normal file
115
InstructorsAndTrainees/docTasks/module.h
Normal file
@@ -0,0 +1,115 @@
|
||||
#ifndef MODULE_H
|
||||
#define MODULE_H
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
|
||||
enum ModuleType
|
||||
{
|
||||
TYPE_PM = 0,
|
||||
TYPE_DM = 1
|
||||
};
|
||||
|
||||
class Module
|
||||
{
|
||||
public:
|
||||
Module();
|
||||
~Module();
|
||||
|
||||
int getID(){ return ID; };
|
||||
ModuleType getType(){ return type; };
|
||||
void setParentModule(Module* parentModule){ this->parentModule = parentModule; };
|
||||
Module* getModuleByID(int id);
|
||||
|
||||
protected:
|
||||
ModuleType type;
|
||||
Module* parentModule;
|
||||
int ID;
|
||||
static int lastID;
|
||||
};
|
||||
|
||||
|
||||
class PM : public Module
|
||||
{
|
||||
public:
|
||||
struct pmLangStruct
|
||||
{
|
||||
QString title;
|
||||
};
|
||||
|
||||
public:
|
||||
PM();
|
||||
~PM();
|
||||
|
||||
public:
|
||||
void initialize(QString modelIdentCode, QString pmIssuer, QString pmNumber, QString pmVolume);
|
||||
void setLangStructRus(QString title);
|
||||
pmLangStruct getLangStructRus();
|
||||
void setLangStructEng(QString title);
|
||||
void addChildModule(Module* childModule);
|
||||
QList<Module*> getListChildModules();
|
||||
QString pmCode();
|
||||
|
||||
private:
|
||||
QString modelIdentCode;
|
||||
QString pmIssuer;
|
||||
QString pmNumber;
|
||||
QString pmVolume;
|
||||
|
||||
pmLangStruct langRus;
|
||||
pmLangStruct langEng;
|
||||
|
||||
QList<Module*> listChildModules;
|
||||
};
|
||||
|
||||
|
||||
class DM : public Module
|
||||
{
|
||||
public:
|
||||
struct dmLangStruct
|
||||
{
|
||||
QString techName;
|
||||
QString infoName;
|
||||
QString pdf;
|
||||
QString bookmark;
|
||||
QString xml;
|
||||
};
|
||||
|
||||
public:
|
||||
DM();
|
||||
~DM();
|
||||
|
||||
public:
|
||||
void initialize(QString modelIdentCode,
|
||||
QString systemDiffCode,
|
||||
QString systemCode,
|
||||
QString subSystemCode,
|
||||
QString subSubSystemCode,
|
||||
QString assyCode,
|
||||
QString disassyCode,
|
||||
QString disassyCodeVariant,
|
||||
QString infoCode,
|
||||
QString infoCodeVariant,
|
||||
QString itemLocationCode);
|
||||
void setLangStructRus(QString techName, QString infoName, QString pdf, QString bookmark, QString xml);
|
||||
dmLangStruct getLangStructRus();
|
||||
void setLangStructEng(QString techName, QString infoName, QString pdf, QString bookmark, QString xml);
|
||||
QString dmCode();
|
||||
|
||||
private:
|
||||
QString modelIdentCode;
|
||||
QString systemDiffCode;
|
||||
QString systemCode;
|
||||
QString subSystemCode;
|
||||
QString subSubSystemCode;
|
||||
QString assyCode;
|
||||
QString disassyCode;
|
||||
QString disassyCodeVariant;
|
||||
QString infoCode;
|
||||
QString infoCodeVariant;
|
||||
QString itemLocationCode;
|
||||
|
||||
dmLangStruct langRus;
|
||||
dmLangStruct langEng;
|
||||
};
|
||||
|
||||
#endif // MODULE_H
|
||||
38
InstructorsAndTrainees/docTasks/tasksAmmFim.cpp
Normal file
38
InstructorsAndTrainees/docTasks/tasksAmmFim.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "tasksAmmFim.h"
|
||||
#include <QDomDocument>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
void TaskAmmFim::initialize(int id, QString type, QString title, QString status, QString created_date, QString changed_date)
|
||||
{
|
||||
this->id = id;
|
||||
this->type = type;
|
||||
this->title = title;
|
||||
this->status = status;
|
||||
this->created_date = created_date;
|
||||
this->changed_date = changed_date;
|
||||
}
|
||||
|
||||
void TaskAmmFim::addMalfunction(Malfunction malfunction)
|
||||
{
|
||||
malfunctionList.append(malfunction);
|
||||
}
|
||||
|
||||
void Malfunction::initialize(QString dmCode, QString num, QString description)
|
||||
{
|
||||
this->dmCode = dmCode;
|
||||
this->num = num;
|
||||
this->description = description;
|
||||
}
|
||||
|
||||
void Malfunction::addMalfunctionSign(MalfunctionSign sign)
|
||||
{
|
||||
malfunctionSigns.append(sign);
|
||||
}
|
||||
|
||||
void MalfunctionSign::initialize(int type, QString description)
|
||||
{
|
||||
this->type = type;
|
||||
this->description = description;
|
||||
}
|
||||
102
InstructorsAndTrainees/docTasks/tasksAmmFim.h
Normal file
102
InstructorsAndTrainees/docTasks/tasksAmmFim.h
Normal file
@@ -0,0 +1,102 @@
|
||||
#ifndef TASKSAMMFIM_H
|
||||
#define TASKSAMMFIM_H
|
||||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
|
||||
class ProcedureID
|
||||
{
|
||||
public:
|
||||
ProcedureID(){};
|
||||
~ProcedureID(){};
|
||||
public:
|
||||
QString doc; // "amm", "fim"
|
||||
QString dmCode;
|
||||
QString title;
|
||||
QString result; // "" - нет результата, "viewed" - процедура изучена (просмотрена при отсутствующем сценарии), "completed" - выполнена (в т.ч. режим "контроль" сценария)
|
||||
};
|
||||
|
||||
class MalfunctionSign // признак неисправности
|
||||
{
|
||||
public:
|
||||
MalfunctionSign(){};
|
||||
~MalfunctionSign(){};
|
||||
public:
|
||||
void initialize(int type, QString description);
|
||||
public:
|
||||
int type; // "1" - аварийно-сигнальные сообщения, "2" - сообщения БСТО,
|
||||
// "3" - сигнализация СЭИ, "4" - локальная сигнализация, "5" - наблюдаемая неисправность
|
||||
QString description; // описание (напр. "ЭРРД, 25, DOOR_FAIL_TO_CLOSE" - для БСТО)
|
||||
};
|
||||
|
||||
class Malfunction // неисправность
|
||||
{
|
||||
public:
|
||||
Malfunction(){};
|
||||
~Malfunction(){};
|
||||
public:
|
||||
void initialize(QString dmCode, QString num, QString description);
|
||||
void addMalfunctionSign(MalfunctionSign sign);
|
||||
public:
|
||||
QString dmCode; // dmCode процедуры
|
||||
QString num; // номер по-порядку в пункте "2. Возможные причины" процедуры
|
||||
QString description; // описание
|
||||
QList<MalfunctionSign> malfunctionSigns;// список соответствующих неисправности признаков
|
||||
};
|
||||
|
||||
class FIMReportItem
|
||||
{
|
||||
public:
|
||||
FIMReportItem(){};
|
||||
~FIMReportItem(){};
|
||||
public:
|
||||
QString title; // текст, вводимый обучаемым
|
||||
ProcedureID procedure; // ссылка на процедуру, при необходимости
|
||||
};
|
||||
|
||||
class FIMReport
|
||||
{
|
||||
public:
|
||||
FIMReport(){};
|
||||
~FIMReport(){};
|
||||
public:
|
||||
QList<FIMReportItem> itemList;
|
||||
};
|
||||
|
||||
class TaskAmmFim
|
||||
{
|
||||
public:
|
||||
TaskAmmFim(){};
|
||||
~TaskAmmFim(){};
|
||||
public:
|
||||
void initialize(int id, QString type, QString title, QString status, QString created_date, QString changed_date);
|
||||
void addMalfunction(Malfunction malfunction);
|
||||
public:
|
||||
|
||||
int id; // для идентификации в БД
|
||||
|
||||
QString type; // "amm" - процедура из Руководства по технической эксплуатации
|
||||
// "fim" - поиск и устранение неисправностей
|
||||
|
||||
QString title; // название задания:
|
||||
// для "amm" - берётся из титула процедуры
|
||||
// для "fim" - вводится вручную
|
||||
|
||||
QString status; // "new" - задание не выполнено
|
||||
// "checkup" - выполнено, на проверке у инструктора (только для "fim")
|
||||
// "failed" - инструктором проверено, выполнено неверно (только для "fim")
|
||||
// "completed" - выполнено корректно
|
||||
|
||||
QString created_date; // дата создания задания инструктором ("new")
|
||||
// (при записи в базу, даты ставить по времени сервера, а не те, что присланы от клиента)
|
||||
QString changed_date; // дата крайнего изменения статуса ("checkup", "failed", "completed")
|
||||
|
||||
// amm:
|
||||
ProcedureID ammProcedure; // ссылка на процедуру в AMM
|
||||
|
||||
// fim:
|
||||
QList<Malfunction> malfunctionList; // список неисправностей
|
||||
FIMReport report; // отчет по выполнению "fim"
|
||||
};
|
||||
|
||||
#endif // TASKSAMMFIM_H
|
||||
Reference in New Issue
Block a user