完成,还未测试!
This commit is contained in:
parent
f653eddf5b
commit
7d265d106b
@ -442,21 +442,102 @@ void ImportRepairSuggestionToOracle( const std::string &
|
|||||||
const std::string & tnsName,
|
const std::string & tnsName,
|
||||||
const std::vector<RepairSuggestionRecord> & recordVector )
|
const std::vector<RepairSuggestionRecord> & recordVector )
|
||||||
{
|
{
|
||||||
OCI_Connection * pConnection = nullptr;
|
OCI_Connection * pConn = nullptr;
|
||||||
OCI_Statement * pStatement = nullptr;
|
OCI_Statement * pStmt = nullptr;
|
||||||
|
int returnCode = 0;
|
||||||
|
|
||||||
const otext * szSql =
|
const otext * szSql =
|
||||||
"BEGIN \n" \
|
"BEGIN \n"
|
||||||
" car_dealer.data_import_util_pkg.import_repairing_suggestion(:a_order_no, \n" \
|
" car_dealer.data_import_util_pkg.import_repairing_suggestion(:a_order_no, \n"
|
||||||
" :a_order_type, \n" \
|
" :a_order_type, \n"
|
||||||
" :a_notify_no, \n" \
|
" :a_notify_no, \n"
|
||||||
" :a_sug_cardealer_code, \n" \
|
" :a_sug_cardealer_code, \n"
|
||||||
" :a_sug_cardealer_name, \n" \
|
" :a_sug_cardealer_name, \n"
|
||||||
" :a_damage_date, \n" \
|
" :a_damage_date, \n"
|
||||||
" :a_plateNo, \n" \
|
" :a_plateNo, \n"
|
||||||
" :a_brand_name, \n" \
|
" :a_brand_name, \n"
|
||||||
" :a_message_type, \n" \
|
" :a_message_type, \n"
|
||||||
" :a_sending_date, \n" \
|
" :a_sending_date, \n"
|
||||||
" :a_data_source); \n" \
|
" :a_data_source); \n"
|
||||||
"END;";
|
"END;";
|
||||||
|
|
||||||
|
returnCode = OCI_Initialize( error_handler, nullptr, OCI_ENV_CONTEXT );
|
||||||
|
|
||||||
|
if ( static_cast<bool>(returnCode) == false )
|
||||||
|
{
|
||||||
|
string errorMessage( "ocilib初始化错误:" );
|
||||||
|
errorMessage.append( get_last_error_message() );
|
||||||
|
|
||||||
|
throw runtime_error( errorMessage );
|
||||||
|
}
|
||||||
|
|
||||||
|
pConn = OCI_ConnectionCreate( tnsName.c_str(),
|
||||||
|
userName.c_str(),
|
||||||
|
password.c_str(),
|
||||||
|
OCI_SESSION_DEFAULT );
|
||||||
|
pStmt = OCI_StatementCreate( pConn );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
OCI_AllowRebinding( pStmt, true );
|
||||||
|
OCI_Prepare( pStmt, szSql );
|
||||||
|
}
|
||||||
|
catch ( runtime_error & error )
|
||||||
|
{
|
||||||
|
OCI_ConnectionFree( pConn );
|
||||||
|
OCI_Cleanup();
|
||||||
|
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( auto iterOrder = recordVector.begin();
|
||||||
|
iterOrder != recordVector.end();
|
||||||
|
++iterOrder )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//绑定数据
|
||||||
|
string 工单号 = QString::fromStdWString( iterOrder->getOrderNo() ).toLocal8Bit();
|
||||||
|
string 工单类型 = QString::fromStdWString( iterOrder->getOrderType() ).toLocal8Bit();
|
||||||
|
string 报案号 = QString::fromStdWString( iterOrder->getNotifyNo() ).toLocal8Bit();
|
||||||
|
string 推荐车商代码 = QString::fromStdWString( iterOrder->getSuggestedCarDealerCode() ).toLocal8Bit();
|
||||||
|
string 推荐车商名称 = QString::fromStdWString( iterOrder->getSuggestedCarDealerName() ).toLocal8Bit();
|
||||||
|
string 出险日期 = QString::fromStdWString( iterOrder->getDamageDate() ).toLocal8Bit();
|
||||||
|
string 短信类型 = QString::fromStdWString( iterOrder->getMessageType() ).toLocal8Bit();
|
||||||
|
string 短信日期 = QString::fromStdWString( iterOrder->getMessageSendingDate() ).toLocal8Bit();
|
||||||
|
string 数据来源 = QString::fromStdWString( iterOrder->getDataSource() ).toLocal8Bit();
|
||||||
|
string 车牌号 = QString::fromStdWString( iterOrder->getPlateNumber() ).toLocal8Bit();
|
||||||
|
string 厂牌型号 = QString::fromStdWString( iterOrder->getBrandName() ).toLocal8Bit();
|
||||||
|
|
||||||
|
//执行语句
|
||||||
|
OCI_BindString( pStmt, ":a_order_no", (otext*)工单号.c_str(), 工单号.size() );
|
||||||
|
OCI_BindString( pStmt, ":a_order_type", (otext*)工单类型.c_str(), 工单类型.size() );
|
||||||
|
OCI_BindString( pStmt, ":a_notify_no", (otext*)报案号.c_str(), 报案号.size() );
|
||||||
|
OCI_BindString( pStmt, ":a_sug_cardealer_code", (otext*)推荐车商代码.c_str(), 推荐车商代码.size() );
|
||||||
|
OCI_BindString( pStmt, ":a_sug_cardealer_name", (otext*)推荐车商名称.c_str(), 推荐车商名称.size() );
|
||||||
|
OCI_BindString( pStmt, ":a_damage_date", (otext*)出险日期.c_str(), 出险日期.size() );
|
||||||
|
OCI_BindString( pStmt, ":a_plateNo", (otext*)车牌号.c_str(), 车牌号.size() );
|
||||||
|
OCI_BindString( pStmt, ":a_message_type", (otext*)短信类型.c_str(), 短信类型.size() );
|
||||||
|
OCI_BindString( pStmt, ":a_sending_date", (otext*)短信日期.c_str(), 短信日期.size() );
|
||||||
|
OCI_BindString( pStmt, ":a_data_source", (otext*)数据来源.c_str(), 数据来源.size() );
|
||||||
|
OCI_BindString( pStmt, ":a_brand_name", (otext*)厂牌型号.c_str(), 厂牌型号.size() );
|
||||||
|
|
||||||
|
returnCode = OCI_Execute( pStmt );
|
||||||
|
}
|
||||||
|
catch ( runtime_error & error )
|
||||||
|
{
|
||||||
|
//输出日志,让过程继续
|
||||||
|
string errorMessage = "送返修工单编号";
|
||||||
|
|
||||||
|
errorMessage.append( QString::fromStdWString( iterOrder->getOrderNo() ).toLocal8Bit() );
|
||||||
|
errorMessage.append( "保存失败,提示信息:" );
|
||||||
|
errorMessage.append( error.what() );
|
||||||
|
|
||||||
|
output_error_message( errorMessage );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OCI_Commit( pConn );
|
||||||
|
OCI_ConnectionFree( pConn );
|
||||||
|
OCI_Cleanup();
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,116 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::wstring getOrderNo() const
|
||||||
|
{
|
||||||
|
return orderNo_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setOrderNo( const std::wstring & orderNo )
|
||||||
|
{
|
||||||
|
orderNo_ = orderNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring getOrderType() const
|
||||||
|
{
|
||||||
|
return orderType_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setOrderType( const std::wstring & orderType )
|
||||||
|
{
|
||||||
|
orderType_ = orderType;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring getNotifyNo() const
|
||||||
|
{
|
||||||
|
return notifyNo_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setNotifyNo( const std::wstring & notifyNo )
|
||||||
|
{
|
||||||
|
notifyNo_ = notifyNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring getSuggestedCarDealerCode() const
|
||||||
|
{
|
||||||
|
return suggestedCarDealerCode_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setSuggestedCarDealerCode( const std::wstring & suggestedCarDealerCode )
|
||||||
|
{
|
||||||
|
suggestedCarDealerCode_ = suggestedCarDealerCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring getSuggestedCarDealerName() const
|
||||||
|
{
|
||||||
|
return suggestedCarDealerName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setSuggestedCarDealerName( const std::wstring & suggestedCarDealerName )
|
||||||
|
{
|
||||||
|
suggestedCarDealerName_ = suggestedCarDealerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring getDamageDate() const
|
||||||
|
{
|
||||||
|
return damageDate_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDamageDate( const std::wstring & damageDate )
|
||||||
|
{
|
||||||
|
damageDate_ = damageDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring getPlateNumber() const
|
||||||
|
{
|
||||||
|
return plateNumber_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPlateNumber( const std::wstring & plateNumber )
|
||||||
|
{
|
||||||
|
plateNumber_ = plateNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring getBrandName() const
|
||||||
|
{
|
||||||
|
return brandName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setBrandName( const std::wstring & brandName )
|
||||||
|
{
|
||||||
|
brandName_ = brandName;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring getMessageType() const
|
||||||
|
{
|
||||||
|
return messageType_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setMessageType( const std::wstring & messageType )
|
||||||
|
{
|
||||||
|
messageType_ = messageType;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring getMessageSendingDate() const
|
||||||
|
{
|
||||||
|
return messageSendingDate_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setMessageSendingDate( const std::wstring & messageSendingDate )
|
||||||
|
{
|
||||||
|
messageSendingDate_ = messageSendingDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring getDataSource() const
|
||||||
|
{
|
||||||
|
return dataSource_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDataSource( const std::wstring & dataSource )
|
||||||
|
{
|
||||||
|
dataSource_ = dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::wstring orderNo_;
|
std::wstring orderNo_;
|
||||||
std::wstring orderType_;
|
std::wstring orderType_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user