车商方案表导入功能完成!
This commit is contained in:
parent
89192f2a82
commit
87a729cbaf
@ -1,4 +1,5 @@
|
|||||||
#include <ocilib.hpp>
|
//如果文件是utf-8编码存放,要注意sql语句编码和ocilib库版本的问题。
|
||||||
|
#include <ocilib.hpp>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include "ImportToOracle.h"
|
#include "ImportToOracle.h"
|
||||||
@ -8,10 +9,10 @@ using namespace std;
|
|||||||
using namespace ocilib;
|
using namespace ocilib;
|
||||||
|
|
||||||
|
|
||||||
void ImportCarDealerAchievementToOracleCpp( std::string userName,
|
void ImportCarDealerAchievementToOracleCpp(const std::string& userName,
|
||||||
std::string password,
|
const std::string& password,
|
||||||
std::string tnsName,
|
const std::string& tnsName,
|
||||||
std::vector<CarDealerAchievement> & achievementVector )
|
const std::vector<CarDealerAchievement>& achievementVector)
|
||||||
{
|
{
|
||||||
ostring sqlImport =
|
ostring sqlImport =
|
||||||
"BEGIN "
|
"BEGIN "
|
||||||
@ -31,70 +32,70 @@ void ImportCarDealerAchievementToOracleCpp( std::string
|
|||||||
{
|
{
|
||||||
Environment::Initialize();
|
Environment::Initialize();
|
||||||
}
|
}
|
||||||
catch ( exception & error )
|
catch (exception & error)
|
||||||
{
|
{
|
||||||
string errorMessage = "ocilib初始化失败!";
|
string errorMessage = "ocilib初始化失败!";
|
||||||
errorMessage.append( error.what() );
|
errorMessage.append(error.what());
|
||||||
|
|
||||||
throw runtime_error( errorMessage );
|
throw runtime_error(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection * pConn = nullptr;
|
Connection* pConn = nullptr;
|
||||||
Statement * pStmt = nullptr;
|
Statement* pStmt = nullptr;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pConn = new Connection( userName, password, tnsName );
|
pConn = new Connection(userName, password, tnsName);
|
||||||
}
|
}
|
||||||
catch ( exception & error )
|
catch (exception & error)
|
||||||
{
|
{
|
||||||
string errorMessage = "连接oracle失败!";
|
string errorMessage = "连接oracle失败!";
|
||||||
errorMessage.append( error.what() );
|
errorMessage.append(error.what());
|
||||||
|
|
||||||
Environment::Cleanup();
|
Environment::Cleanup();
|
||||||
|
|
||||||
throw runtime_error( errorMessage );
|
throw runtime_error(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pStmt = new Statement( *pConn );
|
pStmt = new Statement(*pConn);
|
||||||
|
|
||||||
pStmt->Prepare( sqlImport );
|
pStmt->Prepare(sqlImport);
|
||||||
pStmt->AllowRebinding( true );
|
pStmt->AllowRebinding(true);
|
||||||
|
|
||||||
for ( auto iter = achievementVector.begin();
|
for (auto iter = achievementVector.begin();
|
||||||
iter != achievementVector.end();
|
iter != achievementVector.end();
|
||||||
++iter )
|
++iter)
|
||||||
{
|
{
|
||||||
string checkedAchievement = QString( "%1" ).arg( static_cast<double>(iter->getCheckedAchievement()) ).toStdString();
|
string checkedAchievement = QString("%1").arg(static_cast<double>(iter->getCheckedAchievement())).toStdString();
|
||||||
string policyAmount = QString( "%1" ).arg( iter->getPolicyAmount() ).toStdString();
|
string policyAmount = QString("%1").arg(iter->getPolicyAmount()).toStdString();
|
||||||
string cpicAmount = QString( "%1" ).arg( iter->getCpicAmount() ).toStdString();
|
string cpicAmount = QString("%1").arg(iter->getCpicAmount()).toStdString();
|
||||||
string piccAmount = QString( "%1" ).arg( iter->getPiccAmount() ).toStdString();
|
string piccAmount = QString("%1").arg(iter->getPiccAmount()).toStdString();
|
||||||
string pinganAmount = QString( "%1" ).arg( iter->getPinganAmount() ).toStdString();
|
string pinganAmount = QString("%1").arg(iter->getPinganAmount()).toStdString();
|
||||||
string othersAmount = QString( "%1" ).arg( iter->getOthersAmount() ).toStdString();
|
string othersAmount = QString("%1").arg(iter->getOthersAmount()).toStdString();
|
||||||
|
|
||||||
pStmt->Bind<ostring, int>( ostring( ":a_the_year" ), ostring( QString::fromStdWString( iter->getTheYear() ).toStdString().c_str() ), 0, BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>(ostring(":a_the_year"), ostring(QString::fromStdWString(iter->getTheYear()).toStdString().c_str()), 0, BindInfo::BindDirectionValues::In);
|
||||||
pStmt->Bind<ostring, int>( ostring( ":a_the_month" ), ostring( QString::fromStdWString( iter->getTheMonth() ).toStdString().c_str() ), 0, BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>(ostring(":a_the_month"), ostring(QString::fromStdWString(iter->getTheMonth()).toStdString().c_str()), 0, BindInfo::BindDirectionValues::In);
|
||||||
pStmt->Bind<ostring, int>( ostring( ":a_car_dealer_code" ), ostring( QString::fromStdWString( iter->getCarDealerCode() ).toStdString().c_str() ), 0, BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>(ostring(":a_car_dealer_code"), ostring(QString::fromStdWString(iter->getCarDealerCode()).toStdString().c_str()), 0, BindInfo::BindDirectionValues::In);
|
||||||
pStmt->Bind<ostring, int>( ostring( ":a_checked_achievement" ), ostring( checkedAchievement.c_str() ), 0, BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>(ostring(":a_checked_achievement"), ostring(checkedAchievement.c_str()), 0, BindInfo::BindDirectionValues::In);
|
||||||
pStmt->Bind<ostring, int>( ostring( ":a_policy_amount" ), ostring( policyAmount.c_str() ), 0, BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>(ostring(":a_policy_amount"), ostring(policyAmount.c_str()), 0, BindInfo::BindDirectionValues::In);
|
||||||
pStmt->Bind<ostring, int>( ostring( ":a_cpic_amount" ), ostring( cpicAmount ), 0, BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>(ostring(":a_cpic_amount"), ostring(cpicAmount), 0, BindInfo::BindDirectionValues::In);
|
||||||
pStmt->Bind<ostring, int>( ostring( ":a_picc_amount" ), ostring( piccAmount ), 0, BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>(ostring(":a_picc_amount"), ostring(piccAmount), 0, BindInfo::BindDirectionValues::In);
|
||||||
pStmt->Bind<ostring, int>( ostring( ":a_pingan_amount" ), ostring( pinganAmount ), 0, BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>(ostring(":a_pingan_amount"), ostring(pinganAmount), 0, BindInfo::BindDirectionValues::In);
|
||||||
pStmt->Bind<ostring, int>( ostring( ":a_others_amount" ), ostring( othersAmount ), 0, BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>(ostring(":a_others_amount"), ostring(othersAmount), 0, BindInfo::BindDirectionValues::In);
|
||||||
|
|
||||||
pStmt->ExecutePrepared();
|
pStmt->ExecutePrepared();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( exception & error )
|
catch (exception & error)
|
||||||
{
|
{
|
||||||
string errorMessage = "语句执行失败!";
|
string errorMessage = "语句执行失败!";
|
||||||
errorMessage.append( error.what() );
|
errorMessage.append(error.what());
|
||||||
|
|
||||||
Environment::Cleanup();
|
Environment::Cleanup();
|
||||||
|
|
||||||
throw runtime_error( errorMessage );
|
throw runtime_error(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
Environment::Cleanup();
|
Environment::Cleanup();
|
||||||
@ -108,16 +109,16 @@ void ImportCarDealerAchievementToOracleCpp( std::string
|
|||||||
* \param tnsName oracle TNS名称
|
* \param tnsName oracle TNS名称
|
||||||
* \param orderVector 车商业绩表数据
|
* \param orderVector 车商业绩表数据
|
||||||
************************************************/
|
************************************************/
|
||||||
void ImportCarDealerAchievementToOracle( std::string userName,
|
void ImportCarDealerAchievementToOracle(std::string userName,
|
||||||
std::string password,
|
std::string password,
|
||||||
std::string tnsName,
|
std::string tnsName,
|
||||||
std::vector<CarDealerAchievement> & achievementVector )
|
std::vector<CarDealerAchievement>& achievementVector)
|
||||||
{
|
{
|
||||||
OCI_Connection * pConnection = nullptr;
|
OCI_Connection* pConnection = nullptr;
|
||||||
OCI_Statement * pStatement = nullptr;
|
OCI_Statement* pStatement = nullptr;
|
||||||
int returnCode = 0;
|
int returnCode = 0;
|
||||||
|
|
||||||
const otext * szSqlImport =
|
const otext* szSqlImport =
|
||||||
"BEGIN "
|
"BEGIN "
|
||||||
" car_dealer.data_import_util_pkg.import_cardealer_achvmnt( :a_the_year, "
|
" car_dealer.data_import_util_pkg.import_cardealer_achvmnt( :a_the_year, "
|
||||||
" :a_the_month, "
|
" :a_the_month, "
|
||||||
@ -131,36 +132,36 @@ void ImportCarDealerAchievementToOracle( std::string use
|
|||||||
"END; ";
|
"END; ";
|
||||||
|
|
||||||
//初始化
|
//初始化
|
||||||
returnCode = OCI_Initialize( l_error_handler, nullptr, OCI_ENV_DEFAULT );
|
returnCode = OCI_Initialize(l_error_handler, nullptr, OCI_ENV_DEFAULT);
|
||||||
|
|
||||||
if ( static_cast<bool>(returnCode) == false )
|
if (static_cast<bool>(returnCode) == false)
|
||||||
{
|
{
|
||||||
string errorMessage( "ocilib初始化错误:" );
|
string errorMessage("ocilib初始化错误:");
|
||||||
errorMessage.append( get_last_error_message() );
|
errorMessage.append(get_last_error_message());
|
||||||
|
|
||||||
throw runtime_error( errorMessage );
|
throw runtime_error(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
pConnection = OCI_ConnectionCreate( tnsName.c_str(),
|
pConnection = OCI_ConnectionCreate(tnsName.c_str(),
|
||||||
userName.c_str(),
|
userName.c_str(),
|
||||||
password.c_str(),
|
password.c_str(),
|
||||||
OCI_SESSION_DEFAULT );
|
OCI_SESSION_DEFAULT);
|
||||||
|
|
||||||
pStatement = OCI_StatementCreate( pConnection );
|
pStatement = OCI_StatementCreate(pConnection);
|
||||||
|
|
||||||
OCI_AllowRebinding( pStatement, true );
|
OCI_AllowRebinding(pStatement, true);
|
||||||
OCI_Prepare( pStatement, szSqlImport );
|
OCI_Prepare(pStatement, szSqlImport);
|
||||||
|
|
||||||
for ( auto iterAchievement = achievementVector.begin();
|
for (auto iterAchievement = achievementVector.begin();
|
||||||
iterAchievement != achievementVector.end();
|
iterAchievement != achievementVector.end();
|
||||||
++iterAchievement )
|
++iterAchievement)
|
||||||
{
|
{
|
||||||
string checkedAchievement = QString( "%1" ).arg( static_cast<double>(iterAchievement->getCheckedAchievement()) ).toStdString();
|
string checkedAchievement = QString("%1").arg(static_cast<double>(iterAchievement->getCheckedAchievement())).toStdString();
|
||||||
string policyAmount = QString( "%1" ).arg( iterAchievement->getPolicyAmount() ).toStdString();
|
string policyAmount = QString("%1").arg(iterAchievement->getPolicyAmount()).toStdString();
|
||||||
string cpicAmount = QString( "%1" ).arg( iterAchievement->getCpicAmount() ).toStdString();
|
string cpicAmount = QString("%1").arg(iterAchievement->getCpicAmount()).toStdString();
|
||||||
string piccAmount = QString( "%1" ).arg( iterAchievement->getPiccAmount() ).toStdString();
|
string piccAmount = QString("%1").arg(iterAchievement->getPiccAmount()).toStdString();
|
||||||
string pinganAmount = QString( "%1" ).arg( iterAchievement->getPinganAmount() ).toStdString();
|
string pinganAmount = QString("%1").arg(iterAchievement->getPinganAmount()).toStdString();
|
||||||
string othersAmount = QString( "%1" ).arg( iterAchievement->getOthersAmount() ).toStdString();
|
string othersAmount = QString("%1").arg(iterAchievement->getOthersAmount()).toStdString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,80 +172,105 @@ void ImportCarDealerAchievementToOracle( std::string use
|
|||||||
* \param tnsName oracle TNS名称
|
* \param tnsName oracle TNS名称
|
||||||
* \param orderVector 车商方案表数据
|
* \param orderVector 车商方案表数据
|
||||||
************************************************/
|
************************************************/
|
||||||
void ImportCarDealerSchemeToOracle( std::string userName,
|
void ImportCarDealerSchemeToOracle(const std::string& userName,
|
||||||
std::string password,
|
const std::string& password,
|
||||||
std::string tnsName,
|
const std::string& tnsName,
|
||||||
std::vector<CarDealerScheme> & schemeVector )
|
std::vector<CarDealerScheme>& schemeVector)
|
||||||
{
|
{
|
||||||
//防御性验证
|
//防御性验证
|
||||||
if ( userName.empty() == true ||
|
if (userName.empty() == true ||
|
||||||
password.empty() == true ||
|
password.empty() == true ||
|
||||||
tnsName.empty() == true ||
|
tnsName.empty() == true ||
|
||||||
schemeVector.empty() == true )
|
schemeVector.empty() == true)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection * pConnection = nullptr;
|
Connection* pConnection = nullptr;
|
||||||
Statement * pStatement = nullptr;
|
Statement* pStatement = nullptr;
|
||||||
|
|
||||||
ostring sqlInsertScheme =
|
ostring sqlInsertScheme =
|
||||||
"";
|
"begin \n"
|
||||||
|
" car_dealer.data_import_util_pkg.import_carder_scheme( :the_year, \n"
|
||||||
|
" :the_month, \n"
|
||||||
|
" :car_dealer_code, \n"
|
||||||
|
" :man_hour_price, \n"
|
||||||
|
" :part_price, \n"
|
||||||
|
" :claim_support, \n"
|
||||||
|
" :scheme, \n"
|
||||||
|
" :is_qualified ); \n"
|
||||||
|
"end; ";
|
||||||
|
|
||||||
//初始化
|
//初始化
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Environment::Initialize();
|
Environment::Initialize();
|
||||||
}
|
}
|
||||||
catch ( exception & error )
|
catch (exception & error)
|
||||||
{
|
{
|
||||||
QString errorMessage = "初始化ocilib失败!";
|
QString errorMessage = "初始化ocilib失败!";
|
||||||
errorMessage.append( QString::fromLocal8Bit( error.what() ) );
|
errorMessage.append(QString::fromLocal8Bit(error.what()));
|
||||||
|
|
||||||
throw runtime_error( errorMessage.toLocal8Bit() );
|
throw runtime_error(errorMessage.toLocal8Bit());
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pConnection = new Connection( tnsName, userName, password );
|
pConnection = new Connection(tnsName, userName, password);
|
||||||
}
|
}
|
||||||
catch ( exception & error )
|
catch (exception & error)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//准备语句
|
//准备语句
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pStatement = new Statement( *pConnection );
|
pStatement = new Statement(*pConnection);
|
||||||
|
|
||||||
pStatement->Prepare( sqlInsertScheme );
|
pStatement->Prepare(sqlInsertScheme);
|
||||||
pStatement->AllowRebinding( true );
|
pStatement->AllowRebinding(true);
|
||||||
|
|
||||||
for ( auto iterScheme = schemeVector.begin();
|
for (auto iterScheme = schemeVector.begin();
|
||||||
iterScheme != schemeVector.end();
|
iterScheme != schemeVector.end();
|
||||||
++iterScheme )
|
++iterScheme)
|
||||||
{
|
{
|
||||||
string theYear = QString::fromStdWString( iterScheme->getTheYear() ).toLocal8Bit();
|
string theYear = QString::fromStdWString(iterScheme->getTheYear()).toLocal8Bit();
|
||||||
string theMonth = QString::fromStdWString( iterScheme->getTheMonth() ).toLocal8Bit();
|
string theMonth = QString::fromStdWString(iterScheme->getTheMonth()).toLocal8Bit();
|
||||||
string carDealerCode = QString::fromStdWString( iterScheme->getCarDealerCode() ).toLocal8Bit();
|
string carDealerCode = QString::fromStdWString(iterScheme->getCarDealerCode()).toLocal8Bit();
|
||||||
string manHourPrice = QString::fromStdWString( iterScheme->getManHourPrice() ).toLocal8Bit();
|
string manHourPrice = QString::fromStdWString(iterScheme->getManHourPrice()).toLocal8Bit();
|
||||||
string partPrice = QString::fromStdWString( iterScheme->getPartPrice() ).toLocal8Bit();
|
string partPrice = QString::fromStdWString(iterScheme->getPartPrice()).toLocal8Bit();
|
||||||
string claimSupport = QString::fromStdWString( iterScheme->getCarDealerCode() ).toLocal8Bit();
|
string claimSupport = QString::fromStdWString(iterScheme->getCarDealerCode()).toLocal8Bit();
|
||||||
string scheme = QString::fromStdWString( iterScheme->getScheme() ).toLocal8Bit();
|
string scheme = QString::fromStdWString(iterScheme->getScheme()).toLocal8Bit();
|
||||||
string isQualified = QString::fromStdWString( iterScheme->getIsQualified() ).toLocal8Bit();
|
string isQualified = QString::fromStdWString(iterScheme->getIsQualified()).toLocal8Bit();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
pStatement->Bind<ostring, int>(ostring(":the_year"), theYear, theYear.size(), BindInfo::BindDirectionValues::In);
|
||||||
|
pStatement->Bind<ostring, int>(ostring(":the_month"), theMonth, theMonth.size(), BindInfo::BindDirectionValues::In);
|
||||||
|
pStatement->Bind<ostring, int>(ostring(":car_dealer_code"), carDealerCode, carDealerCode.size(), BindInfo::BindDirectionValues::In);
|
||||||
|
pStatement->Bind<ostring, int>(ostring(":man_hour_price"), manHourPrice, manHourPrice.size(), BindInfo::BindDirectionValues::In);
|
||||||
|
pStatement->Bind<ostring, int>(ostring(":claim_support"), claimSupport, claimSupport.size(), BindInfo::BindDirectionValues::In);
|
||||||
|
pStatement->Bind<ostring, int>(ostring(":part_price"), partPrice, partPrice.size(), BindInfo::BindDirectionValues::In);
|
||||||
|
pStatement->Bind<ostring, int>(ostring(":scheme"), scheme, scheme.size(), BindInfo::BindDirectionValues::In);
|
||||||
|
pStatement->Bind<ostring, int>(ostring(":is_qualified"), isQualified, isQualified.size(), BindInfo::BindDirectionValues::In);
|
||||||
|
|
||||||
|
pStatement->ExecutePrepared();
|
||||||
}
|
}
|
||||||
catch ( exception & error )
|
catch (exception & error)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( exception & erro )
|
catch (exception & error)
|
||||||
{
|
{
|
||||||
|
Environment::Cleanup();
|
||||||
|
|
||||||
|
throw runtime_error(error.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Environment::Cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -255,16 +281,16 @@ void ImportCarDealerSchemeToOracle( std::string userName,
|
|||||||
* \param tnsName oracle TNS名称
|
* \param tnsName oracle TNS名称
|
||||||
* \param orderVector 送返修工单数据
|
* \param orderVector 送返修工单数据
|
||||||
************************************************/
|
************************************************/
|
||||||
void ImportRepairOrderToOracle( const std::string & userName,
|
void ImportRepairOrderToOracle(const std::string& userName,
|
||||||
const std::string & password,
|
const std::string& password,
|
||||||
const std::string & tnsName,
|
const std::string& tnsName,
|
||||||
const std::vector<RepairOrder> & orderVector )
|
const std::vector<RepairOrder>& orderVector)
|
||||||
{
|
{
|
||||||
OCI_Connection * pConn = nullptr;
|
OCI_Connection* pConn = nullptr;
|
||||||
OCI_Statement * pStmt = nullptr;
|
OCI_Statement* pStmt = nullptr;
|
||||||
|
|
||||||
int returnCode = 0;
|
int returnCode = 0;
|
||||||
const otext * szSqlImport =
|
const otext* szSqlImport =
|
||||||
"BEGIN"
|
"BEGIN"
|
||||||
" car_dealer.data_import_util_pkg.import_repairing_order(:a_branch_name, \n"
|
" car_dealer.data_import_util_pkg.import_repairing_order(:a_branch_name, \n"
|
||||||
" :a_order_no,\n"
|
" :a_order_no,\n"
|
||||||
@ -294,110 +320,110 @@ void ImportRepairOrderToOracle( const std::string & userName,
|
|||||||
"END;";
|
"END;";
|
||||||
|
|
||||||
//初始化
|
//初始化
|
||||||
returnCode = OCI_Initialize( l_error_handler, nullptr, OCI_ENV_DEFAULT );
|
returnCode = OCI_Initialize(l_error_handler, nullptr, OCI_ENV_DEFAULT);
|
||||||
|
|
||||||
if ( static_cast<bool>(returnCode) == false )
|
if (static_cast<bool>(returnCode) == false)
|
||||||
{
|
{
|
||||||
string errorMessage( "ocilib初始化错误:" );
|
string errorMessage("ocilib初始化错误:");
|
||||||
errorMessage.append( get_last_error_message() );
|
errorMessage.append(get_last_error_message());
|
||||||
|
|
||||||
throw runtime_error( errorMessage );
|
throw runtime_error(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
pConn = OCI_ConnectionCreate( tnsName.c_str(),
|
pConn = OCI_ConnectionCreate(tnsName.c_str(),
|
||||||
userName.c_str(),
|
userName.c_str(),
|
||||||
password.c_str(),
|
password.c_str(),
|
||||||
OCI_SESSION_DEFAULT );
|
OCI_SESSION_DEFAULT);
|
||||||
pStmt = OCI_StatementCreate( pConn );
|
pStmt = OCI_StatementCreate(pConn);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OCI_AllowRebinding( pStmt, true );
|
OCI_AllowRebinding(pStmt, true);
|
||||||
OCI_Prepare( pStmt, szSqlImport );
|
OCI_Prepare(pStmt, szSqlImport);
|
||||||
}
|
}
|
||||||
catch ( runtime_error & error )
|
catch (runtime_error & error)
|
||||||
{
|
{
|
||||||
OCI_ConnectionFree( pConn );
|
OCI_ConnectionFree(pConn);
|
||||||
OCI_Cleanup();
|
OCI_Cleanup();
|
||||||
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( auto iterOrder = orderVector.begin();
|
for (auto iterOrder = orderVector.begin();
|
||||||
iterOrder != orderVector.end();
|
iterOrder != orderVector.end();
|
||||||
++iterOrder )
|
++iterOrder)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string branchName = QString::fromStdWString( iterOrder->getBranchName() ).toLocal8Bit();
|
string branchName = QString::fromStdWString(iterOrder->getBranchName()).toLocal8Bit();
|
||||||
string orderNo = QString::fromStdWString( iterOrder->getOrderNo() ).toLocal8Bit();
|
string orderNo = QString::fromStdWString(iterOrder->getOrderNo()).toLocal8Bit();
|
||||||
string orderType = QString::fromStdWString( iterOrder->getOrderType() ).toLocal8Bit();
|
string orderType = QString::fromStdWString(iterOrder->getOrderType()).toLocal8Bit();
|
||||||
string notifyNo = QString::fromStdWString( iterOrder->getNotifyNo() ).toLocal8Bit();
|
string notifyNo = QString::fromStdWString(iterOrder->getNotifyNo()).toLocal8Bit();
|
||||||
string damageArea = QString::fromStdWString( iterOrder->getDamageArea() ).toLocal8Bit();
|
string damageArea = QString::fromStdWString(iterOrder->getDamageArea()).toLocal8Bit();
|
||||||
string damageDate = QString::fromStdWString( iterOrder->getDamageDate() ).toLocal8Bit();
|
string damageDate = QString::fromStdWString(iterOrder->getDamageDate()).toLocal8Bit();
|
||||||
string genDate = QString::fromStdWString( iterOrder->getGeneratingDate() ).toLocal8Bit();
|
string genDate = QString::fromStdWString(iterOrder->getGeneratingDate()).toLocal8Bit();
|
||||||
string policyNo = QString::fromStdWString( iterOrder->getPolicyNo() ).toLocal8Bit();
|
string policyNo = QString::fromStdWString(iterOrder->getPolicyNo()).toLocal8Bit();
|
||||||
string policyNoJQX = QString::fromStdWString( iterOrder->getPolicyNoJqx() ).toLocal8Bit();
|
string policyNoJQX = QString::fromStdWString(iterOrder->getPolicyNoJqx()).toLocal8Bit();
|
||||||
string plateNumber = QString::fromStdWString( iterOrder->getPlateNumber() ).toLocal8Bit();;
|
string plateNumber = QString::fromStdWString(iterOrder->getPlateNumber()).toLocal8Bit();;
|
||||||
string brandName = QString::fromStdWString( iterOrder->getBrandName() ).toLocal8Bit();;
|
string brandName = QString::fromStdWString(iterOrder->getBrandName()).toLocal8Bit();;
|
||||||
string isInsuranceObject = QString::fromStdWString( iterOrder->getIsInsuranceObject() ).toLocal8Bit();
|
string isInsuranceObject = QString::fromStdWString(iterOrder->getIsInsuranceObject()).toLocal8Bit();
|
||||||
string isSuccess = QString::fromStdWString( iterOrder->getIsSuccess() ).toLocal8Bit();
|
string isSuccess = QString::fromStdWString(iterOrder->getIsSuccess()).toLocal8Bit();
|
||||||
string recommandDealerCode = QString::fromStdWString( iterOrder->getRecommandDealerCode() ).toLocal8Bit();
|
string recommandDealerCode = QString::fromStdWString(iterOrder->getRecommandDealerCode()).toLocal8Bit();
|
||||||
string recommandDealerName = QString::fromStdWString( iterOrder->getRecommandDealerName() ).toLocal8Bit();
|
string recommandDealerName = QString::fromStdWString(iterOrder->getRecommandDealerName()).toLocal8Bit();
|
||||||
string recommandDealerCodeInNameInNotify = QString::fromStdWString( iterOrder->getRecommandDealerNameInNotify() ).toLocal8Bit();
|
string recommandDealerCodeInNameInNotify = QString::fromStdWString(iterOrder->getRecommandDealerNameInNotify()).toLocal8Bit();
|
||||||
string recommandDealerCodeInSurvy = QString::fromStdWString( iterOrder->getRecommandDealerNameInSurvey() ).toLocal8Bit();
|
string recommandDealerCodeInSurvy = QString::fromStdWString(iterOrder->getRecommandDealerNameInSurvey()).toLocal8Bit();
|
||||||
string agentName = QString::fromStdWString( iterOrder->getAgentName() ).toLocal8Bit();
|
string agentName = QString::fromStdWString(iterOrder->getAgentName()).toLocal8Bit();
|
||||||
string surveyor = QString::fromStdWString( iterOrder->getSurveyor() ).toLocal8Bit();
|
string surveyor = QString::fromStdWString(iterOrder->getSurveyor()).toLocal8Bit();
|
||||||
string repairingStartDate = QString::fromStdWString( iterOrder->getRepairingStartDate() ).toLocal8Bit();
|
string repairingStartDate = QString::fromStdWString(iterOrder->getRepairingStartDate()).toLocal8Bit();
|
||||||
string repairingEndDate = QString::fromStdWString( iterOrder->getRepairingFinishDate() ).toLocal8Bit();
|
string repairingEndDate = QString::fromStdWString(iterOrder->getRepairingFinishDate()).toLocal8Bit();
|
||||||
string checkDate = QString::fromStdWString( iterOrder->getCheckDate() ).toLocal8Bit();
|
string checkDate = QString::fromStdWString(iterOrder->getCheckDate()).toLocal8Bit();
|
||||||
string status = QString::fromStdWString( iterOrder->getStatus() ).toLocal8Bit();
|
string status = QString::fromStdWString(iterOrder->getStatus()).toLocal8Bit();
|
||||||
string lostItemID = QString::fromStdWString( iterOrder->getLostItemId() ).toLocal8Bit();
|
string lostItemID = QString::fromStdWString(iterOrder->getLostItemId()).toLocal8Bit();
|
||||||
string surveyorRecommandStatus = QString::fromStdWString( iterOrder->getSurveyorRecommandStatus() ).toLocal8Bit();
|
string surveyorRecommandStatus = QString::fromStdWString(iterOrder->getSurveyorRecommandStatus()).toLocal8Bit();
|
||||||
|
|
||||||
OCI_BindString( pStmt, ":a_branch_name", const_cast<otext*>(branchName.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_branch_name", const_cast<otext*>(branchName.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_order_no", const_cast<otext*>(orderNo.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_order_no", const_cast<otext*>(orderNo.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_order_type", const_cast<otext*>(orderType.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_order_type", const_cast<otext*>(orderType.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_notify_no", const_cast<otext*>(notifyNo.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_notify_no", const_cast<otext*>(notifyNo.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_damage_area", const_cast<otext*>(damageArea.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_damage_area", const_cast<otext*>(damageArea.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_policy_no", const_cast<otext*>(policyNo.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_policy_no", const_cast<otext*>(policyNo.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_policy_no_jqx", const_cast<otext*>(policyNoJQX.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_policy_no_jqx", const_cast<otext*>(policyNoJQX.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_plate_number", const_cast<otext*>(plateNumber.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_plate_number", const_cast<otext*>(plateNumber.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_brand_name", const_cast<otext*>(brandName.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_brand_name", const_cast<otext*>(brandName.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_is_insurance_object", const_cast<otext*>(isInsuranceObject.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_is_insurance_object", const_cast<otext*>(isInsuranceObject.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_is_success", const_cast<otext*>(isSuccess.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_is_success", const_cast<otext*>(isSuccess.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_recommend_dealer_code", const_cast<otext*>(recommandDealerCode.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_recommend_dealer_code", const_cast<otext*>(recommandDealerCode.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_recommend_dealer_name", const_cast<otext*>(recommandDealerName.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_recommend_dealer_name", const_cast<otext*>(recommandDealerName.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_recomm_dealer_name_in_notify", const_cast<otext*>(recommandDealerCodeInNameInNotify.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_recomm_dealer_name_in_notify", const_cast<otext*>(recommandDealerCodeInNameInNotify.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_recomm_dealer_name_in_survey", const_cast<otext*>(recommandDealerCodeInSurvy.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_recomm_dealer_name_in_survey", const_cast<otext*>(recommandDealerCodeInSurvy.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_agent_name", const_cast<otext*>(agentName.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_agent_name", const_cast<otext*>(agentName.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_surveyor", const_cast<otext*>(surveyor.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_surveyor", const_cast<otext*>(surveyor.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_status", const_cast<otext*>(status.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_status", const_cast<otext*>(status.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_lost_item_id", const_cast<otext*>(lostItemID.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_lost_item_id", const_cast<otext*>(lostItemID.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_surveyor_recomm_status", const_cast<otext*>(surveyorRecommandStatus.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_surveyor_recomm_status", const_cast<otext*>(surveyorRecommandStatus.c_str()), 0);
|
||||||
|
|
||||||
OCI_BindString( pStmt, ":a_damage_date", const_cast<otext*>(damageDate.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_damage_date", const_cast<otext*>(damageDate.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_generating_date", const_cast<otext*>(genDate.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_generating_date", const_cast<otext*>(genDate.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_check_date", const_cast<otext*>(checkDate.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_check_date", const_cast<otext*>(checkDate.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_repairing_start_date", const_cast<otext*>(repairingStartDate.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_repairing_start_date", const_cast<otext*>(repairingStartDate.c_str()), 0);
|
||||||
OCI_BindString( pStmt, ":a_repairing_finish_date", const_cast<otext*>(repairingEndDate.c_str()), 0 );
|
OCI_BindString(pStmt, ":a_repairing_finish_date", const_cast<otext*>(repairingEndDate.c_str()), 0);
|
||||||
|
|
||||||
OCI_Execute( pStmt );
|
OCI_Execute(pStmt);
|
||||||
}
|
}
|
||||||
catch ( runtime_error & error )
|
catch (runtime_error & error)
|
||||||
{
|
{
|
||||||
//输出日志,让过程继续
|
//输出日志,让过程继续
|
||||||
string errorMessage = "送返修工单编号";
|
string errorMessage = "送返修工单编号";
|
||||||
|
|
||||||
errorMessage.append( QString::fromStdWString( iterOrder->getOrderNo() ).toLocal8Bit() );
|
errorMessage.append(QString::fromStdWString(iterOrder->getOrderNo()).toLocal8Bit());
|
||||||
errorMessage.append( "保存失败,提示信息:" );
|
errorMessage.append("保存失败,提示信息:");
|
||||||
errorMessage.append( error.what() );
|
errorMessage.append(error.what());
|
||||||
|
|
||||||
output_error_message( errorMessage );
|
output_error_message(errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OCI_Commit( pConn );
|
OCI_Commit(pConn);
|
||||||
OCI_ConnectionFree( pConn );
|
OCI_ConnectionFree(pConn);
|
||||||
OCI_Cleanup();
|
OCI_Cleanup();
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
* \param tnsName oracle TNS名称
|
* \param tnsName oracle TNS名称
|
||||||
* \param orderVector 车商业绩表数据
|
* \param orderVector 车商业绩表数据
|
||||||
************************************************/
|
************************************************/
|
||||||
void ImportCarDealerAchievementToOracle( std::string userName,
|
void ImportCarDealerAchievementToOracleCpp(const std::string& userName,
|
||||||
std::string password,
|
const std::string& password,
|
||||||
std::string tnsName,
|
const std::string& tnsName,
|
||||||
std::vector<CarDealerAchievement> & achievementVector );
|
const std::vector<CarDealerAchievement>& achievementVector);
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
* \brief 向oracle数据库写入车商方案表
|
* \brief 向oracle数据库写入车商方案表
|
||||||
@ -26,10 +26,10 @@ void ImportCarDealerAchievementToOracle( std::string use
|
|||||||
* \param tnsName oracle TNS名称
|
* \param tnsName oracle TNS名称
|
||||||
* \param orderVector 车商方案表数据
|
* \param orderVector 车商方案表数据
|
||||||
************************************************/
|
************************************************/
|
||||||
void ImportCarDealerSchemeToOracle( std::string userName,
|
void ImportCarDealerSchemeToOracle(const std::string& userName,
|
||||||
std::string password,
|
const std::string& password,
|
||||||
std::string tnsName,
|
const std::string& tnsName,
|
||||||
std::vector<CarDealerScheme> & achievementVector );
|
std::vector<CarDealerScheme>& achievementVector);
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
* \brief 向oracle数据库写入送返修工单信息
|
* \brief 向oracle数据库写入送返修工单信息
|
||||||
@ -38,7 +38,7 @@ void ImportCarDealerSchemeToOracle( std::string userName
|
|||||||
* \param tnsName oracle TNS名称
|
* \param tnsName oracle TNS名称
|
||||||
* \param orderVector 送返修工单数据
|
* \param orderVector 送返修工单数据
|
||||||
************************************************/
|
************************************************/
|
||||||
void ImportRepairOrderToOracle( const std::string & userName,
|
void ImportRepairOrderToOracle(const std::string& userName,
|
||||||
const std::string & password,
|
const std::string& password,
|
||||||
const std::string & tnsName,
|
const std::string& tnsName,
|
||||||
const std::vector<RepairOrder> & orderVector );
|
const std::vector<RepairOrder>& orderVector);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user