...
This commit is contained in:
@@ -389,7 +389,7 @@ void LoadRepairSuggestionFromXlsx( const std::wstring & filePat
|
||||
unsigned startRowIndex,
|
||||
std::vector<RepairSuggestionRecord> & recordVector )
|
||||
{
|
||||
Book * pBook = xlCreateBookW();
|
||||
Book * pBook = xlCreateXMLBookW();
|
||||
Sheet * pSheet = nullptr;
|
||||
|
||||
if ( pBook == nullptr )
|
||||
@@ -397,7 +397,16 @@ void LoadRepairSuggestionFromXlsx( const std::wstring & filePat
|
||||
throw runtime_error( "libxl库加载失败!" );
|
||||
}
|
||||
|
||||
if (pBook->load(filePath.c_str()) != true)
|
||||
{
|
||||
string errorMessage = "打开文件失败!";
|
||||
errorMessage.append(pBook->errorMessage());
|
||||
|
||||
throw runtime_error(errorMessage);
|
||||
}
|
||||
|
||||
setKey( pBook );
|
||||
|
||||
pSheet = pBook->getSheet( sheetIndex );
|
||||
|
||||
if ( pSheet == nullptr )
|
||||
@@ -431,8 +440,20 @@ void LoadRepairSuggestionFromXlsx( const std::wstring & filePat
|
||||
wstring messageSendingDate = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
wstring dataSource = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
|
||||
|
||||
|
||||
RepairSuggestionRecord record( orderNo,
|
||||
orderType,
|
||||
notifyNo,
|
||||
suggestedCarDealerCode,
|
||||
suggestedCarDealerName,
|
||||
damageDate,
|
||||
plateNumber,
|
||||
brandName,
|
||||
messageType,
|
||||
messageSendingDate,
|
||||
dataSource );
|
||||
|
||||
recordVector.push_back( record );
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
|
@@ -48,6 +48,13 @@ void LoadRepairOrderFromXlsx( const std::wstring & filePath,
|
||||
// unsigned startRowIndex,
|
||||
// std::vector<RepairOrder> & orderVector );
|
||||
|
||||
/************************************************
|
||||
* \brief 读取送返修推荐表数据
|
||||
* \param filePath
|
||||
* \param sheetIndex
|
||||
* \param startRowIndex
|
||||
* \param recordVector
|
||||
************************************************/
|
||||
void LoadRepairSuggestionFromXlsx( const std::wstring & filePath,
|
||||
unsigned int sheetIndex,
|
||||
unsigned int startRowIndex,
|
||||
|
@@ -436,3 +436,27 @@ void ImportRepairOrderToOracle( const std::string & userName,
|
||||
OCI_ConnectionFree( pConn );
|
||||
OCI_Cleanup();
|
||||
}
|
||||
|
||||
void ImportRepairSuggestionToOracle( const std::string & userName,
|
||||
const std::string & password,
|
||||
const std::string & tnsName,
|
||||
const std::vector<RepairSuggestionRecord> & recordVector )
|
||||
{
|
||||
OCI_Connection * pConnection = nullptr;
|
||||
OCI_Statement * pStatement = nullptr;
|
||||
|
||||
const otext * szSql =
|
||||
"BEGIN \n" \
|
||||
" car_dealer.data_import_util_pkg.import_repairing_suggestion(:a_order_no, \n" \
|
||||
" :a_order_type, \n" \
|
||||
" :a_notify_no, \n" \
|
||||
" :a_sug_cardealer_code, \n" \
|
||||
" :a_sug_cardealer_name, \n" \
|
||||
" :a_damage_date, \n" \
|
||||
" :a_plateNo, \n" \
|
||||
" :a_brand_name, \n" \
|
||||
" :a_message_type, \n" \
|
||||
" :a_sending_date, \n" \
|
||||
" :a_data_source); \n" \
|
||||
"END;";
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include "../../Datastructure/CarDealerAchievement/CarDealerAchievement.h"
|
||||
#include "../../Datastructure/CarDealerScheme/CarDealerScheme.h"
|
||||
#include "../../Datastructure/RepairOrder/RepairOrder.h"
|
||||
#include "../../Datastructure/RepairSuggestion/RepairSuggestionRecord.h"
|
||||
|
||||
|
||||
/************************************************
|
||||
@@ -55,3 +56,15 @@ void ImportRepairOrderToOracle( const std::string & userName,
|
||||
const std::string & password,
|
||||
const std::string & tnsName,
|
||||
const std::vector<RepairOrder> & orderVector );
|
||||
|
||||
/************************************************
|
||||
* \brief 将送返修推荐记录
|
||||
* \param userName
|
||||
* \param password
|
||||
* \param tnsName
|
||||
* \param recordVector
|
||||
************************************************/
|
||||
void ImportRepairSuggestionToOracle( const std::string & userName,
|
||||
const std::string & password,
|
||||
const std::string & tnsName,
|
||||
const std::vector<RepairSuggestionRecord> & recordVector );
|
||||
|
@@ -29,7 +29,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
test();
|
||||
|
||||
//return 1;
|
||||
return 1;
|
||||
|
||||
//登录界面
|
||||
try
|
||||
|
@@ -13,14 +13,15 @@ void test_username();
|
||||
|
||||
void test()
|
||||
{
|
||||
//excelTest();
|
||||
excelTest();
|
||||
}
|
||||
|
||||
void excelTest()
|
||||
{
|
||||
vector<CarDealerScheme> schemeVector;
|
||||
vector<CarDealerAchievement> achievementsVector;
|
||||
vector<RepairOrder> repairOrderVector;
|
||||
vector<CarDealerScheme> schemeVector;
|
||||
vector<CarDealerAchievement> achievementsVector;
|
||||
vector<RepairOrder> repairOrderVector;
|
||||
vector<RepairSuggestionRecord> suggestionRecordsVector;
|
||||
|
||||
string userName = "car_dealer";
|
||||
string password = "cpic123456";
|
||||
@@ -29,7 +30,7 @@ void excelTest()
|
||||
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";
|
||||
|
||||
wstring filePathRepairSuggestion = L"D:/develop/projects_win/2019/car_dealer_util/数据/卢霖城 - 推荐表.xlsx";
|
||||
//string xlsFilePath = "D:/develop/projects_win/2019/car_dealer_util/数据/345517_1.xls";
|
||||
|
||||
//测试车商方案
|
||||
@@ -38,12 +39,15 @@ void excelTest()
|
||||
|
||||
//测试车商业绩
|
||||
LoadCarDealerAchievementFromXlsx( filePathCarDealerAchievement, 0, 1, achievementsVector );
|
||||
ImportCarDealerAchievementToOracleCpp(userName, password, tnsName, achievementsVector);
|
||||
ImportCarDealerAchievementToOracleCpp( userName, password, tnsName, achievementsVector );
|
||||
|
||||
//测试送返修工单
|
||||
//LoadRepairOrderFromXlsx(filePathRepairOrder, 0, 1, repairOrderVector);
|
||||
//ImportRepairOrderToOracle("car_dealer", "cpic123456", "xmcx1", repairOrderVector);
|
||||
|
||||
//测试送返修推荐
|
||||
LoadRepairSuggestionFromXlsx( filePathRepairSuggestion, 0, 1, suggestionRecordsVector );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user