Установка статуса для AMM

This commit is contained in:
2025-07-04 12:13:13 +03:00
parent 36e9832b40
commit d658745ad3
16 changed files with 223 additions and 67 deletions

View File

@@ -204,7 +204,8 @@ QByteArray DataParser::createQueryToDBMessage(ClientQueryToDB *queryToDB, int id
}
}
}
else if(queryToDB->typeQuery == TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE)
else if(queryToDB->typeQuery == TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_AMM_TO_TRAINEE ||
queryToDB->typeQuery == TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE)
{
QString* status = (QString*)data;
if(status)

View File

@@ -6,6 +6,7 @@
#include <QResizeEvent>
#include "ammtaskswidget.h"
#include "ui_ammtaskswidget.h"
#include "dialogchecktask.h"
AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, TypeListTreeAMMFIM type, QWidget *parent) :
QWidget(parent),
@@ -72,7 +73,7 @@ AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, TypeListTre
ui->verticalLayout->setAlignment(Qt::AlignmentFlag::AlignBottom);
}
ui->btnCheck->setVisible(false);
//ui->btnCheck->setVisible(false);
}
AMMtasksWidget::~AMMtasksWidget()
@@ -150,10 +151,12 @@ void AMMtasksWidget::on_treeWidget_currentItemChanged(QTreeWidgetItem *current,
if(current == nullptr)
{
ui->btnDelete->setEnabled(false);
ui->btnCheck->setEnabled(false);
return;
}
else
{
ui->btnCheck->setEnabled(true);
ui->btnDelete->setEnabled(true);
}
@@ -335,7 +338,29 @@ void AMMtasksWidget::on_btnDelete_clicked()
void AMMtasksWidget::on_btnCheck_clicked()
{
QTreeWidgetItem *treeItemCurrent = treeWidget->currentItem();
if(treeItemCurrent != nullptr)
{//Выбрана задача
int id = treeItemCurrent->text(ColumnsTreeAMM::clmnAMM_ID).toInt();
DialogCheckTask dlg(connectorToServer, "amm", this);
//dlg.setTask(task);
dlg.setIDTask(id);
QDialog* dialog = new QDialog(this);
QHBoxLayout *layout = new QHBoxLayout(dialog);
layout->addWidget(&dlg);
dialog->setWindowTitle(tr("Status Task"));
dialog->setMinimumSize(200, 100);
dialog->setStyleSheet(this->styleSheet());
dialog->exec();
if(dlg.getFlChanged())
waitAnimationWidget->showWithPlay();
}
}
void AMMtasksWidget::on_btnAssignTask_clicked()

View File

@@ -99,7 +99,7 @@
</size>
</property>
<property name="text">
<string>Check</string>
<string>Status</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">

View File

@@ -1,21 +1,37 @@
#include "dialogchecktask.h"
#include "ui_dialogchecktask.h"
DialogCheckTask::DialogCheckTask(ConnectorToServer* connectorToServer, QWidget *parent) :
DialogCheckTask::DialogCheckTask(ConnectorToServer* connectorToServer, QString type, QWidget *parent) :
QWidget(parent),
ui(new Ui::DialogCheckTask),
connectorToServer(connectorToServer),
fimTasksWidget(nullptr),
flChanged(false)
flChanged(false),
id_task(0),
type("fim")
{
ui->setupUi(this);
fimTasksWidget = new FIMtasksWidget(nullptr, TypeListTreeAMMFIM::listOneTask, this);
this->type = type;
ui->verticalLayout_3->addWidget(fimTasksWidget);
if(type == "fim")
{
fimTasksWidget = new FIMtasksWidget(nullptr, TypeListTreeAMMFIM::listOneTask, this);
ui->plainText->setReadOnly(true);
ui->plainText->setObjectName("plainText");
ui->verticalLayout_3->addWidget(fimTasksWidget);
ui->plainText->setReadOnly(true);
ui->plainText->setObjectName("plainText");
}
else
{
ui->plainText->setVisible(false);
ui->label->setVisible(false);
ui->label_2->setVisible(false);
ui->btnRight->setText(tr("Completed"));
ui->btnWrong->setText(tr("New"));
ui->btnWrong->setIcon(QIcon(QStringLiteral(":/resources/icons/circleGray.png")));
}
}
DialogCheckTask::~DialogCheckTask()
@@ -27,6 +43,7 @@ DialogCheckTask::~DialogCheckTask()
void DialogCheckTask::setTask(TaskAmmFim* task)
{
this->task = *task;
id_task = task->getID();
//Задача
fimTasksWidget->setOneTaskFim(&this->task);
@@ -84,13 +101,26 @@ void DialogCheckTask::outReport(FIMReport report)
void DialogCheckTask::on_btnWrong_clicked()
{
int id = task.getID();
QString status = "failed";
TypeQueryToDB typeQuery;
QString status;
QString msgString;
if(QMessageBox::warning(this, tr("Attention!"), tr("Change task status?\nThe status will be set: 'failed'"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
if(type == "fim")
{
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE, id, (void*)&status);
//this->close();
typeQuery = TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE;
status = "failed";
msgString = tr("Change task status?\nThe status will be set:\n'failed'");
}
else
{
typeQuery = TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_AMM_TO_TRAINEE;
status = "new";
msgString = tr("Change task status?\nThe status will be set:\n'new'");
}
if(QMessageBox::warning(this, tr("Attention!"), msgString, QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
{
connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status);
this->parentWidget()->close();
flChanged = true;
}
@@ -98,13 +128,26 @@ void DialogCheckTask::on_btnWrong_clicked()
void DialogCheckTask::on_btnRight_clicked()
{
int id = task.getID();
QString status = "completed";
TypeQueryToDB typeQuery;
QString status;
QString msgString;
if(QMessageBox::warning(this, tr("Attention!"), tr("Change task status?\nThe status will be set: 'completed'"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
if(type == "fim")
{
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE, id, (void*)&status);
//this->close();
typeQuery = TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE;
status = "completed";
msgString = tr("Change task status?\nThe status will be set:\n'completed'");
}
else
{
typeQuery = TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_AMM_TO_TRAINEE;
status = "completed";
msgString = tr("Change task status?\nThe status will be set:\n'completed'");
}
if(QMessageBox::warning(this, tr("Attention!"), msgString, QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
{
connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status);
this->parentWidget()->close();
flChanged = true;
}

View File

@@ -14,13 +14,14 @@ class DialogCheckTask : public QWidget
Q_OBJECT
public:
explicit DialogCheckTask(ConnectorToServer* connectorToServer, QWidget *parent = nullptr);
explicit DialogCheckTask(ConnectorToServer* connectorToServer, QString type, QWidget *parent = nullptr);
~DialogCheckTask();
public:
void setTask(TaskAmmFim* task);
TaskAmmFim getTask();
bool getFlChanged(){return flChanged;}
void setIDTask(int id){id_task = id;}
private slots:
void on_btnWrong_clicked();
@@ -39,6 +40,8 @@ private:
FIMtasksWidget* fimTasksWidget;
bool flChanged;
int id_task;
QString type;
};
#endif // DIALOGCHECKTASK_H

View File

@@ -361,7 +361,7 @@ void FIMtasksWidget::on_btnCheck_clicked()
TaskAmmFim* task = taskTreePreparation->getTaskFIMbyID(id);
DialogCheckTask dlg(connectorToServer, this);
DialogCheckTask dlg(connectorToServer, "fim", this);
dlg.setTask(task);

View File

@@ -18,67 +18,68 @@
<source>Аvailable</source>
<translation>Доступные</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.ui" line="102"/>
<source>Check</source>
<translation>Проверить</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.ui" line="128"/>
<source>Delete</source>
<translation>Удалить</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="274"/>
<location filename="../tasks/ammtaskswidget.cpp" line="277"/>
<source>Task AMM</source>
<translation>Задача AMM</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="274"/>
<location filename="../tasks/ammtaskswidget.cpp" line="277"/>
<source>DM code</source>
<translation>DM код</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="274"/>
<location filename="../tasks/ammtaskswidget.cpp" line="276"/>
<location filename="../tasks/ammtaskswidget.cpp" line="277"/>
<location filename="../tasks/ammtaskswidget.cpp" line="279"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="274"/>
<location filename="../tasks/ammtaskswidget.cpp" line="276"/>
<location filename="../tasks/ammtaskswidget.ui" line="102"/>
<location filename="../tasks/ammtaskswidget.cpp" line="277"/>
<location filename="../tasks/ammtaskswidget.cpp" line="279"/>
<source>Status</source>
<translation>Статус</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="276"/>
<location filename="../tasks/ammtaskswidget.cpp" line="279"/>
<source>PM/DM</source>
<translation>PM/DM</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="276"/>
<location filename="../tasks/ammtaskswidget.cpp" line="279"/>
<source>Code</source>
<translation>Код</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="327"/>
<location filename="../tasks/ammtaskswidget.cpp" line="330"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="327"/>
<location filename="../tasks/ammtaskswidget.cpp" line="330"/>
<source>The deletion will be irrevocable.
Delete it anyway?</source>
<translation>Удаление будет безвозвратным.
Всё равно удалить?</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="343"/>
<location filename="../tasks/ammtaskswidget.cpp" line="356"/>
<source>Status Task</source>
<translation>Статус задачи</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="368"/>
<source>New task</source>
<translation>Новая задача</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="343"/>
<location filename="../tasks/ammtaskswidget.cpp" line="368"/>
<source>Assign this task?</source>
<translation>Назначить эту задачу?</translation>
</message>
@@ -135,32 +136,58 @@ Delete it anyway?</source>
<translation>Верно</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="71"/>
<location filename="../tasks/dialogchecktask.cpp" line="31"/>
<source>Completed</source>
<translation>Выполнена</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="32"/>
<source>New</source>
<translation>Новая</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="88"/>
<source>viewed</source>
<translation>Просмотрено</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="73"/>
<location filename="../tasks/dialogchecktask.cpp" line="90"/>
<source>completed</source>
<translation>Выполнена</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="90"/>
<location filename="../tasks/dialogchecktask.cpp" line="104"/>
<location filename="../tasks/dialogchecktask.cpp" line="112"/>
<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="118"/>
<source>Change task status?
The status will be set:
&apos;new&apos;</source>
<translation>Изменить статус задачи?
Будет установлен статус:
&apos;новая&apos;</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="121"/>
<location filename="../tasks/dialogchecktask.cpp" line="148"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="90"/>
<location filename="../tasks/dialogchecktask.cpp" line="139"/>
<location filename="../tasks/dialogchecktask.cpp" line="145"/>
<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="104"/>
<source>Change task status?
The status will be set: &apos;completed&apos;</source>
<translation>Изменить статус задачи? Будет установлен статус &apos;выполнена&apos;</translation>
The status will be set:
&apos;completed&apos;</source>
<translation>Изменить статус задачи?
Будет установлен статус:
&apos;выполнена&apos;</translation>
</message>
</context>
<context>
@@ -950,7 +977,7 @@ Delete it anyway?</source>
<location filename="../tasks/tasktreepreparation.cpp" line="414"/>
<location filename="../tasks/tasktreepreparation.cpp" line="500"/>
<source>completed</source>
<translation>выполнено</translation>
<translation>выполнена</translation>
</message>
<message>
<location filename="../tasks/tasktreepreparation.cpp" line="371"/>