From 1e383920be55485fd44a3b2f830a35b5dfb5739a Mon Sep 17 00:00:00 2001 From: Kane Wang Date: Fri, 1 Jun 2018 18:21:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=96=87=E4=BB=B6=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E4=BF=AE=E6=94=B9=E6=88=90utf-8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/DataManipulation.cpp | 32 +-- .../telsale_aux_kit/source/DataManipulation.h | 10 +- 代码/telsale_aux_kit/source/Parameters.cpp | 8 +- .../source/QConfigurationWidget.cpp | 6 +- .../source/QConfigurationWidget.h | 2 +- 代码/telsale_aux_kit/source/QMainFrame.cpp | 38 +-- 代码/telsale_aux_kit/source/QMainFrame.h | 2 +- .../source/QRapidInputWidget.cpp | 46 ++-- .../source/QTelSalePolicyInfoInputWidget.cpp | 227 ++++++++++-------- .../source/QTelSalePolicyInfoQuery.cpp | 33 ++- .../source/QTelSalePolicyInfoQuery.h | 2 +- .../source/StringCodeConverter.cpp | 68 +++--- .../source/StringCodeConverter.h | 2 +- 代码/telsale_aux_kit/source/SystemData.cpp | 10 +- .../source/SystemDataQuery.cpp | 4 +- .../telsale_aux_kit/source/SystemDataQuery.h | 24 +- 代码/telsale_aux_kit/source/check.cpp | 6 +- 代码/telsale_aux_kit/source/main.cpp | 54 ++--- 18 files changed, 303 insertions(+), 271 deletions(-) diff --git a/代码/telsale_aux_kit/source/DataManipulation.cpp b/代码/telsale_aux_kit/source/DataManipulation.cpp index cab650a..d06f96d 100644 --- a/代码/telsale_aux_kit/source/DataManipulation.cpp +++ b/代码/telsale_aux_kit/source/DataManipulation.cpp @@ -9,7 +9,7 @@ #include "SystemDataQuery.h" #include "StringCodeConverter.h" - + #pragma comment( lib, "user32.lib") #pragma comment( lib, "version.lib") #pragma comment( lib, "oleaut32.lib") @@ -89,18 +89,18 @@ void SaveTelSalePolicyInfo(const SPolicyRecord & policy, const vector & listPo if ( pSheet == NULL ) { - throw string( "ȡsheetʧܣ" ); + throw string( "读取sheet失败!" ); } iRowCount = pSheet->lastRow(); @@ -406,7 +406,7 @@ void readTelsaleXlsFile(const string strFilePath, vector & listPo iRowIndex = 1; } - //ȡ + //读取数据 while ( iRowIndex < iRowCount ) { SPolicyRecord policy; @@ -421,7 +421,7 @@ void readTelsaleXlsFile(const string strFilePath, vector & listPo //policy.strAutoTraderName = readXlsCell( pSheet, iRowIndex, 5 ); policy.strAutoTraderCode = readXlsCell( pSheet, iRowIndex, 6 ); - //빤 + //补齐工号 if ( policy.strSalerCode.length() == 1 ) { policy.strSalerCode = string("00") + policy.strSalerCode; @@ -539,14 +539,14 @@ void readTelsaleXlsxFile(wchar_t * wszFilePath, vector & listPoli if ( pBook->load(L"D:/1111.xlsx") == false ) { - throw string("ļʧܣ" ); + throw string("打开文件失败!" ); } pSheet = pBook->getSheet( 0 ); if ( pSheet == NULL ) { - throw string( "ȡsheetʧܣ" ); + throw string( "读取sheet失败!" ); } iRowCount = pSheet->lastRow(); @@ -556,7 +556,7 @@ void readTelsaleXlsxFile(wchar_t * wszFilePath, vector & listPoli iRowIndex = 1; } - //ȡ + //读取数据 while ( iRowIndex < iRowCount ) { SPolicyRecord policy; @@ -570,7 +570,7 @@ void readTelsaleXlsxFile(wchar_t * wszFilePath, vector & listPoli policy.strSalerCode = readXlsxCell( pSheet, iRowIndex, 4 ); policy.strAutoTraderName = readXlsxCell( pSheet, iRowIndex, 6 ); - //빤 + //补齐工号 if ( policy.strSalerCode.length() == 1 ) { policy.strSalerCode = string("00") + policy.strSalerCode; diff --git a/代码/telsale_aux_kit/source/DataManipulation.h b/代码/telsale_aux_kit/source/DataManipulation.h index e41dc84..28d017f 100644 --- a/代码/telsale_aux_kit/source/DataManipulation.h +++ b/代码/telsale_aux_kit/source/DataManipulation.h @@ -5,12 +5,12 @@ * \author Kane * Contact: user@company.com * - * \brief תݴ + * \brief 转介绍数据处理 * * TODO: long description * * \note -*/ +*/ #ifndef DataManipulation_h__ #define DataManipulation_h__ @@ -86,8 +86,8 @@ private: // FullName: queryTelsalePolicyGifts // Access: public // Returns: void -// Qualifier: ѯƷϢ -// Parameter: vector & giftList Ʒб +// Qualifier: 查询礼品信息 +// Parameter: vector & giftList 礼品列表 //************************************ void queryTelsalePolicyGifts( vector &giftList ); @@ -125,7 +125,7 @@ void QueryTelSalePolicyInfo( const string & strPolicyNo, // FullName: QueryPolicyGifts // Access: public // Returns: void -// Qualifier: ѯƷбַ +// Qualifier: 查询礼品列表,生成字符串 // Parameter: const string & strPolicyNo // Parameter: string & strGifts //************************************ diff --git a/代码/telsale_aux_kit/source/Parameters.cpp b/代码/telsale_aux_kit/source/Parameters.cpp index 3edc4d0..dacc9e4 100644 --- a/代码/telsale_aux_kit/source/Parameters.cpp +++ b/代码/telsale_aux_kit/source/Parameters.cpp @@ -29,7 +29,7 @@ Parameters::Parameters(const string & strFilePath) throw runtime_error( sqlite3_errmsg(pdbParameter) ); } - //ѯ + //查询 returnCode = sqlite3_get_table( pdbParameter, szSQL, &result, &nRowCount, &nColCount, &pszMessage ); if ( returnCode != SQLITE_OK ) @@ -45,11 +45,11 @@ Parameters::Parameters(const string & strFilePath) m_parameters[strName] = strValue; } - // + //清理 sqlite3_free_table( result ); sqlite3_close( pdbParameter ); - //ļ· + //保存文件路径 m_strDbFilePath = strFilePath; } @@ -67,7 +67,7 @@ void Parameters::setParameter(const string & strParaName, const string & strPara { if ( m_parameters.find( strParaName) == m_parameters.end() ) { - throw runtime_error( "ƴ" ); + throw runtime_error( "参数名称错误!" ); } m_parameters[strParaName] = strParaValue; diff --git a/代码/telsale_aux_kit/source/QConfigurationWidget.cpp b/代码/telsale_aux_kit/source/QConfigurationWidget.cpp index 54a6cd5..aa87602 100644 --- a/代码/telsale_aux_kit/source/QConfigurationWidget.cpp +++ b/代码/telsale_aux_kit/source/QConfigurationWidget.cpp @@ -41,7 +41,7 @@ void QConfigurationWidget::initSignal() void QConfigurationWidget::initData() { - pEditAutoTraderCode->setText( QString::fromLocal8Bit( parameters.getParameter("Ĭϳ̴").c_str() )); + pEditAutoTraderCode->setText( QString::fromLocal8Bit( parameters.getParameter("默认车商代码").c_str() )); emit pEditAutoTraderCode->editingFinished(); } @@ -70,12 +70,12 @@ void QConfigurationWidget::onSave() if ( pEditAutoTraderName->text().isEmpty() ) { - QMessageBox::critical( this, QString::fromLocal8Bit(""), QString::fromLocal8Bit("̴") ); + QMessageBox::critical( this, QString::fromLocal8Bit("错误!"), QString::fromLocal8Bit("车商代码错误!") ); return; } - parameters.setParameter( "Ĭϳ̴", pEditAutoTraderCode->text().toLocal8Bit().data() ); + parameters.setParameter( "默认车商代码", pEditAutoTraderCode->text().toLocal8Bit().data() ); } void QConfigurationWidget::onReset() diff --git a/代码/telsale_aux_kit/source/QConfigurationWidget.h b/代码/telsale_aux_kit/source/QConfigurationWidget.h index 7de6253..c6afbea 100644 --- a/代码/telsale_aux_kit/source/QConfigurationWidget.h +++ b/代码/telsale_aux_kit/source/QConfigurationWidget.h @@ -5,7 +5,7 @@ #include #include "ui_QConfigurationWidget.h" -using std::string; +using std::string; class QConfigurationWidget : public QWidget, public Ui::QConfigurationWidget { diff --git a/代码/telsale_aux_kit/source/QMainFrame.cpp b/代码/telsale_aux_kit/source/QMainFrame.cpp index ae41a48..d72cdf6 100644 --- a/代码/telsale_aux_kit/source/QMainFrame.cpp +++ b/代码/telsale_aux_kit/source/QMainFrame.cpp @@ -5,7 +5,7 @@ QMainFrame::QMainFrame(QWidget *parent) : QMainWindow(parent) -{ +{ setupUi(this); init(); @@ -25,29 +25,29 @@ void QMainFrame::init() void QMainFrame::initWidget() { - // - setWindowTitle( windowTitle() + QString::fromLocal8Bit(" - 汾ţv") + QString::fromLocal8Bit( getVersion().c_str()) ); + //标题栏 + setWindowTitle( windowTitle() + QString::fromLocal8Bit(" - 版本号:v") + QString::fromLocal8Bit( getVersion().c_str()) ); - // + //工具栏 //ui.pActionDataManage->setEnabled( false ); - // + //层叠窗口 m_pWidgetStack = new QMyStackedWidget( this ); setCentralWidget( m_pWidgetStack ); - //Ϣ¼봰 + //加入信息录入窗口 m_pWidgetInfoInput = new QTelSalePolicyInfoInputWidget(); - m_pWidgetStack->addWidget( m_pWidgetInfoInput, QString::fromLocal8Bit("תϢ¼봰") ); - m_pWidgetStack->showWidget( QString::fromLocal8Bit("תϢ¼봰") ); + m_pWidgetStack->addWidget( m_pWidgetInfoInput, QString::fromLocal8Bit("电销转介绍信息录入窗口") ); + m_pWidgetStack->showWidget( QString::fromLocal8Bit("电销转介绍信息录入窗口") ); - //ѯ + //加入查询窗口 m_pWidgetQuery = new QTelSalePolicyInfoQuery(); - m_pWidgetStack->addWidget( m_pWidgetQuery, QString::fromLocal8Bit("Ϣѯ") ); + m_pWidgetStack->addWidget( m_pWidgetQuery, QString::fromLocal8Bit("信息查询窗口") ); - //ô + //加入参数设置窗口 QScrollArea * pScrollArea = new QScrollArea(); m_pWidgetConfiguration = new QConfigurationWidget(); @@ -57,7 +57,7 @@ void QMainFrame::initWidget() pScrollArea->setObjectName( QString::fromLocal8Bit("pScrollAreaInput") ); pScrollArea->setStyleSheet( QString::fromLocal8Bit( "#pScrollAreaInput\n{\n border: none;\n}" )); - m_pWidgetStack->addWidget( pScrollArea, QString::fromLocal8Bit("ô") ); + m_pWidgetStack->addWidget( pScrollArea, QString::fromLocal8Bit("参数配置窗口") ); } void QMainFrame::initSignal() @@ -74,7 +74,7 @@ void QMainFrame::resizeEvent( QResizeEvent * pEvent ) void QMainFrame::initStatusBar() { - //֤ + //验证 QStatusBar * pStatusBar = this->statusBar(); if ( pStatusBar == NULL ) @@ -82,9 +82,9 @@ void QMainFrame::initStatusBar() return; } - QString strDate = QDate::currentDate().toString( QString::fromLocal8Bit("ǰڣyyyyMMdd ") ); - QString strUserName = QString::fromLocal8Bit("Ա") + QString::fromLocal8Bit( getUserName().c_str() ) + QString(" "); - QString strUserCode = QString::fromLocal8Bit("ţ") + QString::fromLocal8Bit( getUserCode().c_str() ) + QString(" "); + QString strDate = QDate::currentDate().toString( QString::fromLocal8Bit("当前日期:yyyy年MM月dd日 ") ); + QString strUserName = QString::fromLocal8Bit("操作员:") + QString::fromLocal8Bit( getUserName().c_str() ) + QString(" "); + QString strUserCode = QString::fromLocal8Bit("工号:") + QString::fromLocal8Bit( getUserCode().c_str() ) + QString(" "); //strUser. @@ -95,15 +95,15 @@ void QMainFrame::initStatusBar() void QMainFrame::onShowInputWidget() { - m_pWidgetStack->showWidget( QString::fromLocal8Bit("תϢ¼봰") ); + m_pWidgetStack->showWidget( QString::fromLocal8Bit("电销转介绍信息录入窗口") ); } void QMainFrame::onShowQueryWidget() { - m_pWidgetStack->showWidget( QString::fromLocal8Bit("Ϣѯ") ); + m_pWidgetStack->showWidget( QString::fromLocal8Bit("信息查询窗口") ); } void QMainFrame::onShowSetParameterWidget() { - m_pWidgetStack->showWidget( QString::fromLocal8Bit("ô") ); + m_pWidgetStack->showWidget( QString::fromLocal8Bit("参数配置窗口") ); } diff --git a/代码/telsale_aux_kit/source/QMainFrame.h b/代码/telsale_aux_kit/source/QMainFrame.h index 9147b42..822fa6f 100644 --- a/代码/telsale_aux_kit/source/QMainFrame.h +++ b/代码/telsale_aux_kit/source/QMainFrame.h @@ -7,7 +7,7 @@ #include "QTelSalePolicyInfoInputWidget.h" #include "QTelSalePolicyInfoQuery.h" #include "QConfigurationWidget.h" -#include "ui_QMainFrame.h" +#include "ui_QMainFrame.h" class QMainFrame : public QMainWindow, public Ui::QMainFrame { diff --git a/代码/telsale_aux_kit/source/QRapidInputWidget.cpp b/代码/telsale_aux_kit/source/QRapidInputWidget.cpp index c36c5e8..cdb49d9 100644 --- a/代码/telsale_aux_kit/source/QRapidInputWidget.cpp +++ b/代码/telsale_aux_kit/source/QRapidInputWidget.cpp @@ -53,7 +53,7 @@ void QRapidInputWidget::dropEvent(QDropEvent * pEvent) QList listURL = pEvent->mimeData()->urls(); QString strFilePath; - //ʽжļ + //正则表达式判断文件类型 QRegularExpression regXlsx( QString::fromLocal8Bit(".xlsx$"), QRegularExpression::PatternOption::CaseInsensitiveOption ); QRegularExpression regXls( QString::fromLocal8Bit(".xls$"), QRegularExpression::PatternOption::CaseInsensitiveOption ); QRegularExpressionMatch match; @@ -65,7 +65,7 @@ void QRapidInputWidget::dropEvent(QDropEvent * pEvent) strFilePath = listURL[0].toLocalFile(); - //xlsxļ + //是xlsx文件 match = regXlsx.match( strFilePath ); if ( match.hasMatch() ) @@ -73,7 +73,7 @@ void QRapidInputWidget::dropEvent(QDropEvent * pEvent) readTelsaleXlsFile( strFilePath.toLocal8Bit().data(), m_vPolicy, ui.pCheckBoxHasTitle->isChecked(), true ); } - //xlsļ + //是xls文件 match = regXls.match( strFilePath ); if ( match.hasMatch() ) @@ -94,63 +94,63 @@ void QRapidInputWidget::showPolicy() 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 ); 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 ); 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 ); 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 ); 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 ); 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 ); 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 ); 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 ); 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 ); @@ -177,10 +177,10 @@ void QRapidInputWidget::onSaveTelSalePolicy() { 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 ); } } @@ -201,33 +201,33 @@ void QRapidInputWidget::onCleanTable() void QRapidInputWidget::onOpenFile() { QSettings reg( "HKEY_CURRENT_USER\\Software\\TelsalePolicyInfoManager", QSettings::NativeFormat); - QString strPath = reg.value( QString::fromLocal8Bit("򿪵ַ") ).toString(); + QString strPath = reg.value( QString::fromLocal8Bit("打开地址") ).toString(); QStringList listFileNames = QFileDialog::getOpenFileNames( this, - QString::fromLocal8Bit("Excelļ"), + QString::fromLocal8Bit("打开Excel文件"), strPath, - QString::fromLocal8Bit("Excelļ (*.xls *.xlsx)") ); + QString::fromLocal8Bit("Excel文件 (*.xls *.xlsx)") ); - //¼һ´򿪵· + //记录一下打开的路径 if ( listFileNames.size() > 0 ) { strPath = listFileNames[0].left( listFileNames[0].lastIndexOf( QString::fromLocal8Bit("/") ) + 1 ); - reg.setValue( QString::fromLocal8Bit("򿪵ַ"), strPath ); + reg.setValue( QString::fromLocal8Bit("打开地址"), strPath ); } else { return; } - //ʽжļ + //正则表达式判断文件类型 QRegularExpression regXlsx( QString::fromLocal8Bit(".xlsx$"), QRegularExpression::PatternOption::CaseInsensitiveOption ); QRegularExpression regXls( QString::fromLocal8Bit(".xls$"), QRegularExpression::PatternOption::CaseInsensitiveOption ); QRegularExpressionMatch match; strPath = listFileNames[0]; - //xlsxļ + //是xlsx文件 match = regXlsx.match( strPath ); if ( match.hasMatch() ) @@ -235,7 +235,7 @@ void QRapidInputWidget::onOpenFile() readTelsaleXlsFile( strPath.toLocal8Bit().data(), m_vPolicy, ui.pCheckBoxHasTitle->isChecked(), true ); } - //xlsļ + //是xls文件 match = regXls.match( strPath ); if ( match.hasMatch() ) diff --git a/代码/telsale_aux_kit/source/QTelSalePolicyInfoInputWidget.cpp b/代码/telsale_aux_kit/source/QTelSalePolicyInfoInputWidget.cpp index 09ac115..1208dc7 100644 --- a/代码/telsale_aux_kit/source/QTelSalePolicyInfoInputWidget.cpp +++ b/代码/telsale_aux_kit/source/QTelSalePolicyInfoInputWidget.cpp @@ -4,10 +4,10 @@ #include "SystemDataQuery.h" #include "SystemData.h" -QTelSalePolicyInfoInputWidget::QTelSalePolicyInfoInputWidget(QWidget *parent) - : QWidget(parent) +QTelSalePolicyInfoInputWidget::QTelSalePolicyInfoInputWidget( QWidget * parent ) + : QWidget( parent ) { - setupUi(this); + setupUi( this ); init(); initWidget(); @@ -17,19 +17,17 @@ QTelSalePolicyInfoInputWidget::QTelSalePolicyInfoInputWidget(QWidget *parent) QTelSalePolicyInfoInputWidget::~QTelSalePolicyInfoInputWidget() { - } void QTelSalePolicyInfoInputWidget::init() { - } void QTelSalePolicyInfoInputWidget::initWidget() { setLayout( pLayoutMain ); - //¼봰 + //单笔录入窗口 pTabWidget->widget( 0 )->setLayout( pLayoutInputMain ); pScrollAreaInput->setWidget( pWidgetInput ); @@ -38,20 +36,19 @@ void QTelSalePolicyInfoInputWidget::initWidget() pWidgetInput->setMaximumWidth( 820 ); pWidgetInput->setMinimumWidth( 820 ); - //¼ + //批量录入 QRapidInputWidget * pWidgetRapid = new QRapidInputWidget; pScrollAreaRapid->setWidget( pWidgetRapid ); pTabWidget->widget( 1 )->setLayout( pLayoutRapid ); - } void QTelSalePolicyInfoInputWidget::initSignal() { - connect( pEditSalerCode, SIGNAL(editingFinished()), this, SLOT(onQuerySalerName())); + connect( pEditSalerCode, SIGNAL(editingFinished()), this, SLOT(onQuerySalerName()) ); connect( pEditSalerCode, SIGNAL(textChanged(const QString &)), this, SLOT(onSalerCodeChanged()) ); - connect( pEditAutoTraderCode, SIGNAL(editingFinished()), this, SLOT(onQueryAutoTraderName())); + connect( pEditAutoTraderCode, SIGNAL(editingFinished()), this, SLOT(onQueryAutoTraderName()) ); connect( pEditAutoTraderCode, SIGNAL(textChanged(const QString &)), this, SLOT(onAutoTraderCodeChanged()) ); connect( pButtonSave, SIGNAL(clicked()), this, SLOT(onSavePolicy()) ); connect( pButtonResetGift, SIGNAL(clicked()), this, SLOT(onResetGiftsTable()) ); @@ -61,12 +58,12 @@ void QTelSalePolicyInfoInputWidget::initSignal() void QTelSalePolicyInfoInputWidget::initData() { - //Ĭϵij̴ - pEditAutoTraderCode->setText( QString::fromLocal8Bit(parameters.getParameter("Ĭϳ̴").c_str() )); + //默认的车商代码 + pEditAutoTraderCode->setText( QString::fromLocal8Bit( parameters.getParameter( "默认车商代码" ).c_str() ) ); emit pEditAutoTraderCode->editingFinished(); - //ʼƷб + //初始化礼品列表 InitGiftTable(); pEditQjxPolicySerial->clear(); @@ -78,12 +75,11 @@ void QTelSalePolicyInfoInputWidget::initData() pEditOfficeCode->clear(); pEditOfficeName->clear(); pComboBoxAutotraderCall->setCurrentIndex( 0 ); - } void QTelSalePolicyInfoInputWidget::InitGiftTable() { - //ñ־λ + //设置标志位 m_initing = true; m_giftsList.clear(); @@ -92,9 +88,9 @@ void QTelSalePolicyInfoInputWidget::InitGiftTable() { queryTelsalePolicyGifts( m_giftsList ); } - catch ( runtime_error &error ) + catch ( runtime_error & error ) { - QMessageBox::critical( this, "ȡƷб", error.what() ); + QMessageBox::critical( this, QString::fromLocal8Bit( "获取礼品列表出错!" ), error.what() ); return; } @@ -107,11 +103,11 @@ void QTelSalePolicyInfoInputWidget::InitGiftTable() for ( unsigned int rowIndex = 0; iter != m_giftsList.end(); rowIndex++ ) { - QTableWidgetItem *pItem = new QTableWidgetItem(); + QTableWidgetItem * pItem = new QTableWidgetItem(); pItem->setCheckState( Qt::Unchecked ); - pItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled ); - pItem->setText( QString::fromLocal8Bit(iter->GiftName().c_str()) ); + pItem->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsEnabled ); + pItem->setText( QString::fromLocal8Bit( iter->GiftName().c_str() ) ); pItem->setTextAlignment( Qt::AlignLeft | Qt::AlignVCenter ); pTableGifts->setItem( rowIndex, 0, pItem ); @@ -119,7 +115,7 @@ void QTelSalePolicyInfoInputWidget::InitGiftTable() pItem = new QTableWidgetItem(); pItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsEditable ); - pItem->setText( QString::fromLocal8Bit(iter->GiftDefaultPrice().c_str()) ); + pItem->setText( QString::fromLocal8Bit( iter->GiftDefaultPrice().c_str() ) ); pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); pTableGifts->setItem( rowIndex, 1, pItem ); @@ -127,13 +123,13 @@ void QTelSalePolicyInfoInputWidget::InitGiftTable() ++iter; } - // - QTableWidgetItem * pItemOther = new QTableWidgetItem(); + //其他 + QTableWidgetItem * pItemOther = new QTableWidgetItem(); QTableWidgetItem * pItemOtherPrice = new QTableWidgetItem(); - pItemOther->setText( QString::fromLocal8Bit("") ); + pItemOther->setText( QString::fromLocal8Bit( "其他" ) ); pItemOther->setCheckState( Qt::Unchecked ); - pItemOther->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled ); + pItemOther->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsEnabled ); pItemOther->setTextAlignment( Qt::AlignLeft | Qt::AlignVCenter ); pItemOtherPrice->setText( "0" ); @@ -143,16 +139,16 @@ void QTelSalePolicyInfoInputWidget::InitGiftTable() pTableGifts->setItem( m_giftsList.size(), 0, pItemOther ); pTableGifts->setItem( m_giftsList.size(), 1, pItemOtherPrice ); - //Ʒֵܼ - QTableWidgetItem * pItemTotalPrice = new QTableWidgetItem(); + //礼品总价值 + QTableWidgetItem * pItemTotalPrice = new QTableWidgetItem(); QTableWidgetItem * pItemTotalPriceAmount = new QTableWidgetItem(); - pItemTotalPrice->setText( QString::fromLocal8Bit("Ʒֵܼ") ); + pItemTotalPrice->setText( QString::fromLocal8Bit( "礼品总价值" ) ); pItemTotalPrice->setTextColor( Qt::red ); pItemTotalPrice->setFlags( Qt::ItemIsEnabled ); pItemTotalPrice->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); - pItemTotalPriceAmount->setText( QString::fromLocal8Bit("0 Ԫ") ); + pItemTotalPriceAmount->setText( QString::fromLocal8Bit( "0 元" ) ); pItemTotalPriceAmount->setTextColor( Qt::red ); pItemTotalPriceAmount->setFlags( Qt::ItemIsEnabled ); pItemTotalPriceAmount->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); @@ -165,13 +161,13 @@ void QTelSalePolicyInfoInputWidget::InitGiftTable() m_initing = false; } -void QTelSalePolicyInfoInputWidget::readGiftTable(vector & giftList) +void QTelSalePolicyInfoInputWidget::readGiftTable( vector & giftList ) { int rowCount = pTableGifts->rowCount(); for ( int rowIndex = 0; rowIndex < rowCount; rowIndex++ ) { - QTableWidgetItem * pItemName = pTableGifts->item( rowIndex, 0 ); + QTableWidgetItem * pItemName = pTableGifts->item( rowIndex, 0 ); QTableWidgetItem * pItemPrice = pTableGifts->item( rowIndex, 1 ); if ( pItemName->checkState() == Qt::Unchecked ) @@ -179,7 +175,9 @@ void QTelSalePolicyInfoInputWidget::readGiftTable(vector & gi continue; } - TelSalePolicyGift gift( rowIndex, string(pItemName->text().toLocal8Bit().data()), string( pItemPrice->text().toLocal8Bit().data() )); + TelSalePolicyGift gift( rowIndex, + string( pItemName->text().toLocal8Bit().data() ), + string( pItemPrice->text().toLocal8Bit().data() ) ); giftList.push_back( gift ); } @@ -203,13 +201,18 @@ void QTelSalePolicyInfoInputWidget::onQuerySalerName() { m_strSalerCode = pEditSalerCode->text().trimmed().toUpper().toLocal8Bit().data(); - queryStaffInfo( m_strSalerCode, m_strSalerName, m_strSalerDeptCode, m_strSalerDeptName, m_strSalerOfficeCode, m_strSalerOfficeName ); + queryStaffInfo( m_strSalerCode, + m_strSalerName, + m_strSalerDeptCode, + m_strSalerDeptName, + m_strSalerOfficeCode, + m_strSalerOfficeName ); - pEditSalerName->setText( QString::fromLocal8Bit( m_strSalerName.c_str() )); - pEditOfficeCode->setText( QString::fromLocal8Bit( m_strSalerOfficeCode.c_str() )); - pEditOfficeName->setText( QString::fromLocal8Bit( m_strSalerOfficeName.c_str() )); - pEditDeptCode->setText( QString::fromLocal8Bit( m_strSalerDeptCode.c_str() )); - pEditDeptName->setText( QString::fromLocal8Bit( m_strSalerDeptName.c_str() )); + pEditSalerName->setText( QString::fromLocal8Bit( m_strSalerName.c_str() ) ); + pEditOfficeCode->setText( QString::fromLocal8Bit( m_strSalerOfficeCode.c_str() ) ); + pEditOfficeName->setText( QString::fromLocal8Bit( m_strSalerOfficeName.c_str() ) ); + pEditDeptCode->setText( QString::fromLocal8Bit( m_strSalerDeptCode.c_str() ) ); + pEditDeptName->setText( QString::fromLocal8Bit( m_strSalerDeptName.c_str() ) ); } void QTelSalePolicyInfoInputWidget::onSavePolicy() @@ -217,79 +220,95 @@ void QTelSalePolicyInfoInputWidget::onSavePolicy() string strJqxPolicySerial = pEditQjxPolicySerial->text().trimmed().toLocal8Bit().data(); string strBizPolicySerial = pEditBizPolicySerial->text().trimmed().toLocal8Bit().data(); - int iAutotraderCallIndex = pComboBoxAutotraderCall->currentIndex(); + int iAutotraderCallIndex = pComboBoxAutotraderCall->currentIndex(); - vector giftsList; //ûѡƷ嵥 + vector giftsList; //用户选择的礼品清单 - //ź + //触发信号 emit pEditSalerCode->editingFinished(); emit pEditAutoTraderCode->editingFinished(); if ( strJqxPolicySerial.empty() && strBizPolicySerial.empty() ) { - QMessageBox::critical( this, QString::fromLocal8Bit("뱣"), QString::fromLocal8Bit("ǿաҵձŽΪգ\nһţ"), QMessageBox::Yes ); + QMessageBox::critical( this, + QString::fromLocal8Bit( "必须输入保单号" ), + QString::fromLocal8Bit( "交强险、商业险保单号皆为空,\n必须输入一个保单号!" ), + QMessageBox::Yes ); return; } if ( m_strSalerName.empty() == true ) { - QMessageBox::critical( this, QString::fromLocal8Bit("뾭˴"), QString::fromLocal8Bit("˴벻ȷ"), QMessageBox::Yes ); + QMessageBox::critical( this, + QString::fromLocal8Bit( "必须输入经办人代码" ), + QString::fromLocal8Bit( "经办人代码不正确!" ), + QMessageBox::Yes ); return; } - if ( iAutotraderCallIndex == 0 ) - { - QMessageBox::critical( this, QString::fromLocal8Bit(""), QString::fromLocal8Bit("δѡǷ񳵵"), QMessageBox::Yes ); + if ( iAutotraderCallIndex == 0 ) + { + QMessageBox::critical( this, + QString::fromLocal8Bit( "输入错误" ), + QString::fromLocal8Bit( "未选择是否车店联呼!" ), + QMessageBox::Yes ); - return; - } + return; + } if ( pEditAutoTraderName->text().isEmpty() ) { - QMessageBox::critical( this, QString::fromLocal8Bit(""), QString::fromLocal8Bit("̴"), QMessageBox::Yes ); + QMessageBox::critical( this, + QString::fromLocal8Bit( "输入错误" ), + QString::fromLocal8Bit( "车商代码错误!" ), + QMessageBox::Yes ); return; } - if ( pGroupBoxGift->isChecked() == true ) - { - readGiftTable( giftsList ); + if ( pGroupBoxGift->isChecked() == true ) + { + readGiftTable( giftsList ); - if ( giftsList.size() == 0 ) - { - QMessageBox::critical( this, QString::fromLocal8Bit(""), QString::fromLocal8Bit("δѡƷ"), QMessageBox::Yes ); + if ( giftsList.size() == 0 ) + { + QMessageBox::critical( this, + QString::fromLocal8Bit( "输入错误" ), + QString::fromLocal8Bit( "未选择礼品!" ), + QMessageBox::Yes ); - return; - } - } + return; + } + } - SPolicyRecord policy;//Ϣ + SPolicyRecord policy; //保单信息 - policy.strSalerCode = m_strSalerCode; - policy.strSalerName = m_strSalerName; - policy.strSalerDeptCode = m_strSalerDeptCode; - policy.strSalerDeptName = m_strSalerDeptName; + policy.strSalerCode = m_strSalerCode; + policy.strSalerName = m_strSalerName; + policy.strSalerDeptCode = m_strSalerDeptCode; + policy.strSalerDeptName = m_strSalerDeptName; policy.strSalerOfficeCode = m_strSalerOfficeCode; policy.strSalerOfficeName = m_strSalerOfficeName; - policy.strOperatorCode = getUserCode(); - policy.strCustomerName = pEditCustomerName->text().trimmed().toLocal8Bit().data(); - policy.strPlateSerial = pEditPlateSerial->text().trimmed().toLocal8Bit().data(); - policy.strFrameSerial = pEditFrameSerial->text().trimmed().toLocal8Bit().data(); - policy.strEngineSerial = pEditEngineSerial->text().trimmed().toLocal8Bit().data(); - policy.strOperatorDate = QDate::currentDate().toString( QString::fromLocal8Bit("MM/dd/yyyy")).toLocal8Bit().data(); + policy.strOperatorCode = getUserCode(); + policy.strCustomerName = pEditCustomerName->text().trimmed().toLocal8Bit().data(); + policy.strPlateSerial = pEditPlateSerial->text().trimmed().toLocal8Bit().data(); + policy.strFrameSerial = pEditFrameSerial->text().trimmed().toLocal8Bit().data(); + policy.strEngineSerial = pEditEngineSerial->text().trimmed().toLocal8Bit().data(); + policy.strOperatorDate = QDate::currentDate() + .toString( QString::fromLocal8Bit( "MM/dd/yyyy" ) ).toLocal8Bit().data(); - if ( iAutotraderCallIndex == 2 ) - { - policy.bIsAutotraderCall = true; - } - else - { - policy.bIsAutotraderCall = false; - } + if ( iAutotraderCallIndex == 2 ) + { + policy.bIsAutotraderCall = true; + } + else + { + policy.bIsAutotraderCall = false; + } - //̴ + //车商代码 if ( m_strAutoTraderName.empty() == false ) { policy.strAutoTraderCode = m_strAutoTraderCode; @@ -298,36 +317,48 @@ void QTelSalePolicyInfoInputWidget::onSavePolicy() if ( strJqxPolicySerial.empty() == false ) { - //ǿձ + //处理交强险保单 policy.strPolicySerial = strJqxPolicySerial; try { SaveTelSalePolicyInfo( policy, giftsList ); - QMessageBox::information( this, QString::fromLocal8Bit("ɹ!"), QString::fromLocal8Bit("ǿձɹ!"), QMessageBox::Yes ); + QMessageBox::information( this, + QString::fromLocal8Bit( "保存成功!" ), + QString::fromLocal8Bit( "交强险保单保存成功!" ), + QMessageBox::Yes ); } catch ( runtime_error & error ) { - QMessageBox::critical( this, QString::fromLocal8Bit("潻ǿձʧܣ"), QString::fromLocal8Bit(error.what()), QMessageBox::Yes ); + QMessageBox::critical( this, + QString::fromLocal8Bit( "保存交强险保单失败!" ), + QString::fromLocal8Bit( error.what() ), + QMessageBox::Yes ); } } if ( strBizPolicySerial.empty() == false ) { - //ǿձ + //处理交强险保单 policy.strPolicySerial = strBizPolicySerial; try { SaveTelSalePolicyInfo( policy, giftsList ); - QMessageBox::information( this, QString::fromLocal8Bit("ɹ!"), QString::fromLocal8Bit("ҵձɹ!"), QMessageBox::Yes ); + QMessageBox::information( this, + QString::fromLocal8Bit( "保存成功!" ), + QString::fromLocal8Bit( "商业险保单保存成功!" ), + QMessageBox::Yes ); } catch ( runtime_error & error ) { - QMessageBox::critical( this, QString::fromLocal8Bit("ҵձʧܣ"), QString::fromLocal8Bit(error.what()), QMessageBox::Yes ); - } + QMessageBox::critical( this, + QString::fromLocal8Bit( "保存商业险保单失败!" ), + QString::fromLocal8Bit( error.what() ), + QMessageBox::Yes ); + } } } @@ -336,29 +367,31 @@ void QTelSalePolicyInfoInputWidget::onResetGiftsTable() InitGiftTable(); } -void QTelSalePolicyInfoInputWidget::onGiftTableItemChanged(int row, int column) +void QTelSalePolicyInfoInputWidget::onGiftTableItemChanged( int row, int column ) { if ( m_initing == true ) { return; } - int rowCount = pTableGifts->rowCount() - 1; - QTableWidgetItem * pItem = NULL; + int rowCount = pTableGifts->rowCount() - 1; + QTableWidgetItem * pItem = NULL; QTableWidgetItem * pItemPrice = NULL; - bool isSuccess = false; - double giftPrice = 0.0l; + bool isSuccess = false; + double giftPrice = 0.0l; if ( column == 1 && row != rowCount ) { - pItem = pTableGifts->item( row, 0 ); + pItem = pTableGifts->item( row, 0 ); pItemPrice = pTableGifts->item( row, column ); pItemPrice->text().toDouble( &isSuccess ); if ( isSuccess == false ) { - QMessageBox::critical( this, QString::fromLocal8Bit(""), pItem->text() + QString::fromLocal8Bit("۸") ); + QMessageBox::critical( this, + QString::fromLocal8Bit( "输入错误!" ), + pItem->text() + QString::fromLocal8Bit( "价格有误!" ) ); pItemPrice->setText( "0" ); } @@ -366,7 +399,7 @@ void QTelSalePolicyInfoInputWidget::onGiftTableItemChanged(int row, int column) for ( int rowIndex = 0; rowIndex < rowCount; rowIndex++ ) { - pItem = pTableGifts->item( rowIndex, 0 ); + pItem = pTableGifts->item( rowIndex, 0 ); pItemPrice = pTableGifts->item( rowIndex, 1 ); if ( pItem->checkState() == Qt::Unchecked ) @@ -378,13 +411,15 @@ void QTelSalePolicyInfoInputWidget::onGiftTableItemChanged(int row, int column) if ( isSuccess == false ) { - QMessageBox::critical( this, QString::fromLocal8Bit(""), pItem->text() + QString::fromLocal8Bit("۸") ); + QMessageBox::critical( this, + QString::fromLocal8Bit( "输入错误!" ), + pItem->text() + QString::fromLocal8Bit( "价格有误!" ) ); pItemPrice->setText( "0" ); } } - pTableGifts->item( pTableGifts->rowCount() - 1, 1 )->setText( QString::fromLocal8Bit("%1 Ԫ").arg(giftPrice) ); + pTableGifts->item( pTableGifts->rowCount() - 1, 1 )->setText( QString::fromLocal8Bit( "%1 元" ).arg( giftPrice ) ); pTableGifts->resizeColumnsToContents(); } @@ -401,7 +436,7 @@ void QTelSalePolicyInfoInputWidget::onQueryAutoTraderName() queryAutoTraderInfo( m_strAutoTraderCode, m_strAutoTraderName ); - pEditAutoTraderName->setText( QString::fromLocal8Bit( m_strAutoTraderName.c_str() )); + pEditAutoTraderName->setText( QString::fromLocal8Bit( m_strAutoTraderName.c_str() ) ); } void QTelSalePolicyInfoInputWidget::onReset() diff --git a/代码/telsale_aux_kit/source/QTelSalePolicyInfoQuery.cpp b/代码/telsale_aux_kit/source/QTelSalePolicyInfoQuery.cpp index 836466d..07d9dfa 100644 --- a/代码/telsale_aux_kit/source/QTelSalePolicyInfoQuery.cpp +++ b/代码/telsale_aux_kit/source/QTelSalePolicyInfoQuery.cpp @@ -5,7 +5,6 @@ #include "SystemData.h" #include "QTelSalePolicyInfoQuery.h" - using namespace std; QTelSalePolicyInfoQuery::QTelSalePolicyInfoQuery(QWidget *parent) @@ -32,7 +31,7 @@ void QTelSalePolicyInfoQuery::initWidget() { setLayout( pLayoutMain ); - //¼ʱ + //录入时间 pDateEditStart->setDate( QDate::currentDate().addDays(-1) ); pDateEditEnd->setDate( QDate::currentDate() ); } @@ -75,7 +74,7 @@ void QTelSalePolicyInfoQuery::onQuery() } else { - //ԶʹòԱĹΪ + //自动使用操作员的工号为条件 strOperatorCode = getUserCode(); } @@ -97,13 +96,13 @@ void QTelSalePolicyInfoQuery::onQuery() } catch ( runtime_error & error ) { - QMessageBox::critical( this, QString::fromLocal8Bit("ѯ"), QString::fromLocal8Bit(error.what()) ); + QMessageBox::critical( this, QString::fromLocal8Bit("查询错误!"), QString::fromLocal8Bit(error.what()) ); } } void QTelSalePolicyInfoQuery::onReset() { - //¼ʱ + //录入时间 pDateEditStart->setDate( QDate::currentDate().addDays(-1) ); pDateEditEnd->setDate( QDate::currentDate() ); @@ -122,69 +121,69 @@ void QTelSalePolicyInfoQuery::showData(std::vector & vPolicy) for ( vector::iterator iter = vPolicy.begin(); iter != vPolicy.end(); ++iter ) { - // + //保单号 pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strPolicySerial.c_str() )); pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); pTableWidgetInfo->setItem( nRowIndex, 0, pItem ); - // + //经办人 pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strSalerCode.c_str() )); pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); pTableWidgetInfo->setItem( nRowIndex, 1, pItem ); - // + //部门 pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strDeptName.c_str() )); pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); pTableWidgetInfo->setItem( nRowIndex, 2, pItem ); - // + //科室 pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strOfficeName.c_str() )); pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); pTableWidgetInfo->setItem( nRowIndex, 3, pItem ); - // + //车店联呼 if ( iter->strCDLH == "1" ) { - pItem = new QTableWidgetItem( QString::fromLocal8Bit( "" )); + pItem = new QTableWidgetItem( QString::fromLocal8Bit( "是" )); } else { - pItem = new QTableWidgetItem( QString::fromLocal8Bit( "" )); + pItem = new QTableWidgetItem( QString::fromLocal8Bit( "否" )); } pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); pTableWidgetInfo->setItem( nRowIndex, 4, pItem ); - //̴ + //车商代码 pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strAutoTraderCode.c_str() )); pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); pTableWidgetInfo->setItem( nRowIndex, 5, pItem ); - // + //车商名称 pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strAutoTraderName.c_str() )); pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); pTableWidgetInfo->setItem( nRowIndex, 6, pItem ); - //Ʒֵܼ + //礼品总价值 pItem = new QTableWidgetItem( QString::number(iter->dGiftPriceSum, 'f', 2) ); pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); pTableWidgetInfo->setItem( nRowIndex, 7, pItem ); - //Ʒ + //礼品 pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strGifts.c_str() )); pItem->setTextAlignment( Qt::AlignLeft | Qt::AlignVCenter ); pTableWidgetInfo->setItem( nRowIndex, 8, pItem ); - //¼ + //录入日期 pItem = new QTableWidgetItem( QString::fromLocal8Bit( iter->strInputDate.c_str() )); pItem->setTextAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); diff --git a/代码/telsale_aux_kit/source/QTelSalePolicyInfoQuery.h b/代码/telsale_aux_kit/source/QTelSalePolicyInfoQuery.h index 200cd73..92058eb 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 1ee3b14..d3975d6 100644 --- a/代码/telsale_aux_kit/source/StringCodeConverter.cpp +++ b/代码/telsale_aux_kit/source/StringCodeConverter.cpp @@ -5,7 +5,7 @@ //#include #include #include - + using namespace std; size_t StringCodeConverter::mbslen( const char *pcszSource ) @@ -30,7 +30,7 @@ size_t StringCodeConverter::mbslen( const char *pcszSource ) wstring StringCodeConverter::mbs2unicode( const string &cstrSource ) { string strCurLocale = setlocale( LC_ALL, NULL ); - setlocale( LC_ALL, "chinese-simplified" ); //ijĻ,ܵIJַע + setlocale( LC_ALL, "chinese-simplified" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果 const char *pcszSource = cstrSource.c_str(); @@ -43,7 +43,7 @@ wstring StringCodeConverter::mbs2unicode( const string &cstrSource ) if ( iConvertedCount == -1 ) { delete [] pwszBuffer; - throw string( "mbs2unicodeзӢַ" ); + throw string( "mbs2unicode参数有非中英文字符" ); } wstring wstrDest( pwszBuffer ); @@ -57,17 +57,17 @@ wstring StringCodeConverter::mbs2unicode( const string &cstrSource ) void StringCodeConverter::mbs2unicode(const string &strSource, wstring &wstrDest) { const char *pcszSource = strSource.c_str(); - string strCurLocale( setlocale(LC_ALL, NULL) );//ȱ浱ǰlocale + string strCurLocale( setlocale(LC_ALL, NULL) );//先保存当前的locale设置 - setlocale( LC_ALL, "chs" );//Ϊ + setlocale( LC_ALL, "chs" );//设置为中文 - size_t iCharCount = strSource.size() + 1;//unicodeַҪַ + size_t iCharCount = strSource.size() + 1;//unicode字符串所需要的字符数 wchar_t *pwszBuffer = new wchar_t[ iCharCount ]; wmemset( pwszBuffer, 0, iCharCount ); mbstowcs( pwszBuffer, pcszSource, iCharCount ); - setlocale( LC_ALL, strCurLocale.c_str() );//Ļԭlocale + setlocale( LC_ALL, strCurLocale.c_str() );//改回原来的locale设置 wstrDest = pwszBuffer; delete [] pwszBuffer; @@ -77,17 +77,17 @@ void StringCodeConverter::mbs2unicode( const char *pcszSource, wchar_t *pwszDest { if ( pcszSource == NULL || pwszDest == NULL ) { - throw string( "ָΪNULL" ); + throw string( "参数指针为NULL" ); } string strCurLocale = setlocale( LC_ALL, NULL ); - setlocale( LC_ALL, "chinese-simplified" ); //ijĻ,ܵIJַע + setlocale( LC_ALL, "chinese-simplified" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果 size_t iCharCount = mbslen( pcszSource ) + 1; if ( iCharCount == -1 ) { - throw string( "ԴַıзӢַ" ); + throw string( "源字符串的编码有非中英文字符" ); } wmemset( pwszDest, 0, iCharCount ); @@ -95,7 +95,7 @@ void StringCodeConverter::mbs2unicode( const char *pcszSource, wchar_t *pwszDest if ( iConvertedCount == -1 ) { - throw string( "ԴַıзӢַ" ); + throw string( "源字符串的编码有非中英文字符" ); } *( pwszDest + iConvertedCount ) = NULL; @@ -108,13 +108,13 @@ void StringCodeConverter::mbs2utf8( const string &cstrSource, char *pszDest ) const char *pcszSource = cstrSource.c_str(); string strCurLocale( setlocale( LC_ALL, NULL ) ); - setlocale( LC_ALL, "chinese-simplified" ); //ijĻ,ܵIJַע + setlocale( LC_ALL, "chinese-simplified" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果 while ( *pcszSource != NULL ) { if ( *pcszSource > 0 ) { - //Ӣַ,ֱӸ + //英文字符,可以直接复制 *pszDest = *pcszSource; pcszSource++; @@ -122,12 +122,12 @@ void StringCodeConverter::mbs2utf8( const string &cstrSource, char *pszDest ) } else { - //asciiӢַ,תunicodeתutf8 + //非ascii英文字符,先转换成unicode,再转换utf8 int iLen = 0; wchar_t wUnicode = 0; char *pcUnicode = (char *)&wUnicode; - //תunicodembַij + //转换成unicode,返回mb字符的长度 iLen = mbtowc( &wUnicode, pcszSource, MB_CUR_MAX ); pszDest[0] = (0xE0 | ((pcUnicode[1] & 0xF0) >> 4)); @@ -147,7 +147,7 @@ void StringCodeConverter::mbs2utf8( const string &cstrSource, char *pszDest ) string StringCodeConverter::unicode2mbs( const wstring &wstrSource ) { string strCurLocale = setlocale( LC_ALL, NULL ); - setlocale( LC_ALL, "chinese-simplified" ); //ijĻ,ܵIJַע + setlocale( LC_ALL, "chinese-simplified" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果 const wchar_t *pcwszSource = wstrSource.c_str(); @@ -159,7 +159,7 @@ string StringCodeConverter::unicode2mbs( const wstring &wstrSource ) if ( iConvertedCount == -1 ) { - throw string( "unicode2mbsԴַıзӢַ" ); + throw string( "unicode2mbs源字符串的编码有非中英文字符" ); } setlocale( LC_ALL, strCurLocale.c_str() ); @@ -185,7 +185,7 @@ void StringCodeConverter::unicode2mbs( const wstring &wstrSource, string &strDes if ( iConvertedCount == -1 ) { delete [] pszBuffer; - throw string( "unicode2mbsתʧܣַзӢַ" ); + throw string( "unicode2mbs转换失败,字符串中有非中英文字符!" ); } strDest = pszBuffer; @@ -198,11 +198,11 @@ void StringCodeConverter::unicode2mbs( const wchar_t *pcwszSource, char *pszDest { if ( pcwszSource == NULL || pszDest == NULL ) { - throw string( "unicode2mbsֵΪNULL" ); + throw string( "unicode2mbs函数,参数值为NULL" ); } string strCurLocale = setlocale( LC_ALL, NULL ); - setlocale( LC_ALL, "chinese-simplified" ); //ijĻ,ܵIJַע + setlocale( LC_ALL, "chinese-simplified" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果 size_t iCount = wcslen( pcwszSource )*2 + 1; memset( pszDest, 0, iCount ); @@ -211,7 +211,7 @@ void StringCodeConverter::unicode2mbs( const wchar_t *pcwszSource, char *pszDest if ( iConvertedCount == -1 ) { - throw string( "unicode2mbsתʧܣַзӢַ" ); + throw string( "unicode2mbs转换失败,字符串中有非中英文字符!" ); } setlocale( LC_ALL, strCurLocale.c_str() ); @@ -221,7 +221,7 @@ void StringCodeConverter::unicode2utf8( const wstring &cwstrSource, char *pszDes { if ( pszDest == NULL ) { - throw string( "ΪNULL" ); + throw string( "参数为NULL" ); } const wchar_t *pcwszSource = cwstrSource.c_str(); @@ -232,14 +232,14 @@ void StringCodeConverter::unicode2utf8( const wstring &cwstrSource, char *pszDes if ( iUnicode < 128 ) { - //С128ӢַҪת + //小于128是英文字符,不需要转换 *pszDest = (char)iUnicode; pszDest++; pcwszSource++; } else { - //128mbsַҪת + //大于128是mbs字符,需要转换 const char *pcszUnicode = (const char *)pcwszSource; pszDest[0] = (0xE0 | ((pcszUnicode[1] & 0xF0) >> 4 )); @@ -251,18 +251,18 @@ void StringCodeConverter::unicode2utf8( const wstring &cwstrSource, char *pszDes } } - *pszDest = NULL;//ĩβNULLַ + *pszDest = NULL;//末尾的NULL字符 } string StringCodeConverter::utf8tombs( const char *pcszSource ) { if ( pcszSource == NULL ) { - throw string( "ΪNULL" ); + throw string( "参数为NULL" ); } string strCurLocale( setlocale( LC_ALL, NULL ) ); - setlocale( LC_ALL, "chinese-simplified" ); //ijĻ,ܵIJַע + setlocale( LC_ALL, "chinese-simplified" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果 char *pszDest = new char[ strlen( pcszSource ) ]; char *pszBuffer = pszDest; @@ -271,7 +271,7 @@ string StringCodeConverter::utf8tombs( const char *pcszSource ) { if ( *pcszSource > 0 ) { - //ASCIIַ + //是ASCII字符 *pszDest = *pcszSource; pszDest++; @@ -309,7 +309,7 @@ string StringCodeConverter::utf8tombs( const char *pcszSource ) *pszDest = NULL; setlocale( LC_ALL, strCurLocale.c_str() ); - strCurLocale = pszBuffer; // + strCurLocale = pszBuffer; //废物利用 return strCurLocale; } @@ -318,11 +318,11 @@ wstring StringCodeConverter::utf8tounicode( const char *pcszSource ) { if ( pcszSource == NULL ) { - throw string( "ΪNULL" ); + throw string( "参数为NULL" ); } string strCurLocale = setlocale( LC_ALL, NULL ); - setlocale( LC_ALL, "chinese-simplified" ); //ijĻ,ܵIJַע + setlocale( LC_ALL, "chinese-simplified" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果 wchar_t *pwszBuffer = new wchar_t[ strlen( pcszSource ) ]; wchar_t *pwszDest = pwszBuffer; @@ -331,7 +331,7 @@ wstring StringCodeConverter::utf8tounicode( const char *pcszSource ) { if ( *pcszSource > 0 ) { - //ASCIIַ + //是ASCII字符 wchar_t wUnicode; mbtowc( &wUnicode, pcszSource, 1 ); @@ -343,7 +343,7 @@ wstring StringCodeConverter::utf8tounicode( const char *pcszSource ) } else { - //ַ3ֽ + //中文字符,3个字节 wchar_t wUnicode; char *pcUnicode = (char *)&wUnicode; @@ -359,7 +359,7 @@ wstring StringCodeConverter::utf8tounicode( const char *pcszSource ) setlocale( LC_ALL, strCurLocale.c_str() ); - *pwszDest = NULL;//ĩβַ + *pwszDest = NULL;//末尾空字符 wstring wstrDest( pwszBuffer ); return wstrDest; diff --git a/代码/telsale_aux_kit/source/StringCodeConverter.h b/代码/telsale_aux_kit/source/StringCodeConverter.h index 64a3e4e..9e438b4 100644 --- a/代码/telsale_aux_kit/source/StringCodeConverter.h +++ b/代码/telsale_aux_kit/source/StringCodeConverter.h @@ -4,7 +4,7 @@ namespace StringCodeConverter { - using std::string; + using std::string; using std::wstring; size_t mbslen( const char *pcszSource ); diff --git a/代码/telsale_aux_kit/source/SystemData.cpp b/代码/telsale_aux_kit/source/SystemData.cpp index 5883a3c..5ac49ec 100644 --- a/代码/telsale_aux_kit/source/SystemData.cpp +++ b/代码/telsale_aux_kit/source/SystemData.cpp @@ -1,22 +1,22 @@ #include "SystemData.h" -//hash_map parameters; //Ųhashmap +//hash_map parameters; //存放参数的hashmap -//汾 +//版本号 const string cstrVersion = "0.99"; string strUserCode; string strUserName; string strUserPassword; -// +//参数 Parameters parameters( "config.db" ); //bool checkVersion() //{ // bool result = false; -// hash_map::iterator iter = parameters.find( string("汾") ); +// hash_map::iterator iter = parameters.find( string("版本号") ); // // if ( iter != parameters.end() && iter->second == cstrVersion ) // { @@ -48,5 +48,5 @@ void setUserName(const string & cstrUserName) string getVersion() { - return parameters.getParameter("汾"); + return parameters.getParameter("版本号"); } \ No newline at end of file diff --git a/代码/telsale_aux_kit/source/SystemDataQuery.cpp b/代码/telsale_aux_kit/source/SystemDataQuery.cpp index 155d842..bbb96f7 100644 --- a/代码/telsale_aux_kit/source/SystemDataQuery.cpp +++ b/代码/telsale_aux_kit/source/SystemDataQuery.cpp @@ -91,13 +91,13 @@ void QueryUserInfo(const string & strCode, string & strName, string & strPasswor if ( command.FetchNext() == true ) { - // + //名字 SAString sastrResult = command.Field("rymc").asString(); sastrResult.TrimRight(); strName = (const char *)sastrResult; - // + //密码 sastrResult = command.Field("rymm").asString(); sastrResult.TrimRight(); diff --git a/代码/telsale_aux_kit/source/SystemDataQuery.h b/代码/telsale_aux_kit/source/SystemDataQuery.h index 2ce55e4..d2d5538 100644 --- a/代码/telsale_aux_kit/source/SystemDataQuery.h +++ b/代码/telsale_aux_kit/source/SystemDataQuery.h @@ -11,10 +11,10 @@ using std::string; // FullName: QueryOperatorInfo // Access: public // Returns: void -// Qualifier: ѯϵͳûϢ -// Parameter: const string & strCode -// Parameter: string & strName -// Parameter: string & strPassword +// Qualifier: 查询系统用户的信息 +// Parameter: const string & strCode 工号 +// Parameter: string & strName 名字 +// Parameter: string & strPassword 密码 //************************************ void QueryUserInfo( const string & strCode, string & strName, @@ -26,13 +26,13 @@ void QueryUserInfo( const string & strCode, // FullName: queryOperatorInfo // Access: public // Returns: void -// Qualifier: ѯ˵Ϣ -// Parameter: const string & strOperatorCode ˴ -// Parameter: string & strOperatorName -// Parameter: string & strDeptCode Ŵ -// Parameter: string & strDeptName -// Parameter: string & strOfficeCode Ҵ -// Parameter: string & strOfficeName +// Qualifier: 查询经办人的信息 +// Parameter: const string & strOperatorCode 经办人代码 +// Parameter: string & strOperatorName 经办人名称 +// Parameter: string & strDeptCode 部门代码 +// Parameter: string & strDeptName 部门名称 +// Parameter: string & strOfficeCode 科室代码 +// Parameter: string & strOfficeName 科室名称 //************************************ void queryStaffInfo( const string & strOperatorCode, string & strOperatorName, @@ -46,7 +46,7 @@ void queryStaffInfo( const string & strOperatorCode, // FullName: queryAutoTraderInfo // Access: public // Returns: void -// Qualifier: ѯϢ +// Qualifier: 查询车商信息 // Parameter: const string & strAutoTraderCode // Parameter: string & strAutoTraderName //************************************ diff --git a/代码/telsale_aux_kit/source/check.cpp b/代码/telsale_aux_kit/source/check.cpp index 83e3b20..404008e 100644 --- a/代码/telsale_aux_kit/source/check.cpp +++ b/代码/telsale_aux_kit/source/check.cpp @@ -1,9 +1,9 @@ #include "check.h" -hash_map parameters; //Ųhashmap +hash_map parameters; //存放参数的hashmap -//汾 +//版本号 const string cstrVersion = "0.99"; string strUserCode; @@ -13,7 +13,7 @@ string strUserPassword; bool checkVersion() { bool result = false; - hash_map::iterator iter = parameters.find( string("汾") ); + hash_map::iterator iter = parameters.find( string("版本号") ); if ( iter != parameters.end() && iter->second == cstrVersion ) { diff --git a/代码/telsale_aux_kit/source/main.cpp b/代码/telsale_aux_kit/source/main.cpp index 0656fa6..220b871 100644 --- a/代码/telsale_aux_kit/source/main.cpp +++ b/代码/telsale_aux_kit/source/main.cpp @@ -1,54 +1,52 @@ - - -#include +//#include #include -#include +#include #include #include #include "QMainFrame.h" #include "QLoginWidget.h" -int main(int argc, char *argv[]) +int main( int argc, char * argv[] ) { - //ڱת - QTextCodec * pCodecLocal = QTextCodec::codecForLocale(); + //用于编码转换 + //QTextCodec * pCodecLocal = QTextCodec::codecForLocale(); - QApplication a(argc, argv); + QApplication a( argc, argv ); QLoginWidget login; int iReturnCode = 0; /*try { - initConnectionPool(); - queryParameters(); + initConnectionPool(); + queryParameters(); - if ( checkVersion() == false ) - { - QMessageBox::warning( NULL, - pCodecLocal->toUnicode( "汾" ), - pCodecLocal->toUnicode( "汾!\nϵϢ³" )); + if ( checkVersion() == false ) + { + QMessageBox::warning( NULL, + pCodecLocal->toUnicode( "版本错误" ), + pCodecLocal->toUnicode( "程序版本过低!\n请联系信息技术部更新程序!" ) ); - return 0; - } + return 0; + } } catch ( std::runtime_error & error ) { - releaseConnectionPool(); - QMessageBox::critical( NULL, - "", - pCodecLocal->toUnicode(error.what()) ); + releaseConnectionPool(); + QMessageBox::critical( NULL, + "错误", + pCodecLocal->toUnicode( error.what() ) ); - return iReturnCode; + return iReturnCode; } - catch ( std::exception &error ) + catch ( std::exception & error ) { - releaseConnectionPool(); - QMessageBox::critical( NULL, - "δ֪", - pCodecLocal->toUnicode( error.what() )); + releaseConnectionPool(); + QMessageBox::critical( NULL, + "未知错误", + pCodecLocal->toUnicode( error.what() ) ); - return iReturnCode; + return iReturnCode; }*/ login.exec();