增加获取当前登录用户名功能,增加送返修工单excel文件读取功能。

This commit is contained in:
Kane Wang 2019-12-26 16:32:40 +08:00
parent 330d2923b0
commit aaec461d4a
10 changed files with 812 additions and 19 deletions

View File

@ -24,6 +24,7 @@
<ClCompile Include="..\..\..\source\data\Datastructure\RepairOrder\RepairOrder.cpp" />
<ClCompile Include="..\..\..\source\data\excel\excel.cpp" />
<ClCompile Include="..\..\..\source\main.cpp" />
<ClCompile Include="..\..\..\source\system\system_util.cpp" />
<ClCompile Include="..\..\..\source\test\test.cpp" />
<ClCompile Include="..\..\..\source\Widgets\MainFrame\QMainFrame.cpp" />
</ItemGroup>
@ -43,6 +44,7 @@
<ClInclude Include="..\..\..\source\Data\Datastructure\CarDealerScheme\CarDealerScheme.h" />
<ClInclude Include="..\..\..\source\data\Datastructure\RepairOrder\RepairOrder.h" />
<ClInclude Include="..\..\..\source\data\excel\excel.h" />
<ClInclude Include="..\..\..\source\system\system_util.h" />
<ClInclude Include="..\..\..\source\test\test.h" />
</ItemGroup>
<PropertyGroup Label="Globals">

View File

@ -59,6 +59,9 @@
<Filter Include="数据\数据结构\送返修工单">
<UniqueIdentifier>{985188c7-d233-46c8-bc1f-f7079c27bb2e}</UniqueIdentifier>
</Filter>
<Filter Include="操作系统">
<UniqueIdentifier>{fe56cbb8-cdae-4845-ba36-378341641817}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\source\main.cpp">
@ -88,6 +91,9 @@
<ClCompile Include="..\..\..\source\data\Datastructure\RepairOrder\RepairOrder.cpp">
<Filter>数据\数据结构\送返修工单</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\system\system_util.cpp">
<Filter>操作系统</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtRcc Include="..\..\..\source\resource.qrc">
@ -136,5 +142,8 @@
<ClInclude Include="..\..\..\source\data\Datastructure\RepairOrder\RepairOrder.h">
<Filter>数据\数据结构\送返修工单</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\system\system_util.h">
<Filter>操作系统</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -67,13 +67,13 @@ void LoadCarDealerSchemeFromXlsx( const wstring & filePath,
const wstring && isQualified = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex + 8, true );
//空行跳过
if (carDealerCode.empty() == true)
if ( carDealerCode.empty() == true )
{
rowIndex++;
continue;
}
CarDealerScheme carDealerScheme( theYear,
theMonth,
carDealerCode,
@ -150,10 +150,10 @@ void LoadCarDealerAchievementFromXlsx( const std::wstring & fileP
if ( carDealerCode.empty() == true )
{
rowIndex++;
continue;
}
//每个字段都要先判断数据类型再读写,防止填写表格的人填错内容。
CellType type = pSheet->cellType( rowIndex, firstColumnIndex + 4 );
char errorMessage[1000];
@ -166,7 +166,7 @@ void LoadCarDealerAchievementFromXlsx( const std::wstring & fileP
else
{
pBook->release();
sprintf( errorMessage, "第%d行第%d列格式错误不是数字类型", rowIndex, firstColumnIndex + 4 );
throw runtime_error( errorMessage );
@ -182,7 +182,7 @@ void LoadCarDealerAchievementFromXlsx( const std::wstring & fileP
else
{
pBook->release();
sprintf( errorMessage, "第%d行第%d列格式错误不是数字类型", rowIndex, firstColumnIndex + 5 );
throw runtime_error( errorMessage );
@ -198,7 +198,7 @@ void LoadCarDealerAchievementFromXlsx( const std::wstring & fileP
else
{
pBook->release();
sprintf( errorMessage, "第%d行第%d列格式错误不是数字类型", rowIndex, firstColumnIndex + 6 );
throw runtime_error( errorMessage );
@ -214,7 +214,7 @@ void LoadCarDealerAchievementFromXlsx( const std::wstring & fileP
else
{
pBook->release();
sprintf( errorMessage, "第%d行第%d列格式错误不是数字类型", rowIndex, firstColumnIndex + 7 );
throw runtime_error( errorMessage );
@ -230,7 +230,7 @@ void LoadCarDealerAchievementFromXlsx( const std::wstring & fileP
else
{
pBook->release();
sprintf( errorMessage, "第%d行第%d列格式错误不是数字类型", rowIndex, firstColumnIndex + 8 );
throw runtime_error( errorMessage );
@ -246,7 +246,7 @@ void LoadCarDealerAchievementFromXlsx( const std::wstring & fileP
else
{
pBook->release();
sprintf( errorMessage, "第%d行第%d列格式错误不是数字类型", rowIndex, firstColumnIndex + 9 );
throw runtime_error( errorMessage );
@ -269,3 +269,229 @@ void LoadCarDealerAchievementFromXlsx( const std::wstring & fileP
pBook->release();
}
void LoadRepairOrderFromXlsx( const std::wstring & filePath,
unsigned sheetIndex,
unsigned startRowIndex,
std::vector<RepairOrder> & orderVector )
{
Book * pBook = xlCreateXMLBookW();
Sheet * pSheet = nullptr;
if ( pBook == nullptr )
{
throw runtime_error( "libxl库加载失败" );
}
setKey( pBook );
if ( pBook->load( filePath.c_str() ) != true )
{
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();
}
void LoadRepairOrderFromXls( const std::wstring & filePath,
unsigned sheetIndex,
unsigned startRowIndex,
std::vector<RepairOrder> & orderVector )
{
Book * pBook = xlCreateBookW();
Sheet * pSheet = nullptr;
if ( pBook == nullptr )
{
throw runtime_error( "libxl库加载失败" );
}
setKey( pBook );
if ( pBook->load( filePath.c_str() ) != true )
{
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();
}

View File

@ -4,6 +4,7 @@
#include <vector>
#include "../../Datastructure/CarDealerScheme/CarDealerScheme.h"
#include "../../Datastructure/CarDealerAchievement/CarDealerAchievement.h"
#include "../../Datastructure/RepairOrder/RepairOrder.h"
void LoadCarDealerSchemeFromXlsx( const std::wstring & filePath,
unsigned int sheetIndex,
@ -15,4 +16,14 @@ void LoadCarDealerAchievementFromXlsx( const std::wstring & fileP
unsigned int startRowIndex,
std::vector<CarDealerAchievement> & achievementVector );
void LoadRepairOrderFromXlsx( const std::wstring & filePath,
unsigned int sheetIndex,
unsigned int startRowIndex,
std::vector<RepairOrder> & orderVector );
void LoadRepairOrderFromXls( const std::wstring & filePath,
unsigned sheetIndex,
unsigned startRowIndex,
std::vector<RepairOrder> & orderVector );
//void LoadRepairOrderFromXlsx();

View File

@ -1,14 +1,514 @@

#pragma once
#pragma once
#include <string>
#include <utility>
class RepairOrder
{
public:
RepairOrder( std::wstring branchName,
std::wstring orderNo,
std::wstring orderType,
std::wstring notifyNo,
std::wstring damageArea,
std::wstring damageDate,
std::wstring generatingDate,
std::wstring policyNo,
std::wstring policyNoJqx,
std::wstring plateNumber,
std::wstring brandName,
std::wstring isInsuranceObject,
std::wstring isSuccess,
std::wstring recommandDealerCode,
std::wstring recommandDealerName,
std::wstring recommandDealerCodeInNotify,
std::wstring recommandDealerNameInNotify,
std::wstring recommandDealerNameInSurvey,
std::wstring agentName,
std::wstring surveyor,
std::wstring checkDate,
std::wstring repairingStartDate,
std::wstring repairingFinishDate,
std::wstring status,
std::wstring lostItemId,
std::wstring surveyorRecommandStatus )
: branchName( std::move( branchName ) ),
orderNo( std::move( orderNo ) ),
orderType( std::move( orderType ) ),
notifyNo( std::move( notifyNo ) ),
damageArea( std::move( damageArea ) ),
damageDate( std::move( damageDate ) ),
generatingDate( std::move( generatingDate ) ),
policyNo( std::move( policyNo ) ),
policyNoJQX( std::move( policyNoJqx ) ),
plateNumber( std::move( plateNumber ) ),
brandName( std::move( brandName ) ),
isInsuranceObject( std::move( isInsuranceObject ) ),
isSuccess( std::move( isSuccess ) ),
recommandDealerCode( std::move( recommandDealerCode ) ),
recommandDealerName( std::move( recommandDealerName ) ),
recommandDealerCodeInNotify( std::move( recommandDealerCodeInNotify ) ),
recommandDealerNameInNotify( std::move( recommandDealerNameInNotify ) ),
recommandDealerNameInSurvey( std::move( recommandDealerNameInSurvey ) ),
agentName( std::move( agentName ) ),
surveyor( std::move( surveyor ) ),
checkDate( std::move( checkDate ) ),
repairingStartDate( std::move( repairingStartDate ) ),
repairingFinishDate( std::move( repairingFinishDate ) ),
status( std::move( status ) ),
lostItemID( std::move( lostItemId ) ),
surveyorRecommandStatus( std::move( surveyorRecommandStatus ) )
{
}
RepairOrder( const RepairOrder & other )
: branchName( other.branchName ),
orderNo( other.orderNo ),
orderType( other.orderType ),
notifyNo( other.notifyNo ),
damageArea( other.damageArea ),
damageDate( other.damageDate ),
generatingDate( other.generatingDate ),
policyNo( other.policyNo ),
policyNoJQX( other.policyNoJQX ),
plateNumber( other.plateNumber ),
brandName( other.brandName ),
isInsuranceObject( other.isInsuranceObject ),
isSuccess( other.isSuccess ),
recommandDealerCode( other.recommandDealerCode ),
recommandDealerName( other.recommandDealerName ),
recommandDealerCodeInNotify( other.recommandDealerCodeInNotify ),
recommandDealerNameInNotify( other.recommandDealerNameInNotify ),
recommandDealerNameInSurvey( other.recommandDealerNameInSurvey ),
agentName( other.agentName ),
surveyor( other.surveyor ),
checkDate( other.checkDate ),
repairingStartDate( other.repairingStartDate ),
repairingFinishDate( other.repairingFinishDate ),
status( other.status ),
lostItemID( other.lostItemID ),
surveyorRecommandStatus( other.surveyorRecommandStatus )
{
}
RepairOrder( RepairOrder && other )
: branchName( std::move( other.branchName ) ),
orderNo( std::move( other.orderNo ) ),
orderType( std::move( other.orderType ) ),
notifyNo( std::move( other.notifyNo ) ),
damageArea( std::move( other.damageArea ) ),
damageDate( std::move( other.damageDate ) ),
generatingDate( std::move( other.generatingDate ) ),
policyNo( std::move( other.policyNo ) ),
policyNoJQX( std::move( other.policyNoJQX ) ),
plateNumber( std::move( other.plateNumber ) ),
brandName( std::move( other.brandName ) ),
isInsuranceObject( std::move( other.isInsuranceObject ) ),
isSuccess( std::move( other.isSuccess ) ),
recommandDealerCode( std::move( other.recommandDealerCode ) ),
recommandDealerName( std::move( other.recommandDealerName ) ),
recommandDealerCodeInNotify( std::move( other.recommandDealerCodeInNotify ) ),
recommandDealerNameInNotify( std::move( other.recommandDealerNameInNotify ) ),
recommandDealerNameInSurvey( std::move( other.recommandDealerNameInSurvey ) ),
agentName( std::move( other.agentName ) ),
surveyor( std::move( other.surveyor ) ),
checkDate( std::move( other.checkDate ) ),
repairingStartDate( std::move( other.repairingStartDate ) ),
repairingFinishDate( std::move( other.repairingFinishDate ) ),
status( std::move( other.status ) ),
lostItemID( std::move( other.lostItemID ) ),
surveyorRecommandStatus( std::move( other.surveyorRecommandStatus ) )
{
}
RepairOrder & operator=( const RepairOrder & other )
{
if ( this == &other )
return *this;
branchName = other.branchName;
orderNo = other.orderNo;
orderType = other.orderType;
notifyNo = other.notifyNo;
damageArea = other.damageArea;
damageDate = other.damageDate;
generatingDate = other.generatingDate;
policyNo = other.policyNo;
policyNoJQX = other.policyNoJQX;
plateNumber = other.plateNumber;
brandName = other.brandName;
isInsuranceObject = other.isInsuranceObject;
isSuccess = other.isSuccess;
recommandDealerCode = other.recommandDealerCode;
recommandDealerName = other.recommandDealerName;
recommandDealerCodeInNotify = other.recommandDealerCodeInNotify;
recommandDealerNameInNotify = other.recommandDealerNameInNotify;
recommandDealerNameInSurvey = other.recommandDealerNameInSurvey;
agentName = other.agentName;
surveyor = other.surveyor;
checkDate = other.checkDate;
repairingStartDate = other.repairingStartDate;
repairingFinishDate = other.repairingFinishDate;
status = other.status;
lostItemID = other.lostItemID;
surveyorRecommandStatus = other.surveyorRecommandStatus;
return *this;
}
RepairOrder & operator=( RepairOrder && other )
{
if ( this == &other )
return *this;
branchName = std::move( other.branchName );
orderNo = std::move( other.orderNo );
orderType = std::move( other.orderType );
notifyNo = std::move( other.notifyNo );
damageArea = std::move( other.damageArea );
damageDate = std::move( other.damageDate );
generatingDate = std::move( other.generatingDate );
policyNo = std::move( other.policyNo );
policyNoJQX = std::move( other.policyNoJQX );
plateNumber = std::move( other.plateNumber );
brandName = std::move( other.brandName );
isInsuranceObject = std::move( other.isInsuranceObject );
isSuccess = std::move( other.isSuccess );
recommandDealerCode = std::move( other.recommandDealerCode );
recommandDealerName = std::move( other.recommandDealerName );
recommandDealerCodeInNotify = std::move( other.recommandDealerCodeInNotify );
recommandDealerNameInNotify = std::move( other.recommandDealerNameInNotify );
recommandDealerNameInSurvey = std::move( other.recommandDealerNameInSurvey );
agentName = std::move( other.agentName );
surveyor = std::move( other.surveyor );
checkDate = std::move( other.checkDate );
repairingStartDate = std::move( other.repairingStartDate );
repairingFinishDate = std::move( other.repairingFinishDate );
status = std::move( other.status );
lostItemID = std::move( other.lostItemID );
surveyorRecommandStatus = std::move( other.surveyorRecommandStatus );
return *this;
}
friend bool operator==( const RepairOrder & lhs, const RepairOrder & rhs )
{
return lhs.branchName == rhs.branchName
&& lhs.orderNo == rhs.orderNo
&& lhs.orderType == rhs.orderType
&& lhs.notifyNo == rhs.notifyNo
&& lhs.damageArea == rhs.damageArea
&& lhs.damageDate == rhs.damageDate
&& lhs.generatingDate == rhs.generatingDate
&& lhs.policyNo == rhs.policyNo
&& lhs.policyNoJQX == rhs.policyNoJQX
&& lhs.plateNumber == rhs.plateNumber
&& lhs.brandName == rhs.brandName
&& lhs.isInsuranceObject == rhs.isInsuranceObject
&& lhs.isSuccess == rhs.isSuccess
&& lhs.recommandDealerCode == rhs.recommandDealerCode
&& lhs.recommandDealerName == rhs.recommandDealerName
&& lhs.recommandDealerCodeInNotify == rhs.recommandDealerCodeInNotify
&& lhs.recommandDealerNameInNotify == rhs.recommandDealerNameInNotify
&& lhs.recommandDealerNameInSurvey == rhs.recommandDealerNameInSurvey
&& lhs.agentName == rhs.agentName
&& lhs.surveyor == rhs.surveyor
&& lhs.checkDate == rhs.checkDate
&& lhs.repairingStartDate == rhs.repairingStartDate
&& lhs.repairingFinishDate == rhs.repairingFinishDate
&& lhs.status == rhs.status
&& lhs.lostItemID == rhs.lostItemID
&& lhs.surveyorRecommandStatus == rhs.surveyorRecommandStatus;
}
friend bool operator!=( const RepairOrder & lhs, const RepairOrder & rhs )
{
return !(lhs == rhs);
}
std::wstring getBranchName() const
{
return branchName;
}
void setBranchName( const std::wstring & branchName )
{
this->branchName = branchName;
}
std::wstring getOrderNo() const
{
return orderNo;
}
void setOrderNo( const std::wstring & orderNo )
{
this->orderNo = orderNo;
}
std::wstring getOrderType() const
{
return orderType;
}
void setOrderType( const std::wstring & orderType )
{
this->orderType = orderType;
}
std::wstring getNotifyNo() const
{
return notifyNo;
}
void setNotifyNo( const std::wstring & notifyNo )
{
this->notifyNo = notifyNo;
}
std::wstring getDamageArea() const
{
return damageArea;
}
void setDamageArea( const std::wstring & damageArea )
{
this->damageArea = damageArea;
}
std::wstring getDamageDate() const
{
return damageDate;
}
void setDamageDate( const std::wstring & damageDate )
{
this->damageDate = damageDate;
}
std::wstring getGeneratingDate() const
{
return generatingDate;
}
void setGeneratingDate( const std::wstring & generatingDate )
{
this->generatingDate = generatingDate;
}
std::wstring getPolicyNo() const
{
return policyNo;
}
void setPolicyNo( const std::wstring & policyNo )
{
this->policyNo = policyNo;
}
std::wstring getPolicyNoJqx() const
{
return policyNoJQX;
}
void setPolicyNoJqx( const std::wstring & policyNoJqx )
{
policyNoJQX = policyNoJqx;
}
std::wstring getPlateNumber() const
{
return plateNumber;
}
void setPlateNumber( const std::wstring & plateNumber )
{
this->plateNumber = plateNumber;
}
std::wstring getBrandName() const
{
return brandName;
}
void setBrandName( const std::wstring & brandName )
{
this->brandName = brandName;
}
std::wstring getIsInsuranceObject() const
{
return isInsuranceObject;
}
void setIsInsuranceObject( const std::wstring & isInsuranceObject )
{
this->isInsuranceObject = isInsuranceObject;
}
std::wstring getIsSuccess() const
{
return isSuccess;
}
void setIsSuccess( const std::wstring & isSuccess )
{
this->isSuccess = isSuccess;
}
std::wstring getRecommandDealerCode() const
{
return recommandDealerCode;
}
void setRecommandDealerCode( const std::wstring & recommandDealerCode )
{
this->recommandDealerCode = recommandDealerCode;
}
std::wstring getRecommandDealerName() const
{
return recommandDealerName;
}
void setRecommandDealerName( const std::wstring & recommandDealerName )
{
this->recommandDealerName = recommandDealerName;
}
std::wstring getRecommandDealerCodeInNotify() const
{
return recommandDealerCodeInNotify;
}
void setRecommandDealerCodeInNotify( const std::wstring & recommandDealerCodeInNotify )
{
this->recommandDealerCodeInNotify = recommandDealerCodeInNotify;
}
std::wstring getRecommandDealerNameInNotify() const
{
return recommandDealerNameInNotify;
}
void setRecommandDealerNameInNotify( const std::wstring & recommandDealerNameInNotify )
{
this->recommandDealerNameInNotify = recommandDealerNameInNotify;
}
std::wstring getRecommandDealerNameInSurvey() const
{
return recommandDealerNameInSurvey;
}
void setRecommandDealerNameInSurvey( const std::wstring & recommandDealerNameInSurvey )
{
this->recommandDealerNameInSurvey = recommandDealerNameInSurvey;
}
std::wstring getAgentName() const
{
return agentName;
}
void setAgentName( const std::wstring & agentName )
{
this->agentName = agentName;
}
std::wstring getSurveyor() const
{
return surveyor;
}
void setSurveyor( const std::wstring & surveyor )
{
this->surveyor = surveyor;
}
std::wstring getCheckDate() const
{
return checkDate;
}
void setCheckDate( const std::wstring & checkDate )
{
this->checkDate = checkDate;
}
std::wstring getRepairingStartDate() const
{
return repairingStartDate;
}
void setRepairingStartDate( const std::wstring & repairingStartDate )
{
this->repairingStartDate = repairingStartDate;
}
std::wstring getRepairingFinishDate() const
{
return repairingFinishDate;
}
void setRepairingFinishDate( const std::wstring & repairingFinishDate )
{
this->repairingFinishDate = repairingFinishDate;
}
std::wstring getStatus() const
{
return status;
}
void setStatus( const std::wstring & status )
{
this->status = status;
}
std::wstring getLostItemId() const
{
return lostItemID;
}
void setLostItemId( const std::wstring & lostItemId )
{
lostItemID = lostItemId;
}
std::wstring getSurveyorRecommandStatus() const
{
return surveyorRecommandStatus;
}
void setSurveyorRecommandStatus( const std::wstring & surveyorRecommandStatus )
{
this->surveyorRecommandStatus = surveyorRecommandStatus;
}
private:
std::wstring branchName;
orderNo;
orderType;
};
std::wstring orderNo;
std::wstring orderType;
std::wstring notifyNo;
std::wstring damageArea;
std::wstring damageDate;
std::wstring generatingDate;
std::wstring policyNo;
std::wstring policyNoJQX;
std::wstring plateNumber;
std::wstring brandName;
std::wstring isInsuranceObject;
std::wstring isSuccess;
std::wstring recommandDealerCode;
std::wstring recommandDealerName;
std::wstring recommandDealerCodeInNotify;
std::wstring recommandDealerNameInNotify;
std::wstring recommandDealerNameInSurvey;
std::wstring agentName;
std::wstring surveyor; //查勘员
std::wstring checkDate;
std::wstring repairingStartDate;
std::wstring repairingFinishDate;
std::wstring status;
std::wstring lostItemID;
std::wstring surveyorRecommandStatus;
};

View File

@ -0,0 +1,25 @@

#include "system_util.h"
using namespace std;
const unsigned int BUFFER_SIZE = 1024;
std::wstring getUserName()
{
wstring userName;
wchar_t szUserName[BUFFER_SIZE];
DWORD userNameBufferSize = BUFFER_SIZE;
if ( GetUserNameW( szUserName, &userNameBufferSize ) == false )
{
throw runtime_error("获取操作系统用户名失败!");
}
if ( userNameBufferSize != 0 )
{
userName = szUserName;
}
return userName;
}

View File

@ -0,0 +1,8 @@

#pragma once
#include <windows.h>
#include <string>
#include <stdexcept>
std::wstring getUserName();

View File

@ -1,11 +1,14 @@
#include <vector>
#include <string>
#include <QtWidgets/QMessageBox>
#include "test.h"
#include "../data/DataManipulation/Excel/LoadFromExcel.h"
#include "../system/system_util.h"
using namespace std;
void excelTest();
void test_username();
void test()
{
@ -16,11 +19,20 @@ void excelTest()
{
vector<CarDealerScheme> schemeVector;
vector<CarDealerAchievement> achievementsVector;
wstring filePath = L"D:/develop/projects_win/2019/car_dealer_util/数据/PC端导入模板客户经理版.xlsx";
vector<RepairOrder> repairOrderVector;
wstring filePath = L"D:/develop/projects_win/2019/car_dealer_util/数据/345517_1.xls";
//LoadCarDealerSchemeFromXlsx(filePath, 0, 1, schemeVector);
LoadCarDealerAchievementFromXlsx( filePath, 0, 1, achievementsVector );
//LoadCarDealerAchievementFromXlsx( filePath, 0, 1, achievementsVector );
LoadRepairOrderFromXls(filePath, 0, 1, repairOrderVector);
return;
}
void test_username()
{
wstring userName = getUserName();
QMessageBox::information(nullptr, "测试", QString::fromStdWString(userName));
}

BIN
数据/345517_1.xls Normal file

Binary file not shown.

Binary file not shown.