|
@@ -176,13 +176,17 @@ Error_manager Command_manager::execute_store_command(message::Store_command_requ
|
|
|
if (request.base_info().msg_type() == message::eStore_command_request_msg
|
|
|
&& request.base_info().receiver() == message::eMain
|
|
|
&& request.base_info().sender() == message::eTerminor) {
|
|
|
- if (request.has_locate_information() && request.has_base_info()) {
|
|
|
+ if (request.has_locate_information() && request.has_base_info())
|
|
|
+ {
|
|
|
message::Locate_information locate_info = request.locate_information();
|
|
|
- if (locate_info.has_locate_correct()) {
|
|
|
- if (locate_info.locate_correct() == true) {
|
|
|
+ if (locate_info.has_locate_correct())
|
|
|
+ {
|
|
|
+ if (locate_info.locate_correct() == true)
|
|
|
+ {
|
|
|
if (locate_info.has_locate_width() && locate_info.has_locate_height()
|
|
|
- && locate_info.has_locate_x() && locate_info.has_locate_y()
|
|
|
- && locate_info.has_locate_angle() && locate_info.has_locate_wheel_base()) {
|
|
|
+ && locate_info.has_locate_x() && locate_info.has_locate_y()
|
|
|
+ && locate_info.has_locate_angle() && locate_info.has_locate_wheel_base())
|
|
|
+ {
|
|
|
|
|
|
/*
|
|
|
* 检查消息完毕,开始处理
|
|
@@ -194,7 +198,8 @@ Error_manager Command_manager::execute_store_command(message::Store_command_requ
|
|
|
StoreProcessTask *pStore_task = (StoreProcessTask *) ptask;
|
|
|
//初始化流程
|
|
|
code = pStore_task->init_task(locate_info);
|
|
|
- if (code != SUCCESS) {
|
|
|
+ if (code != SUCCESS)
|
|
|
+ {
|
|
|
delete pStore_task;
|
|
|
error_msg.set_error_code(code.get_error_code());
|
|
|
error_msg.set_error_description(code.to_string());
|
|
@@ -252,14 +257,15 @@ Error_manager Command_manager::execute_pickup_command(message::Pickup_command_re
|
|
|
response.mutable_base_info()->CopyFrom(base_info_response);
|
|
|
response.set_terminal_id(request.terminal_id());
|
|
|
|
|
|
- if (m_thread_queue_process == nullptr) {
|
|
|
+ if (m_thread_queue_process == nullptr)
|
|
|
+ {
|
|
|
error_msg.set_error_code(ERROR);
|
|
|
error_msg.set_error_description(" xxxxx bug,线程池未初始化");
|
|
|
response.mutable_code()->CopyFrom(error_msg);
|
|
|
return Error_manager(ERROR, MINOR_ERROR, "线程池未初始化,bug");
|
|
|
}
|
|
|
|
|
|
- if(m_system_paused==true)
|
|
|
+ if (m_system_paused == true)
|
|
|
{
|
|
|
error_msg.set_error_code(PAUSE);
|
|
|
error_msg.set_error_description("急停");
|
|
@@ -268,14 +274,14 @@ Error_manager Command_manager::execute_pickup_command(message::Pickup_command_re
|
|
|
}
|
|
|
|
|
|
//判断出口是否开放
|
|
|
- if(request.terminal_id()<0 || request.terminal_id()>=m_system_setting.export_num())
|
|
|
+ if (request.terminal_id() < 0 || request.terminal_id() >= m_system_setting.export_num())
|
|
|
{
|
|
|
error_msg.set_error_code(ERROR);
|
|
|
error_msg.set_error_description(" xxxx 出口 id 设置错误");
|
|
|
response.mutable_code()->CopyFrom(error_msg);
|
|
|
return Error_manager(ERROR, MINOR_ERROR, " xxxxx出口 id 设置错误");
|
|
|
}
|
|
|
- if(m_output_entrance_paused[request.terminal_id()]!=false)
|
|
|
+ if (m_output_entrance_paused[request.terminal_id()] != false)
|
|
|
{
|
|
|
error_msg.set_error_code(ERROR);
|
|
|
error_msg.set_error_description("中控出口已停止使用");
|
|
@@ -283,18 +289,19 @@ Error_manager Command_manager::execute_pickup_command(message::Pickup_command_re
|
|
|
return Error_manager(ERROR, MINOR_ERROR, "中控出口已停止使用");
|
|
|
}
|
|
|
|
|
|
- if(request.base_info().msg_type()==message::ePickup_command_request_msg
|
|
|
- &&request.base_info().receiver()==message::eMain
|
|
|
- &&request.base_info().sender()==message::eTerminor
|
|
|
- &&request.has_car_info()) {
|
|
|
+ if (request.base_info().msg_type() == message::ePickup_command_request_msg
|
|
|
+ && request.base_info().receiver() == message::eMain
|
|
|
+ && request.base_info().sender() == message::eTerminor
|
|
|
+ && request.has_car_info())
|
|
|
+ {
|
|
|
|
|
|
response.set_terminal_id(request.terminal_id());
|
|
|
|
|
|
/*
|
|
|
* 检查各个节点是否正常
|
|
|
*/
|
|
|
- Error_manager parkspace_code= Parkspace_excutor::get_instance_pointer()->check_statu();
|
|
|
- if(parkspace_code!=SUCCESS)
|
|
|
+ Error_manager parkspace_code = Parkspace_excutor::get_instance_pointer()->check_statu();
|
|
|
+ if (parkspace_code != SUCCESS)
|
|
|
{
|
|
|
error_msg.set_error_code(parkspace_code.get_error_code());
|
|
|
error_msg.set_error_description(parkspace_code.get_error_description());
|
|
@@ -302,8 +309,8 @@ Error_manager Command_manager::execute_pickup_command(message::Pickup_command_re
|
|
|
return parkspace_code;
|
|
|
}
|
|
|
|
|
|
- Error_manager dispatch_code= Dispatch_excutor::get_instance_pointer()->check_export_statu(request.terminal_id());
|
|
|
- if(dispatch_code!=SUCCESS)
|
|
|
+ Error_manager dispatch_code = Dispatch_excutor::get_instance_pointer()->check_export_statu(request.terminal_id());
|
|
|
+ if (dispatch_code != SUCCESS)
|
|
|
{
|
|
|
error_msg.set_error_code(dispatch_code.get_error_code());
|
|
|
error_msg.set_error_description(dispatch_code.get_error_description());
|
|
@@ -313,26 +320,26 @@ Error_manager Command_manager::execute_pickup_command(message::Pickup_command_re
|
|
|
|
|
|
//一切正常,接受指令
|
|
|
Error_manager code;
|
|
|
- LOG(WARNING)<<"--------- 取 -------收到取车-----------------------------"<<request.car_info().license();
|
|
|
- Process_task* ptask=new PickupProcessTask(request.terminal_id(),request.car_info());
|
|
|
- PickupProcessTask* pPick_task=(PickupProcessTask*)ptask;
|
|
|
+ LOG(WARNING) << "--------- 取 -------收到取车-----------------------------" << request.car_info().license();
|
|
|
+ Process_task *ptask = new PickupProcessTask(request.terminal_id(), request.car_info());
|
|
|
+ PickupProcessTask *pPick_task = (PickupProcessTask *) ptask;
|
|
|
//初始化流程
|
|
|
- code=pPick_task->init_task();
|
|
|
+ code = pPick_task->init_task();
|
|
|
|
|
|
- if(code==SUCCESS)
|
|
|
+ if (code == SUCCESS)
|
|
|
{
|
|
|
m_thread_queue_process->AddTask(pPick_task);
|
|
|
return SUCCESS;
|
|
|
}
|
|
|
- usleep(1000*1000);
|
|
|
+ usleep(1000 * 1000);
|
|
|
error_msg.set_error_code(code.get_error_code());
|
|
|
error_msg.set_error_description(code.to_string());
|
|
|
response.mutable_code()->CopyFrom(error_msg);
|
|
|
- LOG(ERROR)<<"创建取车流程失败(车位查询失败),终端:"<<request.terminal_id()<<
|
|
|
- "车牌:"<<request.car_info().license()<<" "<<code.to_string();
|
|
|
+ LOG(ERROR) << "创建取车流程失败(车位查询失败),终端:" << request.terminal_id() <<
|
|
|
+ "车牌:" << request.car_info().license() << " " << code.to_string();
|
|
|
delete pPick_task;
|
|
|
Communication_message msg;
|
|
|
- msg.reset(response.base_info(),response.SerializeAsString());
|
|
|
+ msg.reset(response.base_info(), response.SerializeAsString());
|
|
|
Message_communicator::get_instance_pointer()->send_msg(&msg);
|
|
|
return code;
|
|
|
}
|
|
@@ -342,9 +349,9 @@ Error_manager Command_manager::execute_pickup_command(message::Pickup_command_re
|
|
|
error_msg.set_error_description("停车请求信息错误");
|
|
|
response.mutable_code()->CopyFrom(error_msg);
|
|
|
Communication_message msg;
|
|
|
- msg.reset(response.base_info(),response.SerializeAsString());
|
|
|
+ msg.reset(response.base_info(), response.SerializeAsString());
|
|
|
Message_communicator::get_instance_pointer()->send_msg(&msg);
|
|
|
- return Error_manager(INVALID_MESSAGE,MAJOR_ERROR,"停车请求信息错误");
|
|
|
+ return Error_manager(INVALID_MESSAGE, MAJOR_ERROR, "停车请求信息错误");
|
|
|
}
|
|
|
}
|
|
|
|