开始编写excel导入导出。
This commit is contained in:
parent
eb6bdf43a0
commit
2d1b9535cb
@ -17,6 +17,8 @@
|
|||||||
<ResourceCompile Include="..\..\..\source\car_dealer_util.rc" />
|
<ResourceCompile Include="..\..\..\source\car_dealer_util.rc" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\source\Data\DataManipulation\Excel\ExportToExcel.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\source\Data\DataManipulation\Excel\LoadFromExcel.cpp" />
|
||||||
<ClCompile Include="..\..\..\source\Data\Datastructure\CarDealerAchievement\CarDealerAchievement.cpp" />
|
<ClCompile Include="..\..\..\source\Data\Datastructure\CarDealerAchievement\CarDealerAchievement.cpp" />
|
||||||
<ClCompile Include="..\..\..\source\Data\Datastructure\CarDealerScheme\CarDealerScheme.cpp" />
|
<ClCompile Include="..\..\..\source\Data\Datastructure\CarDealerScheme\CarDealerScheme.cpp" />
|
||||||
<ClCompile Include="..\..\..\source\main.cpp" />
|
<ClCompile Include="..\..\..\source\main.cpp" />
|
||||||
@ -32,6 +34,8 @@
|
|||||||
<QtMoc Include="..\..\..\source\Widgets\MainFrame\QMainFrame.h" />
|
<QtMoc Include="..\..\..\source\Widgets\MainFrame\QMainFrame.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\source\Data\DataManipulation\Excel\ExportToExcel.h" />
|
||||||
|
<ClInclude Include="..\..\..\source\Data\DataManipulation\Excel\LoadFromExcel.h" />
|
||||||
<ClInclude Include="..\..\..\source\Data\Datastructure\CarDealerAchievement\CarDealerAchievement.h" />
|
<ClInclude Include="..\..\..\source\Data\Datastructure\CarDealerAchievement\CarDealerAchievement.h" />
|
||||||
<ClInclude Include="..\..\..\source\Data\Datastructure\CarDealerScheme\CarDealerScheme.h" />
|
<ClInclude Include="..\..\..\source\Data\Datastructure\CarDealerScheme\CarDealerScheme.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -68,9 +72,11 @@
|
|||||||
<ImportGroup Label="Shared" />
|
<ImportGroup Label="Shared" />
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\..\..\..\..\..\..\sdk\cpp\libxl\libxl-3.8.5.0\libxl_3.8.5.0_x64.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\..\..\..\..\..\..\sdk\cpp\libxl\libxl-3.8.5.0\libxl_3.8.5.0_x64.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
|
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
|
||||||
|
@ -41,6 +41,15 @@
|
|||||||
<Filter Include="数据\数据结构\车商业绩表">
|
<Filter Include="数据\数据结构\车商业绩表">
|
||||||
<UniqueIdentifier>{2c961c49-9981-447f-901d-c449e261fada}</UniqueIdentifier>
|
<UniqueIdentifier>{2c961c49-9981-447f-901d-c449e261fada}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="数据\数据管理">
|
||||||
|
<UniqueIdentifier>{3a2c4541-3486-4b47-9f4d-5aa7355190ed}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="数据\数据管理\导入导出">
|
||||||
|
<UniqueIdentifier>{1aa1a23b-6239-4b36-98be-cd6497547504}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="数据\数据管理\excel">
|
||||||
|
<UniqueIdentifier>{849ef05c-ca3c-479b-ad38-3b9eae188820}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\source\main.cpp">
|
<ClCompile Include="..\..\..\source\main.cpp">
|
||||||
@ -55,6 +64,12 @@
|
|||||||
<ClCompile Include="..\..\..\source\Data\Datastructure\CarDealerAchievement\CarDealerAchievement.cpp">
|
<ClCompile Include="..\..\..\source\Data\Datastructure\CarDealerAchievement\CarDealerAchievement.cpp">
|
||||||
<Filter>数据\数据结构\车商业绩表</Filter>
|
<Filter>数据\数据结构\车商业绩表</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\source\Data\DataManipulation\Excel\ExportToExcel.cpp">
|
||||||
|
<Filter>数据\数据管理\excel</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\source\Data\DataManipulation\Excel\LoadFromExcel.cpp">
|
||||||
|
<Filter>数据\数据管理\excel</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtRcc Include="..\..\..\source\resource.qrc">
|
<QtRcc Include="..\..\..\source\resource.qrc">
|
||||||
@ -88,5 +103,11 @@
|
|||||||
<ClInclude Include="..\..\..\source\Data\Datastructure\CarDealerAchievement\CarDealerAchievement.h">
|
<ClInclude Include="..\..\..\source\Data\Datastructure\CarDealerAchievement\CarDealerAchievement.h">
|
||||||
<Filter>数据\数据结构\车商业绩表</Filter>
|
<Filter>数据\数据结构\车商业绩表</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\source\Data\DataManipulation\Excel\ExportToExcel.h">
|
||||||
|
<Filter>数据\数据管理\excel</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\source\Data\DataManipulation\Excel\LoadFromExcel.h">
|
||||||
|
<Filter>数据\数据管理\excel</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
#include <libxl.h>
|
||||||
|
#include "ExportToExcel.h"
|
||||||
|
|
||||||
|
using namespace libxl;
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
|||||||
|
#pragma once
|
||||||
|
|
@ -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);
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <exception>
|
||||||
|
#include "../../Datastructure/CarDealerScheme/CarDealerScheme.h"
|
||||||
|
#include "../../Datastructure/CarDealerAchievement/CarDealerAchievement.h"
|
||||||
|
|
||||||
|
|
@ -5,7 +5,182 @@
|
|||||||
class CarDealerScheme
|
class CarDealerScheme
|
||||||
{
|
{
|
||||||
public:
|
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:
|
private:
|
||||||
std::wstring theYear;
|
std::wstring theYear;
|
||||||
std::wstring theMonth;
|
std::wstring theMonth;
|
||||||
@ -16,4 +191,3 @@ private:
|
|||||||
std::wstring scheme;
|
std::wstring scheme;
|
||||||
std::wstring isQualified; //是否达成预期
|
std::wstring isQualified; //是否达成预期
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user