三个导入导出功能完成。
This commit is contained in:
parent
87a729cbaf
commit
d6faa08e7a
@ -9,22 +9,29 @@ using namespace std;
|
|||||||
using namespace ocilib;
|
using namespace ocilib;
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************
|
||||||
|
* \brief 向oracle数据库写入车商业绩表,C++实现。
|
||||||
|
* \param userName oracle数据库用户名
|
||||||
|
* \param password oracle数据库密码
|
||||||
|
* \param tnsName oracle TNS名称
|
||||||
|
* \param orderVector 车商业绩表数据
|
||||||
|
************************************************/
|
||||||
void ImportCarDealerAchievementToOracleCpp( const std::string & userName,
|
void ImportCarDealerAchievementToOracleCpp( const std::string & userName,
|
||||||
const std::string & password,
|
const std::string & password,
|
||||||
const std::string & tnsName,
|
const std::string & tnsName,
|
||||||
const std::vector<CarDealerAchievement> & achievementVector )
|
const std::vector<CarDealerAchievement> & achievementVector )
|
||||||
{
|
{
|
||||||
ostring sqlImport =
|
ostring sqlImport =
|
||||||
"BEGIN "
|
"BEGIN \n"
|
||||||
" car_dealer.data_import_util_pkg.import_cardealer_achvmnt( :a_the_year, "
|
" car_dealer.data_import_util_pkg.import_cardealer_achvmnt( :a_the_year, \n"
|
||||||
" :a_the_month, "
|
" :a_the_month, \n"
|
||||||
" :a_car_dealer_code, "
|
" :a_car_dealer_code, \n"
|
||||||
" :a_checked_achievement, "
|
" :a_checked_achievement, \n"
|
||||||
" :a_policy_amount, "
|
" :a_policy_amount, \n"
|
||||||
" :a_cpic_amount, "
|
" :a_cpic_amount, \n"
|
||||||
" :a_picc_amount , "
|
" :a_picc_amount , \n"
|
||||||
" :a_pingan_amount, "
|
" :a_pingan_amount, \n"
|
||||||
" :a_others_amount ); "
|
" :a_others_amount ); \n"
|
||||||
"END; ";
|
"END; ";
|
||||||
|
|
||||||
//初始化
|
//初始化
|
||||||
@ -45,7 +52,7 @@ void ImportCarDealerAchievementToOracleCpp(const std::string& userName,
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pConn = new Connection(userName, password, tnsName);
|
pConn = new Connection( tnsName, userName, password );
|
||||||
}
|
}
|
||||||
catch ( exception & error )
|
catch ( exception & error )
|
||||||
{
|
{
|
||||||
@ -68,6 +75,9 @@ void ImportCarDealerAchievementToOracleCpp(const std::string& userName,
|
|||||||
iter != achievementVector.end();
|
iter != achievementVector.end();
|
||||||
++iter )
|
++iter )
|
||||||
{
|
{
|
||||||
|
string theYear = QString::fromStdWString( iter->getTheYear() ).toStdString().c_str();
|
||||||
|
string theMonth = QString::fromStdWString( iter->getTheMonth() ).toStdString().c_str();
|
||||||
|
string carDealerCode = QString::fromStdWString( iter->getCarDealerCode() ).toStdString().c_str();
|
||||||
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();
|
||||||
@ -75,15 +85,15 @@ void ImportCarDealerAchievementToOracleCpp(const std::string& userName,
|
|||||||
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" ), theYear, 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" ), theMonth, 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" ), carDealerCode, 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" ), checkedAchievement, 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" ), policyAmount, 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" ), 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" ), 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" ), 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" ), othersAmount, 0, BindInfo::BindDirectionValues::In );
|
||||||
|
|
||||||
pStmt->ExecutePrepared();
|
pStmt->ExecutePrepared();
|
||||||
}
|
}
|
||||||
@ -191,7 +201,7 @@ void ImportCarDealerSchemeToOracle(const std::string& userName,
|
|||||||
|
|
||||||
ostring sqlInsertScheme =
|
ostring sqlInsertScheme =
|
||||||
"begin \n"
|
"begin \n"
|
||||||
" car_dealer.data_import_util_pkg.import_carder_scheme( :the_year, \n"
|
" car_dealer.data_import_util_pkg.import_cardealer_scheme( :the_year, \n"
|
||||||
" :the_month, \n"
|
" :the_month, \n"
|
||||||
" :car_dealer_code, \n"
|
" :car_dealer_code, \n"
|
||||||
" :man_hour_price, \n"
|
" :man_hour_price, \n"
|
||||||
@ -259,7 +269,6 @@ void ImportCarDealerSchemeToOracle(const std::string& userName,
|
|||||||
}
|
}
|
||||||
catch ( exception & error )
|
catch ( exception & error )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,19 @@ void ImportCarDealerAchievementToOracleCpp(const std::string& userName,
|
|||||||
const std::string & tnsName,
|
const std::string & tnsName,
|
||||||
const std::vector<CarDealerAchievement> & achievementVector );
|
const std::vector<CarDealerAchievement> & achievementVector );
|
||||||
|
|
||||||
|
/************************************************
|
||||||
|
* \brief 向oracle数据库写入车商业绩表
|
||||||
|
* \param userName oracle数据库用户名
|
||||||
|
* \param password oracle数据库密码
|
||||||
|
* \param tnsName oracle TNS名称
|
||||||
|
* \param orderVector 车商业绩表数据
|
||||||
|
************************************************/
|
||||||
|
void ImportCarDealerAchievementToOracle( std::string userName,
|
||||||
|
std::string password,
|
||||||
|
std::string tnsName,
|
||||||
|
std::vector<CarDealerAchievement> & achievementVector );
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
* \brief 向oracle数据库写入车商方案表
|
* \brief 向oracle数据库写入车商方案表
|
||||||
* \param userName oracle数据库用户名
|
* \param userName oracle数据库用户名
|
||||||
|
@ -22,14 +22,27 @@ void excelTest()
|
|||||||
vector<CarDealerAchievement> achievementsVector;
|
vector<CarDealerAchievement> achievementsVector;
|
||||||
vector<RepairOrder> repairOrderVector;
|
vector<RepairOrder> repairOrderVector;
|
||||||
|
|
||||||
wstring filePath = L"D:/develop/projects_win/2019/car_dealer_util/数据/送返修工单/357783_1.xlsx";
|
string userName = "car_dealer";
|
||||||
|
string password = "cpic123456";
|
||||||
|
string tnsName = "xmcx1";
|
||||||
|
|
||||||
string xlsFilePath = "D:/develop/projects_win/2019/car_dealer_util/数据/345517_1.xls";
|
wstring filePathRepairOrder = L"D:/develop/projects_win/2019/car_dealer_util/数据/送返修工单/357783_1.xlsx";
|
||||||
|
wstring filePathCarDealerScheme = L"D:/develop/projects_win/2019/car_dealer_util/数据/PC端导入模板(管理员版).xlsx";
|
||||||
|
wstring filePathCarDealerAchievement = L"D:/develop/projects_win/2019/car_dealer_util/数据/PC端导入模板(客户经理版).xlsx";
|
||||||
|
|
||||||
//LoadCarDealerSchemeFromXlsx(filePath, 0, 1, schemeVector);
|
//string xlsFilePath = "D:/develop/projects_win/2019/car_dealer_util/数据/345517_1.xls";
|
||||||
//LoadCarDealerAchievementFromXlsx( filePath, 0, 1, achievementsVector );
|
|
||||||
LoadRepairOrderFromXlsx(filePath, 0, 1, repairOrderVector);
|
//测试车商方案
|
||||||
ImportRepairOrderToOracle("car_dealer", "cpic123456", "xmcx1", repairOrderVector);
|
//LoadCarDealerSchemeFromXlsx( filePathCarDealerScheme, 0, 1, schemeVector );
|
||||||
|
//ImportCarDealerSchemeToOracle( userName, password, tnsName, schemeVector );
|
||||||
|
|
||||||
|
//测试车商业绩
|
||||||
|
LoadCarDealerAchievementFromXlsx( filePathCarDealerAchievement, 0, 1, achievementsVector );
|
||||||
|
ImportCarDealerAchievementToOracleCpp(userName, password, tnsName, achievementsVector);
|
||||||
|
|
||||||
|
//测试送返修工单
|
||||||
|
//LoadRepairOrderFromXlsx(filePathRepairOrder, 0, 1, repairOrderVector);
|
||||||
|
//ImportRepairOrderToOracle("car_dealer", "cpic123456", "xmcx1", repairOrderVector);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13,15 +13,15 @@ CREATE OR REPLACE PACKAGE data_import_util_pkg IS
|
|||||||
a_the_year IN VARCHAR2,
|
a_the_year IN VARCHAR2,
|
||||||
a_the_month IN VARCHAR2,
|
a_the_month IN VARCHAR2,
|
||||||
a_car_dealer_code IN VARCHAR2,
|
a_car_dealer_code IN VARCHAR2,
|
||||||
a_checked_achievement IN NUMBER,
|
a_checked_achievement IN VARCHAR2,
|
||||||
a_policy_amount IN INTEGER,
|
a_policy_amount IN VARCHAR2,
|
||||||
a_cpic_amount IN INTEGER,
|
a_cpic_amount IN VARCHAR2,
|
||||||
a_picc_amount IN INTEGER,
|
a_picc_amount IN VARCHAR2,
|
||||||
a_pingan_amount IN INTEGER,
|
a_pingan_amount IN VARCHAR2,
|
||||||
a_others_amount IN INTEGER
|
a_others_amount IN VARCHAR2
|
||||||
);
|
);
|
||||||
|
|
||||||
PROCEDURE import_carder_scheme
|
PROCEDURE import_cardealer_scheme
|
||||||
(
|
(
|
||||||
a_the_year IN VARCHAR2,
|
a_the_year IN VARCHAR2,
|
||||||
a_the_month IN VARCHAR2,
|
a_the_month IN VARCHAR2,
|
||||||
@ -72,12 +72,12 @@ CREATE OR REPLACE PACKAGE BODY data_import_util_pkg IS
|
|||||||
a_the_year IN VARCHAR2,
|
a_the_year IN VARCHAR2,
|
||||||
a_the_month IN VARCHAR2,
|
a_the_month IN VARCHAR2,
|
||||||
a_car_dealer_code IN VARCHAR2,
|
a_car_dealer_code IN VARCHAR2,
|
||||||
a_checked_achievement IN NUMBER,
|
a_checked_achievement IN VARCHAR2,
|
||||||
a_policy_amount IN INTEGER,
|
a_policy_amount IN VARCHAR2,
|
||||||
a_cpic_amount IN INTEGER,
|
a_cpic_amount IN VARCHAR2,
|
||||||
a_picc_amount IN INTEGER,
|
a_picc_amount IN VARCHAR2,
|
||||||
a_pingan_amount IN INTEGER,
|
a_pingan_amount IN VARCHAR2,
|
||||||
a_others_amount IN INTEGER
|
a_others_amount IN VARCHAR2
|
||||||
) IS
|
) IS
|
||||||
BEGIN
|
BEGIN
|
||||||
--·ÀÓùÐÔÑéÖ¤
|
--·ÀÓùÐÔÑéÖ¤
|
||||||
@ -122,7 +122,7 @@ CREATE OR REPLACE PACKAGE BODY data_import_util_pkg IS
|
|||||||
COMMIT;
|
COMMIT;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
PROCEDURE import_carder_scheme
|
PROCEDURE import_cardealer_scheme
|
||||||
(
|
(
|
||||||
a_the_year IN VARCHAR2,
|
a_the_year IN VARCHAR2,
|
||||||
a_the_month IN VARCHAR2,
|
a_the_month IN VARCHAR2,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user