diff --git a/code/cpp/car_dealer_util/proj/vs2019/car_dealer_util/核价(2.28).xlsx b/code/cpp/car_dealer_util/proj/vs2019/car_dealer_util/核价(2.28).xlsx new file mode 100644 index 0000000..f8a0cc1 Binary files /dev/null and b/code/cpp/car_dealer_util/proj/vs2019/car_dealer_util/核价(2.28).xlsx differ 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 25c7143..604dd6c 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 @@ -1128,7 +1128,96 @@ void ImportPriceCheckedListToOracle( const std::string & OCI_Statement * pStatement = nullptr; int returnCode = 0; - returnCode = OCI_Initialize(l_error_handler, nullptr, OCI_ENV_DEFAULT); + QString sql = QString::fromUtf8( "begin \n" + " car_dealer.data_import_util_pkg.import_pricecheck_list( \n" + " :a_caseno, \n" + " :a_report_date, \n" + " :a_damage_date, \n" + " :a_damage_address, \n" + " :a_plateno, \n" + " :a_brandname, \n" + " :a_carseries, \n" + " :a_policyno, \n" + " :a_insuredcar, \n" + " :a_checked_premium, \n" + " :a_step, \n" + " :a_branch_name, \n" + " :a_cardealer_code, \n" + " :a_cardealer_name, \n" + " :a_check_date \n" + " ); \n" + "end;" ); - + returnCode = OCI_Initialize( l_error_handler, nullptr, OCI_ENV_DEFAULT ); + + if ( static_cast(returnCode) == false ) + { + string errorMessage( "ocilib初始化错误:" ); + errorMessage.append( get_last_error_message() ); + + throw runtime_error( errorMessage ); + } + + try + { + pConn = OCI_ConnectionCreate( tnsName.c_str(), + userName.c_str(), + password.c_str(), + OCI_SESSION_DEFAULT ); + pStatement = OCI_StatementCreate( pConn ); + + OCI_AllowRebinding( pStatement, true ); + OCI_Prepare( pStatement, sql.toLocal8Bit().data() ); + + for ( auto iterRecord = recordVector.begin(); + iterRecord != recordVector.end(); + ++iterRecord ) + { + string a_caseno = QString::fromStdWString( iterRecord->报案号_ ).toLocal8Bit(); + string a_report_date = QString::fromStdWString( iterRecord->报案日期_ ).toLocal8Bit(); + string a_damage_date = QString::fromStdWString( iterRecord->出险日期_ ).toLocal8Bit(); + string a_damage_address = QString::fromStdWString( iterRecord->出险地点_ ).toLocal8Bit(); + string a_plateno = QString::fromStdWString( iterRecord->车牌_ ).toLocal8Bit(); + string a_brandname = QString::fromStdWString( iterRecord->品牌名称_ ).toLocal8Bit(); + string a_carseries = QString::fromStdWString( iterRecord->车系名称_ ).toLocal8Bit(); + string a_policyno = QString::fromStdWString( iterRecord->保单号_ ).toLocal8Bit(); + string a_insuredcar = QString::fromStdWString( iterRecord->标的车_三者车_ ).toLocal8Bit(); + string a_checked_premium = QString::fromStdWString( iterRecord->核价金额_ ).toLocal8Bit(); + string a_step = QString::fromStdWString( iterRecord->车状_核价通过环节_ ).toLocal8Bit(); + string a_branch_name = QString::fromStdWString( iterRecord->核价车商分公司名称_ ).toLocal8Bit(); + string a_cardealer_code = QString::fromStdWString( iterRecord->核价车商代码_ ).toLocal8Bit(); + string a_cardealer_name = QString::fromStdWString( iterRecord->核价车商名称_ ).toLocal8Bit(); + string a_check_date = QString::fromStdWString( iterRecord->核价通过时间_ ).toLocal8Bit(); + + //OCI_BindString(pStatement, (const otext*)(":"), (otext*)(.c_str()), .size()); + OCI_BindString( pStatement, (const otext*)(":a_caseno"), (otext*)(a_caseno.c_str()), a_caseno.size() ); + OCI_BindString( pStatement, (const otext*)(":a_report_date"), (otext*)(a_report_date.c_str()), a_report_date.size() ); + OCI_BindString( pStatement, (const otext*)(":a_damage_date"), (otext*)(a_damage_date.c_str()), a_damage_date.size() ); + OCI_BindString( pStatement, (const otext*)(":a_damage_address"), (otext*)(a_damage_address.c_str()), a_damage_address.size() ); + OCI_BindString( pStatement, (const otext*)(":a_plateno"), (otext*)(a_plateno.c_str()), a_plateno.size() ); + OCI_BindString( pStatement, (const otext*)(":a_brandname"), (otext*)(a_brandname.c_str()), a_brandname.size() ); + OCI_BindString( pStatement, (const otext*)(":a_carseries"), (otext*)(a_carseries.c_str()), a_carseries.size() ); + OCI_BindString( pStatement, (const otext*)(":a_policyno"), (otext*)(a_policyno.c_str()), a_policyno.size() ); + OCI_BindString( pStatement, (const otext*)(":a_insuredcar"), (otext*)(a_insuredcar.c_str()), a_insuredcar.size() ); + OCI_BindString( pStatement, (const otext*)(":a_checked_premium"), (otext*)(a_checked_premium.c_str()), a_checked_premium.size() ); + OCI_BindString( pStatement, (const otext*)(":a_step"), (otext*)(a_step.c_str()), a_step.size() ); + OCI_BindString( pStatement, (const otext*)(":a_branch_name"), (otext*)(a_branch_name.c_str()), a_branch_name.size() ); + OCI_BindString( pStatement, (const otext*)(":a_cardealer_code"), (otext*)(a_cardealer_code.c_str()), a_cardealer_code.size() ); + OCI_BindString( pStatement, (const otext*)(":a_cardealer_name"), (otext*)(a_cardealer_name.c_str()), a_cardealer_name.size() ); + OCI_BindString( pStatement, (const otext*)(":a_check_date"), (otext*)(a_check_date.c_str()), a_check_date.size() ); + + OCI_Execute( pStatement ); + } + } + catch ( runtime_error & error ) + { + OCI_ConnectionFree( pConn ); + OCI_Cleanup(); + + throw error; + } + + OCI_Commit( pConn ); + OCI_ConnectionFree( pConn ); + OCI_Cleanup(); } 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 92fcd8f..9d9cfde 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 @@ -71,7 +71,8 @@ void QNewRepairMonitorWidget::onImport() string password = "cpic123456"; string tnsName = "xmcx1"; - ImportNewRepairMonitorToOracle( userName, password, tnsName, recordVector ); + //ImportNewRepairMonitorToOracle( userName, password, tnsName, recordVector ); + ImportPriceCheckedListToOracle(userName, password, tnsName, recordVector); //showNewRepairMonitorRecords(); } diff --git a/code/数据库/oracle/pkg/data_import_util_pkg.pck b/code/数据库/oracle/pkg/data_import_util_pkg.pck index 1f1d4de..aa1a0dc 100644 --- a/code/数据库/oracle/pkg/data_import_util_pkg.pck +++ b/code/数据库/oracle/pkg/data_import_util_pkg.pck @@ -85,6 +85,26 @@ CREATE OR REPLACE PACKAGE data_import_util_pkg IS a_data_source VARCHAR2 ); + --˼嵥ͷ޼ر + PROCEDURE import_pricecheck_list + ( + a_ VARCHAR2, + a_ VARCHAR2, + a_ VARCHAR2, + a_յص VARCHAR2, + a_ VARCHAR2, + a_Ʒ VARCHAR2, + a_ϵ VARCHAR2, + a_ VARCHAR2, + a_ij߳ VARCHAR2, + a_˼۽ VARCHAR2, + a_״̬ƺ˼ͨ VARCHAR2, + a_˼۳̷ֹ˾ VARCHAR2, + a_˼۳̴ VARCHAR2, + a_˼۳ VARCHAR2, + a_˼ͨʱ VARCHAR2 + ); + PROCEDURE ͷ޼ر ( a_ֹ˾ VARCHAR2, @@ -408,7 +428,8 @@ CREATE OR REPLACE PACKAGE BODY data_import_util_pkg IS --ɾ BEGIN - DELETE car_dealer.repair_order_info a WHERE a_order_no = a.order_no; + DELETE car_dealer.repair_order_info a + WHERE a_order_no = a.order_no; EXCEPTION WHEN OTHERS THEN NULL; @@ -539,7 +560,8 @@ CREATE OR REPLACE PACKAGE BODY data_import_util_pkg IS --ɾ BEGIN - DELETE FROM car_dealer.ͷƼ a WHERE a. = a_notify_no; + DELETE FROM car_dealer.ͷƼ a + WHERE a. = a_notify_no; EXCEPTION WHEN OTHERS THEN NULL; @@ -584,6 +606,90 @@ CREATE OR REPLACE PACKAGE BODY data_import_util_pkg IS END; + PROCEDURE import_pricecheck_list + ( + a_ VARCHAR2, + a_ VARCHAR2, + a_ VARCHAR2, + a_յص VARCHAR2, + a_ VARCHAR2, + a_Ʒ VARCHAR2, + a_ϵ VARCHAR2, + a_ VARCHAR2, + a_ij߳ VARCHAR2, + a_˼۽ VARCHAR2, + a_״̬ƺ˼ͨ VARCHAR2, + a_˼۳̷ֹ˾ VARCHAR2, + a_˼۳̴ VARCHAR2, + a_˼۳ VARCHAR2, + a_˼ͨʱ VARCHAR2 + ) IS + l_ DATE; + l_ DATE; + l_˼ͨʱ DATE; + BEGIN + NULL; + + IF a_ IS NULL OR + a_ IS NULL + THEN + raise_application_error(no_notify_no_excpt, + no_notify_no_text); + END IF; + + BEGIN + DELETE ˼嵥 hj + --DELETE check_price_list hj + WHERE hj. = a_ + AND hj. = a_; + EXCEPTION + WHEN OTHERS THEN + NULL; + END; + + l_ := ַת(a_, + 'yyyy-mm-dd hh24:mi:ss'); + l_ := ַת(a_, + 'yyyy-mm-dd hh24:mi:ss'); + l_˼ͨʱ := ַת(a_˼ͨʱ, + 'yyyy-mm-dd hh24:mi:ss'); + + INSERT INTO ˼嵥 + --INSERT INTO check_price_list + (, + , + , + յص, + , + Ʒ, + ϵ, + , + ij߳, + ˼۽, + ״̬ƺ˼ͨ, + ˼۳̷ֹ˾, + ˼۳̴, + ˼۳, + ˼ͨʱ) + VALUES + (a_, + l_, + l_, + a_յص, + a_, + a_Ʒ, + a_ϵ, + a_, + a_ij߳, + a_˼۽, + a_״̬ƺ˼ͨ, + a_˼۳̷ֹ˾, + a_˼۳̴, + a_˼۳, + l_˼ͨʱ); + + END; + PROCEDURE ͷ޼ر ( a_ֹ˾ VARCHAR2,