浏览代码

20220107, dispatch status

huli 3 年之前
父节点
当前提交
f2c937dc87

+ 158 - 21
dispatch/dispatch_manager.cpp

@@ -212,10 +212,12 @@ Error_manager Dispatch_manager::execute_for_dispatch_request_msg(message::Dispat
 	if ( dispatch_request_msg.dispatch_motion_direction() == message::Dispatch_motion_direction::E_STORE_CAR )
 	{
 		m_dispatch_request_store_list.push_back(dispatch_request_msg);
+		m_store_updata_time = std::chrono::system_clock::now();
 	}
 	else
 	{
 		m_dispatch_request_pickup_list.push_back(dispatch_request_msg);
+		m_pickup_updata_time = std::chrono::system_clock::now();
 	}
 
 
@@ -283,30 +285,130 @@ Error_manager Dispatch_manager::encapsulate_send_dispatch_manager_status()
 	t_dispatch_terminal_status_msg.mutable_base_info()->set_receiver(message::Communicator::eEmpty);
 
 	t_dispatch_terminal_status_msg.mutable_id_struct()->set_unit_id(t_dispatch_manager_id);
-	t_dispatch_terminal_status_msg.set_terminal_status(message::Terminal_status::E_TERMINAL_READY);
+	t_dispatch_terminal_status_msg.set_terminal_status(message::Terminal_status(m_dispatch_manager_status));
 	t_dispatch_terminal_status_msg.set_passageway_direction(message::Passageway_direction::E_BILATERAL);
 
+
+	//E_DISPATCH_POCESS_OVER
+	{
+		std::unique_lock<std::mutex> t_lock(m_lock);
+		for (auto iter = m_dispatch_response_store_map.begin(); iter != m_dispatch_response_store_map.end(); ++iter)
+		{
+			message::Dispatch_process_information * tp_dispatch_process_information =
+			t_dispatch_terminal_status_msg.mutable_dispatch_store_process_information_vector()->Add();
+			tp_dispatch_process_information->set_car_numberplate(iter->second.parkspace_info_ex(0).car_info().car_numberplate());
+			tp_dispatch_process_information->set_command_key(iter->second.command_key());
+			tp_dispatch_process_information->set_dispatch_motion_direction(iter->second.dispatch_motion_direction());
+			tp_dispatch_process_information->mutable_id_struct()->CopyFrom(iter->second.id_struct());
+			tp_dispatch_process_information->mutable_locate_information()->CopyFrom(iter->second.locate_information());
+			tp_dispatch_process_information->mutable_parkspace_info_ex()->CopyFrom(iter->second.parkspace_info_ex());
+			tp_dispatch_process_information->set_car_type(iter->second.car_type());
+
+			tp_dispatch_process_information->set_dispatch_process_status(message::Dispatch_process_status::E_DISPATCH_POCESS_OVER);
+		}
+		for (auto iter = m_dispatch_response_pickup_map.begin(); iter != m_dispatch_response_pickup_map.end(); ++iter)
+		{
+			message::Dispatch_process_information * tp_dispatch_process_information =
+			t_dispatch_terminal_status_msg.mutable_dispatch_pickup_process_information_vector()->Add();
+			tp_dispatch_process_information->set_car_numberplate(iter->second.parkspace_info_ex(0).car_info().car_numberplate());
+			tp_dispatch_process_information->set_command_key(iter->second.command_key());
+			tp_dispatch_process_information->set_dispatch_motion_direction(iter->second.dispatch_motion_direction());
+			tp_dispatch_process_information->mutable_id_struct()->CopyFrom(iter->second.id_struct());
+			tp_dispatch_process_information->mutable_locate_information()->CopyFrom(iter->second.locate_information());
+			tp_dispatch_process_information->mutable_parkspace_info_ex()->CopyFrom(iter->second.parkspace_info_ex());
+			tp_dispatch_process_information->set_car_type(iter->second.car_type());
+
+			tp_dispatch_process_information->set_dispatch_process_status(message::Dispatch_process_status::E_DISPATCH_POCESS_OVER);
+		}
+	}
+
+	//E_DISPATCH_POCESS_WORKING
+	{
+		if ( m_dispatch_plc.get_dispatch_plc_status() == Dispatch_plc::Dispatch_plc_status::DISPATCH_PLC_REQUEST ||
+		m_dispatch_plc.get_dispatch_plc_status() == Dispatch_plc::Dispatch_plc_status::DISPATCH_PLC_WORKING||
+		m_dispatch_plc.get_dispatch_plc_status() == Dispatch_plc::Dispatch_plc_status::DISPATCH_PLC_BUSY)
+		{
+			message::Dispatch_request_msg t_dispatch_request_msg = m_dispatch_plc.get_dispatch_request_msg();
+			if ( t_dispatch_request_msg.dispatch_motion_direction() == message::Dispatch_motion_direction::E_STORE_CAR )
+			{
+				message::Dispatch_process_information * tp_dispatch_process_information =
+				t_dispatch_terminal_status_msg.mutable_dispatch_store_process_information_vector()->Add();
+				tp_dispatch_process_information->set_car_numberplate(t_dispatch_request_msg.parkspace_info_ex(0).car_info().car_numberplate());
+				tp_dispatch_process_information->set_command_key(t_dispatch_request_msg.command_key());
+				tp_dispatch_process_information->set_dispatch_motion_direction(t_dispatch_request_msg.dispatch_motion_direction());
+				tp_dispatch_process_information->mutable_id_struct()->CopyFrom(t_dispatch_request_msg.id_struct());
+				tp_dispatch_process_information->mutable_locate_information()->CopyFrom(t_dispatch_request_msg.locate_information());
+				tp_dispatch_process_information->mutable_parkspace_info_ex()->CopyFrom(t_dispatch_request_msg.parkspace_info_ex());
+				tp_dispatch_process_information->set_car_type(t_dispatch_request_msg.car_type());
+
+				tp_dispatch_process_information->set_dispatch_process_status(message::Dispatch_process_status::E_DISPATCH_POCESS_WORKING);
+			}
+			else
+			{
+				message::Dispatch_process_information * tp_dispatch_process_information =
+				t_dispatch_terminal_status_msg.mutable_dispatch_pickup_process_information_vector()->Add();
+				tp_dispatch_process_information->set_car_numberplate(t_dispatch_request_msg.parkspace_info_ex(0).car_info().car_numberplate());
+				tp_dispatch_process_information->set_command_key(t_dispatch_request_msg.command_key());
+				tp_dispatch_process_information->set_dispatch_motion_direction(t_dispatch_request_msg.dispatch_motion_direction());
+				tp_dispatch_process_information->mutable_id_struct()->CopyFrom(t_dispatch_request_msg.id_struct());
+				tp_dispatch_process_information->mutable_locate_information()->CopyFrom(t_dispatch_request_msg.locate_information());
+				tp_dispatch_process_information->mutable_parkspace_info_ex()->CopyFrom(t_dispatch_request_msg.parkspace_info_ex());
+				tp_dispatch_process_information->set_car_type(t_dispatch_request_msg.car_type());
+
+				tp_dispatch_process_information->set_dispatch_process_status(message::Dispatch_process_status::E_DISPATCH_POCESS_WORKING);
+			}
+		}
+	}
+
+	//E_DISPATCH_POCESS_WAIT
+	{
+		std::unique_lock<std::mutex> t_lock(m_lock);
+		int t_store_wait_number = 1;
+		for (auto iter = m_dispatch_request_store_list.begin(); iter != m_dispatch_request_store_list.end(); ++iter)
+		{
+			message::Dispatch_process_information * tp_dispatch_process_information =
+			t_dispatch_terminal_status_msg.mutable_dispatch_store_process_information_vector()->Add();
+			tp_dispatch_process_information->set_car_numberplate(iter->parkspace_info_ex(0).car_info().car_numberplate());
+			tp_dispatch_process_information->set_command_key(iter->command_key());
+			tp_dispatch_process_information->set_dispatch_motion_direction(iter->dispatch_motion_direction());
+			tp_dispatch_process_information->mutable_id_struct()->CopyFrom(iter->id_struct());
+			tp_dispatch_process_information->mutable_locate_information()->CopyFrom(iter->locate_information());
+			tp_dispatch_process_information->mutable_parkspace_info_ex()->CopyFrom(iter->parkspace_info_ex());
+			tp_dispatch_process_information->set_car_type(iter->car_type());
+
+			tp_dispatch_process_information->set_dispatch_process_status(message::Dispatch_process_status::E_DISPATCH_POCESS_WAIT);
+			tp_dispatch_process_information->set_m_wait_number(t_store_wait_number);
+			t_store_wait_number++;
+		}
+		int t_pickup_wait_number = 1;
+		for (auto iter = m_dispatch_request_pickup_list.begin(); iter != m_dispatch_request_pickup_list.end(); ++iter)
+		{
+			message::Dispatch_process_information * tp_dispatch_process_information =
+			t_dispatch_terminal_status_msg.mutable_dispatch_pickup_process_information_vector()->Add();
+			tp_dispatch_process_information->set_car_numberplate(iter->parkspace_info_ex(0).car_info().car_numberplate());
+			tp_dispatch_process_information->set_command_key(iter->command_key());
+			tp_dispatch_process_information->set_dispatch_motion_direction(iter->dispatch_motion_direction());
+			tp_dispatch_process_information->mutable_id_struct()->CopyFrom(iter->id_struct());
+			tp_dispatch_process_information->mutable_locate_information()->CopyFrom(iter->locate_information());
+			tp_dispatch_process_information->mutable_parkspace_info_ex()->CopyFrom(iter->parkspace_info_ex());
+			tp_dispatch_process_information->set_car_type(iter->car_type());
+
+			tp_dispatch_process_information->set_dispatch_process_status(message::Dispatch_process_status::E_DISPATCH_POCESS_WAIT);
+			tp_dispatch_process_information->set_m_wait_number(t_pickup_wait_number);
+			t_pickup_wait_number++;
+		}
+	}
+
+	std::string t_store_updata_time = Time_tool::get_instance_references().get_time_string_millisecond(m_store_updata_time);
+	std::string t_pickup_updata_time = Time_tool::get_instance_references().get_time_string_millisecond(m_pickup_updata_time);
+
+	t_dispatch_terminal_status_msg.set_dispatch_store_process_information_updata_time(t_store_updata_time);
+	t_dispatch_terminal_status_msg.set_dispatch_pickup_process_information_updata_time(t_pickup_updata_time);
+
+
 	t_msg1 = t_dispatch_terminal_status_msg.SerializeAsString();
 	System_communication::get_instance_references().encapsulate_msg(t_msg1);
-/*
-	std::string t_msg2;
-	//创建一条 调度管理总管理的状态  新版
-	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_manager);
-	t_dispatch_manager_status_msg.mutable_base_info()->set_receiver(message::Communicator::eEmpty);
-
-	t_dispatch_manager_status_msg.set_dispatch_id(t_dispatch_manager_id*2);
-	Dispatch_manager::Dispatch_manager_status t_dispatch_manager_status = get_dispatch_manager_status();
-	t_dispatch_manager_status_msg.set_dispatch_manager_status((message::Dispatch_manager_status)t_dispatch_manager_status);
-
-	t_msg2 = t_dispatch_manager_status_msg.SerializeAsString();
-	System_communication::get_instance_references().encapsulate_msg(t_msg2);
-	t_dispatch_manager_status_msg.set_dispatch_id(t_dispatch_manager_id*2+1);
-	t_msg2 = t_dispatch_manager_status_msg.SerializeAsString();
-	System_communication::get_instance_references().encapsulate_msg(t_msg2);
-*/
+
 
 	return Error_code::SUCCESS;
 }
@@ -382,7 +484,7 @@ void Dispatch_manager::resource_allocation()
 			std::this_thread::yield();
 			std::unique_lock<std::mutex> t_lock(m_lock);
 
-
+			//sort    resource_allocation
 			if ( m_dispatch_plc.get_dispatch_plc_status() == Dispatch_plc::Dispatch_plc_status::DISPATCH_PLC_READY )
 			{
 				if ( m_dispatch_motion_direction_next == Common_data::Dispatch_motion_direction::DISPATCH_MOTION_DIRECTION_PICKUP)
@@ -392,6 +494,7 @@ void Dispatch_manager::resource_allocation()
 					{
 						m_dispatch_plc.execute_for_dispatch_request_msg(*iter);
 						m_dispatch_request_pickup_list.erase(iter);
+						m_store_updata_time = std::chrono::system_clock::now();
 					}
 					m_dispatch_motion_direction_next = Common_data::Dispatch_motion_direction::DISPATCH_MOTION_DIRECTION_STORE;
 				}
@@ -402,6 +505,7 @@ void Dispatch_manager::resource_allocation()
 					{
 						m_dispatch_plc.execute_for_dispatch_request_msg(*iter);
 						m_dispatch_request_store_list.erase(iter);
+						m_pickup_updata_time = std::chrono::system_clock::now();
 					}
 					m_dispatch_motion_direction_next = Common_data::Dispatch_motion_direction::DISPATCH_MOTION_DIRECTION_PICKUP;
 				}
@@ -409,8 +513,41 @@ void Dispatch_manager::resource_allocation()
 				{
 					///////
 				}
+			}
 
+
+			//store finish check and erese
+			for (auto iter = m_dispatch_response_store_map.begin(); iter != m_dispatch_response_store_map.end();)
+			{
+			    if ( std::chrono::system_clock::now() - iter->first  >  std::chrono::seconds(10) )
+			    {
+					iter = m_dispatch_response_store_map.erase(iter);
+					m_store_updata_time = std::chrono::system_clock::now();
+			    }
+			    else
+			    {
+					++iter;
+			    }
 			}
+
+			//pickup finish check and erese       //判断2个出口是否空闲
+			if ( Dispatch_manager::get_instance_references().m_dispatch_singlechip[2].is_outlet_ready() )
+			{
+				if ( m_dispatch_response_pickup_map.find(0) != m_dispatch_response_pickup_map.end() )
+				{
+					m_dispatch_response_pickup_map.erase(0);
+					m_pickup_updata_time = std::chrono::system_clock::now();
+				}
+			}
+			else if ( Dispatch_manager::get_instance_references().m_dispatch_singlechip[3].is_outlet_ready() )
+			{
+				if ( m_dispatch_response_pickup_map.find(1) != m_dispatch_response_pickup_map.end() )
+				{
+					m_dispatch_response_pickup_map.erase(1);
+					m_pickup_updata_time = std::chrono::system_clock::now();
+				}
+			}
+
 		}
 	}
 

+ 8 - 1
dispatch/dispatch_manager.h

@@ -71,7 +71,7 @@ public:
 		E_DISPATCH_MANAGER_STORE                = 2,    //正在存车
 		E_DISPATCH_MANAGER_PICKUP               = 3,    //正在取车
 
-		E_DISPATCH_MANAGER_FAULT               = 100,    //故障
+		E_DISPATCH_MANAGER_FAULT               = 10,  //故障
 	};
 
 	//调度方向, 停车取车
@@ -164,6 +164,13 @@ public://member variable
 	std::list<message::Dispatch_request_msg>				m_dispatch_request_pickup_list;					//取车请求指令的list, 内存由线程池管理
 	Common_data::Dispatch_motion_direction					m_dispatch_motion_direction_next;				//下一次的调度方向, 保证存车取车交替进行
 
+
+	std::map<std::chrono::system_clock::time_point , message::Dispatch_response_msg>
+															m_dispatch_response_store_map;					//存车dafu de map, 内存由线程池管理, time_point
+	std::map<int , message::Dispatch_response_msg>			m_dispatch_response_pickup_map;					//取车dafu de map, 内存由线程池管理, int:outlet_id
+	std::chrono::system_clock::time_point					m_store_updata_time;									//
+	std::chrono::system_clock::time_point					m_pickup_updata_time;									//
+
 	//调度总管理的线程, 负责资源分配
 	std::thread*                        		m_dispatch_manager_thread;        	//调度总管理的线程, 总控全局, 控制每个流程的先后顺序, 并合理的分配资源.
 	Thread_condition				    		m_dispatch_manager_condition;		//调度总管理的条件变量, 总控全局, 控制每个流程的先后顺序, 并合理的分配资源.

+ 50 - 15
dispatch/dispatch_plc.cpp

@@ -76,19 +76,19 @@ Error_manager Dispatch_plc::execute_for_dispatch_request_msg(message::Dispatch_r
 
 
 		m_dispatch_request_msg = dispatch_request_msg;
-		if ( dispatch_request_msg.dispatch_motion_direction() == message::Dispatch_motion_direction::E_STORE_CAR )
-		{
-			m_dispatch_process_type = Common_data::Dispatch_process_type::DISPATCH_PROCESS_STORE;
-		}
-		else if ( dispatch_request_msg.dispatch_motion_direction() == message::Dispatch_motion_direction::E_PICKUP_CAR )
-		{
-			m_dispatch_process_type = Common_data::Dispatch_process_type::DISPATCH_PROCESS_PICKUP;
-		}
-		else
-		{
-			return Error_manager(Error_code::DISPATCH_PLC_REQUEST_ERROR, Error_level::MINOR_ERROR,
-								 " dispatch_request_msg.dispatch_motion_direction() PARAMRTER ERROR ");
-		}
+//		if ( dispatch_request_msg.dispatch_motion_direction() == message::Dispatch_motion_direction::E_STORE_CAR )
+//		{
+//			m_dispatch_process_type = Common_data::Dispatch_process_type::DISPATCH_PROCESS_STORE;
+//		}
+//		else if ( dispatch_request_msg.dispatch_motion_direction() == message::Dispatch_motion_direction::E_PICKUP_CAR )
+//		{
+//			m_dispatch_process_type = Common_data::Dispatch_process_type::DISPATCH_PROCESS_PICKUP;
+//		}
+//		else
+//		{
+//			return Error_manager(Error_code::DISPATCH_PLC_REQUEST_ERROR, Error_level::MINOR_ERROR,
+//								 " dispatch_request_msg.dispatch_motion_direction() PARAMRTER ERROR ");
+//		}
 
 		m_dispatch_process_type = Common_data::Dispatch_process_type::DISPATCH_PROCESS_TYPE_UNKNOW;
 		m_dispatch_plc_status = Dispatch_plc::Dispatch_plc_status::DISPATCH_PLC_REQUEST;
@@ -108,6 +108,12 @@ Dispatch_plc::Dispatch_plc_status Dispatch_plc::get_dispatch_plc_status()
 	return m_dispatch_plc_status;
 }
 
+message::Dispatch_request_msg Dispatch_plc::get_dispatch_request_msg()
+{
+	std::unique_lock<std::mutex> t_lock(m_lock);
+	return m_dispatch_request_msg;
+}
+
 void Dispatch_plc::clear_request_msg()
 {
     m_request_key.clear();                //请求唯一码, 用作识别
@@ -320,6 +326,20 @@ void Dispatch_plc::execute_thread_fun()
 
 					if ( m_result == Error_code::SUCCESS )
 					{
+						//response add to  _map
+						if ( m_dispatch_request_msg.dispatch_motion_direction() == message::Dispatch_motion_direction::E_STORE_CAR )
+						{
+							std::unique_lock<std::mutex> t_lock(Dispatch_manager::get_instance_references().m_lock);
+							std::chrono::system_clock::time_point t_time = std::chrono::system_clock::now();
+							Dispatch_manager::get_instance_references().m_dispatch_response_store_map[t_time] = m_dispatch_response_msg;
+							Dispatch_manager::get_instance_references().m_store_updata_time = std::chrono::system_clock::now();
+						}
+						else if( m_dispatch_request_msg.dispatch_motion_direction() == message::Dispatch_motion_direction::E_PICKUP_CAR )
+						{
+							std::unique_lock<std::mutex> t_lock(Dispatch_manager::get_instance_references().m_lock);
+							Dispatch_manager::get_instance_references().m_dispatch_response_pickup_map[m_outlet_id] = m_dispatch_response_msg;
+							Dispatch_manager::get_instance_references().m_pickup_updata_time = std::chrono::system_clock::now();
+						}
 						//流程正常结束, 恢复到待机状态.
 						m_dispatch_plc_status = DISPATCH_PLC_READY;
 						m_dispatch_process_type = Common_data::Dispatch_process_type::DISPATCH_PROCESS_TYPE_UNKNOW;
@@ -341,10 +361,25 @@ void Dispatch_plc::execute_thread_fun()
 					//不在接受新的任务,但是保持基本的通信正常
 					update_dispatch_plc_communication();
 
-
+					//response add to  _map
+					if ( m_dispatch_request_msg.dispatch_motion_direction() == message::Dispatch_motion_direction::E_STORE_CAR )
+					{
+						std::unique_lock<std::mutex> t_lock(Dispatch_manager::get_instance_references().m_lock);
+						std::chrono::system_clock::time_point t_time = std::chrono::system_clock::now();
+						Dispatch_manager::get_instance_references().m_dispatch_response_store_map[t_time] = m_dispatch_response_msg;
+						Dispatch_manager::get_instance_references().m_store_updata_time = std::chrono::system_clock::now();
+					}
+					else if( m_dispatch_request_msg.dispatch_motion_direction() == message::Dispatch_motion_direction::E_PICKUP_CAR )
+					{
+						std::unique_lock<std::mutex> t_lock(Dispatch_manager::get_instance_references().m_lock);
+						Dispatch_manager::get_instance_references().m_dispatch_response_pickup_map[m_outlet_id] = m_dispatch_response_msg;
+						Dispatch_manager::get_instance_references().m_pickup_updata_time = std::chrono::system_clock::now();
+					}
                     //20211209 huli //流程异常结束, 进入到 ready.
                     m_dispatch_plc_status = DISPATCH_PLC_READY;
-                    LOG(ERROR) << " Dispatch_plc::execute_thread_fun() dispatch_plc is fault, now recover to normal " << this;
+					m_dispatch_process_type = Common_data::Dispatch_process_type::DISPATCH_PROCESS_TYPE_UNKNOW;
+					m_result.error_manager_clear_all();
+					LOG(ERROR) << " Dispatch_plc::execute_thread_fun() dispatch_plc is fault, now recover to normal " << this;
 
                     break;
 				}

+ 1 - 0
dispatch/dispatch_plc.h

@@ -71,6 +71,7 @@ public://API functions
 
 public://get or set member variable
 	Dispatch_plc::Dispatch_plc_status get_dispatch_plc_status();
+	message::Dispatch_request_msg get_dispatch_request_msg();
 
 	void clear_request_msg();
 protected://member functions

+ 1 - 0
main.cpp

@@ -22,6 +22,7 @@
 
 
 #include "./tool/common_data.h"
+#include "./tool/time_tool.h"
 
 
 

文件差异内容过多而无法显示
+ 1217 - 249
message/dispatch_message.pb.cc


文件差异内容过多而无法显示
+ 873 - 21
message/dispatch_message.pb.h


+ 35 - 1
message/dispatch_message.proto

@@ -23,13 +23,47 @@ enum Passageway_direction
     E_BILATERAL         =2;         //双向口
 }
 
+
+
+//
+enum Dispatch_process_status
+{
+    E_DISPATCH_POCESS_UNKNOW                = 0;     //未知
+    E_DISPATCH_POCESS_WAIT                  = 1;     //未知
+    E_DISPATCH_POCESS_WORKING               = 2;     //未知
+    E_DISPATCH_POCESS_OVER                  = 3;     //未知
+
+    E_DISPATCH_POCESS_FAULT                 = 100;     //未知
+}
+
+//
+message Dispatch_process_information
+{
+
+    optional string                     car_numberPlate=1;					    //车牌号
+    optional string                     command_key=2;                          //指令唯一标识符id
+    optional Dispatch_motion_direction  dispatch_motion_direction=3;            //调度方向, 停车取车
+    optional Id_struct                  id_struct=4;                            //id
+    optional Locate_information         locate_information=5;                   //汽车测量信息, 只有停车时有数据, 取车时没有数据.
+    repeated Parkspace_info             parkspace_info_ex=6;                    //车位编号, 停车位(B方案, 分配3个停车位)
+    optional Car_type                   car_type=7;                             //汽车大小
+
+    optional Dispatch_process_status    dispatch_process_status=8;              //
+    optional int32                      m_wait_number=9;                        //
+}
+
 //调度模块终端出入口的状态
 message Dispatch_terminal_status_msg
 {
     required Base_info                  base_info=1;                    //消息类型
-    optional Id_struct                  id_struct=2;                              //id
+    optional Id_struct                  id_struct=2;                    //id
     required Terminal_status            terminal_status = 3;            //终端流程状态, 表示这个出入口到楼上停车位之间的所有设备总状态
     required Passageway_direction       passageway_direction = 4;       //通道口属性, 出入口的方向属性, 表示这个通道允许停车或者取车
+
+    repeated Dispatch_process_information   dispatch_store_process_information_vector = 5;                          //
+    optional string                         dispatch_store_process_information_updata_time=6;                        //
+    repeated Dispatch_process_information   dispatch_pickup_process_information_vector = 7;                         //
+    optional string                         dispatch_pickup_process_information_updata_time=8;                        //
 }
 
 //调度方向, 停车取车, 表示正在执行的动作

+ 10 - 10
snap7_communication/snap7_communication_base.cpp

@@ -285,11 +285,11 @@ Error_manager Snap7_communication_base::read_data_buf(Snap7_buf& snap7_buf)
 		if ( result == 0 )
 		{
 			result = m_snap7_client.WaitAsCompletion(100);
-			if ( result !=0 )
-			{
-				return Error_manager(Error_code::SNAP7_READ_ERROR, Error_level::MINOR_ERROR,
-									 " Snap7_communication_base::read_data_buf error ");
-			}
+//			if ( result !=0 )
+//			{
+//				return Error_manager(Error_code::SNAP7_READ_ERROR, Error_level::MINOR_ERROR,
+//									 " Snap7_communication_base::read_data_buf error ");
+//			}
 			//倒序数据 转为 正序数据
 			snap7_buf.reverse_to_obverse();
 		}
@@ -325,11 +325,11 @@ Error_manager Snap7_communication_base::write_data_buf(Snap7_buf& snap7_buf)
 		if ( result == 0 )
 		{
 			result = m_snap7_client.WaitAsCompletion(100);
-			if ( result !=0 )
-			{
-				return Error_manager(Error_code::SNAP7_WRITE_ERROR, Error_level::MINOR_ERROR,
-									 " Snap7_communication_base::write_data_buf error ");
-			}
+//			if ( result !=0 )
+//			{
+//				return Error_manager(Error_code::SNAP7_WRITE_ERROR, Error_level::MINOR_ERROR,
+//									 " Snap7_communication_base::write_data_buf error ");
+//			}
 		}
 		else
 		{

+ 29 - 0
tool/time_tool.cpp

@@ -56,6 +56,35 @@ std::string Time_tool::get_current_time_microsecond()
 	std::string strTime=get_current_time_millisecond()+" "+std::to_string((int)dis_microseconds);
 	return strTime;
 }
+
+std::string Time_tool::get_time_string_seconds(std::chrono::system_clock::time_point time_point)
+{
+	time_t tt = std::chrono::system_clock::to_time_t(time_point);
+	tm time_tm=*localtime(&tt);
+	char strTime[100] = "";
+	sprintf(strTime, "%d-%02d-%02d %02d:%02d:%02d", time_tm.tm_year + 1900,
+			time_tm.tm_mon + 1, time_tm.tm_mday, time_tm.tm_hour,
+			time_tm.tm_min, time_tm.tm_sec);
+	std::string str=strTime;
+	return str;
+}
+std::string Time_tool::get_time_string_millisecond(std::chrono::system_clock::time_point time_point)
+{
+	//通过不同精度获取相差的毫秒数
+	uint64_t dis_millseconds = std::chrono::duration_cast<std::chrono::milliseconds>(time_point.time_since_epoch()).count()
+							   - std::chrono::duration_cast<std::chrono::seconds>(time_point.time_since_epoch()).count() * 1000;
+	std::string strTime=get_time_string_seconds(time_point)+" "+std::to_string((int)dis_millseconds);
+	return strTime;
+}
+std::string Time_tool::get_time_string_microsecond(std::chrono::system_clock::time_point time_point)
+{
+	//通过不同精度获取相差的微秒
+	uint64_t dis_microseconds = std::chrono::duration_cast<std::chrono::microseconds>(time_point.time_since_epoch()).count()
+								- std::chrono::duration_cast<std::chrono::milliseconds>(time_point.time_since_epoch()).count() * 1000;
+	std::string strTime=get_time_string_millisecond(time_point)+" "+std::to_string((int)dis_microseconds);
+	return strTime;
+}
+
 void Time_tool::time_start(int key)
 {
 	timetool_map[key].t_time_start=get_system_point();//保存开始的时间 //单位为微秒

+ 11 - 2
tool/time_tool.h

@@ -39,6 +39,9 @@ public://API functions
 	//设置输出格式  保留小数点后几位  不设置默认为系统输出
 	void set_points_digits(int);
 
+	//获取当前时间结构体
+	tm get_current_time_struct();
+
 	//获取当前时间 精确到秒
 	 std::string get_current_time_seconds();
 
@@ -48,8 +51,14 @@ public://API functions
 	//获取当前时间 精确到微妙
 	std::string get_current_time_microsecond();
 
-	//获取当前时间结构体
-	tm get_current_time_struct();
+	//获取 时间 精确到秒
+	std::string get_time_string_seconds(std::chrono::system_clock::time_point time_point);
+
+	//获取 时间 精确到毫秒
+	std::string get_time_string_millisecond(std::chrono::system_clock::time_point time_point);
+
+	//获取 时间 精确到微妙
+	std::string get_time_string_microsecond(std::chrono::system_clock::time_point time_point);
 
 	//计时开始
 	void time_start(int key=1);