С задачами пока закончил

This commit is contained in:
2025-05-27 15:07:55 +03:00
parent 5a3ba9a75c
commit d76bb562d9
9 changed files with 292 additions and 74 deletions

View File

@@ -783,6 +783,44 @@ int DataBaseLMS::deleteTaskFIM(int id_task)
return 0;
}
//Выгребаем все malfunction для этой задачи
queryStr = QString("SELECT malfunctions.malfunction_id "
"FROM public.malfunctions JOIN public.tasks_fim ON tasks_fim.task_id = malfunctions.task_fim_malf "
"WHERE malfunctions.task_fim_malf = %1 "
"ORDER BY malfunctions.malfunction_id ASC").arg(
id_task);
QSqlQuery queryMalf = QSqlQuery(*db);
if(queryExec(queryStr, &queryMalf))
{
while (queryMalf.next())
{//Неисправность
int malfunction_id = 0;
malfunction_id = queryMalf.value(0).toString().toInt();
if(malfunction_id)
{
queryStr = QString("DELETE FROM public.malf_sign "
"WHERE malf_malf_sign = %1 ").arg(
malfunction_id);
QSqlQuery querySign = QSqlQuery(*db);
if(!queryExec(queryStr, &querySign))
{
resBool = db->rollback();
return 0;
}
}
};
}
else
{
resBool = db->rollback();
return 0;
}
queryStr = QString("DELETE FROM public.malfunctions "
"WHERE task_fim_malf = %1 ").arg(
QString::number(id_task));

View File

@@ -94,13 +94,13 @@ void AMMtasksWidget::resizeEvent(QResizeEvent *event)
treeWidget->setColumnWidth(ColumnsTree::clmn_ID, 50);
treeWidget->setColumnWidth(ColumnsTree::clmn_code, 250);
treeWidget->setColumnWidth(ColumnsTree::clmn_status, 100);
treeWidget->setColumnWidth(ColumnsTree::clmn_status, 110);
int widthPMorDM;
if(type == TypeList::listCommon)
widthPMorDM = width - (250 + 10);
else
widthPMorDM = width - (400 + 10);
widthPMorDM = width - (410 + 10);
treeWidget->setColumnWidth(ColumnsTree::clmn_PMorDM, widthPMorDM);
}

View File

@@ -49,7 +49,7 @@
</size>
</property>
<property name="text">
<string>Active</string>
<string>Аvailable</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">

View File

@@ -65,7 +65,12 @@ void DialogCheckTask::outReport(FIMReport report)
ui->plainText->appendHtml(str);
//Result
str = QString("<p>%1</p>").arg(item.procedure.result);
str = item.procedure.result;
if(str == "viewed")
str = tr("viewed");
else if(str == "completed")
str = tr("completed");
str = QString("<p>%1</p>").arg(str);
ui->plainText->appendHtml(str);
//Text

View File

@@ -53,10 +53,16 @@
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="plainText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>500</height>
<height>0</height>
</size>
</property>
</widget>
@@ -79,7 +85,7 @@
</size>
</property>
<property name="text">
<string>Wrong</string>
<string>Failed</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
@@ -105,7 +111,7 @@
</size>
</property>
<property name="text">
<string>Right</string>
<string>Completed</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
@@ -124,19 +130,6 @@
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>

View File

@@ -28,6 +28,7 @@ FIMtasksWidget::FIMtasksWidget(ConnectorToServer* connectorToServer, TypeList ty
treeWidget = new QTreeWidget();
ui->horizontalLayout_1->addWidget(treeWidget);
//treeWidget->setMinimumSize(400, 400);
connect(treeWidget, &QTreeWidget::currentItemChanged, this, &FIMtasksWidget::on_treeWidget_currentItemChanged);
@@ -92,13 +93,13 @@ void FIMtasksWidget::resizeEvent(QResizeEvent *event)
int width = treeWidget->width();
treeWidget->setColumnWidth(ColumnsTree::clmn_ID, 50);
treeWidget->setColumnWidth(ColumnsTree::clmn_status, 100);
treeWidget->setColumnWidth(ColumnsTree::clmn_status, 110);
int widthTitle;
if(type == TypeList::listCommon)
widthTitle = width - (0 + 10);
else
widthTitle = width - (150 + 10);
widthTitle = width - (160 + 10);
treeWidget->setColumnWidth(ColumnsTree::clmn_Title, widthTitle);
}
@@ -249,24 +250,27 @@ void FIMtasksWidget::fillTree()
itemTask->setText(0, task->title);
itemTask->setText(1, QString::number(task->id));
itemTask->setText(2, task->status);
//itemTask->setFlags(itemTask->flags() | Qt::ItemIsUserCheckable);
//itemTask->setCheckState(0, Qt::Checked);
if(task->status == "completed")
{
itemTask->setText(2, tr("completed"));
itemTask->setIcon(2, QIcon(QStringLiteral(":/resources/icons/circleGreen.png")));
}
else if(task->status == "failed")
{
itemTask->setText(2, tr("failed"));
itemTask->setIcon(2, QIcon(QStringLiteral(":/resources/icons/circleRed.png")));
}
else if(task->status == "checkup")
{
itemTask->setText(2, tr("checkup"));
itemTask->setIcon(2, QIcon(QStringLiteral(":/resources/icons/circleYellow.png")));
}
else
{
itemTask->setText(2, tr("new"));
itemTask->setIcon(2, QIcon(QStringLiteral(":/resources/icons/circleGray.png")));
}

View File

@@ -251,23 +251,26 @@ void TaskTreePreparation::slot_prepareListItemsForTrainee(QList<TaskAmmFim> list
item->setText(ColumnsTree::clmn_PMorDM, text);
item->setText(ColumnsTree::clmn_code, code);
item->setText(ColumnsTree::clmn_ID, ID);
item->setText(ColumnsTree::clmn_status, status);
item->setText(ColumnsTree::clmn_ID, ID);
if(status == "completed")
{
item->setText(ColumnsTree::clmn_status, tr("completed"));
item->setIcon(ColumnsTree::clmn_status, QIcon(QStringLiteral(":/resources/icons/circleGreen.png")));
}
else if(status == "failed")
{
item->setText(ColumnsTree::clmn_status, tr("failed"));
item->setIcon(ColumnsTree::clmn_status, QIcon(QStringLiteral(":/resources/icons/circleRed.png")));
}
else if(status == "checkup")
{
item->setText(ColumnsTree::clmn_status, tr("checkup"));
item->setIcon(ColumnsTree::clmn_status, QIcon(QStringLiteral(":/resources/icons/circleYellow.png")));
}
else
{
item->setText(ColumnsTree::clmn_status, tr("new"));
item->setIcon(ColumnsTree::clmn_status, QIcon(QStringLiteral(":/resources/icons/circleGray.png")));
}

View File

@@ -6,34 +6,67 @@
<message>
<location filename="../tasks/ammtaskswidget.ui" line="20"/>
<source>Form</source>
<translation type="unfinished">Форма</translation>
<translation>Форма</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="216"/>
<location filename="../tasks/ammtaskswidget.ui" line="52"/>
<source>Аvailable</source>
<translation>Доступные</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.ui" line="81"/>
<source>Check</source>
<translation>Проверить</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.ui" line="107"/>
<source>Delete</source>
<translation>Удалить</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="258"/>
<source>Task AMM</source>
<translation>Задача AMM</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="216"/>
<location filename="../tasks/ammtaskswidget.cpp" line="258"/>
<source>DM code</source>
<translation>DM код</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="216"/>
<location filename="../tasks/ammtaskswidget.cpp" line="218"/>
<location filename="../tasks/ammtaskswidget.cpp" line="258"/>
<location filename="../tasks/ammtaskswidget.cpp" line="260"/>
<source>ID</source>
<translation type="unfinished">ID</translation>
<translation>ID</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="218"/>
<location filename="../tasks/ammtaskswidget.cpp" line="258"/>
<location filename="../tasks/ammtaskswidget.cpp" line="260"/>
<source>Status</source>
<translation>Статус</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="260"/>
<source>PM/DM</source>
<translation type="unfinished"></translation>
<translation>PM/DM</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="218"/>
<location filename="../tasks/ammtaskswidget.cpp" line="260"/>
<source>Code</source>
<translation>Код</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="315"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="315"/>
<source>The deletion will be irrevocable.
Delete it anyway?</source>
<translation>Удаление будет безвозвратным.
Всё равно удалить?</translation>
</message>
</context>
<context>
<name>DialogAuthorizationInstructor</name>
@@ -59,6 +92,62 @@
<translation>Пароль</translation>
</message>
</context>
<context>
<name>DialogCheckTask</name>
<message>
<location filename="../tasks/dialogchecktask.ui" line="14"/>
<source>Form</source>
<translation>Форма</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.ui" line="26"/>
<source>Task</source>
<translation>Задача</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.ui" line="41"/>
<source>Completion Report</source>
<translation>Отчет о выполнении</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.ui" line="88"/>
<source>Failed</source>
<translation>Неверно</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.ui" line="114"/>
<source>Completed</source>
<translation>Выполнена</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="70"/>
<source>viewed</source>
<translation>Просмотрено</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="72"/>
<source>completed</source>
<translation>Выполнена</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="89"/>
<location filename="../tasks/dialogchecktask.cpp" line="102"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="89"/>
<source>Change task status?
The status will be set: &apos;failed&apos;</source>
<translation>Изменить статус задачи? Будет установлен статус &apos;неверно&apos;</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="102"/>
<source>Change task status?
The status will be set: &apos;completed&apos;</source>
<translation>Изменить статус задачи? Будет установлен статус &apos;выполнена&apos;</translation>
</message>
</context>
<context>
<name>DialogEditGroup</name>
<message>
@@ -419,24 +508,77 @@ The changes will not be accepted.</source>
<message>
<location filename="../tasks/fimtaskswidget.ui" line="14"/>
<source>Form</source>
<translation type="unfinished">Форма</translation>
<translation>Форма</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="267"/>
<location filename="../tasks/fimtaskswidget.ui" line="46"/>
<source>Check</source>
<translation>Проверить</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.ui" line="72"/>
<source>Delete</source>
<translation>Удалить</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="258"/>
<source>completed</source>
<translation>выполнена</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="263"/>
<source>failed</source>
<translation>неверно</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="268"/>
<source>checkup</source>
<translation>на проверке</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="273"/>
<source>new</source>
<translation>новая</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="361"/>
<source>Task FIM</source>
<translation>Задача FIM</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="267"/>
<location filename="../tasks/fimtaskswidget.cpp" line="269"/>
<location filename="../tasks/fimtaskswidget.cpp" line="361"/>
<location filename="../tasks/fimtaskswidget.cpp" line="363"/>
<source>ID</source>
<translation type="unfinished">ID</translation>
<translation>ID</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="269"/>
<location filename="../tasks/fimtaskswidget.cpp" line="361"/>
<location filename="../tasks/fimtaskswidget.cpp" line="363"/>
<source>Status</source>
<translation>Статус</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="363"/>
<source>Title</source>
<translation>Заголовок</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="504"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="504"/>
<source>The deletion will be irrevocable.
Delete it anyway?</source>
<translation>Удаление будет безвозвратным.
Всё равно удалить?</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="533"/>
<source>Check Task</source>
<translation>Проверка задачи</translation>
</message>
</context>
<context>
<name>InstructorsAndTraineesWidget</name>
@@ -468,7 +610,7 @@ The changes will not be accepted.</source>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="228"/>
<source>Update StyleSheet</source>
<translation type="unfinished"></translation>
<translation>Обновить стиль</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="242"/>
@@ -478,12 +620,12 @@ The changes will not be accepted.</source>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="254"/>
<source>AMM</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="264"/>
<source>FIM</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="279"/>
@@ -492,52 +634,62 @@ The changes will not be accepted.</source>
</message>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="116"/>
<location filename="../instructorsandtraineeswidget.cpp" line="136"/>
<location filename="../instructorsandtraineeswidget.cpp" line="236"/>
<location filename="../instructorsandtraineeswidget.cpp" line="261"/>
<location filename="../instructorsandtraineeswidget.cpp" line="139"/>
<location filename="../instructorsandtraineeswidget.cpp" line="239"/>
<location filename="../instructorsandtraineeswidget.cpp" line="264"/>
<source>Authorization Instructor</source>
<translation>Авторизация инструктора</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="189"/>
<location filename="../instructorsandtraineeswidget.cpp" line="396"/>
<location filename="../instructorsandtraineeswidget.cpp" line="406"/>
<source>none</source>
<translation>нет</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="134"/>
<location filename="../instructorsandtraineeswidget.cpp" line="204"/>
<location filename="../instructorsandtraineeswidget.cpp" line="137"/>
<location filename="../instructorsandtraineeswidget.cpp" line="207"/>
<source>Deauthorization Instructor</source>
<translation>Деавторизация инструктора</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="164"/>
<location filename="../instructorsandtraineeswidget.cpp" line="167"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="164"/>
<location filename="../instructorsandtraineeswidget.cpp" line="167"/>
<source>The file could not be opened </source>
<translation>Файл не может быть открыт </translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="244"/>
<location filename="../instructorsandtraineeswidget.cpp" line="247"/>
<source>Instructor deauthorization</source>
<translation>Деавторизация инструктора</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="244"/>
<location filename="../instructorsandtraineeswidget.cpp" line="247"/>
<source>Error!</source>
<translation>Ошибка!</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="217"/>
<location filename="../instructorsandtraineeswidget.cpp" line="299"/>
<location filename="../instructorsandtraineeswidget.cpp" line="281"/>
<source>Warning!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="281"/>
<source>The server is disabled</source>
<translation>Сервер отключен</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="220"/>
<location filename="../instructorsandtraineeswidget.cpp" line="308"/>
<source>Instructor authorization</source>
<translation>Авторизация инструктора</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="217"/>
<location filename="../instructorsandtraineeswidget.cpp" line="220"/>
<source>Invalid login or password!</source>
<translation>Неправильный логин или пароль!</translation>
</message>
@@ -599,7 +751,7 @@ The changes will not be accepted.</source>
<message>
<location filename="../messanger/messangerwidget.ui" line="20"/>
<source>Form</source>
<translation type="unfinished">Форма</translation>
<translation>Форма</translation>
</message>
<message>
<location filename="../messanger/messangerwidget.ui" line="28"/>
@@ -614,12 +766,12 @@ The changes will not be accepted.</source>
<message>
<location filename="../messanger/messangerwidget.ui" line="120"/>
<source>Tab 1</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../messanger/messangerwidget.ui" line="125"/>
<source>Tab 2</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
</context>
<context>
@@ -627,12 +779,12 @@ The changes will not be accepted.</source>
<message>
<location filename="../messanger/msgwidget.ui" line="20"/>
<source>Form</source>
<translation type="unfinished">Форма</translation>
<translation>Форма</translation>
</message>
<message>
<location filename="../messanger/msgwidget.ui" line="42"/>
<source>TextLabel</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
</context>
<context>
@@ -684,31 +836,54 @@ The changes will not be accepted.</source>
<context>
<name>RecognizeSystem</name>
<message>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="309"/>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="308"/>
<source>Attention!</source>
<translation type="unfinished">Внимание!</translation>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="309"/>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="308"/>
<source>The file could not be opened </source>
<translation type="unfinished"></translation>
<translation>Файл не может быть открыт </translation>
</message>
<message>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="369"/>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="368"/>
<source>You cannot delete the basic version!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="374"/>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="373"/>
<source>You cannot delete the active version</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="379"/>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="378"/>
<source>This name already exists</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TaskTreePreparation</name>
<message>
<location filename="../tasks/tasktreepreparation.cpp" line="258"/>
<source>completed</source>
<translation>выполнено</translation>
</message>
<message>
<location filename="../tasks/tasktreepreparation.cpp" line="263"/>
<source>failed</source>
<translation>неверно</translation>
</message>
<message>
<location filename="../tasks/tasktreepreparation.cpp" line="268"/>
<source>checkup</source>
<translation>на проверке</translation>
</message>
<message>
<location filename="../tasks/tasktreepreparation.cpp" line="273"/>
<source>new</source>
<translation>новая</translation>
</message>
</context>
<context>
<name>TraineesView</name>
<message>
@@ -789,7 +964,7 @@ The changes will not be accepted.</source>
<message>
<location filename="../widgets/versionselectwidget.ui" line="130"/>
<source>Delete</source>
<translation type="unfinished"></translation>
<translation type="unfinished">Удалить</translation>
</message>
<message>
<location filename="../widgets/versionselectwidget.ui" line="150"/>
@@ -869,12 +1044,12 @@ The changes will not be accepted.</source>
<translation>Инструкторы</translation>
</message>
<message>
<location filename="../instructors/viewerinstructors.ui" line="68"/>
<location filename="../instructors/viewerinstructors.ui" line="55"/>
<source>Editor of Instructors</source>
<translation>Редактор инструкторов</translation>
</message>
<message>
<location filename="../instructors/viewerinstructors.cpp" line="54"/>
<location filename="../instructors/viewerinstructors.cpp" line="60"/>
<source>Editor of instructors</source>
<translation>Редактор инструкторов</translation>
</message>
@@ -888,12 +1063,12 @@ The changes will not be accepted.</source>
<translation>Обучаемые</translation>
</message>
<message>
<location filename="../trainees/viewertrainees.ui" line="71"/>
<location filename="../trainees/viewertrainees.ui" line="68"/>
<source>Editor of Trainees</source>
<translation>Редактор обучаемых</translation>
</message>
<message>
<location filename="../trainees/viewertrainees.cpp" line="106"/>
<location filename="../trainees/viewertrainees.cpp" line="114"/>
<source>Editor of trainees</source>
<translation>Редактор обучаемых</translation>
</message>
@@ -903,7 +1078,7 @@ The changes will not be accepted.</source>
<message>
<location filename="../widgets/waitanimationwidget.ui" line="20"/>
<source>Form</source>
<translation type="unfinished">Форма</translation>
<translation>Форма</translation>
</message>
</context>
</TS>