mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
пилотная рабочая версия с кодами dm/pm
This commit is contained in:
@@ -10,18 +10,56 @@ DocTasksWidget::DocTasksWidget(QWidget *parent) :
|
|||||||
ui(new Ui::DocTasksWidget)
|
ui(new Ui::DocTasksWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
treeWidget = new QTreeWidget();
|
treeWidget = new QTreeWidget();
|
||||||
|
|
||||||
|
connect(treeWidget, &QTreeWidget::currentItemChanged, this, &DocTasksWidget::on_treeWidget_currentItemChanged);
|
||||||
|
|
||||||
ui->horizontalLayout_2->addWidget(treeWidget);
|
ui->horizontalLayout_2->addWidget(treeWidget);
|
||||||
treeWidget->setStyleSheet(QStringLiteral("font-size: 10pt;"
|
|
||||||
"font-family: Tahoma;"));
|
preparationTreeWidget();
|
||||||
|
|
||||||
loadDocTasksFromXML();
|
loadDocTasksFromXML();
|
||||||
|
|
||||||
|
updateTreeWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
DocTasksWidget::~DocTasksWidget()
|
DocTasksWidget::~DocTasksWidget()
|
||||||
{
|
{
|
||||||
deleteAllModuls();
|
deleteAllModuls();
|
||||||
delete ui;
|
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)
|
void DocTasksWidget::DomElementParser(QDomElement element, Module* moduleParent)
|
||||||
@@ -55,6 +93,8 @@ void DocTasksWidget::DomElementParser(QDomElement element, Module* moduleParent)
|
|||||||
|
|
||||||
if(moduleParent)
|
if(moduleParent)
|
||||||
{
|
{
|
||||||
|
PMmodul->setParentModule(moduleParent);
|
||||||
|
|
||||||
PM* PMmodulParent = static_cast<PM*>(moduleParent);
|
PM* PMmodulParent = static_cast<PM*>(moduleParent);
|
||||||
PMmodulParent->addChildModule(module);
|
PMmodulParent->addChildModule(module);
|
||||||
}
|
}
|
||||||
@@ -75,9 +115,9 @@ void DocTasksWidget::DomElementParser(QDomElement element, Module* moduleParent)
|
|||||||
|
|
||||||
module = new DM();
|
module = new DM();
|
||||||
|
|
||||||
DM* PMmodul = static_cast<DM*>(module);
|
DM* DMmodul = static_cast<DM*>(module);
|
||||||
|
|
||||||
PMmodul->initialize(modelIdentCode,
|
DMmodul->initialize(modelIdentCode,
|
||||||
systemDiffCode,
|
systemDiffCode,
|
||||||
systemCode,
|
systemCode,
|
||||||
subSystemCode,
|
subSystemCode,
|
||||||
@@ -91,6 +131,8 @@ void DocTasksWidget::DomElementParser(QDomElement element, Module* moduleParent)
|
|||||||
|
|
||||||
if(moduleParent)
|
if(moduleParent)
|
||||||
{
|
{
|
||||||
|
DMmodul->setParentModule(moduleParent);
|
||||||
|
|
||||||
PM* PMmodulParent = static_cast<PM*>(moduleParent);
|
PM* PMmodulParent = static_cast<PM*>(moduleParent);
|
||||||
PMmodulParent->addChildModule(module);
|
PMmodulParent->addChildModule(module);
|
||||||
}
|
}
|
||||||
@@ -174,3 +216,87 @@ void DocTasksWidget::deleteAllModuls()
|
|||||||
listAllModules.clear();
|
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->header()->setStyleSheet(QStringLiteral("font-size: 10pt;"));
|
||||||
|
treeWidget->setStyleSheet(QStringLiteral("font-size: 10pt;"
|
||||||
|
"font-family: Tahoma;"));
|
||||||
|
|
||||||
|
treeWidget->setColumnWidth(ColumnsTree::clmn_ID, 80);
|
||||||
|
treeWidget->setColumnWidth(ColumnsTree::clmn_PMorDM, 800);
|
||||||
|
|
||||||
|
//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)
|
||||||
|
{
|
||||||
|
addModulToTreeWidget(module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DocTasksWidget::addModulToTreeWidget(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())
|
||||||
|
{
|
||||||
|
addModulToTreeWidget(module, itemModule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DM* DMmodul = static_cast<DM*>(module);
|
||||||
|
text = DMmodul->getLangStructRus().techName;
|
||||||
|
}
|
||||||
|
|
||||||
|
itemModule->setText(ColumnsTree::clmn_PMorDM, text);
|
||||||
|
itemModule->setText(ColumnsTree::clmn_ID, ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,15 +14,29 @@ class DocTasksWidget : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum ColumnsTree{
|
||||||
|
clmn_PMorDM = 0,
|
||||||
|
clmn_ID
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DocTasksWidget(QWidget *parent = nullptr);
|
explicit DocTasksWidget(QWidget *parent = nullptr);
|
||||||
~DocTasksWidget();
|
~DocTasksWidget();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DomElementParser(QDomElement element, Module* moduleParent);
|
void DomElementParser(QDomElement element, Module* moduleParent);
|
||||||
void loadDocTasksFromXML();
|
void loadDocTasksFromXML();
|
||||||
|
|
||||||
void deleteAllModuls();
|
void deleteAllModuls();
|
||||||
|
Module* searchModuleByID(int id);
|
||||||
|
|
||||||
|
void preparationTreeWidget();
|
||||||
|
void reSetHeadTreeWidget();
|
||||||
|
void updateTreeWidget();
|
||||||
|
void addModulToTreeWidget(Module* module, QTreeWidgetItem* parentItem = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::DocTasksWidget *ui;
|
Ui::DocTasksWidget *ui;
|
||||||
|
|||||||
@@ -31,6 +31,20 @@
|
|||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2"/>
|
<layout class="QHBoxLayout" name="horizontalLayout_2"/>
|
||||||
</item>
|
</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"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
#include "module.h"
|
#include "module.h"
|
||||||
|
|
||||||
|
int Module::lastID = 0;
|
||||||
|
|
||||||
Module::Module():
|
Module::Module():
|
||||||
type (ModuleType::TYPE_PM),
|
type (ModuleType::TYPE_PM),
|
||||||
parentModule(nullptr)
|
parentModule(nullptr),
|
||||||
|
ID(0)
|
||||||
{
|
{
|
||||||
|
ID = ++lastID;
|
||||||
}
|
}
|
||||||
|
|
||||||
Module::~Module()
|
Module::~Module()
|
||||||
@@ -12,6 +15,29 @@ 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():
|
PM::PM():
|
||||||
@@ -51,6 +77,11 @@ void PM::setLangStructRus(QString title)
|
|||||||
langRus.title = title;
|
langRus.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PM::pmLangStruct PM::getLangStructRus()
|
||||||
|
{
|
||||||
|
return langRus;
|
||||||
|
}
|
||||||
|
|
||||||
void PM::setLangStructEng(QString title)
|
void PM::setLangStructEng(QString title)
|
||||||
{
|
{
|
||||||
langEng.title = title;
|
langEng.title = title;
|
||||||
@@ -61,6 +92,16 @@ void PM::addChildModule(Module *childModule)
|
|||||||
listChildModules.append(childModule);
|
listChildModules.append(childModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<Module *> PM::getListChildModules()
|
||||||
|
{
|
||||||
|
return listChildModules;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString PM::pmCode()
|
||||||
|
{
|
||||||
|
return (modelIdentCode + "-" + pmIssuer + "-" + pmNumber + "-" + pmVolume).toUpper();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DM::DM():
|
DM::DM():
|
||||||
@@ -114,6 +155,11 @@ void DM::setLangStructRus(QString techName, QString infoName, QString pdf, QStri
|
|||||||
langRus.xml = xml;
|
langRus.xml = xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DM::dmLangStruct DM::getLangStructRus()
|
||||||
|
{
|
||||||
|
return langRus;
|
||||||
|
}
|
||||||
|
|
||||||
void DM::setLangStructEng(QString techName, QString infoName, QString pdf, QString bookmark, QString xml)
|
void DM::setLangStructEng(QString techName, QString infoName, QString pdf, QString bookmark, QString xml)
|
||||||
{
|
{
|
||||||
langEng.techName = techName;
|
langEng.techName = techName;
|
||||||
@@ -122,3 +168,11 @@ void DM::setLangStructEng(QString techName, QString infoName, QString pdf, QStri
|
|||||||
langEng.bookmark = bookmark;
|
langEng.bookmark = bookmark;
|
||||||
langEng.xml = xml;
|
langEng.xml = xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString DM::dmCode()
|
||||||
|
{
|
||||||
|
return (modelIdentCode + "-" + systemDiffCode + "-" + systemCode + "-" +
|
||||||
|
subSystemCode + subSubSystemCode + "-" + assyCode + "-" +
|
||||||
|
disassyCode + disassyCodeVariant + "-" + infoCode +
|
||||||
|
infoCodeVariant + "-" + itemLocationCode).toUpper();
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,12 +15,16 @@ public:
|
|||||||
Module();
|
Module();
|
||||||
~Module();
|
~Module();
|
||||||
|
|
||||||
|
int getID(){ return ID; };
|
||||||
ModuleType getType(){ return type; };
|
ModuleType getType(){ return type; };
|
||||||
void setParentModule(Module* parentModule){ this->parentModule = parentModule; };
|
void setParentModule(Module* parentModule){ this->parentModule = parentModule; };
|
||||||
|
Module* getModuleByID(int id);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ModuleType type;
|
ModuleType type;
|
||||||
Module* parentModule;
|
Module* parentModule;
|
||||||
|
int ID;
|
||||||
|
static int lastID;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -39,8 +43,11 @@ public:
|
|||||||
public:
|
public:
|
||||||
void initialize(QString modelIdentCode, QString pmIssuer, QString pmNumber, QString pmVolume);
|
void initialize(QString modelIdentCode, QString pmIssuer, QString pmNumber, QString pmVolume);
|
||||||
void setLangStructRus(QString title);
|
void setLangStructRus(QString title);
|
||||||
|
pmLangStruct getLangStructRus();
|
||||||
void setLangStructEng(QString title);
|
void setLangStructEng(QString title);
|
||||||
void addChildModule(Module* childModule);
|
void addChildModule(Module* childModule);
|
||||||
|
QList<Module*> getListChildModules();
|
||||||
|
QString pmCode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString modelIdentCode;
|
QString modelIdentCode;
|
||||||
@@ -84,7 +91,9 @@ public:
|
|||||||
QString infoCodeVariant,
|
QString infoCodeVariant,
|
||||||
QString itemLocationCode);
|
QString itemLocationCode);
|
||||||
void setLangStructRus(QString techName, QString infoName, QString pdf, QString bookmark, QString xml);
|
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);
|
void setLangStructEng(QString techName, QString infoName, QString pdf, QString bookmark, QString xml);
|
||||||
|
QString dmCode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString modelIdentCode;
|
QString modelIdentCode;
|
||||||
|
|||||||
Reference in New Issue
Block a user