提交信息!
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "QRepairRecommendationWidget.h"
|
||||
#include "../../Data/DataManipulation/Excel/LoadFromExcel.h"
|
||||
#include "../../Data/DataManipulation/oracle/ImportToOracle.h"
|
||||
#include "../../util/qt/qt_util.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -10,6 +11,8 @@ QRepairRecommendationWidget::QRepairRecommendationWidget( QWidget * parent )
|
||||
: QWidget( parent )
|
||||
{
|
||||
ui.setupUi( this );
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
QRepairRecommendationWidget::~QRepairRecommendationWidget()
|
||||
@@ -19,10 +22,10 @@ QRepairRecommendationWidget::~QRepairRecommendationWidget()
|
||||
void QRepairRecommendationWidget::onImport()
|
||||
{
|
||||
//打开文件
|
||||
QString dir = QString::fromLocal8Bit( "." );
|
||||
QString filter = QString::fromLocal8Bit( "Excel文件(*.xlsx)" );
|
||||
QString dir = QString::fromUtf8( "." );
|
||||
QString filter = QString::fromUtf8( "Excel文件(*.xlsx)" );
|
||||
QStringList fileList = QFileDialog::getOpenFileNames( this,
|
||||
QString::fromLocal8Bit( "请选择要导入的数据文件" ),
|
||||
QString::fromUtf8( "请选择要导入的数据文件" ),
|
||||
dir,
|
||||
filter );
|
||||
|
||||
@@ -48,8 +51,8 @@ void QRepairRecommendationWidget::onImport()
|
||||
recommandationVector.clear();
|
||||
|
||||
QMessageBox::critical( nullptr,
|
||||
QString::fromLocal8Bit( "读取Excel表格出错!" ),
|
||||
QString::fromLocal8Bit( error.what() ) );
|
||||
QString::fromUtf8( "读取Excel表格出错!" ),
|
||||
QString::fromUtf8( error.what() ) );
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -60,9 +63,10 @@ void QRepairRecommendationWidget::onImport()
|
||||
//以后要修改
|
||||
string userName = "car_dealer";
|
||||
string password = "cpic123456";
|
||||
string tnsName = "xmcx1";
|
||||
string tnsName = "xmcx1";
|
||||
|
||||
ImportRepairRecommandationToOracle(userName, password, tnsName, recommandationVector);
|
||||
ImportRepairRecommandationToOracle( userName, password, tnsName, recommandationVector );
|
||||
showRepairRecommandation();
|
||||
}
|
||||
catch ( runtime_error & error )
|
||||
{
|
||||
@@ -70,11 +74,18 @@ void QRepairRecommendationWidget::onImport()
|
||||
recommandationVector.clear();
|
||||
|
||||
QMessageBox::critical( nullptr,
|
||||
QString::fromLocal8Bit( "保存数据出错!" ),
|
||||
QString::fromLocal8Bit( error.what() ) );
|
||||
QString::fromUtf8( "保存数据出错!" ),
|
||||
QString::fromUtf8( error.what() ) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//提示
|
||||
QString messageInfo = QString::fromUtf8( "Maybe写入%1了条记录。" ).arg( recommandationVector.size() );
|
||||
|
||||
QMessageBox::information( nullptr,
|
||||
QString::fromUtf8( "保存成功" ),
|
||||
messageInfo );
|
||||
}
|
||||
|
||||
void QRepairRecommendationWidget::init()
|
||||
@@ -100,4 +111,96 @@ void QRepairRecommendationWidget::initSignal()
|
||||
|
||||
void QRepairRecommendationWidget::showRepairRecommandation()
|
||||
{
|
||||
int rowIndex = 0;
|
||||
int columnIndex = 0;
|
||||
QTableWidgetItem * pItem = nullptr;
|
||||
|
||||
ui.pTableWidgetRepairRecommandation->clearContents();
|
||||
ui.pTableWidgetRepairRecommandation->setRowCount( recommandationVector.size() );
|
||||
|
||||
for ( auto iter = recommandationVector.begin();
|
||||
iter != recommandationVector.end();
|
||||
++iter, ++rowIndex )
|
||||
{
|
||||
columnIndex = 0;
|
||||
|
||||
//工单号
|
||||
pItem = new QTableWidgetItem();
|
||||
pItem->setText( QString::fromStdWString( iter->getOrderNo() ) );
|
||||
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
||||
|
||||
ui.pTableWidgetRepairRecommandation->setItem(rowIndex, columnIndex++, pItem);
|
||||
|
||||
//工单类型
|
||||
pItem = new QTableWidgetItem();
|
||||
pItem->setText(QString::fromStdWString(iter->getOrderType()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
ui.pTableWidgetRepairRecommandation->setItem(rowIndex, columnIndex++, pItem);
|
||||
|
||||
//报案号
|
||||
pItem = new QTableWidgetItem();
|
||||
pItem->setText(QString::fromStdWString(iter->getNotifyNo()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
ui.pTableWidgetRepairRecommandation->setItem(rowIndex, columnIndex++, pItem);
|
||||
|
||||
//推荐车商代码
|
||||
pItem = new QTableWidgetItem();
|
||||
pItem->setText(QString::fromStdWString(iter->getSuggestedCarDealerCode()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
ui.pTableWidgetRepairRecommandation->setItem(rowIndex, columnIndex++, pItem);
|
||||
|
||||
//推荐车商名称
|
||||
pItem = new QTableWidgetItem();
|
||||
pItem->setText(QString::fromStdWString(iter->getSuggestedCarDealerName()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
ui.pTableWidgetRepairRecommandation->setItem(rowIndex, columnIndex++, pItem);
|
||||
|
||||
//出险日期
|
||||
pItem = new QTableWidgetItem();
|
||||
pItem->setText(QString::fromStdWString(iter->getDamageDate()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
ui.pTableWidgetRepairRecommandation->setItem(rowIndex, columnIndex++, pItem);
|
||||
|
||||
//车牌号
|
||||
pItem = new QTableWidgetItem();
|
||||
pItem->setText(QString::fromStdWString(iter->getPlateNumber()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
ui.pTableWidgetRepairRecommandation->setItem(rowIndex, columnIndex++, pItem);
|
||||
|
||||
//品牌名称
|
||||
pItem = new QTableWidgetItem();
|
||||
pItem->setText(QString::fromStdWString(iter->getBrandName()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
ui.pTableWidgetRepairRecommandation->setItem(rowIndex, columnIndex++, pItem);
|
||||
|
||||
//短信类型
|
||||
pItem = new QTableWidgetItem();
|
||||
pItem->setText(QString::fromStdWString(iter->getMessageType()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
ui.pTableWidgetRepairRecommandation->setItem(rowIndex, columnIndex++, pItem);
|
||||
|
||||
//发送时间
|
||||
pItem = new QTableWidgetItem();
|
||||
pItem->setText(QString::fromStdWString(iter->getMessageSendingDate()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
ui.pTableWidgetRepairRecommandation->setItem(rowIndex, columnIndex++, pItem);
|
||||
|
||||
//数据来源
|
||||
pItem = new QTableWidgetItem();
|
||||
pItem->setText(QString::fromStdWString(iter->getDataSource()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
ui.pTableWidgetRepairRecommandation->setItem(rowIndex, columnIndex++, pItem);
|
||||
}
|
||||
|
||||
resizeTableWidgetTab(ui.pTableWidgetRepairRecommandation, 10);
|
||||
}
|
||||
|
@@ -18,8 +18,8 @@
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>70</y>
|
||||
<width>258</width>
|
||||
<height>240</height>
|
||||
<width>581</width>
|
||||
<height>331</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="pLayoutMain">
|
||||
@@ -184,6 +184,8 @@
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../../../resource.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Reference in New Issue
Block a user