//
// Created by huli on 2020/7/2.
//

#include "system_executor.h"


System_executor::System_executor()
{

}

System_executor::~System_executor()
{
	system_executor_uninit();
}

//初始化
Error_manager System_executor::system_executor_init(int threads_size)
{
	m_thread_pool.thread_pool_init(threads_size);
	m_system_executor_status = SYSTEM_EXECUTOR_READY;
	return Error_code::SUCCESS;
}

//反初始化
Error_manager System_executor::system_executor_uninit()
{
	m_thread_pool.thread_pool_uninit();
	m_system_executor_status = SYSTEM_EXECUTOR_UNKNOW;
	return Error_code::SUCCESS;
}

//检查消息是否有效, 主要检查消息类型和接受者, 判断这条消息是不是给我的.
Error_manager System_executor::check_msg(Rabbitmq_message* p_msg)
{
	return Error_code::SUCCESS;
	/*
	if ( p_msg == NULL )
	{
		return Error_manager(Error_code::POINTER_IS_NULL, Error_level::MINOR_ERROR,
							 "  POINTER IS NULL ");
	}
	
	//检查接受人
	if ( p_msg->get_receiver() == Communication_message::Communicator::eDispatch_mamager )
	{
		//检查消息类型
		switch ( p_msg->get_message_type() )
		{
			case Communication_message::Message_type::eDispatch_request_msg:
			{
				message::Dispatch_request_msg t_dispatch_request_msg;
				//针对消息类型, 对消息进行二次解析
				if (t_dispatch_request_msg.ParseFromString(p_msg->get_message_buf()))
				{
					if ( t_dispatch_request_msg.dispatch_motion_direction() == message::Dispatch_motion_direction::E_STORE_CAR )
					{
						if ( t_dispatch_request_msg.id_struct().has_terminal_id() &&
							 t_dispatch_request_msg.mutable_id_struct()->terminal_id() == Dispatch_manager::get_instance_references().get_dispatch_manager_id()*2 ||
							 t_dispatch_request_msg.mutable_id_struct()->terminal_id() == Dispatch_manager::get_instance_references().get_dispatch_manager_id()*2+1)
						{
							return Error_code::SUCCESS;
						}
					}
					else if ( t_dispatch_request_msg.dispatch_motion_direction() == message::Dispatch_motion_direction::E_PICKUP_CAR )
					{
						if ( t_dispatch_request_msg.id_struct().has_unit_id() &&
						t_dispatch_request_msg.mutable_id_struct()->unit_id() == Dispatch_manager::get_instance_references().get_dispatch_manager_id() )
						{
							return Error_code::SUCCESS;
						}
					}
				}
				else
				{
					return Error_manager(Error_code::SYSTEM_EXECUTOR_PARSE_ERROR, Error_level::MINOR_ERROR,
										 " message::Dispatch_request_msg  ParseFromString error ");
				}
				break;
			}
			case Communication_message::Message_type::eDispatch_plan_response_msg:
			{
				return Error_code::SUCCESS;
				break;
			}
			case Communication_message::Message_type::eDispatch_control_request_msg:
			{
				return Error_code::SUCCESS;
				break;
			}
			default :
				;
				break;
		}
	}

	//检查接受人
	if ( p_msg->get_receiver() == Communication_message::Communicator::eEmpty )
	{
		//检查消息类型
		switch ( p_msg->get_message_type() )
		{
			case Communication_message::Message_type::eGround_status_msg:
			{
				message::Ground_status_msg t_ground_status_msg;
				//针对消息类型, 对消息进行二次解析
				if (t_ground_status_msg.ParseFromString(p_msg->get_message_buf()))
				{
					if ( t_ground_status_msg.mutable_id_struct()->terminal_id() == Dispatch_manager::get_instance_references().get_dispatch_manager_id()*2 ||
					t_ground_status_msg.mutable_id_struct()->terminal_id() == Dispatch_manager::get_instance_references().get_dispatch_manager_id()*2+1)
					{
						return Error_code::SUCCESS;
					}
				}
				else
				{
					return Error_manager(Error_code::SYSTEM_EXECUTOR_PARSE_ERROR, Error_level::MINOR_ERROR,
										 " message::Dispatch_request_msg  ParseFromString error ");
				}
				break;
			}
			case Communication_message::Message_type::eTerminal_status_msg:
			{
				message::Terminal_status_msg t_terminal_status_msg;
				//针对消息类型, 对消息进行二次解析
				if (t_terminal_status_msg.ParseFromString(p_msg->get_message_buf()))
				{
                    if ( t_terminal_status_msg.id_struct().terminal_id() == Dispatch_manager::get_instance_references().get_dispatch_manager_id()*2 ||
					t_terminal_status_msg.id_struct().terminal_id() == Dispatch_manager::get_instance_references().get_dispatch_manager_id()*2+1)
					{
                        return Error_code::SUCCESS;
					}
				}
				else
				{
					return Error_manager(Error_code::SYSTEM_EXECUTOR_PARSE_ERROR, Error_level::MINOR_ERROR,
										 " message::Dispatch_request_msg  ParseFromString error ");
				}
				break;
			}
			case Communication_message::Message_type::eNotify_status_msg:
			{
				message::Notify_status_msg t_notify_status_msg;

				//针对消息类型, 对消息进行二次解析
				if (t_notify_status_msg.ParseFromString(p_msg->get_message_buf()))
				{
					if ( t_notify_status_msg.mutable_id_struct()->terminal_id() == Dispatch_manager::get_instance_references().get_dispatch_manager_id()*2 ||
					t_notify_status_msg.mutable_id_struct()->terminal_id() == Dispatch_manager::get_instance_references().get_dispatch_manager_id()*2+1)
					{
						return Error_code::SUCCESS;
					}
				}
				else
				{
					return Error_manager(Error_code::SYSTEM_EXECUTOR_PARSE_ERROR, Error_level::MINOR_ERROR,
										 " message::Dispatch_request_msg  ParseFromString error ");
				}
				break;
			}
			default :
				;
				break;
		}
	}

	//无效的消息,
	return Error_manager(Error_code::INVALID_MESSAGE, Error_level::NEGLIGIBLE_ERROR,
						 " INVALID_MESSAGE error ");
						 */
}
//检查执行者的状态, 判断能否处理这条消息,
Error_manager System_executor::check_executer(Rabbitmq_message* p_msg)
{
	return Error_code::SUCCESS;
	/*
	if ( p_msg == NULL )
	{
		return Error_manager(Error_code::POINTER_IS_NULL, Error_level::MINOR_ERROR,
							 "  POINTER IS NULL ");
	}

	//检查执行线程池
	Error_manager t_executor_result = System_executor::get_instance_references().check_status();
	if (t_executor_result.get_error_level() == NEGLIGIBLE_ERROR)//一级故障,轻微故障,
	{
		std::cout << "executer_is_busy , " << std::endl;
		//返回繁忙之后, 通信模块1秒后再次调用check
		return Error_code::COMMUNICATION_EXCUTER_IS_BUSY;
	}
	else if (t_executor_result.get_error_level() > NEGLIGIBLE_ERROR)
	{
		return Error_manager(Error_code::SYSTEM_EXECUTOR_STATUS_ERROR, Error_level::MINOR_ERROR,
							"System_executor::get_instance_references().check_status(); fun error ");
	}

	//检查接受人
	if ( p_msg->get_receiver() == Communication_message::Communicator::eDispatch_mamager )
	{
		return Dispatch_manager::get_instance_references().check_execute_msg(p_msg);
	}
*/
	return Error_code::SUCCESS;

}


//处理消息的执行函数
Error_manager System_executor::execute_msg(Rabbitmq_message* p_msg)
{
	if ( p_msg == NULL )
	{
		return Error_manager(Error_code::POINTER_IS_NULL, Error_level::MINOR_ERROR,
							 "  POINTER IS NULL ");
	}


	return Dispatch_manager::get_instance_references().execute_rabbitmq_message_new(p_msg);


//	//通过key来判断消息类型
//	if ( p_msg->m_routing_key.find("count_command_signal") != p_msg->m_routing_key.npos ||
//	p_msg->m_routing_key.find("count_command_signal") != p_msg->m_routing_key.npos)
//	{
//
//	}
//	else
//	{
//	    std::cout << " huli test :::: xxxxxxxxxxxxxxxxxxxxxxx" << " p_msg = " << p_msg->m_message_buf << std::endl;
//	}



	//不用解析, 直接给调度模块


	/*
	//检查接受人
	if ( p_msg->get_receiver() == Communication_message::Communicator::eDispatch_mamager )
	{
		switch ( p_msg->get_message_type() )
		{
			case Communication_message::Message_type::eDispatch_request_msg:
			{
				message::Dispatch_request_msg t_dispatch_request_msg;
				//针对消息类型, 对消息进行二次解析
				if (t_dispatch_request_msg.ParseFromString(p_msg->get_message_buf()))
				{
					//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
					m_thread_pool.enqueue(&System_executor::execute_for_dispatch_request_msg, this,
										  t_dispatch_request_msg	);
				}
				else
				{
					return Error_manager(Error_code::SYSTEM_EXECUTOR_PARSE_ERROR, Error_level::MINOR_ERROR,
										 " message::Dispatch_request_msg  ParseFromString error ");
				}
				break;
			}
			case Communication_message::Message_type::eDispatch_plan_response_msg:
			{
				message::Dispatch_plan_response_msg t_dispatch_plan_response_msg;
				//针对消息类型, 对消息进行二次解析
				if (t_dispatch_plan_response_msg.ParseFromString(p_msg->get_message_buf()))
				{
					//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
					m_thread_pool.enqueue(&System_executor::execute_for_dispatch_plan_response_msg, this,
										  t_dispatch_plan_response_msg	);
				}
				else
				{
					return Error_manager(Error_code::SYSTEM_EXECUTOR_PARSE_ERROR, Error_level::MINOR_ERROR,
										 " message::Dispatch_request_msg  ParseFromString error ");
				}
				break;
			}
			case Communication_message::Message_type::eDispatch_control_request_msg:
			{
				message::Dispatch_control_request_msg t_dispatch_control_request_msg;
				//针对消息类型, 对消息进行二次解析
				if (t_dispatch_control_request_msg.ParseFromString(p_msg->get_message_buf()))
				{
					//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
					m_thread_pool.enqueue(&System_executor::execute_for_dispatch_control_request_msg, this,
										  t_dispatch_control_request_msg	);
				}
				else
				{
					return Error_manager(Error_code::SYSTEM_EXECUTOR_PARSE_ERROR, Error_level::MINOR_ERROR,
										 " message::Dispatch_request_msg  ParseFromString error ");
				}
				break;
			}
			default:
				break;
		}
	}


	//检查接受人
	if ( p_msg->get_receiver() == Communication_message::Communicator::eEmpty )
	{
		switch ( p_msg->get_message_type() )
		{
			case Communication_message::Message_type::eGround_status_msg:
			{
				message::Ground_status_msg t_ground_status_msg;
				//针对消息类型, 对消息进行二次解析
				if (t_ground_status_msg.ParseFromString(p_msg->get_message_buf()))
				{
					//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
					m_thread_pool.enqueue(&System_executor::execute_for_ground_status_msg, this,
										  t_ground_status_msg	);
				}
				else
				{
					return Error_manager(Error_code::SYSTEM_EXECUTOR_PARSE_ERROR, Error_level::MINOR_ERROR,
										 " message::Dispatch_request_msg  ParseFromString error ");
				}
				break;
			}
			case Communication_message::Message_type::eTerminal_status_msg:
			{
				message::Terminal_status_msg t_terminal_status_msg;
				//针对消息类型, 对消息进行二次解析
				if (t_terminal_status_msg.ParseFromString(p_msg->get_message_buf()))
				{
					//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
					m_thread_pool.enqueue(&System_executor::execute_for_terminal_status_msg, this,
										  t_terminal_status_msg	);
				}
				else
				{
					return Error_manager(Error_code::SYSTEM_EXECUTOR_PARSE_ERROR, Error_level::MINOR_ERROR,
										 " message::Dispatch_request_msg  ParseFromString error ");
				}
				break;
			}
			case Communication_message::Message_type::eNotify_status_msg:
			{
				message::Notify_status_msg t_notify_status_msg;
				//针对消息类型, 对消息进行二次解析
				if (t_notify_status_msg.ParseFromString(p_msg->get_message_buf()))
				{
					//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
					m_thread_pool.enqueue(&System_executor::execute_for_notify_status_msg, this,
										  t_notify_status_msg	);
				}
				else
				{
					return Error_manager(Error_code::SYSTEM_EXECUTOR_PARSE_ERROR, Error_level::MINOR_ERROR,
										 " message::Dispatch_request_msg  ParseFromString error ");
				}
				break;
			}
			default:
				break;
		}
	}
*/

	return Error_code::SUCCESS;
}

//检查状态
Error_manager System_executor::check_status()
{
	if ( m_system_executor_status == SYSTEM_EXECUTOR_READY )
	{
		if ( m_thread_pool.thread_is_full_load() == false )
		{
		    return Error_code::SUCCESS;
		}
		else
		{
		    return Error_manager(Error_code::SYSTEM_EXECUTOR_STATUS_BUSY, Error_level::NEGLIGIBLE_ERROR,
		    					" System_executor::check_status error ");
		}
	}
	else
	{
		return Error_manager(Error_code::SYSTEM_EXECUTOR_STATUS_ERROR, Error_level::MINOR_ERROR,
							" System_executor::check_status error ");
	}
}

//定时发送状态信息
Error_manager System_executor::encapsulate_send_status()
{
	Error_manager t_error;
return Error_code::SUCCESS;

	int t_dispatch_manager_id = Dispatch_manager::get_instance_references().get_dispatch_manager_id();
	std::string t_msg;
/*
	//创建一条 调度管理总管理的状态
	message::Dispatch_manager_status_msg t_dispatch_manager_status_msg;
	t_dispatch_manager_status_msg.mutable_base_info()->set_msg_type(message::Message_type::eDispatch_manager_status_msg);
	t_dispatch_manager_status_msg.mutable_base_info()->set_timeout_ms(5000);
	t_dispatch_manager_status_msg.mutable_base_info()->set_sender(message::Communicator::eDispatch);
	t_dispatch_manager_status_msg.mutable_base_info()->set_receiver(message::Communicator::eMain);

	t_dispatch_manager_status_msg.set_dispatch_id(t_dispatch_id);

	Dispatch_manager::Dispatch_manager_status t_dispatch_manager_status = Dispatch_manager::get_instance_references().get_dispatch_manager_status();
	t_dispatch_manager_status_msg.set_dispatch_manager_status((message::Dispatch_manager_status)t_dispatch_manager_status);

	t_msg = t_dispatch_manager_status_msg.SerializeAsString();
	System_communication::get_instance_references().encapsulate_msg(t_msg);
*/

/*
	//创建4条 调度模块终端出入口的状态
	message::Dispatch_terminal_status_msg t_dispatch_terminal_status_msg;
	t_dispatch_terminal_status_msg.mutable_base_info()->set_msg_type(message::Message_type::eDispatch_status_msg);
	t_dispatch_terminal_status_msg.mutable_base_info()->set_timeout_ms(5000);
	t_dispatch_terminal_status_msg.mutable_base_info()->set_sender(message::Communicator::eDispatch_manager);
	t_dispatch_terminal_status_msg.mutable_base_info()->set_receiver(message::Communicator::eMain);
	t_dispatch_terminal_status_msg.set_terminal_id(t_dispatch_manager_id*2+0);
	t_dispatch_terminal_status_msg.set_terminal_status(message::Terminal_status::E_TERMINAL_READY);
	t_dispatch_terminal_status_msg.set_passageway_direction(message::Passageway_direction::E_INLET);
	t_msg = t_dispatch_terminal_status_msg.SerializeAsString();
	System_communication::get_instance_references().encapsulate_msg(t_msg);

	t_dispatch_terminal_status_msg.mutable_base_info()->set_msg_type(message::Message_type::eDispatch_status_msg);
	t_dispatch_terminal_status_msg.mutable_base_info()->set_timeout_ms(5000);
	t_dispatch_terminal_status_msg.mutable_base_info()->set_sender(message::Communicator::eDispatch_manager);
	t_dispatch_terminal_status_msg.mutable_base_info()->set_receiver(message::Communicator::eMain);
	t_dispatch_terminal_status_msg.set_terminal_id(t_dispatch_manager_id*2+0);
	t_dispatch_terminal_status_msg.set_terminal_status(message::Terminal_status::E_TERMINAL_READY);
	t_dispatch_terminal_status_msg.set_passageway_direction(message::Passageway_direction::E_OUTLET);
	t_msg = t_dispatch_terminal_status_msg.SerializeAsString();
	System_communication::get_instance_references().encapsulate_msg(t_msg);

	t_dispatch_terminal_status_msg.mutable_base_info()->set_msg_type(message::Message_type::eDispatch_status_msg);
	t_dispatch_terminal_status_msg.mutable_base_info()->set_timeout_ms(5000);
	t_dispatch_terminal_status_msg.mutable_base_info()->set_sender(message::Communicator::eDispatch_manager);
	t_dispatch_terminal_status_msg.mutable_base_info()->set_receiver(message::Communicator::eMain);
	t_dispatch_terminal_status_msg.set_terminal_id(t_dispatch_manager_id*2+1);
	t_dispatch_terminal_status_msg.set_terminal_status(message::Terminal_status::E_TERMINAL_READY);
	t_dispatch_terminal_status_msg.set_passageway_direction(message::Passageway_direction::E_INLET);
	t_msg = t_dispatch_terminal_status_msg.SerializeAsString();
	System_communication::get_instance_references().encapsulate_msg(t_msg);

	t_dispatch_terminal_status_msg.mutable_base_info()->set_msg_type(message::Message_type::eDispatch_status_msg);
	t_dispatch_terminal_status_msg.mutable_base_info()->set_timeout_ms(5000);
	t_dispatch_terminal_status_msg.mutable_base_info()->set_sender(message::Communicator::eDispatch_manager);
	t_dispatch_terminal_status_msg.mutable_base_info()->set_receiver(message::Communicator::eMain);
	t_dispatch_terminal_status_msg.set_terminal_id(t_dispatch_manager_id*2+1);
	t_dispatch_terminal_status_msg.set_terminal_status(message::Terminal_status::E_TERMINAL_READY);
	t_dispatch_terminal_status_msg.set_passageway_direction(message::Passageway_direction::E_OUTLET);
	t_msg = t_dispatch_terminal_status_msg.SerializeAsString();
	System_communication::get_instance_references().encapsulate_msg(t_msg);

 */
	return Error_code::SUCCESS;
}

//定时发送 调度管理的状态
Error_manager System_executor::encapsulate_send_dispatch_manager_status()
{
//	return Dispatch_manager::get_instance_references().encapsulate_send_dispatch_manager_status();
	return Dispatch_manager::get_instance_references().encapsulate_send_dispatch_manager_status_new();
}


//判断是否为待机，如果已经准备好，则可以执行任务。
bool System_executor::is_ready()
{
	if ( m_system_executor_status == SYSTEM_EXECUTOR_READY && m_thread_pool.thread_is_full_load() == false )
	{
	    return true;
	}
	else
	{
		return false;
	}
}

System_executor::System_executor_status System_executor::get_system_executor_status()
{
	return m_system_executor_status;
}




//雷达感测定位 的处理函数
//input::command_id, 消息指令id, 由主控制系统生成的唯一码
//input::command_id, 终端id, 对应具体的某个车位
//return::void, 没有返回, 执行结果直接生成一条答复消息, 然后通过通信返回
//void System_executor::execute_for_measure(std::string command_key, int unit_id, int terminal_id)
//{
//	Error_manager t_error;
//
//	LOG(INFO) << " System_executor::execute_for_measure run "<< this;
//	//这里要处理.......以后再写
//
//	//创建一条答复消息
//	message::Measure_response_msg t_measure_response_msg;
//	t_measure_response_msg.mutable_base_info()->set_msg_type(message::Message_type::eLocate_response_msg);
//	t_measure_response_msg.mutable_base_info()->set_timeout_ms(5000);
//	t_measure_response_msg.mutable_base_info()->set_sender(message::Communicator::eMeasurer);
//	t_measure_response_msg.mutable_base_info()->set_receiver(message::Communicator::eMain);
//
//	t_measure_response_msg.set_command_key(command_key);
//	t_measure_response_msg.mutable_id_struct()->set_unit_id(unit_id);
//	t_measure_response_msg.mutable_id_struct()->set_terminal_id(terminal_id);
//	t_measure_response_msg.mutable_error_manager()->set_error_code(t_error.get_error_code());
//	t_measure_response_msg.mutable_error_manager()->set_error_level((message::Error_level)t_error.get_error_level());
//	t_measure_response_msg.mutable_error_manager()->set_error_description(t_error.get_error_description());
//
//	t_measure_response_msg.mutable_locate_information()->set_locate_x(0);
//	t_measure_response_msg.mutable_locate_information()->set_locate_y(0);
//	t_measure_response_msg.mutable_locate_information()->set_locate_angle(0);
//	t_measure_response_msg.mutable_locate_information()->set_locate_length(0);
//	t_measure_response_msg.mutable_locate_information()->set_locate_width(0);
//	t_measure_response_msg.mutable_locate_information()->set_locate_height(0);
//	t_measure_response_msg.mutable_locate_information()->set_locate_wheel_base(0);
//	t_measure_response_msg.mutable_locate_information()->set_locate_wheel_width(0);
//	t_measure_response_msg.mutable_locate_information()->set_locate_correct(0);
//
//	std::string t_msg = t_measure_response_msg.SerializeAsString();
//	System_communication::get_instance_references().encapsulate_task_msg(t_msg);
//	LOG(INFO) << " System_executor::execute_for_measure end "<< this;
//
//	return ;
//}
//
//
////调度模块的处理函数
//void System_executor::execute_for_dispatch(std::string command_key, Dispatch_manager::Dispatch_motion_direction dispatch_motion_direction,
//										   int terminal_id, int parkspace_id, Locate_information * p_locate_information)
//{
//	Error_manager t_error;
//
//	LOG(INFO) << " System_executor::execute_for_dispatch run "<< this;
//	//这里要处理.......以后再写
//
//	t_error = Dispatch_manager::get_instance_references().execute_task(dispatch_motion_direction);
//
//	//创建一条答复消息
//	message::Dispatch_response_msg t_dispatch_response_msg;
//	t_dispatch_response_msg.mutable_base_info()->set_msg_type(message::Message_type::eDispatch_response_msg);
//	t_dispatch_response_msg.mutable_base_info()->set_timeout_ms(5000);
//	t_dispatch_response_msg.mutable_base_info()->set_sender(message::Communicator::eDispatch_manager);
//	t_dispatch_response_msg.mutable_base_info()->set_receiver(message::Communicator::eMain);
//
//	t_dispatch_response_msg.set_command_key(command_key);
//	t_dispatch_response_msg.mutable_error_manager()->set_error_code(t_error.get_error_code());
//	t_dispatch_response_msg.mutable_error_manager()->set_error_level((message::Error_level)t_error.get_error_level());
//	t_dispatch_response_msg.mutable_error_manager()->set_error_description(t_error.get_error_description());
//
//	std::string t_msg = t_dispatch_response_msg.SerializeAsString();
//	System_communication::get_instance_references().encapsulate_task_msg(t_msg);
//
//	std::cout << "huli test dispatch_motion_direction = " << dispatch_motion_direction << std::endl;
//	std::cout << "huli test error = " << t_error << std::endl;
//
//
//	LOG(INFO) << " System_executor::execute_for_dispatch end "<< this;
//	return ;
//
//}
//
////调度模块的处理函数
//void System_executor::execute_for_dispatch_request_msg(message::Dispatch_request_msg dispatch_request_msg)
//{
//	Error_manager t_error;
//	t_error = Dispatch_manager::get_instance_references().execute_for_dispatch_request_msg(dispatch_request_msg);
//	if ( t_error != Error_code::SUCCESS )
//	{
//		LOG(INFO) << " System_executor::execute_for_dispatch_request_msg fun error "<< this;
//		LOG(INFO) << t_error.to_string() << "   "<< this;
//	}
//	return;
//}
////调度模块 //调度总规划的答复(调度算法->调度管理)
//void System_executor::execute_for_dispatch_plan_response_msg(message::Dispatch_plan_response_msg dispatch_plan_response_msg)
//{
//	Error_manager t_error;
//	t_error = Dispatch_manager::get_instance_references().execute_for_dispatch_plan_response_msg(dispatch_plan_response_msg);
//	if ( t_error != Error_code::SUCCESS )
//	{
//		LOG(INFO) << " System_executor::execute_for_dispatch_request_msg fun error "<< this;
//		LOG(INFO) << t_error.to_string() << "   "<< this;
//	}
//	return;
//}
////调度模块 //调度控制的任务请求(调度算法->调度管理)
//void System_executor::execute_for_dispatch_control_request_msg(message::Dispatch_control_request_msg dispatch_control_request_msg)
//{
//	Error_manager t_error;
//	t_error = Dispatch_manager::get_instance_references().execute_for_dispatch_control_request_msg(dispatch_control_request_msg);
//	if ( t_error != Error_code::SUCCESS )
//	{
//		LOG(INFO) << " System_executor::execute_for_dispatch_request_msg fun error "<< this;
//		LOG(INFO) << t_error.to_string() << "   "<< this;
//	}
//	return;
//}
//
////地面雷达的状态消息(地面雷达->null)
//void System_executor::execute_for_ground_status_msg(message::Ground_status_msg ground_status_msg)
//{
//	Error_manager t_error;
//	t_error = Dispatch_manager::get_instance_references().execute_for_ground_status_msg(ground_status_msg);
//	if ( t_error != Error_code::SUCCESS )
//	{
//		LOG(INFO) << " System_executor::execute_for_dispatch_request_msg fun error "<< this;
//		LOG(INFO) << t_error.to_string() << "   "<< this;
//	}
//	return ;
//}
//
////地面雷达的状态消息(地面雷达->null)
//void System_executor::execute_for_terminal_status_msg(message::Terminal_status_msg terminal_status_msg)
//{
//	Error_manager t_error;
//	t_error = Dispatch_manager::get_instance_references().execute_for_singlechip_data_msg(terminal_status_msg.singlechipdata(), terminal_status_msg.singlechip_validity());
//	if ( t_error != Error_code::SUCCESS )
//	{
//		LOG(INFO) << " System_executor::execute_for_singlechip_data_msg fun error "<< this;
//		LOG(INFO) << t_error.to_string() << "   "<< this;
//	}
//	return ;
//}
//
////调度模块 ///单片机的状态消息
//void System_executor::execute_for_notify_status_msg(message::Notify_status_msg notify_status_msg)
//{
//  //  LOG(INFO) << "notify_status_msg = " << notify_status_msg.DebugString()<< this;
//
//
//    Error_manager t_error;
//	t_error = Dispatch_manager::get_instance_references().execute_for_singlechip_data_msg(notify_status_msg.singlechipdata(), notify_status_msg.singlechip_validity());
//	if ( t_error != Error_code::SUCCESS )
//	{
//		LOG(INFO) << " System_executor::execute_for_singlechip_data_msg fun error "<< this;
//		LOG(INFO) << t_error.to_string() << "   "<< this;
//	}
//	return ;
//}

