Преглед на файлове

20211125, outlet unit id

huli преди 3 години
родител
ревизия
5fd55ada7c
променени са 2 файла, в които са добавени 17 реда и са изтрити 1 реда
  1. 15 1
      dispatch/dispatch_plc.cpp
  2. 2 0
      dispatch/dispatch_plc.h

+ 15 - 1
dispatch/dispatch_plc.cpp

@@ -174,6 +174,7 @@ void Dispatch_plc::execute_thread_fun()
 							//判断2个出口是否空闲
 							if ( Dispatch_manager::get_instance_references().m_dispatch_singlechip[2].is_outlet_ready() )
 							{
+								m_outlet_id = 0;
 								//封装 给plc的调度请求
 								m_result = encapsulate_dispatch_request_to_plc(0);
 								if ( m_result == Error_code::SUCCESS )
@@ -187,6 +188,7 @@ void Dispatch_plc::execute_thread_fun()
 							}
 							else if ( Dispatch_manager::get_instance_references().m_dispatch_singlechip[3].is_outlet_ready() )
 							{
+								m_outlet_id = 1;
 								//封装 给plc的调度请求
 								m_result = encapsulate_dispatch_request_to_plc(1);
 								if ( m_result == Error_code::SUCCESS )
@@ -567,7 +569,19 @@ Error_manager Dispatch_plc::send_dispatch_response_to_main_control()
 	m_dispatch_response_msg.set_command_key(m_dispatch_request_msg.command_key());
 
 	m_dispatch_response_msg.set_dispatch_motion_direction(m_dispatch_request_msg.dispatch_motion_direction());
-	m_dispatch_response_msg.set_terminal_id(m_dispatch_request_msg.terminal_id());
+
+	//need,need
+	if ( m_dispatch_request_msg.dispatch_motion_direction() == message::Dispatch_motion_direction::E_STORE_CAR )
+	{
+		m_dispatch_response_msg.set_terminal_id(m_dispatch_request_msg.terminal_id());
+
+	}
+	else if( m_dispatch_request_msg.dispatch_motion_direction() == message::Dispatch_motion_direction::E_PICKUP_CAR )
+	{
+		m_dispatch_response_msg.set_terminal_id(m_dispatch_request_msg.terminal_id()*2+m_outlet_id);
+	}
+
+//	m_dispatch_response_msg.set_terminal_id(m_dispatch_request_msg.terminal_id());
 	m_dispatch_response_msg.mutable_locate_information()->CopyFrom(m_dispatch_request_msg.locate_information());
 	m_dispatch_response_msg.mutable_parkspace_info_ex()->CopyFrom(m_dispatch_request_msg.parkspace_info_ex());
 	m_dispatch_response_msg.set_car_type(m_dispatch_request_msg.car_type());

+ 2 - 0
dispatch/dispatch_plc.h

@@ -178,6 +178,8 @@ protected://member variable
 	std::chrono::system_clock::time_point			m_status_updata_time;	//状态更新时间点
 	unsigned char									m_last_heartbeat;			//上一次的心跳
 
+	int 	m_outlet_id;
+
 private:
 
 };