diff --git a/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit.sln b/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit.sln index c27b0ec..d6d902b 100644 --- a/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit.sln +++ b/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit.sln @@ -20,6 +20,7 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution + Qt5Version = 5.10.1_msvc2017_x64 SolutionGuid = {A4A9332B-14DA-4126-B98B-613DCABA7F66} EndGlobalSection EndGlobal diff --git a/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit/telsale_aux_kit.vcxproj b/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit/telsale_aux_kit.vcxproj index 005e139..1a66431 100644 --- a/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit/telsale_aux_kit.vcxproj +++ b/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit/telsale_aux_kit.vcxproj @@ -11,7 +11,6 @@ - @@ -23,21 +22,17 @@ - - - - @@ -171,6 +166,7 @@ $(SolutionDir)$(Platform)\$(Configuration)\ + D:\develop\sdk\cpp\Qt\qt_5.10.1\5.10.1\msvc2017_64\lib;$(LibraryPath) $(SolutionDir)$(Platform)\$(Configuration)\ @@ -197,25 +193,26 @@ true - UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions) - .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories) + UNICODE;_UNICODE;WIN32;WIN64;%(PreprocessorDefinitions) + .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);%(AdditionalIncludeDirectories) Disabled ProgramDatabase MultiThreadedDebugDLL true + /source-charset:utf-8 %(AdditionalOptions) Windows $(OutDir)\$(ProjectName).exe $(QTDIR)\lib;%(AdditionalLibraryDirectories) true - qtmaind.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Widgetsd.lib;%(AdditionalDependencies) + qtmaind.lib;Qt5Widgetsd.lib;Qt5Cored.lib;Qt5Guid.lib;%(AdditionalDependencies) .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp Moc'ing %(Identity)... - .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName)\.;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtWidgets - UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB + .\GeneratedFiles;.;$(QTDIR)\include;$(QTDIR)\include\QtCore;.\GeneratedFiles\$(ConfigurationName);%(AdditionalIncludeDirectories) + UNICODE;_UNICODE;WIN32;WIN64;%(PreprocessorDefinitions) Uic'ing %(Identity)... @@ -229,8 +226,8 @@ true - UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions) - .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories) + UNICODE;_UNICODE;WIN32;WIN64;QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions) + .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);%(AdditionalIncludeDirectories) MultiThreadedDLL true @@ -240,13 +237,13 @@ $(OutDir)\$(ProjectName).exe $(QTDIR)\lib;%(AdditionalLibraryDirectories) false - qtmain.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Widgets.lib;%(AdditionalDependencies) + qtmain.lib;%(AdditionalDependencies) .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp Moc'ing %(Identity)... - .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName)\.;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtWidgets - UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB + .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);%(AdditionalIncludeDirectories) + UNICODE;_UNICODE;WIN32;WIN64;QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions) Uic'ing %(Identity)... @@ -265,7 +262,7 @@ - + \ No newline at end of file diff --git a/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit/telsale_aux_kit.vcxproj.filters b/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit/telsale_aux_kit.vcxproj.filters index ff046cf..664f357 100644 --- a/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit/telsale_aux_kit.vcxproj.filters +++ b/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit/telsale_aux_kit.vcxproj.filters @@ -75,9 +75,6 @@ - - sqlite3 - sqlite3 @@ -96,9 +93,6 @@ 数据\工具 - - 数据\数据库操作 - 数据\数据库操作 @@ -126,9 +120,6 @@ 窗口\层叠窗口\层叠子窗口 - - 数据 - @@ -143,9 +134,6 @@ 数据\工具 - - 数据\数据库操作 - 数据\数据库操作 @@ -155,9 +143,6 @@ 数据\参数管理 - - 数据 - diff --git a/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit/telsale_aux_kit.vcxproj.user b/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit/telsale_aux_kit.vcxproj.user index b392615..2f5564f 100644 --- a/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit/telsale_aux_kit.vcxproj.user +++ b/代码/telsale_aux_kit/proj/vs2017/telsale_aux_kit/telsale_aux_kit.vcxproj.user @@ -2,11 +2,11 @@ - D:\develop\sdk\cpp\qt\qt_5.10.1\5.10.1\msvc2017_64 + D:\develop\sdk\cpp\Qt\qt_5.10.1\5.10.1\msvc2017_64 PATH=$(QTDIR)\bin%3b$(PATH) - D:\develop\sdk\cpp\qt\qt_5.10.1\5.10.1\msvc2017_64 + D:\develop\sdk\cpp\Qt\qt_5.10.1\5.10.1\msvc2017_64 PATH=$(QTDIR)\bin%3b$(PATH) \ No newline at end of file diff --git a/代码/telsale_aux_kit/source/DataManipulation.cpp b/代码/telsale_aux_kit/source/DataManipulation.cpp index d06f96d..3ce7ef8 100644 --- a/代码/telsale_aux_kit/source/DataManipulation.cpp +++ b/代码/telsale_aux_kit/source/DataManipulation.cpp @@ -362,10 +362,10 @@ void QueryPolicyGifts(const string & strPolicyNo, string & strGifts, double dGif } -void readTelsaleXlsFile(const string strFilePath, vector & listPolicy, bool hasTitle, bool isXML ) +/*void readTelsaleXlsFile(const string strFilePath, vector & listPolicy, bool hasTitle, bool isXML ) { - IBookT * pBook = NULL; - ISheetT * pSheet = NULL; + Book * pBook = NULL; + Sheet * pSheet = NULL; int iRowCount = 0; int iRowIndex = 0; @@ -413,13 +413,13 @@ void readTelsaleXlsFile(const string strFilePath, vector & 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 & listPo } pBook->release(); -} +}*/ string readXlsCell(ISheetT * pSheet, int iRowIndex, int iColIndex) { @@ -521,7 +521,7 @@ string readXlsxCell(ISheetT * pSheet, int iRowIndex, int iColIndex) return strReturn; } -void readTelsaleXlsxFile(wchar_t * wszFilePath, vector & listPolicy, bool hasTitle) +void readTelsaleXlsxFile( const wstring & filePath, vector & listPolicy, bool hasTitle) { IBookT * pBook = NULL; ISheetT * pSheet = NULL; @@ -537,7 +537,7 @@ void readTelsaleXlsxFile(wchar_t * wszFilePath, vector & listPoli throw string(""); } - if ( pBook->load(L"D:/1111.xlsx") == false ) + if ( pBook->load( filePath.data() ) == false ) { throw string("打开文件失败!" ); } diff --git a/代码/telsale_aux_kit/source/DataManipulation.h b/代码/telsale_aux_kit/source/DataManipulation.h index 28d017f..bbc6839 100644 --- a/代码/telsale_aux_kit/source/DataManipulation.h +++ b/代码/telsale_aux_kit/source/DataManipulation.h @@ -18,6 +18,7 @@ #include #include #include +#include #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 & listPolicy, bool hasTitle, bool isXML ); +//void readTelsaleXlsFile( const string & strFilePath, vector & listPolicy, bool hasTitle, bool isXML ); -void readTelsaleXlsxFile( wchar_t * wszFilePath, vector & listPolicy, bool hasTitle ); +void readTelsaleXlsxFile( const wstring & filePath, vector & listPolicy, bool hasTitle ); string readXlsCell( ISheetT * pSheet, int iRowIndex, int iColIndex ); string readXlsxCell( ISheetT * pSheet, int iRowIndex, int iColIndex); diff --git a/代码/telsale_aux_kit/source/Parameters.cpp b/代码/telsale_aux_kit/source/Parameters.cpp index dacc9e4..70b225d 100644 --- a/代码/telsale_aux_kit/source/Parameters.cpp +++ b/代码/telsale_aux_kit/source/Parameters.cpp @@ -1,5 +1,6 @@ #include +#include #include "Parameters.h" #include "sqlite/sqlite3.h" diff --git a/代码/telsale_aux_kit/source/Parameters.h b/代码/telsale_aux_kit/source/Parameters.h index e6a3306..798006e 100644 --- a/代码/telsale_aux_kit/source/Parameters.h +++ b/代码/telsale_aux_kit/source/Parameters.h @@ -16,10 +16,10 @@ #define Parameters_h__ #include -#include +#include using std::string; -using std::hash_map; +using std::unordered_map; class Parameters { @@ -35,7 +35,7 @@ private: private: string m_strDbFilePath; - hash_map m_parameters; + unordered_map m_parameters; }; #endif // Parameters_h__ diff --git a/代码/telsale_aux_kit/source/QConfigurationWidget.h b/代码/telsale_aux_kit/source/QConfigurationWidget.h index c6afbea..2ad6ec5 100644 --- a/代码/telsale_aux_kit/source/QConfigurationWidget.h +++ b/代码/telsale_aux_kit/source/QConfigurationWidget.h @@ -1,7 +1,7 @@ #ifndef QCONFIGURATIONWIDGET_H #define QCONFIGURATIONWIDGET_H -#include +#include #include #include "ui_QConfigurationWidget.h" diff --git a/代码/telsale_aux_kit/source/QLoginWidget.cpp b/代码/telsale_aux_kit/source/QLoginWidget.cpp index 5b826fb..5339ccc 100644 --- a/代码/telsale_aux_kit/source/QLoginWidget.cpp +++ b/代码/telsale_aux_kit/source/QLoginWidget.cpp @@ -1,6 +1,6 @@ //#include -#include +//#include #include #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; } diff --git a/代码/telsale_aux_kit/source/QLoginWidget.h b/代码/telsale_aux_kit/source/QLoginWidget.h index 1f98065..e9f5f26 100644 --- a/代码/telsale_aux_kit/source/QLoginWidget.h +++ b/代码/telsale_aux_kit/source/QLoginWidget.h @@ -2,8 +2,9 @@ #define QLOGINWIDGET_H #include -#include -#include +#include +//#include +//#include #include "ui_QLoginWidget.h" //#include "DataManipulate.h" diff --git a/代码/telsale_aux_kit/source/QMainFrame.cpp b/代码/telsale_aux_kit/source/QMainFrame.cpp index d72cdf6..08736dd 100644 --- a/代码/telsale_aux_kit/source/QMainFrame.cpp +++ b/代码/telsale_aux_kit/source/QMainFrame.cpp @@ -1,5 +1,4 @@ -#include -#include + #include #include "QMainFrame.h" diff --git a/代码/telsale_aux_kit/source/QMainFrame.h b/代码/telsale_aux_kit/source/QMainFrame.h index 822fa6f..696692b 100644 --- a/代码/telsale_aux_kit/source/QMainFrame.h +++ b/代码/telsale_aux_kit/source/QMainFrame.h @@ -1,7 +1,7 @@ #ifndef QMAINFRAME_H #define QMAINFRAME_H -#include +#include #include "SystemData.h" #include "QMyStackedWidget.h" #include "QTelSalePolicyInfoInputWidget.h" diff --git a/代码/telsale_aux_kit/source/QMyStackedWidget.h b/代码/telsale_aux_kit/source/QMyStackedWidget.h index 06048b0..eb758a1 100644 --- a/代码/telsale_aux_kit/source/QMyStackedWidget.h +++ b/代码/telsale_aux_kit/source/QMyStackedWidget.h @@ -1,7 +1,9 @@ #ifndef QMYSTACKEDWIDGET_H #define QMYSTACKEDWIDGET_H -#include +#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS + +#include #include class QMyStackedWidget : public QStackedWidget diff --git a/代码/telsale_aux_kit/source/QRapidInputWidget.cpp b/代码/telsale_aux_kit/source/QRapidInputWidget.cpp index cdb49d9..f8ac8a7 100644 --- a/代码/telsale_aux_kit/source/QRapidInputWidget.cpp +++ b/代码/telsale_aux_kit/source/QRapidInputWidget.cpp @@ -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 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::iterator iter = m_vPolicy.begin(); iter != m_vPolicy.end(); ++iter ) + for (vector::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及以后!")); } diff --git a/代码/telsale_aux_kit/source/QRapidInputWidget.h b/代码/telsale_aux_kit/source/QRapidInputWidget.h index bfee7dd..bd1d8d5 100644 --- a/代码/telsale_aux_kit/source/QRapidInputWidget.h +++ b/代码/telsale_aux_kit/source/QRapidInputWidget.h @@ -2,7 +2,7 @@ #define QRAPIDINPUTWIDGET_H #include -#include +//#include #include #include "ui_QRapidInputWidget.h" #include "DataManipulation.h" diff --git a/代码/telsale_aux_kit/source/QTelSalePolicyInfoInputWidget.h b/代码/telsale_aux_kit/source/QTelSalePolicyInfoInputWidget.h index 7b15309..fd339ee 100644 --- a/代码/telsale_aux_kit/source/QTelSalePolicyInfoInputWidget.h +++ b/代码/telsale_aux_kit/source/QTelSalePolicyInfoInputWidget.h @@ -2,7 +2,7 @@ #define QTELSALEPOLICYINFOINPUTWIDGET_H #include -#include +#include #include "DataManipulation.h" #include "ui_QTelSalePolicyInfoInputWidget.h" diff --git a/代码/telsale_aux_kit/source/QTelSalePolicyInfoQuery.h b/代码/telsale_aux_kit/source/QTelSalePolicyInfoQuery.h index 92058eb..d8afc45 100644 --- a/代码/telsale_aux_kit/source/QTelSalePolicyInfoQuery.h +++ b/代码/telsale_aux_kit/source/QTelSalePolicyInfoQuery.h @@ -2,7 +2,7 @@ #define QTELSALEPOLICYINFOQUERY_H #include -#include +#include #include "DataManipulation.h" #include "ui_QTelSalePolicyInfoQuery.h" diff --git a/代码/telsale_aux_kit/source/StringCodeConverter.cpp b/代码/telsale_aux_kit/source/StringCodeConverter.cpp index d3975d6..0abb6eb 100644 --- a/代码/telsale_aux_kit/source/StringCodeConverter.cpp +++ b/代码/telsale_aux_kit/source/StringCodeConverter.cpp @@ -42,7 +42,7 @@ wstring StringCodeConverter::mbs2unicode( const string &cstrSource ) if ( iConvertedCount == -1 ) { - delete [] pwszBuffer; + delete [] pwszBuffer; throw string( "mbs2unicode参数有非中英文字符" ); } diff --git a/代码/telsale_aux_kit/source/SystemData.h b/代码/telsale_aux_kit/source/SystemData.h index cf58c49..98e79c2 100644 --- a/代码/telsale_aux_kit/source/SystemData.h +++ b/代码/telsale_aux_kit/source/SystemData.h @@ -15,7 +15,7 @@ #ifndef SystemData_h__ #define SystemData_h__ -#include +#include #include #include "Parameters.h" diff --git a/代码/telsale_aux_kit/source/TelSalePolicyManager.cpp b/代码/telsale_aux_kit/source/TelSalePolicyManager.cpp index f28b288..4a6308a 100644 --- a/代码/telsale_aux_kit/source/TelSalePolicyManager.cpp +++ b/代码/telsale_aux_kit/source/TelSalePolicyManager.cpp @@ -5,7 +5,7 @@ #include -using namespace std; +using namespace std; using namespace StringCodeConverter; #ifndef _UNICODE @@ -51,11 +51,11 @@ void CTelSalePolicyManager::Query( SPolicyQuery &policy, std::vector='" ); + 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( "Ϊ!" ); + throw invalid_argument( "保单号为空!" ); } if ( policy.strSalerCode.empty() == true ) { - throw invalid_argument( "Ϊգ" ); + throw invalid_argument( "保单号为空!" ); } ostringstream ostrCommand; string strAutotraderCall; - // + //车店联呼 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 ); // + //conn.setAutoCommit( SA_AutoCommitOff ); //导致锁表 - //汣 + //保存保单 command.Execute(); - //Ʒб,ɾ + //保存礼品列表,先删除旧数据 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( "ƷбΪգ" ); + throw invalid_argument( "礼品列表为空!" ); } SAConnection conn; @@ -478,12 +478,12 @@ string getCellString( ISheetT *pSheet, int iRowIndex, int iColIndex ) switch ( celltype ) { case CELLTYPE_STRING: - //ַ + //字符串 strCell = unicode2mbs( pSheet->readStr( iRowIndex, iColIndex ) ); break; case CELLTYPE_NUMBER: - // + //数字 iCellValue = pSheet->readNum( iRowIndex, iColIndex ); sprintf( pszNumber,"%d", iCellValue ); diff --git a/代码/telsale_aux_kit/source/check.cpp b/代码/telsale_aux_kit/source/check.cpp index 404008e..87be21a 100644 --- a/代码/telsale_aux_kit/source/check.cpp +++ b/代码/telsale_aux_kit/source/check.cpp @@ -1,7 +1,7 @@ #include "check.h" -hash_map parameters; //存放参数的hashmap +unordered_map parameters; //存放参数的hashmap //版本号 const string cstrVersion = "0.99"; @@ -13,7 +13,7 @@ string strUserPassword; bool checkVersion() { bool result = false; - hash_map::iterator iter = parameters.find( string("版本号") ); + unordered_map::iterator iter = parameters.find( string("版本号") ); if ( iter != parameters.end() && iter->second == cstrVersion ) { diff --git a/代码/telsale_aux_kit/source/check.h b/代码/telsale_aux_kit/source/check.h index 1920d78..73a1a4f 100644 --- a/代码/telsale_aux_kit/source/check.h +++ b/代码/telsale_aux_kit/source/check.h @@ -2,12 +2,12 @@ #ifndef check_h__ #define check_h__ -#include #include +#include using namespace std; -extern hash_map parameters; +extern unordered_map parameters; bool checkVersion(); diff --git a/代码/telsale_aux_kit/source/main.cpp b/代码/telsale_aux_kit/source/main.cpp index 220b871..272ad31 100644 --- a/代码/telsale_aux_kit/source/main.cpp +++ b/代码/telsale_aux_kit/source/main.cpp @@ -1,5 +1,5 @@ //#include -#include + #include #include #include