Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* WarehouseManagement - Operator Edit Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2016-02-29
|
||||
*/
|
||||
|
||||
#include "injury_model_edit_dialog.h"
|
||||
#include "ui_injury_model_edit_dialog.h"
|
||||
#include "../whm_data_plugin_interface.h"
|
||||
|
||||
#include <WarehouseGuez/whg_dtc.h>
|
||||
#include <WarehouseGuez/whg_ftc.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
namespace WarehouseManagement
|
||||
{
|
||||
InjuryModelEditDialog::InjuryModelEditDialog(const int injuryModelId,
|
||||
LtsSession::LtsSession *session,
|
||||
QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_injuryModelId(injuryModelId)
|
||||
, m_session(session)
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(WarehouseGuez::getLogger("InjuryModelEditDialog"))
|
||||
, m_ui(new Ui::InjuryModelEditDialog)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
m_uiRequirements->addRequirement({m_ui->lbName, [this]()
|
||||
{
|
||||
m_ui->leName->setText(m_ui->leName->text().simplified());
|
||||
return (m_ui->leName->text().size() > 0);
|
||||
}});
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Administrator-Injury_Model"));
|
||||
}
|
||||
|
||||
InjuryModelEditDialog::~InjuryModelEditDialog()
|
||||
{
|
||||
delete m_requestHelper;
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
bool InjuryModelEditDialog::init()
|
||||
{
|
||||
if (!m_session->getDtc<WarehouseManagement::DataInterface>(m_dtc) ||
|
||||
!m_dtc->enableAll() ||
|
||||
!m_session->getFtc<WarehouseManagement::DataInterface>(m_ftc) ||
|
||||
!m_ftc->enableAll())
|
||||
return false;
|
||||
|
||||
loadUiValues();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InjuryModelEditDialog::loadUiValues()
|
||||
{
|
||||
WarehouseGuez::InjuryModelAgdusWh inj = m_dtc->injuryModelAgdusWh(m_injuryModelId);
|
||||
|
||||
m_ui->lblId->setText(QString::number(inj.id()));
|
||||
m_ui->leName->setText(QString::fromStdString(inj.name()));
|
||||
m_ui->leVersion->setText(QString::fromStdString(inj.version()));
|
||||
m_ui->pteDescription->insertPlainText(QString::fromStdString(inj.description()));
|
||||
}
|
||||
|
||||
void InjuryModelEditDialog::onModifyInjuryModelAgdusWhReply(const Core::FunctionReplyObject &reply)
|
||||
{
|
||||
m_requestHelper->requestReply(reply);
|
||||
}
|
||||
|
||||
void InjuryModelEditDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, m_injuryModelId < 1 ? tr("Add Injury Model") : tr("Edit Injury Model #%1").arg(m_injuryModelId));
|
||||
}
|
||||
|
||||
bool InjuryModelEditDialog::apply()
|
||||
{
|
||||
WarehouseGuez::InjuryModelAgdusWh req = WarehouseGuez::InjuryModelAgdusWh(
|
||||
m_ui->lblId->text().toInt(),
|
||||
m_ui->leName->text().toStdString(),
|
||||
m_ui->leVersion->text().toStdString(),
|
||||
m_ui->pteDescription->toPlainText().toStdString());
|
||||
|
||||
return m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
return m_ftc->modifyInjuryModelAgdusWhRequest(req, this);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace WarehouseManagement
|
||||
Reference in new issue
Block a user