Установка статуса для 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

@@ -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;
}