开始编写excel导入导出。

This commit is contained in:
2019-12-18 18:04:20 +08:00
parent eb6bdf43a0
commit 2d1b9535cb
7 changed files with 260 additions and 2 deletions

View File

@@ -0,0 +1,10 @@

#include <libxl.h>
#include "ExportToExcel.h"
using namespace libxl;
using namespace std;

View File

@@ -0,0 +1,2 @@
#pragma once

View File

@@ -0,0 +1,36 @@
#include <libxl.h>
#include <exception>
#include "LoadFromExcel.h"
#include <stdexcept>
using namespace std;
using namespace libxl;
void SetKey( Book * pBook )
{
if ( pBook == nullptr )
{
return;
}
pBook->setKey(L"cpic", L"windows-202d21040bc4e70060bc6264a6ucu7i1");
}
/************************************************
* \brief 从Excel文件读取车商方案表
* \param filePath Excel文件路径
* \param schemeMap 存放车商方案数据的map
************************************************/
void LoadCarDealerSchemeFromXlsx( const wstring & filePath,
map<wstring, CarDealerScheme> & schemeMap )
{
Book* pBook = xlCreateXMLBookW();
Sheet* pSheet = nullptr;
if ( pBook == nullptr )
{
throw runtime_error("libxl库加载失败");
}
SetKey(pBook);
}

View File

@@ -0,0 +1,9 @@

#pragma once
#include <map>
#include <exception>
#include "../../Datastructure/CarDealerScheme/CarDealerScheme.h"
#include "../../Datastructure/CarDealerAchievement/CarDealerAchievement.h"

View File

@@ -5,7 +5,182 @@
class CarDealerScheme
{
public:
CarDealerScheme( const std::wstring & theYear,
const std::wstring & theMonth,
const std::wstring & carDealerCode,
const std::wstring & manHourPrice,
const std::wstring & partPrice,
const std::wstring & claimSupport,
const std::wstring & scheme,
const std::wstring & isQualified )
: theYear( theYear ),
theMonth( theMonth ),
carDealerCode( carDealerCode ),
manHourPrice( manHourPrice ),
partPrice( partPrice ),
claimSupport( claimSupport ),
scheme( scheme ),
isQualified( isQualified )
{
}
CarDealerScheme( const wchar_t * theYear,
const wchar_t * theMonth,
const wchar_t * carDealerCode,
const wchar_t * manHourPrice,
const wchar_t * partPrice,
const wchar_t * claimSupport,
const wchar_t * scheme,
const wchar_t * isQualified )
: theYear( theYear ),
theMonth( theMonth ),
carDealerCode( carDealerCode ),
manHourPrice( manHourPrice ),
partPrice( partPrice ),
claimSupport( claimSupport ),
scheme( scheme ),
isQualified( isQualified )
{
}
CarDealerScheme( const CarDealerScheme & other )
: theYear( other.theYear ),
theMonth( other.theMonth ),
carDealerCode( other.carDealerCode ),
manHourPrice( other.manHourPrice ),
partPrice( other.partPrice ),
claimSupport( other.claimSupport ),
scheme( other.scheme ),
isQualified( other.isQualified )
{
}
CarDealerScheme( CarDealerScheme && other )
: theYear( std::move(other.theYear) ),
theMonth( std::move(other.theMonth) ),
carDealerCode( std::move(other.carDealerCode) ),
manHourPrice( std::move(other.manHourPrice) ),
partPrice( std::move(other.partPrice) ),
claimSupport( std::move(other.claimSupport) ),
scheme( std::move(other.scheme) ),
isQualified( std::move(other.isQualified) )
{
}
CarDealerScheme & operator=( const CarDealerScheme & other )
{
if ( this == &other )
return *this;
theYear = other.theYear;
theMonth = other.theMonth;
carDealerCode = other.carDealerCode;
manHourPrice = other.manHourPrice;
partPrice = other.partPrice;
claimSupport = other.claimSupport;
scheme = other.scheme;
isQualified = other.isQualified;
return *this;
}
CarDealerScheme & operator=( CarDealerScheme && other )
{
if ( this == &other )
return *this;
theYear = std::move( other.theYear );
theMonth = std::move( other.theMonth );
carDealerCode = std::move( other.carDealerCode );
manHourPrice = std::move( other.manHourPrice );
partPrice = std::move( other.partPrice );
claimSupport = std::move( other.claimSupport );
scheme = std::move( other.scheme );
isQualified = std::move( other.isQualified );
return *this;
}
std::wstring getTheYear() const
{
return theYear;
}
void setTheYear( const std::wstring & theYear )
{
this->theYear = theYear;
}
std::wstring getTheMonth() const
{
return theMonth;
}
void setTheMonth( const std::wstring & theMonth )
{
this->theMonth = theMonth;
}
std::wstring getCarDealerCode() const
{
return carDealerCode;
}
void setCarDealerCode( const std::wstring & carDealerCode )
{
this->carDealerCode = carDealerCode;
}
std::wstring getManHourPrice() const
{
return manHourPrice;
}
void setManHourPrice( const std::wstring & manHourPrice )
{
this->manHourPrice = manHourPrice;
}
std::wstring getPartPrice() const
{
return partPrice;
}
void setPartPrice( const std::wstring & partPrice )
{
this->partPrice = partPrice;
}
std::wstring getClaimSupport() const
{
return claimSupport;
}
void setClaimSupport( const std::wstring & claimSupport )
{
this->claimSupport = claimSupport;
}
std::wstring getScheme() const
{
return scheme;
}
void setScheme( const std::wstring & scheme )
{
this->scheme = scheme;
}
std::wstring getIsQualified() const
{
return isQualified;
}
void setIsQualified( const std::wstring & isQualified )
{
this->isQualified = isQualified;
}
private:
std::wstring theYear;
std::wstring theMonth;
@@ -16,4 +191,3 @@ private:
std::wstring scheme;
std::wstring isQualified; //是否达成预期
};