huli 4 anni fa
parent
commit
6d716ff6a0

+ 5 - 5
dispatch/carrier.cpp

@@ -256,11 +256,11 @@ Error_manager Carrier::check_and_read_memory_to_task(std::shared_ptr<Task_Base>
 {
 
 
-	std::cout << " huli test :::: " << " ((((((((((((((((((((((((((333333333333333333 = " << 333 << std::endl;
-	std::cout << " huli test :::: " << " m_request_key = " << m_request_key << std::endl;
-	std::cout << " huli test :::: " << " m_respons_key = " << m_respons_key << std::endl;
-	std::cout << " huli test :::: " << " m_respons_status = " << m_respons_status << std::endl;
-	std::cout << " huli test :::: " << " )))))))))))))))))))))))))))))))4444444444444 = " << 444 << std::endl;
+//	std::cout << " huli test :::: " << " ((((((((((((((((((((((((((333333333333333333 = " << 333 << std::endl;
+//	std::cout << " huli test :::: " << " m_request_key = " << m_request_key << std::endl;
+//	std::cout << " huli test :::: " << " m_respons_key = " << m_respons_key << std::endl;
+//	std::cout << " huli test :::: " << " m_respons_status = " << m_respons_status << std::endl;
+//	std::cout << " huli test :::: " << " )))))))))))))))))))))))))))))))4444444444444 = " << 444 << std::endl;
 
 
 

+ 5 - 5
dispatch/catcher.cpp

@@ -253,11 +253,11 @@ Error_manager Catcher::update_device_communication()
 Error_manager Catcher::check_and_read_memory_to_task(std::shared_ptr<Task_Base> p_task)
 {
 
-	std::cout << " huli test :::: " << " ((((((((((((((((((((((((((1111111111111 = " << 111 << std::endl;
-	std::cout << " huli test :::: " << " m_request_key = " << m_request_key << std::endl;
-	std::cout << " huli test :::: " << " m_respons_key = " << m_respons_key << std::endl;
-	std::cout << " huli test :::: " << " m_respons_status = " << m_respons_status << std::endl;
-	std::cout << " huli test :::: " << " ))))))))))))))))))))))))))))2222222222 = " << 222 << std::endl;
+//	std::cout << " huli test :::: " << " ((((((((((((((((((((((((((1111111111111 = " << 111 << std::endl;
+//	std::cout << " huli test :::: " << " m_request_key = " << m_request_key << std::endl;
+//	std::cout << " huli test :::: " << " m_respons_key = " << m_respons_key << std::endl;
+//	std::cout << " huli test :::: " << " m_respons_status = " << m_respons_status << std::endl;
+//	std::cout << " huli test :::: " << " ))))))))))))))))))))))))))))2222222222 = " << 222 << std::endl;
 
 
 

+ 1 - 0
dispatch/dispatch_device_base.h

@@ -11,6 +11,7 @@
 #include <mutex>
 #include "../tool/thread_condition.h"
 #include "../tool/common_data.h"
+#include "../tool/time_tool.h"
 #include "../task/task_base.h"
 #include "../dispatch/dispatch_communication.h"
 #include "../dispatch/dispatch_coordinates.h"

+ 22 - 16
dispatch/dispatch_process.cpp

@@ -113,7 +113,7 @@ void Dispatch_process::Main()
 		std::this_thread::sleep_for(std::chrono::microseconds(1));
 		std::this_thread::sleep_for(std::chrono::milliseconds(1));
 //		std::this_thread::sleep_for(std::chrono::seconds(1));
-		std::cout << " huli test :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: " << " m_dispatch_process_status = " << m_dispatch_process_status << std::endl;
+//		std::cout << " huli test :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: " << " m_dispatch_process_status = " << m_dispatch_process_status << std::endl;
 
 		switch ( m_dispatch_process_status )
 		{
@@ -296,7 +296,7 @@ Error_manager Dispatch_process::dispatch_control_motion()
 					//长流程结束, 就答复 control_response_msg
 					// 注:这里执行调度控制, 即使报错了 也要答复给调度控制, 交给调度控制来进行决策.
 					iter->second.m_error = t_error;
-					iter->second.m_dispatch_control_status = DISPATCH_CONTROL_RESPONSE;
+					iter->second.m_dispatch_control_status = DISPATCH_CONTROL_TASK_WITHDRAW;
 				}
 				break;
 		    }
@@ -404,6 +404,9 @@ Error_manager Dispatch_process::connect_dispatch_device(int dispatch_device_type
 		}
 		else
 		{
+			std::cout << " huli test :::: " << " 123123123123123123123 = " << 1233 << std::endl;
+			std::cout << " huli test :::: " << " tp_catcher->check_status() = " << tp_catcher->check_status().to_string() << std::endl;
+			std::cout << " huli test :::: " << " tp_catcher->m_actual_device_status = " << tp_catcher->m_actual_device_status << std::endl;
 			t_error = Error_manager(Error_code::DISPATCH_PROCESS_DEVICE_STATUS_ERROR, Error_level::MINOR_ERROR,
 														  " tp_catcher->m_actual_device_status device_status error ");
 			dispatch_control_node.m_error = t_error;
@@ -475,6 +478,9 @@ Error_manager Dispatch_process::connect_dispatch_device(int dispatch_device_type
 		}
 		else
 		{
+			std::cout << " huli test :::: " << " 123123123123123123123 = " << 4566 << std::endl;
+			std::cout << " huli test :::: " << " tp_carrier->check_status() = " << tp_carrier->check_status().to_string() << std::endl;
+			std::cout << " huli test :::: " << " tp_carrier->m_actual_device_status = " << tp_carrier->m_actual_device_status << std::endl;
 			t_error = Error_manager(Error_code::DISPATCH_PROCESS_DEVICE_STATUS_ERROR, Error_level::MINOR_ERROR,
 								 " tp_carrier->m_actual_device_status device_status error ");
 			dispatch_control_node.m_error = t_error;
@@ -522,8 +528,8 @@ Error_manager Dispatch_process::excute_dispatch_control(int dispatch_device_type
 //				break;
 //			}
 //		}
-		std::cout << " huli test :::: " << "ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp  = " << tp_catcher_task->m_step << std::endl;
-		std::cout << " huli test :::: " << "1111111 tp_catcher_task->m_step   = " << tp_catcher_task->m_step << std::endl;
+//		std::cout << " huli test :::: " << "ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp  = " << tp_catcher_task->m_step << std::endl;
+//		std::cout << " huli test :::: " << "1111111 tp_catcher_task->m_step   = " << tp_catcher_task->m_step << std::endl;
 
 		//设备的动作也使用外部的Main()的线程来循环
 		switch ( dispatch_control_node.m_dispatch_control_request_msg.dispatch_task_type() )
@@ -561,8 +567,8 @@ Error_manager Dispatch_process::excute_dispatch_control(int dispatch_device_type
 				break;
 			}
 		}
-		std::cout << " huli test :::: " << "222222 tp_catcher_task->m_step   = " << tp_catcher_task->m_step << std::endl;
-		std::cout << " huli test :::: " << " t_error_catcher = " << t_error.to_string() << std::endl;
+//		std::cout << " huli test :::: " << "222222 tp_catcher_task->m_step   = " << tp_catcher_task->m_step << std::endl;
+//		std::cout << " huli test :::: " << " t_error_catcher = " << t_error.to_string() << std::endl;
 	}
 	else if ( dispatch_device_type == message::Dispatch_device_type::CARRIER_1 ||
 			  dispatch_device_type == message::Dispatch_device_type::CARRIER_2 ||
@@ -578,11 +584,11 @@ Error_manager Dispatch_process::excute_dispatch_control(int dispatch_device_type
 //				break;
 //			}
 //		}
-		std::cout << " huli test :::: "
-				  << "lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll   = "
-				  << tp_carrier_task->m_step << std::endl;
-		std::cout << " huli test :::: " << "3333333 tp_carrier_task->m_step   = " << tp_carrier_task->m_step
-				  << std::endl;
+//		std::cout << " huli test :::: "
+//				  << "lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll   = "
+//				  << tp_carrier_task->m_step << std::endl;
+//		std::cout << " huli test :::: " << "3333333 tp_carrier_task->m_step   = " << tp_carrier_task->m_step
+//				  << std::endl;
 
 		//设备的动作也使用外部的Main()的线程来循环
 		switch (dispatch_control_node.m_dispatch_control_request_msg.dispatch_task_type())
@@ -629,8 +635,8 @@ Error_manager Dispatch_process::excute_dispatch_control(int dispatch_device_type
 				break;
 			}
 		}
-		std::cout << " huli test :::: " << "44444444 tp_carrier_task->m_step   = " << tp_carrier_task->m_step << std::endl;
-		std::cout << " huli test :::: " << " t_error_carrier = " << t_error.to_string() << std::endl;
+//		std::cout << " huli test :::: " << "44444444 tp_carrier_task->m_step   = " << tp_carrier_task->m_step << std::endl;
+//		std::cout << " huli test :::: " << " t_error_carrier = " << t_error.to_string() << std::endl;
 	}
 	dispatch_control_node.m_error = t_error;
 	return t_error;
@@ -2627,9 +2633,9 @@ Error_manager Dispatch_process::check_task_ex(std::shared_ptr<Task_Base> p_task,
 	}
 	else
 	{
-		std::cout << " huli test :::: " << " ffffffffffffffffffffffffffffffffffffffffffffffffffffff = " << 333 << std::endl;
-		std::cout << " huli test :::: " << " p_task->get_task_statu() = " << p_task->get_task_statu() << std::endl;
-		std::cout << " huli test :::: " << " gggggggggggggggggggggggggggggggggggggggggggggggggggggg = " << 333 << std::endl;
+//		std::cout << " huli test :::: " << " ffffffffffffffffffffffffffffffffffffffffffffffffffffff = " << 333 << std::endl;
+//		std::cout << " huli test :::: " << " p_task->get_task_statu() = " << p_task->get_task_statu() << std::endl;
+//		std::cout << " huli test :::: " << " gggggggggggggggggggggggggggggggggggggggggggggggggggggg = " << 333 << std::endl;
 
 
 		if ( p_task->get_task_statu() == Task_Base::Task_statu::TASK_OVER )

+ 3 - 3
main.cpp

@@ -53,7 +53,7 @@ GOOGLE_GLOG_DLL_DECL void shut_down_logging(const char* data, int size)
 using namespace std;
 
 
-
+#define MAIN_TEST 1
 
 int main(int argc,char* argv[])
 {
@@ -74,7 +74,7 @@ int main(int argc,char* argv[])
 
 
 
-
+#ifdef MAIN_TEST
 	t_error = Dispatch_coordinates::get_instance_references().dispatch_coordinates_init();
 	std::cout << " huli test :::: " << " t_error.to = " << t_error.to_string() << std::endl;
 
@@ -96,7 +96,7 @@ int main(int argc,char* argv[])
 
 	}
 	return 0;
-
+#endif
 
 
 

+ 3 - 28
system/system_executor.cpp

@@ -125,6 +125,7 @@ Error_manager System_executor::execute_msg(Communication_message* p_msg)
 				//针对消息类型, 对消息进行二次解析
 				if (t_dispatch_request_msg.ParseFromString(p_msg->get_message_buf()))
 				{
+					LOG(INFO) << " message::Dispatch_request_msg t_dispatch_request_msg =  "<< t_dispatch_request_msg.DebugString()<< " " << this;
 					//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
 					m_thread_pool.enqueue(&System_executor::execute_for_dispatch_request_msg, this,
 										  t_dispatch_request_msg	);
@@ -142,6 +143,7 @@ Error_manager System_executor::execute_msg(Communication_message* p_msg)
 				//针对消息类型, 对消息进行二次解析
 				if (t_dispatch_plan_response_msg.ParseFromString(p_msg->get_message_buf()))
 				{
+					LOG(INFO) << " message::Dispatch_plan_response_msg t_dispatch_plan_response_msg =  "<< t_dispatch_plan_response_msg.DebugString()<< " " << this;
 					//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
 					m_thread_pool.enqueue(&System_executor::execute_for_dispatch_plan_response_msg, this,
 										  t_dispatch_plan_response_msg	);
@@ -159,7 +161,7 @@ Error_manager System_executor::execute_msg(Communication_message* p_msg)
 				//针对消息类型, 对消息进行二次解析
 				if (t_dispatch_control_request_msg.ParseFromString(p_msg->get_message_buf()))
 				{
-
+					LOG(INFO) << " message::Dispatch_control_request_msg t_dispatch_control_request_msg =  "<< t_dispatch_control_request_msg.DebugString()<< " " << this;
 					//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
 					m_thread_pool.enqueue(&System_executor::execute_for_dispatch_control_request_msg, this,
 										  t_dispatch_control_request_msg	);
@@ -175,33 +177,6 @@ Error_manager System_executor::execute_msg(Communication_message* p_msg)
 				break;
 		}
 	}
-	//检查接受人
-	if ( p_msg->get_receiver() == Communication_message::Communicator::eMeasurer )
-	{
-		switch ( p_msg->get_message_type() )
-		{
-			case Communication_message::Message_type::eLocate_request_msg:
-			{
-				message::Measure_request_msg t_measure_request_msg;
-				//针对消息类型, 对消息进行二次解析
-				if (t_measure_request_msg.ParseFromString(p_msg->get_message_buf()))
-				{
-					//往线程池添加执行任务, 之后会唤醒一个线程去执行他.
-					m_thread_pool.enqueue(&System_executor::execute_for_measure, this,
-										  t_measure_request_msg.command_key(), t_measure_request_msg.terminal_id());
-				}
-				else
-				{
-					return Error_manager(Error_code::SYSTEM_EXECUTOR_PARSE_ERROR, Error_level::MINOR_ERROR,
-										 " message::Measure_request_msg  ParseFromString error ");
-				}
-				break;
-			}
-
-			default:
-				break;
-		}
-	}
 
 	return Error_code::SUCCESS;
 }