代码文件编码修改成utf-8。
This commit is contained in:
parent
d59b437f86
commit
1e383920be
@ -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<TelSalePol
|
||||
{
|
||||
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";
|
||||
@ -186,12 +186,12 @@ void SaveTelSalePolicyInfo(const SPolicyRecord & policy, const vector<TelSalePol
|
||||
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();
|
||||
@ -231,7 +231,7 @@ void QueryTelSalePolicyInfo( const string & strPolicyNo,
|
||||
SPolicyQuery policy;
|
||||
|
||||
string strSQL =
|
||||
"select trim(bdh) bdh, trim(zhjywy) zhjywy, to_char(czrq, '%Y年%m月%d日') czrq, trim(czydm) czydm, chdlh, zhjywybmm, kshmc, chshdm, chshmc "
|
||||
"select trim(bdh) bdh, trim(zhjywy) zhjywy, to_char(czrq, '%Y年%m月%d日') czrq, trim(czydm) czydm, chdlh, zhjywybmm, kshmc, chshdm, chshmc "
|
||||
" from w_dxbd_i "
|
||||
" where 1=1 ";
|
||||
|
||||
@ -340,7 +340,7 @@ void QueryPolicyGifts(const string & strPolicyNo, string & strGifts, double dGif
|
||||
strGifts.append( command.Field("gift_name").asString() );
|
||||
strGifts.append( " " );
|
||||
strGifts.append( command.Field("gift_price").asString() );
|
||||
strGifts.append( "元" );
|
||||
strGifts.append( "元" );
|
||||
|
||||
dGiftPriceSum += command.Field("gift_price").asDouble();
|
||||
}
|
||||
@ -396,7 +396,7 @@ void readTelsaleXlsFile(const string strFilePath, vector<SPolicyRecord> & listPo
|
||||
|
||||
if ( pSheet == NULL )
|
||||
{
|
||||
throw string( "读取sheet失败!" );
|
||||
throw string( "读取sheet失败!" );
|
||||
}
|
||||
|
||||
iRowCount = pSheet->lastRow();
|
||||
@ -406,7 +406,7 @@ void readTelsaleXlsFile(const string strFilePath, vector<SPolicyRecord> & listPo
|
||||
iRowIndex = 1;
|
||||
}
|
||||
|
||||
//读取数据
|
||||
//读取数据
|
||||
while ( iRowIndex < iRowCount )
|
||||
{
|
||||
SPolicyRecord policy;
|
||||
@ -421,7 +421,7 @@ void readTelsaleXlsFile(const string strFilePath, vector<SPolicyRecord> & 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<SPolicyRecord> & 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<SPolicyRecord> & listPoli
|
||||
iRowIndex = 1;
|
||||
}
|
||||
|
||||
//读取数据
|
||||
//读取数据
|
||||
while ( iRowIndex < iRowCount )
|
||||
{
|
||||
SPolicyRecord policy;
|
||||
@ -570,7 +570,7 @@ void readTelsaleXlsxFile(wchar_t * wszFilePath, vector<SPolicyRecord> & listPoli
|
||||
policy.strSalerCode = readXlsxCell( pSheet, iRowIndex, 4 );
|
||||
policy.strAutoTraderName = readXlsxCell( pSheet, iRowIndex, 6 );
|
||||
|
||||
//补齐工号
|
||||
//补齐工号
|
||||
if ( policy.strSalerCode.length() == 1 )
|
||||
{
|
||||
policy.strSalerCode = string("00") + policy.strSalerCode;
|
||||
|
@ -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<TelSalePolicyGift> & giftList 礼品列表
|
||||
// Qualifier: 查询礼品信息
|
||||
// Parameter: vector<TelSalePolicyGift> & giftList 礼品列表
|
||||
//************************************
|
||||
void queryTelsalePolicyGifts( vector<TelSalePolicyGift> &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
|
||||
//************************************
|
||||
|
@ -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;
|
||||
|
@ -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()
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <string>
|
||||
#include "ui_QConfigurationWidget.h"
|
||||
|
||||
using std::string;
|
||||
using std::string;
|
||||
|
||||
class QConfigurationWidget : public QWidget, public Ui::QConfigurationWidget
|
||||
{
|
||||
|
@ -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("当前日期:yyyy年MM月dd日 ") );
|
||||
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("参数配置窗口") );
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ void QRapidInputWidget::dropEvent(QDropEvent * pEvent)
|
||||
QList<QUrl> 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() )
|
||||
|
@ -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()
|
||||
{
|
||||
//默认的车商代码
|
||||
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<TelSalePolicyGift> & giftList)
|
||||
void QTelSalePolicyInfoInputWidget::readGiftTable( vector<TelSalePolicyGift> & 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<TelSalePolicyGift> & 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<TelSalePolicyGift> giftsList; //用户选择的礼品清单
|
||||
vector<TelSalePolicyGift> 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()
|
||||
|
@ -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<SPolicyQuery> & vPolicy)
|
||||
|
||||
for ( vector<SPolicyQuery>::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 );
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define QTELSALEPOLICYINFOQUERY_H
|
||||
|
||||
#include <vector>
|
||||
#include <QWidget>
|
||||
#include <QWidget>
|
||||
#include "DataManipulation.h"
|
||||
#include "ui_QTelSalePolicyInfoQuery.h"
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
//#include <stdio.h>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
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" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果
|
||||
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" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果
|
||||
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" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果
|
||||
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;
|
||||
|
||||
//转换成unicode,返回mb字符的长度
|
||||
//转换成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" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果
|
||||
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" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果
|
||||
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
|
||||
{
|
||||
//大于128是mbs字符,需要转换
|
||||
//大于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" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果
|
||||
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" ); //改成中文环境,如果接受的参数不是中文字符串,得注意结果
|
||||
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;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
namespace StringCodeConverter
|
||||
{
|
||||
using std::string;
|
||||
using std::string;
|
||||
using std::wstring;
|
||||
|
||||
size_t mbslen( const char *pcszSource );
|
||||
|
@ -1,22 +1,22 @@
|
||||
|
||||
#include "SystemData.h"
|
||||
|
||||
//hash_map<string, string> parameters; //存放参数的hashmap
|
||||
//hash_map<string, string> parameters; //存放参数的hashmap
|
||||
|
||||
//版本号
|
||||
//版本号
|
||||
const string cstrVersion = "0.99";
|
||||
|
||||
string strUserCode;
|
||||
string strUserName;
|
||||
string strUserPassword;
|
||||
|
||||
//参数
|
||||
//参数
|
||||
Parameters parameters( "config.db" );
|
||||
|
||||
//bool checkVersion()
|
||||
//{
|
||||
// bool result = false;
|
||||
// hash_map<string,string>::iterator iter = parameters.find( string("版本号") );
|
||||
// hash_map<string,string>::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("版本号");
|
||||
}
|
@ -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();
|
||||
|
||||
|
@ -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
|
||||
//************************************
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
#include "check.h"
|
||||
|
||||
hash_map<string, string> parameters; //存放参数的hashmap
|
||||
hash_map<string, string> parameters; //存放参数的hashmap
|
||||
|
||||
//版本号
|
||||
//版本号
|
||||
const string cstrVersion = "0.99";
|
||||
|
||||
string strUserCode;
|
||||
@ -13,7 +13,7 @@ string strUserPassword;
|
||||
bool checkVersion()
|
||||
{
|
||||
bool result = false;
|
||||
hash_map<string,string>::iterator iter = parameters.find( string("版本号") );
|
||||
hash_map<string,string>::iterator iter = parameters.find( string("版本号") );
|
||||
|
||||
if ( iter != parameters.end() && iter->second == cstrVersion )
|
||||
{
|
||||
|
@ -1,54 +1,52 @@
|
||||
|
||||
|
||||
#include <QTextCodec>
|
||||
//#include <QTextCodec>
|
||||
#include <QString>
|
||||
#include <QtWidgets/QMessageBox.h>
|
||||
#include <QtWidgets/QtWidgets>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <exception>
|
||||
#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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user