From 8c6fef3c4678e7df62a230b1e365dac902c314b6 Mon Sep 17 00:00:00 2001 From: Kane Wang Date: Mon, 7 Dec 2020 21:46:27 +0800 Subject: [PATCH] ... --- .../car_dealer_util/source/qrc_resource.cpp | 60 +++++++++---------- .../oracle/ImportToOracle.cpp | 6 +- .../QNewRepairMonitorWidget.cpp | 28 +++++++++ .../source/db/ocilib/db_oper.cpp | 42 ++++++------- 4 files changed, 82 insertions(+), 54 deletions(-) diff --git a/code/cpp/car_dealer_util/proj/vs2019/car_dealer_util/source/qrc_resource.cpp b/code/cpp/car_dealer_util/proj/vs2019/car_dealer_util/source/qrc_resource.cpp index 8b1cdde..4d8b921 100644 --- a/code/cpp/car_dealer_util/proj/vs2019/car_dealer_util/source/qrc_resource.cpp +++ b/code/cpp/car_dealer_util/proj/vs2019/car_dealer_util/source/qrc_resource.cpp @@ -36909,94 +36909,94 @@ static const unsigned char qt_resource_struct[] = { 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, // :/QMainFrame/Resources/8218_box1.png 0x0,0x0,0x1,0x2,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x3f,0xef, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x87, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0xe, // :/QMainFrame/Resources/find.png 0x0,0x0,0x1,0x22,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0xaa,0x5f, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8c, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x22, // :/QMainFrame/Resources/print.png 0x0,0x0,0x1,0x62,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x2,0x47,0x63, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8f, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x2d, // :/QMainFrame/Resources/option.png 0x0,0x0,0x2,0x94,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x7,0x6,0xb8, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8e, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x2b, // :/QMainFrame/Resources/x.png 0x0,0x0,0x2,0x2c,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x5,0x6a,0x2d, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x91, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x34, // :/QMainFrame/Resources/telephone.png 0x0,0x0,0x2,0xc4,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x7,0xb2,0x8, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x90, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x32, // :/QMainFrame/Resources/plus.png 0x0,0x0,0x2,0x52,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x6,0x5d,0x5f, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8f, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x2c, // :/QMainFrame/Resources/20121016085311441_easyicon_cn_128.png 0x0,0x0,0x0,0x82,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x77,0x17, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x86, +0x0,0x0,0x1,0x73,0x52,0xd3,0xd,0xf7, // :/QMainFrame/Resources/new.png 0x0,0x0,0x2,0xe4,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x7,0xcc,0x61, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8e, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x29, // :/QMainFrame/Resources/CPIC.png 0x0,0x0,0x2,0x3c,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x5,0xc9,0x50, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x88, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x11, // :/QMainFrame/Resources/ok.png 0x0,0x0,0x1,0x38,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0xe8,0x27, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8e, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x2a, // :/QMainFrame/Resources/face.png 0x0,0x0,0x1,0xc8,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x4,0x29,0xa6, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8c, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x21, // :/QMainFrame/Resources/CNY_Red.png 0x0,0x0,0x1,0xf8,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x4,0xfc,0xe0, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x88, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0xf, // :/QMainFrame/Resources/car2.png 0x0,0x0,0x3,0x10,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x8,0x69,0x71, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8a, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x19, // :/QMainFrame/Resources/app.ico 0x0,0x0,0x0,0x46,0x0,0x1,0x0,0x0,0x0,0x1,0x0,0x0,0x2,0x22, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x89, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x16, // :/QMainFrame/Resources/save.png 0x0,0x0,0x2,0x7e,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x6,0xcf,0x1, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x90, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x30, // :/QMainFrame/Resources/car.png 0x0,0x0,0x0,0x5a,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x1f,0x7e, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x89, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x18, // :/QMainFrame/Resources/cat.png 0x0,0x0,0x0,0x6e,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x55,0x58, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8a, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x1b, // :/QMainFrame/Resources/excel.png 0x0,0x0,0x2,0x14,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x5,0x51,0x43, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8c, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x1f, // :/QMainFrame/Resources/CPIC??.png 0x0,0x0,0x1,0x7a,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x2,0x9e,0xab, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x89, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x13, // :/QMainFrame/Resources/dec.png 0x0,0x0,0x0,0x32,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8b, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x1d, // :/QMainFrame/Resources/folder.png 0x0,0x0,0x0,0xd2,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0xcc,0x2a, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8c, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x23, // :/QMainFrame/Resources/edit.png 0x0,0x0,0x2,0x68,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x6,0x61,0x1b, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8b, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x1e, // :/QMainFrame/Resources/clean.png 0x0,0x0,0x2,0xf8,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x8,0x3a,0x47, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8a, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x1c, // :/QMainFrame/Resources/gear.png 0x0,0x0,0x2,0xae,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x7,0x5c,0x60, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8d, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x24, // :/QMainFrame/Resources/quit.png 0x0,0x0,0x0,0xec,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0xe0,0xcc, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8f, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x2e, // :/QMainFrame/Resources/save2.png 0x0,0x0,0x1,0x4a,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x2,0x29,0x5d, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x90, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x31, // :/QMainFrame/Resources/manager.png 0x0,0x0,0x1,0x94,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x3,0x55,0x8f, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8d, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x28, // :/QMainFrame/Resources/login.png 0x0,0x0,0x1,0xb0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x3,0xb9,0xe4, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x8d, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x26, // :/QMainFrame/Resources/tongji.png 0x0,0x0,0x1,0xde,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x4,0x8a,0x1, -0x0,0x0,0x1,0x73,0xb3,0x4d,0xb3,0x90, +0x0,0x0,0x1,0x73,0x52,0xd3,0xe,0x33, }; diff --git a/code/cpp/car_dealer_util/source/Data/DataManipulation/oracle/ImportToOracle.cpp b/code/cpp/car_dealer_util/source/Data/DataManipulation/oracle/ImportToOracle.cpp index 826e8af..35152d5 100644 --- a/code/cpp/car_dealer_util/source/Data/DataManipulation/oracle/ImportToOracle.cpp +++ b/code/cpp/car_dealer_util/source/Data/DataManipulation/oracle/ImportToOracle.cpp @@ -1,4 +1,4 @@ -//如果文件是utf-8编码存放,要注意sql语句编码和ocilib库版本的问题。 +//如果文件是utf-8编码存放,要注意sql语句编码和ocilib库版本的问题。 #include #include #include @@ -39,7 +39,7 @@ void ImportCarDealerAchievementToOracleCpp( const std::string & { Environment::Initialize(); } - catch ( exception & error ) + catch ( Exception & error ) { string errorMessage = "ocilib初始化失败!"; errorMessage.append( error.what() ); @@ -98,7 +98,7 @@ void ImportCarDealerAchievementToOracleCpp( const std::string & pStmt->ExecutePrepared(); } } - catch ( exception & error ) + catch ( Exception & error ) { string errorMessage = "语句执行失败!"; errorMessage.append( error.what() ); diff --git a/code/cpp/car_dealer_util/source/Widgets/ContentWidget/QNewRepairMonitorWidget/QNewRepairMonitorWidget.cpp b/code/cpp/car_dealer_util/source/Widgets/ContentWidget/QNewRepairMonitorWidget/QNewRepairMonitorWidget.cpp index 3f79df2..2d4e4cb 100644 --- a/code/cpp/car_dealer_util/source/Widgets/ContentWidget/QNewRepairMonitorWidget/QNewRepairMonitorWidget.cpp +++ b/code/cpp/car_dealer_util/source/Widgets/ContentWidget/QNewRepairMonitorWidget/QNewRepairMonitorWidget.cpp @@ -5,6 +5,7 @@ #include #include "../../Data/DataManipulation/Excel/LoadFromExcel.h" +#include "../../Data/DataManipulation/oracle/ImportToOracle.h" using namespace std; @@ -60,6 +61,25 @@ void QNewRepairMonitorWidget::onImport() return; } + + //写入数据库 + try + { + //以后要改掉 + string userName = "car_dealer"; + string password = "cpic123456"; + string tnsName = "xmcx1"; + + ImportNewRepairMonitorToOracle( userName, password, tnsName, recordVector ); + } + catch ( runtime_error & error ) + { + QMessageBox::critical( nullptr, + "保存失败!", + error.what() ); + + return; + } } void QNewRepairMonitorWidget::init() @@ -85,4 +105,12 @@ void QNewRepairMonitorWidget::initSignal() void QNewRepairMonitorWidget::showNewRepairMonitorRecords() { + ui.pTableWidgeRepairOrder->clearContents(); + ui.pTableWidgeRepairOrder->setRowCount( recordVector.size() ); + + int rowIndex = 0; + int columnIndex = 0; + QTableWidgetItem * pItem = nullptr; + + for ( ) } diff --git a/code/cpp/car_dealer_util/source/db/ocilib/db_oper.cpp b/code/cpp/car_dealer_util/source/db/ocilib/db_oper.cpp index 64d1342..35a77b7 100644 --- a/code/cpp/car_dealer_util/source/db/ocilib/db_oper.cpp +++ b/code/cpp/car_dealer_util/source/db/ocilib/db_oper.cpp @@ -1,4 +1,4 @@ - +#include #include #include #include @@ -8,27 +8,27 @@ const int ERROR_MESSAGE_LENGTH = 1001; using namespace std; -void get_error_message(OCI_Error * pError, char * pszMessage, size_t length); +void get_error_message( OCI_Error * pError, char * pszMessage, size_t length ); void initOciLib() { - int returnCode = 0; - char * pszErrorMessage = (char *)malloc(sizeof(char) * ERROR_MESSAGE_LENGTH); + int returnCode = 0; + char * pszErrorMessage = (char*)malloc( sizeof( char ) * ERROR_MESSAGE_LENGTH ); - returnCode = OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT); + returnCode = OCI_Initialize( NULL, NULL, OCI_ENV_DEFAULT ); - if (!returnCode ) + if ( !returnCode ) { - get_error_message(OCI_GetLastError(), pszErrorMessage, ERROR_MESSAGE_LENGTH - 1); + get_error_message( OCI_GetLastError(), pszErrorMessage, ERROR_MESSAGE_LENGTH - 1 ); - string message("OCILIB初始化失败!\n"); + string message( "OCILIB初始化失败!\n" ); message += pszErrorMessage; - throw runtime_error(message); + throw runtime_error( message ); } - free(pszErrorMessage); + free( pszErrorMessage ); } void releaseOciLib() @@ -36,47 +36,47 @@ void releaseOciLib() OCI_Cleanup(); } -void get_error_message(OCI_Error * pError, char * pszMessage, size_t length) +void get_error_message( OCI_Error * pError, char * pszMessage, size_t length ) { //防御性验证 - if (pError == NULL) + if ( pError == NULL ) { pszMessage[0] = NULL; return; } - const otext * psz = OCI_ErrorGetString(pError); + const otext * psz = OCI_ErrorGetString( pError ); - strcpy_s(pszMessage, length, psz); + strcpy_s( pszMessage, length, psz ); } -void error_handler(OCI_Error * pError) +void error_handler( OCI_Error * pError ) { - std::runtime_error error(OCI_ErrorGetString(pError)); + std::runtime_error error( OCI_ErrorGetString( pError ) ); OCI_Cleanup(); throw error; } -void l_error_handler(OCI_Error* pError) +void l_error_handler( OCI_Error * pError ) { - string errorString = OCI_ErrorGetString(pError); + string errorString = OCI_ErrorGetString( pError ); - std::runtime_error error(OCI_ErrorGetString(pError)); + std::runtime_error error( OCI_ErrorGetString( pError ) ); throw error; } void output_error_message( const std::string & errorMessage ) { - qDebug() << QString::fromLocal8Bit(errorMessage.c_str()); + qDebug() << QString::fromLocal8Bit( errorMessage.c_str() ); } std::string get_last_error_message() { OCI_Error * pError = OCI_GetLastError(); - return std::string(OCI_ErrorGetString(pError)); + return std::string( OCI_ErrorGetString( pError ) ); }