完成转换
This commit is contained in:
@@ -362,10 +362,10 @@ void QueryPolicyGifts(const string & strPolicyNo, string & strGifts, double dGif
|
||||
}
|
||||
|
||||
|
||||
void readTelsaleXlsFile(const string strFilePath, vector<SPolicyRecord> & listPolicy, bool hasTitle, bool isXML )
|
||||
/*void readTelsaleXlsFile(const string strFilePath, vector<SPolicyRecord> & listPolicy, bool hasTitle, bool isXML )
|
||||
{
|
||||
IBookT<char> * pBook = NULL;
|
||||
ISheetT<char> * pSheet = NULL;
|
||||
Book * pBook = NULL;
|
||||
Sheet * pSheet = NULL;
|
||||
|
||||
int iRowCount = 0;
|
||||
int iRowIndex = 0;
|
||||
@@ -413,13 +413,13 @@ void readTelsaleXlsFile(const string strFilePath, vector<SPolicyRecord> & listPo
|
||||
|
||||
CellType type = pSheet->cellType( iRowIndex, 4 );
|
||||
|
||||
policy.strSignDate = readXlsCell( pSheet, iRowIndex, 0 );
|
||||
policy.strPolicySerial = readXlsCell( pSheet, iRowIndex, 1 );
|
||||
policy.strPlateSerial = readXlsCell( pSheet, iRowIndex, 2 );
|
||||
policy.strCustomerName = readXlsCell( pSheet, iRowIndex, 3 );
|
||||
policy.strSalerCode = readXlsCell( pSheet, iRowIndex, 4 );
|
||||
policy.strSignDate = readXlsxCell( pSheet, iRowIndex, 0 );
|
||||
policy.strPolicySerial = readXlsxCell( pSheet, iRowIndex, 1 );
|
||||
policy.strPlateSerial = readXlsxCell( pSheet, iRowIndex, 2 );
|
||||
policy.strCustomerName = readXlsxCell( pSheet, iRowIndex, 3 );
|
||||
policy.strSalerCode = readXlsxCell( pSheet, iRowIndex, 4 );
|
||||
//policy.strAutoTraderName = readXlsCell( pSheet, iRowIndex, 5 );
|
||||
policy.strAutoTraderCode = readXlsCell( pSheet, iRowIndex, 6 );
|
||||
policy.strAutoTraderCode = readXlsxCell( pSheet, iRowIndex, 6 );
|
||||
|
||||
//补齐工号
|
||||
if ( policy.strSalerCode.length() == 1 )
|
||||
@@ -449,7 +449,7 @@ void readTelsaleXlsFile(const string strFilePath, vector<SPolicyRecord> & listPo
|
||||
}
|
||||
|
||||
pBook->release();
|
||||
}
|
||||
}*/
|
||||
|
||||
string readXlsCell(ISheetT<char> * pSheet, int iRowIndex, int iColIndex)
|
||||
{
|
||||
@@ -521,7 +521,7 @@ string readXlsxCell(ISheetT<wchar_t> * pSheet, int iRowIndex, int iColIndex)
|
||||
return strReturn;
|
||||
}
|
||||
|
||||
void readTelsaleXlsxFile(wchar_t * wszFilePath, vector<SPolicyRecord> & listPolicy, bool hasTitle)
|
||||
void readTelsaleXlsxFile( const wstring & filePath, vector<SPolicyRecord> & listPolicy, bool hasTitle)
|
||||
{
|
||||
IBookT<wchar_t> * pBook = NULL;
|
||||
ISheetT<wchar_t> * pSheet = NULL;
|
||||
@@ -537,7 +537,7 @@ void readTelsaleXlsxFile(wchar_t * wszFilePath, vector<SPolicyRecord> & listPoli
|
||||
throw string("");
|
||||
}
|
||||
|
||||
if ( pBook->load(L"D:/1111.xlsx") == false )
|
||||
if ( pBook->load( filePath.data() ) == false )
|
||||
{
|
||||
throw string("打开文件失败!" );
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <libxl.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include "SystemData.h"
|
||||
|
||||
using namespace std;
|
||||
@@ -133,9 +134,9 @@ void QueryPolicyGifts( const string & strPolicyNo,
|
||||
string & strGifts,
|
||||
double dGiftPriceSum );
|
||||
|
||||
void readTelsaleXlsFile( const string strFilePath, vector<SPolicyRecord> & listPolicy, bool hasTitle, bool isXML );
|
||||
//void readTelsaleXlsFile( const string & strFilePath, vector<SPolicyRecord> & listPolicy, bool hasTitle, bool isXML );
|
||||
|
||||
void readTelsaleXlsxFile( wchar_t * wszFilePath, vector<SPolicyRecord> & listPolicy, bool hasTitle );
|
||||
void readTelsaleXlsxFile( const wstring & filePath, vector<SPolicyRecord> & listPolicy, bool hasTitle );
|
||||
|
||||
string readXlsCell( ISheetT<char> * pSheet, int iRowIndex, int iColIndex );
|
||||
string readXlsxCell( ISheetT<wchar_t> * pSheet, int iRowIndex, int iColIndex);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
#include <exception>
|
||||
#include <unordered_map>
|
||||
#include "Parameters.h"
|
||||
#include "sqlite/sqlite3.h"
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
#define Parameters_h__
|
||||
|
||||
#include <string>
|
||||
#include <hash_map>
|
||||
#include <unordered_map>
|
||||
|
||||
using std::string;
|
||||
using std::hash_map;
|
||||
using std::unordered_map;
|
||||
|
||||
class Parameters
|
||||
{
|
||||
@@ -35,7 +35,7 @@ private:
|
||||
|
||||
private:
|
||||
string m_strDbFilePath;
|
||||
hash_map<string, string> m_parameters;
|
||||
unordered_map<string, string> m_parameters;
|
||||
};
|
||||
|
||||
#endif // Parameters_h__
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef QCONFIGURATIONWIDGET_H
|
||||
#define QCONFIGURATIONWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QtWidgets/QtWidgets>
|
||||
#include <string>
|
||||
#include "ui_QConfigurationWidget.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
//#include <occi.h>
|
||||
#include <QTextCodec>
|
||||
//#include <QTextCodec>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include "QLoginWidget.h"
|
||||
#include "SystemData.h"
|
||||
@@ -24,8 +24,8 @@ void QLoginWidget::init()
|
||||
initWidget();
|
||||
initSignal();
|
||||
|
||||
pCodecLocal = QTextCodec::codecForLocale();
|
||||
pCodecUTF8 = QTextCodec::codecForName( "UTF-8" );
|
||||
//pCodecLocal = QTextCodec::codecForLocale();
|
||||
//pCodecUTF8 = QTextCodec::codecForName( "UTF-8" );
|
||||
|
||||
m_isLoginSuccess = false;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
#define QLOGINWIDGET_H
|
||||
|
||||
#include <string>
|
||||
#include <QDialog>
|
||||
#include <QTextCodec>
|
||||
#include <QtWidgets/QtWidgets>
|
||||
//#include <QDialog>
|
||||
//#include <QTextCodec>
|
||||
#include "ui_QLoginWidget.h"
|
||||
//#include "DataManipulate.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <QtWidgets/QtWidgets>
|
||||
#include <QStatusBar>
|
||||
|
||||
#include <QtWidgets/QtWidgets>
|
||||
#include "QMainFrame.h"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef QMAINFRAME_H
|
||||
#define QMAINFRAME_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QtWidgets/QtWidgets>
|
||||
#include "SystemData.h"
|
||||
#include "QMyStackedWidget.h"
|
||||
#include "QTelSalePolicyInfoInputWidget.h"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#ifndef QMYSTACKEDWIDGET_H
|
||||
#define QMYSTACKEDWIDGET_H
|
||||
|
||||
#include <QHash>
|
||||
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
|
||||
|
||||
#include <QtCore/qhash.h>
|
||||
#include <QtWidgets/QStackedWidget>
|
||||
|
||||
class QMyStackedWidget : public QStackedWidget
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "QRapidInputWidget.h"
|
||||
#include "DataManipulation.h"
|
||||
|
||||
QRapidInputWidget::QRapidInputWidget(QWidget *parent)
|
||||
QRapidInputWidget::QRapidInputWidget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
@@ -11,7 +11,6 @@ QRapidInputWidget::QRapidInputWidget(QWidget *parent)
|
||||
|
||||
QRapidInputWidget::~QRapidInputWidget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void QRapidInputWidget::init()
|
||||
@@ -23,42 +22,43 @@ void QRapidInputWidget::init()
|
||||
|
||||
void QRapidInputWidget::initWidget()
|
||||
{
|
||||
setLayout( ui.pLayoutMain );
|
||||
setLayout(ui.pLayoutMain);
|
||||
|
||||
setAcceptDrops( true );
|
||||
setAcceptDrops(true);
|
||||
}
|
||||
|
||||
void QRapidInputWidget::initSignal()
|
||||
{
|
||||
connect( ui.pButtonSave,SIGNAL(clicked()), this, SLOT(onSaveTelSalePolicy()) );
|
||||
connect( ui.pButtonClean,SIGNAL(clicked()), this, SLOT(onCleanTable()) );
|
||||
connect( ui.pButtonOpenFile,SIGNAL(clicked()), this, SLOT(onOpenFile()) );
|
||||
connect(ui.pButtonSave,SIGNAL(clicked()), this, SLOT(onSaveTelSalePolicy()));
|
||||
connect(ui.pButtonClean,SIGNAL(clicked()), this, SLOT(onCleanTable()));
|
||||
connect(ui.pButtonOpenFile,SIGNAL(clicked()), this, SLOT(onOpenFile()));
|
||||
}
|
||||
|
||||
void QRapidInputWidget::initData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void QRapidInputWidget::dragEnterEvent(QDragEnterEvent * pEvent)
|
||||
void QRapidInputWidget::dragEnterEvent(QDragEnterEvent* pEvent)
|
||||
{
|
||||
if ( pEvent->mimeData()->hasUrls() )
|
||||
if (pEvent->mimeData()->hasUrls())
|
||||
{
|
||||
pEvent->acceptProposedAction();
|
||||
}
|
||||
}
|
||||
|
||||
void QRapidInputWidget::dropEvent(QDropEvent * pEvent)
|
||||
void QRapidInputWidget::dropEvent(QDropEvent* pEvent)
|
||||
{
|
||||
QList<QUrl> listURL = pEvent->mimeData()->urls();
|
||||
QString strFilePath;
|
||||
QString strFilePath;
|
||||
|
||||
//正则表达式判断文件类型
|
||||
QRegularExpression regXlsx( QString::fromLocal8Bit(".xlsx$"), QRegularExpression::PatternOption::CaseInsensitiveOption );
|
||||
QRegularExpression regXls( QString::fromLocal8Bit(".xls$"), QRegularExpression::PatternOption::CaseInsensitiveOption );
|
||||
QRegularExpression regXlsx(QString::fromLocal8Bit(".xlsx$"),
|
||||
QRegularExpression::PatternOption::CaseInsensitiveOption);
|
||||
QRegularExpression regXls(QString::fromLocal8Bit(".xls$"),
|
||||
QRegularExpression::PatternOption::CaseInsensitiveOption);
|
||||
QRegularExpressionMatch match;
|
||||
|
||||
if ( listURL.size() == 0 )
|
||||
if (listURL.size() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -66,96 +66,101 @@ void QRapidInputWidget::dropEvent(QDropEvent * pEvent)
|
||||
strFilePath = listURL[0].toLocalFile();
|
||||
|
||||
//是xlsx文件
|
||||
match = regXlsx.match( strFilePath );
|
||||
match = regXlsx.match(strFilePath);
|
||||
|
||||
if ( match.hasMatch() )
|
||||
if (match.hasMatch())
|
||||
{
|
||||
readTelsaleXlsFile( strFilePath.toLocal8Bit().data(), m_vPolicy, ui.pCheckBoxHasTitle->isChecked(), true );
|
||||
readTelsaleXlsxFile(strFilePath.toStdWString(),
|
||||
m_vPolicy,
|
||||
ui.pCheckBoxHasTitle->isChecked());
|
||||
}
|
||||
|
||||
//是xls文件
|
||||
match = regXls.match( strFilePath );
|
||||
|
||||
if ( match.hasMatch() )
|
||||
match = regXls.match(strFilePath);
|
||||
|
||||
if (match.hasMatch())
|
||||
{
|
||||
readTelsaleXlsFile( strFilePath.toLocal8Bit().data(), m_vPolicy, ui.pCheckBoxHasTitle->isChecked(), false );
|
||||
//readTelsaleXlsFile(strFilePath.toStdWString(), m_vPolicy, ui.pCheckBoxHasTitle->isChecked(), false);
|
||||
QMessageBox::critical(this,
|
||||
QString::fromLocal8Bit("文件类型错误!"),
|
||||
QString::fromLocal8Bit("文件格式需为Excel 2007及以后!"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
showPolicy();
|
||||
}
|
||||
|
||||
void QRapidInputWidget::showPolicy()
|
||||
{
|
||||
int iRowCount = m_vPolicy.size();
|
||||
QTableWidgetItem * pItem = NULL;
|
||||
int iRowCount = m_vPolicy.size();
|
||||
QTableWidgetItem* pItem = NULL;
|
||||
|
||||
ui.pTableWidgetPolicy->setRowCount( iRowCount );
|
||||
ui.pTableWidgetPolicy->setRowCount(iRowCount);
|
||||
|
||||
for ( int iRowIndex = 0; iRowIndex < iRowCount; iRowIndex++ )
|
||||
for (int iRowIndex = 0; iRowIndex < iRowCount; iRowIndex++)
|
||||
{
|
||||
//保单号
|
||||
pItem = new QTableWidgetItem( QString::fromLocal8Bit( m_vPolicy[iRowIndex].strPolicySerial.c_str()) );
|
||||
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
||||
pItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
|
||||
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strPolicySerial.c_str()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
ui.pTableWidgetPolicy->setItem( iRowIndex, 0, pItem );
|
||||
ui.pTableWidgetPolicy->setItem(iRowIndex, 0, pItem);
|
||||
|
||||
//签单日期
|
||||
pItem = new QTableWidgetItem( QString::fromLocal8Bit( m_vPolicy[iRowIndex].strSignDate.c_str()) );
|
||||
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
||||
pItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
|
||||
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strSignDate.c_str()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
ui.pTableWidgetPolicy->setItem( iRowIndex, 1, pItem );
|
||||
ui.pTableWidgetPolicy->setItem(iRowIndex, 1, pItem);
|
||||
|
||||
//车牌号
|
||||
pItem = new QTableWidgetItem( QString::fromLocal8Bit( m_vPolicy[iRowIndex].strPlateSerial.c_str()) );
|
||||
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
||||
pItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
|
||||
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strPlateSerial.c_str()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
ui.pTableWidgetPolicy->setItem( iRowIndex, 2, pItem );
|
||||
ui.pTableWidgetPolicy->setItem(iRowIndex, 2, pItem);
|
||||
|
||||
//被保险人
|
||||
pItem = new QTableWidgetItem( QString::fromLocal8Bit( m_vPolicy[iRowIndex].strCustomerName.c_str()) );
|
||||
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
||||
pItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
|
||||
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strCustomerName.c_str()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
ui.pTableWidgetPolicy->setItem( iRowIndex, 3, pItem );
|
||||
ui.pTableWidgetPolicy->setItem(iRowIndex, 3, pItem);
|
||||
|
||||
//车商代码
|
||||
pItem = new QTableWidgetItem( QString::fromLocal8Bit( m_vPolicy[iRowIndex].strAutoTraderCode.c_str()) );
|
||||
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
||||
pItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
|
||||
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strAutoTraderCode.c_str()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
ui.pTableWidgetPolicy->setItem( iRowIndex, 4, pItem );
|
||||
ui.pTableWidgetPolicy->setItem(iRowIndex, 4, pItem);
|
||||
|
||||
//经办人代码
|
||||
pItem = new QTableWidgetItem( QString::fromLocal8Bit( m_vPolicy[iRowIndex].strSalerCode.c_str()) );
|
||||
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
||||
pItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable );
|
||||
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strSalerCode.c_str()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
|
||||
|
||||
ui.pTableWidgetPolicy->setItem( iRowIndex, 5, pItem );
|
||||
ui.pTableWidgetPolicy->setItem(iRowIndex, 5, pItem);
|
||||
|
||||
//经办人名称
|
||||
pItem = new QTableWidgetItem( QString::fromLocal8Bit( m_vPolicy[iRowIndex].strSalerName.c_str()) );
|
||||
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
||||
pItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
|
||||
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strSalerName.c_str()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
ui.pTableWidgetPolicy->setItem( iRowIndex, 6, pItem );
|
||||
ui.pTableWidgetPolicy->setItem(iRowIndex, 6, pItem);
|
||||
|
||||
//部门
|
||||
pItem = new QTableWidgetItem( QString::fromLocal8Bit( m_vPolicy[iRowIndex].strSalerDeptName.c_str()) );
|
||||
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
||||
pItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
|
||||
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strSalerDeptName.c_str()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
ui.pTableWidgetPolicy->setItem( iRowIndex, 7, pItem );
|
||||
ui.pTableWidgetPolicy->setItem(iRowIndex, 7, pItem);
|
||||
|
||||
//科室
|
||||
pItem = new QTableWidgetItem( QString::fromLocal8Bit( m_vPolicy[iRowIndex].strSalerOfficeName.c_str()) );
|
||||
pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
|
||||
pItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
|
||||
pItem = new QTableWidgetItem(QString::fromLocal8Bit(m_vPolicy[iRowIndex].strSalerOfficeName.c_str()));
|
||||
pItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
pItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
ui.pTableWidgetPolicy->setItem( iRowIndex, 8, pItem );
|
||||
ui.pTableWidgetPolicy->setItem(iRowIndex, 8, pItem);
|
||||
}
|
||||
|
||||
ui.pTableWidgetPolicy->resizeColumnsToContents();
|
||||
@@ -167,20 +172,21 @@ void QRapidInputWidget::onSaveTelSalePolicy()
|
||||
|
||||
m_vErrorPolicy.clear();
|
||||
|
||||
for ( vector<SPolicyRecord>::iterator iter = m_vPolicy.begin(); iter != m_vPolicy.end(); ++iter )
|
||||
for (vector<SPolicyRecord>::iterator iter = m_vPolicy.begin(); iter != m_vPolicy.end(); ++iter)
|
||||
{
|
||||
try
|
||||
{
|
||||
SaveTelSalePolicyInfo( *iter, vGifts );
|
||||
SaveTelSalePolicyInfo(*iter, vGifts);
|
||||
}
|
||||
catch( runtime_error &excpt )
|
||||
catch (runtime_error& excpt)
|
||||
{
|
||||
m_vErrorPolicy.push_back( *iter );
|
||||
m_vErrorPolicy.push_back(*iter);
|
||||
|
||||
QString strInfo = QString::fromLocal8Bit("保单") + QString::fromLocal8Bit( (*iter).strPolicySerial.c_str() ) + QString::fromLocal8Bit("保存错误!\n") +
|
||||
QString::fromLocal8Bit("错误信息:") + QString::fromLocal8Bit( excpt.what() );
|
||||
QString strInfo = QString::fromLocal8Bit("保单") + QString::fromLocal8Bit((*iter).strPolicySerial.c_str()) + QString::
|
||||
fromLocal8Bit("保存错误!\n") +
|
||||
QString::fromLocal8Bit("错误信息:") + QString::fromLocal8Bit(excpt.what());
|
||||
|
||||
QMessageBox::critical( this, QString::fromLocal8Bit("保存错误"), strInfo );
|
||||
QMessageBox::critical(this, QString::fromLocal8Bit("保存错误"), strInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,20 +206,20 @@ void QRapidInputWidget::onCleanTable()
|
||||
|
||||
void QRapidInputWidget::onOpenFile()
|
||||
{
|
||||
QSettings reg( "HKEY_CURRENT_USER\\Software\\TelsalePolicyInfoManager", QSettings::NativeFormat);
|
||||
QString strPath = reg.value( QString::fromLocal8Bit("打开地址") ).toString();
|
||||
QSettings reg("HKEY_CURRENT_USER\\Software\\TelsalePolicyInfoManager", QSettings::NativeFormat);
|
||||
QString strPath = reg.value(QString::fromLocal8Bit("打开地址")).toString();
|
||||
|
||||
QStringList listFileNames = QFileDialog::getOpenFileNames( this,
|
||||
QString::fromLocal8Bit("打开Excel文件"),
|
||||
strPath,
|
||||
QString::fromLocal8Bit("Excel文件 (*.xls *.xlsx)") );
|
||||
QStringList listFileNames = QFileDialog::getOpenFileNames(this,
|
||||
QString::fromLocal8Bit("打开Excel文件"),
|
||||
strPath,
|
||||
QString::fromLocal8Bit("Excel文件 (*.xls *.xlsx)"));
|
||||
|
||||
//记录一下打开的路径
|
||||
if ( listFileNames.size() > 0 )
|
||||
if (listFileNames.size() > 0)
|
||||
{
|
||||
strPath = listFileNames[0].left( listFileNames[0].lastIndexOf( QString::fromLocal8Bit("/") ) + 1 );
|
||||
strPath = listFileNames[0].left(listFileNames[0].lastIndexOf(QString::fromLocal8Bit("/")) + 1);
|
||||
|
||||
reg.setValue( QString::fromLocal8Bit("打开地址"), strPath );
|
||||
reg.setValue(QString::fromLocal8Bit("打开地址"), strPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -221,26 +227,31 @@ void QRapidInputWidget::onOpenFile()
|
||||
}
|
||||
|
||||
//正则表达式判断文件类型
|
||||
QRegularExpression regXlsx( QString::fromLocal8Bit(".xlsx$"), QRegularExpression::PatternOption::CaseInsensitiveOption );
|
||||
QRegularExpression regXls( QString::fromLocal8Bit(".xls$"), QRegularExpression::PatternOption::CaseInsensitiveOption );
|
||||
QRegularExpression regXlsx(QString::fromLocal8Bit(".xlsx$"),
|
||||
QRegularExpression::PatternOption::CaseInsensitiveOption);
|
||||
QRegularExpression regXls(QString::fromLocal8Bit(".xls$"),
|
||||
QRegularExpression::PatternOption::CaseInsensitiveOption);
|
||||
QRegularExpressionMatch match;
|
||||
|
||||
strPath = listFileNames[0];
|
||||
|
||||
//是xlsx文件
|
||||
match = regXlsx.match( strPath );
|
||||
match = regXlsx.match(strPath);
|
||||
|
||||
if ( match.hasMatch() )
|
||||
if (match.hasMatch())
|
||||
{
|
||||
readTelsaleXlsFile( strPath.toLocal8Bit().data(), m_vPolicy, ui.pCheckBoxHasTitle->isChecked(), true );
|
||||
readTelsaleXlsxFile(strPath.toStdWString(), m_vPolicy, ui.pCheckBoxHasTitle->isChecked());
|
||||
}
|
||||
|
||||
//是xls文件
|
||||
match = regXls.match( strPath );
|
||||
match = regXls.match(strPath);
|
||||
|
||||
if ( match.hasMatch() )
|
||||
if (match.hasMatch())
|
||||
{
|
||||
readTelsaleXlsFile( strPath.toLocal8Bit().data(), m_vPolicy, ui.pCheckBoxHasTitle->isChecked(), false );
|
||||
//readTelsaleXlsFile( strPath.toLocal8Bit().data(), m_vPolicy, ui.pCheckBoxHasTitle->isChecked(), false );
|
||||
QMessageBox::critical(this,
|
||||
QString::fromLocal8Bit("文件类型错误!"),
|
||||
QString::fromLocal8Bit("文件格式需为Excel 2007及以后!"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define QRAPIDINPUTWIDGET_H
|
||||
|
||||
#include <QtWidgets/QtWidgets>
|
||||
#include <QWidget>
|
||||
//#include <QWidget>
|
||||
#include <vector>
|
||||
#include "ui_QRapidInputWidget.h"
|
||||
#include "DataManipulation.h"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define QTELSALEPOLICYINFOINPUTWIDGET_H
|
||||
|
||||
#include <vector>
|
||||
#include <QWidget>
|
||||
#include <QtWidgets/QtWidgets>
|
||||
#include "DataManipulation.h"
|
||||
#include "ui_QTelSalePolicyInfoInputWidget.h"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define QTELSALEPOLICYINFOQUERY_H
|
||||
|
||||
#include <vector>
|
||||
#include <QWidget>
|
||||
#include <QtWidgets/QtWidgets>
|
||||
#include "DataManipulation.h"
|
||||
#include "ui_QTelSalePolicyInfoQuery.h"
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ wstring StringCodeConverter::mbs2unicode( const string &cstrSource )
|
||||
|
||||
if ( iConvertedCount == -1 )
|
||||
{
|
||||
delete [] pwszBuffer;
|
||||
delete [] pwszBuffer;
|
||||
throw string( "mbs2unicode参数有非中英文字符" );
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#ifndef SystemData_h__
|
||||
#define SystemData_h__
|
||||
|
||||
#include <hash_map>
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
#include "Parameters.h"
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace std;
|
||||
using namespace StringCodeConverter;
|
||||
|
||||
#ifndef _UNICODE
|
||||
@@ -51,11 +51,11 @@ void CTelSalePolicyManager::Query( SPolicyQuery &policy, std::vector<SPolicyReco
|
||||
SACommand command;
|
||||
|
||||
|
||||
//<EFBFBD><EFBFBD><EFBFBD>ɲ<EFBFBD>ѯ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
||||
//生成查询字符串
|
||||
string strCommand;
|
||||
|
||||
strCommand.reserve( 1024 );
|
||||
strCommand.append( "select bdh, zhjywy, to_char(czrq, '%Y<EFBFBD><EFBFBD>%m<><6D>%d<><64>') from w_dxbd_i where 1=1 and czrq >='" );
|
||||
strCommand.append( "select bdh, zhjywy, to_char(czrq, '%Y年%m月%d日') from w_dxbd_i where 1=1 and czrq >='" );
|
||||
|
||||
strCommand += policy.strStartDate;
|
||||
strCommand += "' and czrq <= '";
|
||||
@@ -239,18 +239,18 @@ void CTelSalePolicyManager::SavePolicy( const SPolicyRecord & policy,
|
||||
{
|
||||
if ( policy.strPolicySerial.empty() == true )
|
||||
{
|
||||
throw invalid_argument( "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>!" );
|
||||
throw invalid_argument( "保单号为空!" );
|
||||
}
|
||||
|
||||
if ( policy.strSalerCode.empty() == true )
|
||||
{
|
||||
throw invalid_argument( "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>" );
|
||||
throw invalid_argument( "保单号为空!" );
|
||||
}
|
||||
|
||||
ostringstream ostrCommand;
|
||||
string strAutotraderCall;
|
||||
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//车店联呼
|
||||
if ( policy.bIsAutotraderCall == true )
|
||||
{
|
||||
strAutotraderCall = "1";
|
||||
@@ -324,12 +324,12 @@ void CTelSalePolicyManager::SavePolicy( const SPolicyRecord & policy,
|
||||
g_cszUserNameYwgl,
|
||||
g_cszPasswordYwgl,
|
||||
SA_Informix_Client );
|
||||
//conn.setAutoCommit( SA_AutoCommitOff ); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//conn.setAutoCommit( SA_AutoCommitOff ); //导致锁表
|
||||
|
||||
//<EFBFBD><EFBFBD><EFBFBD>汣<EFBFBD><EFBFBD>
|
||||
//保存保单
|
||||
command.Execute();
|
||||
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>б<EFBFBD>,<2C><>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//保存礼品列表,先删除旧数据
|
||||
command.setCommandText( "delete w_dxbd_gift_i where bdh = :1 " );
|
||||
command.Param( 1 ).setAsString() = policy.strPolicySerial.c_str();
|
||||
command.Execute();
|
||||
@@ -427,7 +427,7 @@ void CTelSalePolicyManager::SavePolicyGift( const string & strPolicyNo, const ve
|
||||
|
||||
if ( giftsList.empty() )
|
||||
{
|
||||
throw invalid_argument( "<EFBFBD><EFBFBD>Ʒ<EFBFBD>б<EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>" );
|
||||
throw invalid_argument( "礼品列表为空!" );
|
||||
}
|
||||
|
||||
SAConnection conn;
|
||||
@@ -478,12 +478,12 @@ string getCellString( ISheetT<wchar_t> *pSheet, int iRowIndex, int iColIndex )
|
||||
switch ( celltype )
|
||||
{
|
||||
case CELLTYPE_STRING:
|
||||
//<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
||||
//字符串
|
||||
strCell = unicode2mbs( pSheet->readStr( iRowIndex, iColIndex ) );
|
||||
break;
|
||||
|
||||
case CELLTYPE_NUMBER:
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//数字
|
||||
iCellValue = pSheet->readNum( iRowIndex, iColIndex );
|
||||
|
||||
sprintf( pszNumber,"%d", iCellValue );
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#include "check.h"
|
||||
|
||||
hash_map<string, string> parameters; //存放参数的hashmap
|
||||
unordered_map<string, string> parameters; //存放参数的hashmap
|
||||
|
||||
//版本号
|
||||
const string cstrVersion = "0.99";
|
||||
@@ -13,7 +13,7 @@ string strUserPassword;
|
||||
bool checkVersion()
|
||||
{
|
||||
bool result = false;
|
||||
hash_map<string,string>::iterator iter = parameters.find( string("版本号") );
|
||||
unordered_map<string,string>::iterator iter = parameters.find( string("版本号") );
|
||||
|
||||
if ( iter != parameters.end() && iter->second == cstrVersion )
|
||||
{
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
#ifndef check_h__
|
||||
#define check_h__
|
||||
|
||||
#include <hash_map>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern hash_map<string, string> parameters;
|
||||
extern unordered_map<string, string> parameters;
|
||||
|
||||
bool checkVersion();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//#include <QTextCodec>
|
||||
#include <QString>
|
||||
|
||||
#include <QtWidgets/QtWidgets>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <exception>
|
||||
|
||||
Reference in New Issue
Block a user