Browse Source

20210617, 调度流程 存车流程 carrier

huli 4 years ago
parent
commit
8a939b7bda
5 changed files with 1003 additions and 281 deletions
  1. 15 6
      dispatch/dispatch_coordinates.cpp
  2. 2 0
      dispatch/dispatch_coordinates.h
  3. 985 266
      dispatch/dispatch_process.cpp
  4. 1 1
      error_code/error_code.h
  5. 0 8
      main.cpp

+ 15 - 6
dispatch/dispatch_coordinates.cpp

@@ -485,6 +485,20 @@ Error_manager Dispatch_coordinates::catcher_try_space_lock(int row_min, int colu
 							 " Dispatch_coordinates::carrier_try_space_lock error ");
 	}
 }
+//搬运器强制空间加锁(不做判断了, 直接加锁)
+Error_manager Dispatch_coordinates::carrier_force_space_lock(int row_min, int column_min, int row_max, int column_max, int carrier_id )
+{
+	//不做判断了, 直接加锁
+	std::unique_lock<std::mutex> t_lock(m_lock);
+	for (int i = row_min; i <= row_max; ++i)
+	{
+		for (int j = column_min; j <= column_max ; ++j)
+		{
+			mpp_space_lock[i][j].m_carrier_id = carrier_id;
+		}
+	}
+	return Error_code::SUCCESS;
+}
 //抓取器强制空间加锁(不做判断了, 直接加锁)
 Error_manager Dispatch_coordinates::catcher_force_space_lock(int row_min, int column_min, int row_max, int column_max, int catcher_id )
 {
@@ -494,12 +508,7 @@ Error_manager Dispatch_coordinates::catcher_force_space_lock(int row_min, int co
 	{
 		for (int j = column_min; j <= column_max ; ++j)
 		{
-			if ( mpp_space_lock[i][j].m_catcher_id != -1 &&
-				 mpp_space_lock[i][j].m_catcher_id != catcher_id &&
-				 mpp_space_lock[i][j].m_carrier_id != -1)
-			{
-				mpp_space_lock[i][j].m_catcher_id = catcher_id;
-			}
+			mpp_space_lock[i][j].m_catcher_id = catcher_id;
 		}
 	}
 	return Error_code::SUCCESS;

+ 2 - 0
dispatch/dispatch_coordinates.h

@@ -86,6 +86,8 @@ public://API functions
 	Error_manager carrier_try_space_lock(int row_min, int column_min, int row_max, int column_max, int carrier_id, int & avoid_catcher_id );
 	//抓取器尝试空间加锁
 	Error_manager catcher_try_space_lock(int row_min, int column_min, int row_max, int column_max, int catcher_id );
+	//搬运器强制空间加锁(不做判断了, 直接加锁)
+	Error_manager carrier_force_space_lock(int row_min, int column_min, int row_max, int column_max, int carrier_id );
 	//抓取器强制空间加锁(不做判断了, 直接加锁)
 	Error_manager catcher_force_space_lock(int row_min, int column_min, int row_max, int column_max, int catcher_id );
 	//搬运器解锁, 退回电梯井, 全部解锁

File diff suppressed because it is too large
+ 985 - 266
dispatch/dispatch_process.cpp


+ 1 - 1
error_code/error_code.h

@@ -566,7 +566,7 @@ public://外部接口函数
 protected:
     Error_code              m_error_code;               //错误码
     Error_level             m_error_level;              //错误等级
-    std::string             m_error_description;
+    std::string             m_error_description;		// 错误描述
 
 protected://内部功能函数
 public:

+ 0 - 8
main.cpp

@@ -69,14 +69,6 @@ public:
 
 int main(int argc,char* argv[])
 {
-//	int t_terminal = 6;
-//	int t_temp = (t_terminal-1)%2;
-//	int t_column = 4 + ((t_terminal-1)/2)*3 + t_temp*2 ;
-//std::cout << " huli test :::: " << " t_column = " << t_column << std::endl;
-//
-//	return 0;
-
-
 	Error_manager t_error;
 
 	const char* logPath = "./";