开了个头!
This commit is contained in:
parent
50304c0c80
commit
96bd16a290
@ -542,15 +542,15 @@ void LoadNewRepairMonitorReportFromXlsx( const std::wstring &
|
||||
|
||||
NewRepairMonitorReportRecord record;
|
||||
|
||||
record.分公司名称_ = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
record.部门组名称_ = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
record.报案号_ = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
record.分公司名称_ = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
record.部门组名称_ = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
record.报案号_ = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
|
||||
if (record.报案号_.empty() == true)
|
||||
if ( record.报案号_.empty() == true )
|
||||
{
|
||||
//空行跳过
|
||||
rowIndex++;
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -717,115 +717,27 @@ void LoadNewRepairMonitorReportFromXlsx( const std::wstring &
|
||||
pBook->release();
|
||||
}
|
||||
|
||||
void LoadRepairOrderFromXls( const std::wstring & filePath,
|
||||
unsigned sheetIndex,
|
||||
unsigned startRowIndex,
|
||||
std::vector<RepairOrder> & orderVector )
|
||||
{
|
||||
Book * pBook = xlCreateBookW();
|
||||
Sheet * pSheet = nullptr;
|
||||
|
||||
/************************************************
|
||||
* \brief
|
||||
* \param pBook
|
||||
* \param sheetIndex
|
||||
* \param captionRowIndex
|
||||
* \param pszCaptionFormat
|
||||
* \return
|
||||
************************************************/
|
||||
bool checkExcelFileFormat( Book * pBook, int sheetIndex, int captionRowIndex, wchar_t * pszCaptionFormat[], int captionCount )
|
||||
{
|
||||
if ( pBook == nullptr )
|
||||
{
|
||||
throw runtime_error( "libxl库加载失败!" );
|
||||
throw logic_error( "Excel文件指针为空!" );
|
||||
}
|
||||
|
||||
setKey( pBook );
|
||||
Sheet * pSheet = pBook->getSheet( sheetIndex );
|
||||
int captionIndex = 0;
|
||||
|
||||
if ( pBook->load( filePath.c_str() ) != true )
|
||||
while ( captionIndex < captionCount )
|
||||
{
|
||||
string errorMessage = "打开文件失败!";
|
||||
errorMessage.append( pBook->errorMessage() );
|
||||
|
||||
throw runtime_error( errorMessage );
|
||||
|
||||
}
|
||||
|
||||
pSheet = pBook->getSheet( sheetIndex );
|
||||
|
||||
if ( pSheet == nullptr )
|
||||
{
|
||||
string errorMessage = "读取sheet失败!";
|
||||
errorMessage.append( pBook->errorMessage() );
|
||||
|
||||
pBook->release();
|
||||
|
||||
throw runtime_error( errorMessage );
|
||||
}
|
||||
|
||||
int lastRowIndex = pSheet->lastRow();
|
||||
int firstRowIndex = pSheet->firstRow();
|
||||
int rowIndex = firstRowIndex + startRowIndex;
|
||||
|
||||
while ( rowIndex <= lastRowIndex )
|
||||
{
|
||||
int colunmIndex = pSheet->firstCol();
|
||||
|
||||
// const wstring && branchName = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && orderNo = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && orderType = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && notifyNo = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && damageArea = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && damageDate = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && generatingDate = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && policyNo = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && policyNoJQX = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && plateNumber = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && brandName = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && isInsuranceObject = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && isSuccess = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && recommandDealerCode = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && recommandDealerName = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && recommandDealerCodeInNotify = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && recommandDealerNameInNotify = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && recommandDealerNameInSurvey = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && agentName = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && surveyor = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && checkDate = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && repairingStartDate = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && repairingFinishDate = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && status = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && lostItemID = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
// const wstring && surveyorRecommandStatus = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex++, true );
|
||||
//
|
||||
// //空行跳过
|
||||
// if ( orderNo.empty() == true )
|
||||
// {
|
||||
// rowIndex++;
|
||||
//
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// RepairOrder order( branchName,
|
||||
// orderNo,
|
||||
// orderType,
|
||||
// notifyNo,
|
||||
// damageArea,
|
||||
// damageDate,
|
||||
// generatingDate,
|
||||
// policyNo,
|
||||
// policyNoJQX,
|
||||
// plateNumber,
|
||||
// brandName,
|
||||
// isInsuranceObject,
|
||||
// isSuccess,
|
||||
// recommandDealerCode,
|
||||
// recommandDealerName,
|
||||
// recommandDealerCodeInNotify,
|
||||
// recommandDealerNameInNotify,
|
||||
// recommandDealerNameInSurvey,
|
||||
// agentName,
|
||||
// surveyor,
|
||||
// checkDate,
|
||||
// repairingStartDate,
|
||||
// repairingFinishDate,
|
||||
// status,
|
||||
// lostItemID,
|
||||
// surveyorRecommandStatus );
|
||||
//
|
||||
// orderVector.push_back( order );
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
pBook->release();
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
|
||||
#ifndef _DB_OPER_H
|
||||
#define _DB_OPER_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ocilib.h>
|
||||
#include <string>
|
||||
@ -15,7 +14,4 @@ void l_error_handler(OCI_Error* pError);
|
||||
|
||||
void output_error_message(const std::string& errorMessage);
|
||||
|
||||
std::string get_last_error_message();
|
||||
|
||||
|
||||
#endif
|
||||
std::string get_last_error_message();
|
Loading…
x
Reference in New Issue
Block a user