diff --git a/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj b/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj index 078ba36..7c84b28 100644 --- a/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj +++ b/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj @@ -24,6 +24,7 @@ + @@ -43,6 +44,7 @@ + diff --git a/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj.filters b/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj.filters index 6e1549b..cde6766 100644 --- a/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj.filters +++ b/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj.filters @@ -59,6 +59,9 @@ {985188c7-d233-46c8-bc1f-f7079c27bb2e} + + {fe56cbb8-cdae-4845-ba36-378341641817} + @@ -88,6 +91,9 @@ 数据\数据结构\送返修工单 + + 操作系统 + @@ -136,5 +142,8 @@ 数据\数据结构\送返修工单 + + 操作系统 + \ No newline at end of file diff --git a/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.cpp b/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.cpp index 5740ab5..d827de8 100644 --- a/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.cpp +++ b/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.cpp @@ -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 & 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 & 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(); +} diff --git a/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.h b/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.h index 1da6718..387693c 100644 --- a/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.h +++ b/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.h @@ -4,6 +4,7 @@ #include #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 & achievementVector ); +void LoadRepairOrderFromXlsx( const std::wstring & filePath, + unsigned int sheetIndex, + unsigned int startRowIndex, + std::vector & orderVector ); + +void LoadRepairOrderFromXls( const std::wstring & filePath, + unsigned sheetIndex, + unsigned startRowIndex, + std::vector & orderVector ); + //void LoadRepairOrderFromXlsx(); diff --git a/代码/cpp/car_dealer_util/source/data/Datastructure/RepairOrder/RepairOrder.h b/代码/cpp/car_dealer_util/source/data/Datastructure/RepairOrder/RepairOrder.h index 65bcd32..e351152 100644 --- a/代码/cpp/car_dealer_util/source/data/Datastructure/RepairOrder/RepairOrder.h +++ b/代码/cpp/car_dealer_util/source/data/Datastructure/RepairOrder/RepairOrder.h @@ -1,14 +1,514 @@ - -#pragma once +#pragma once #include +#include 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; - -}; \ No newline at end of file + 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; +}; diff --git a/代码/cpp/car_dealer_util/source/system/system_util.cpp b/代码/cpp/car_dealer_util/source/system/system_util.cpp new file mode 100644 index 0000000..de818b3 --- /dev/null +++ b/代码/cpp/car_dealer_util/source/system/system_util.cpp @@ -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; +} diff --git a/代码/cpp/car_dealer_util/source/system/system_util.h b/代码/cpp/car_dealer_util/source/system/system_util.h new file mode 100644 index 0000000..4ab38d8 --- /dev/null +++ b/代码/cpp/car_dealer_util/source/system/system_util.h @@ -0,0 +1,8 @@ + +#pragma once + +#include +#include +#include + +std::wstring getUserName(); diff --git a/代码/cpp/car_dealer_util/source/test/test.cpp b/代码/cpp/car_dealer_util/source/test/test.cpp index 1587d61..0e325a7 100644 --- a/代码/cpp/car_dealer_util/source/test/test.cpp +++ b/代码/cpp/car_dealer_util/source/test/test.cpp @@ -1,11 +1,14 @@ #include #include +#include #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 schemeVector; vector achievementsVector; - - wstring filePath = L"D:/develop/projects_win/2019/car_dealer_util/数据/PC端导入模板(客户经理版).xlsx"; + vector 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)); +} \ No newline at end of file diff --git a/数据/345517_1.xls b/数据/345517_1.xls new file mode 100644 index 0000000..63f46e4 Binary files /dev/null and b/数据/345517_1.xls differ diff --git a/数据/送返修工单/345517_1.xls b/数据/送返修工单/345517_1.xls new file mode 100644 index 0000000..63f46e4 Binary files /dev/null and b/数据/送返修工单/345517_1.xls differ