Преглед изворни кода

增加 下一步,next_step

zx пре 4 година
родитељ
комит
ef204e4e14

+ 7 - 44
message/central_control_message.pb.cc

@@ -104,7 +104,7 @@ void InitDefaultsProcess_manual_operation_msg() {
 }
 
 ::google::protobuf::Metadata file_level_metadata[3];
-const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[3];
+const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[2];
 
 const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Central_controller_statu_msg, _has_bits_),
@@ -195,21 +195,12 @@ void AddDescriptorsImpl() {
       "%\n\tstep_type\030\003 \002(\0162\022.message.Step_type\0225"
       "\n\014operate_type\030\004 \002(\0162\037.message.Process_o"
       "peration_type*8\n\016Entrance_statu\022\013\n\007eEnab"
-      "le\020\000\022\014\n\010eDisable\020\001\022\013\n\007ePaused\020\002*\335\002\n\tStep"
-      "_type\022\017\n\013eAlloc_step\020\000\022\021\n\reMeasure_step\020"
-      "\001\022\021\n\reCompare_step\020\002\022\022\n\016eDispatch_step\020\003"
-      "\022\021\n\reConfirm_step\020\004\022\020\n\014eSearch_step\020\005\022\016\n"
-      "\neWait_step\020\006\022\021\n\reRelease_step\020\007\022\r\n\teCom"
-      "plete\020\010\022\025\n\021eBackConfirm_step\020\t\022\026\n\022eBack_"
-      "compare_step\020\n\022\025\n\021eBackMeasure_step\020\013\022\023\n"
-      "\017eBackAlloc_step\020\014\022\022\n\016eBackWait_step\020\r\022\026"
-      "\n\022eBackDispatch_step\020\016\022\024\n\020eBackSearch_st"
-      "ep\020\017\022\021\n\reBackComplete\020\020*\?\n\026Process_opera"
-      "tion_type\022\022\n\016eManual_cancel\020\000\022\021\n\reManual"
-      "_retry\020\001"
+      "le\020\000\022\014\n\010eDisable\020\001\022\013\n\007ePaused\020\002*S\n\026Proce"
+      "ss_operation_type\022\022\n\016eManual_cancel\020\000\022\021\n"
+      "\reManual_retry\020\001\022\022\n\016eManual_ignore\020\002"
   };
   ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
-      descriptor, 1088);
+      descriptor, 756);
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
     "central_control_message.proto", &protobuf_RegisterTypes);
   ::protobuf_message_5fbase_2eproto::AddDescriptors();
@@ -242,43 +233,15 @@ bool Entrance_statu_IsValid(int value) {
   }
 }
 
-const ::google::protobuf::EnumDescriptor* Step_type_descriptor() {
-  protobuf_central_5fcontrol_5fmessage_2eproto::protobuf_AssignDescriptorsOnce();
-  return protobuf_central_5fcontrol_5fmessage_2eproto::file_level_enum_descriptors[1];
-}
-bool Step_type_IsValid(int value) {
-  switch (value) {
-    case 0:
-    case 1:
-    case 2:
-    case 3:
-    case 4:
-    case 5:
-    case 6:
-    case 7:
-    case 8:
-    case 9:
-    case 10:
-    case 11:
-    case 12:
-    case 13:
-    case 14:
-    case 15:
-    case 16:
-      return true;
-    default:
-      return false;
-  }
-}
-
 const ::google::protobuf::EnumDescriptor* Process_operation_type_descriptor() {
   protobuf_central_5fcontrol_5fmessage_2eproto::protobuf_AssignDescriptorsOnce();
-  return protobuf_central_5fcontrol_5fmessage_2eproto::file_level_enum_descriptors[2];
+  return protobuf_central_5fcontrol_5fmessage_2eproto::file_level_enum_descriptors[1];
 }
 bool Process_operation_type_IsValid(int value) {
   switch (value) {
     case 0:
     case 1:
+    case 2:
       return true;
     default:
       return false;

+ 3 - 41
message/central_control_message.pb.h

@@ -89,47 +89,14 @@ inline bool Entrance_statu_Parse(
   return ::google::protobuf::internal::ParseNamedEnum<Entrance_statu>(
     Entrance_statu_descriptor(), name, value);
 }
-enum Step_type {
-  eAlloc_step = 0,
-  eMeasure_step = 1,
-  eCompare_step = 2,
-  eDispatch_step = 3,
-  eConfirm_step = 4,
-  eSearch_step = 5,
-  eWait_step = 6,
-  eRelease_step = 7,
-  eComplete = 8,
-  eBackConfirm_step = 9,
-  eBack_compare_step = 10,
-  eBackMeasure_step = 11,
-  eBackAlloc_step = 12,
-  eBackWait_step = 13,
-  eBackDispatch_step = 14,
-  eBackSearch_step = 15,
-  eBackComplete = 16
-};
-bool Step_type_IsValid(int value);
-const Step_type Step_type_MIN = eAlloc_step;
-const Step_type Step_type_MAX = eBackComplete;
-const int Step_type_ARRAYSIZE = Step_type_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* Step_type_descriptor();
-inline const ::std::string& Step_type_Name(Step_type value) {
-  return ::google::protobuf::internal::NameOfEnum(
-    Step_type_descriptor(), value);
-}
-inline bool Step_type_Parse(
-    const ::std::string& name, Step_type* value) {
-  return ::google::protobuf::internal::ParseNamedEnum<Step_type>(
-    Step_type_descriptor(), name, value);
-}
 enum Process_operation_type {
   eManual_cancel = 0,
-  eManual_retry = 1
+  eManual_retry = 1,
+  eManual_ignore = 2
 };
 bool Process_operation_type_IsValid(int value);
 const Process_operation_type Process_operation_type_MIN = eManual_cancel;
-const Process_operation_type Process_operation_type_MAX = eManual_retry;
+const Process_operation_type Process_operation_type_MAX = eManual_ignore;
 const int Process_operation_type_ARRAYSIZE = Process_operation_type_MAX + 1;
 
 const ::google::protobuf::EnumDescriptor* Process_operation_type_descriptor();
@@ -1014,11 +981,6 @@ template <>
 inline const EnumDescriptor* GetEnumDescriptor< ::message::Entrance_statu>() {
   return ::message::Entrance_statu_descriptor();
 }
-template <> struct is_proto_enum< ::message::Step_type> : ::google::protobuf::internal::true_type {};
-template <>
-inline const EnumDescriptor* GetEnumDescriptor< ::message::Step_type>() {
-  return ::message::Step_type_descriptor();
-}
 template <> struct is_proto_enum< ::message::Process_operation_type> : ::google::protobuf::internal::true_type {};
 template <>
 inline const EnumDescriptor* GetEnumDescriptor< ::message::Process_operation_type>() {

+ 1 - 28
message/central_control_message.proto

@@ -10,38 +10,12 @@ enum Entrance_statu
     ePaused=2;                          //急停
 }
 
-//流程中的步骤类型
-enum Step_type
-{
-    eAlloc_step=0;
-    eMeasure_step=1;
-    eCompare_step=2;
-    eDispatch_step=3;
-    eConfirm_step=4;
-
-    eSearch_step=5;        //查询数据库
-    eWait_step=6;             //等待车辆离开
-    eRelease_step=7;          //释放车位
-
-    eComplete=8;              //完成
-
-    eBackConfirm_step=9;
-    eBack_compare_step=10;
-    eBackMeasure_step=11;
-    eBackAlloc_step=12;
-
-    eBackWait_step=13;
-    eBackDispatch_step=14;
-    eBackSearch_step=15;
-
-    eBackComplete=16;
-}
-
 //针对流程的手动操作类型
 enum Process_operation_type
 {
     eManual_cancel=0;                   //取消流程
     eManual_retry=1;                    //重试
+    eManual_ignore=2;                   //忽略
 }
 
 
@@ -62,7 +36,6 @@ message Entrance_manual_operation_msg
     required Entrance_statu             entrance_statu=4;           //要修改的出入口状态
 }
 
-
 //流程手动操作消息
 message Process_manual_operation_msg
 {

+ 58 - 3
message/message_base.pb.cc

@@ -181,7 +181,7 @@ void InitDefaultsParkspace_info() {
 }
 
 ::google::protobuf::Metadata file_level_metadata[6];
-const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[6];
+const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[8];
 
 const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Base_info, _has_bits_),
@@ -376,10 +376,20 @@ void AddDescriptorsImpl() {
       "\n\020eParkspace_empty\020\000\022\027\n\023eParkspace_occup"
       "ied\020\001\022\030\n\024eParkspace_reserverd\020\002\022\024\n\020ePark"
       "space_error\020\003*(\n\tDirection\022\014\n\010eForward\020\001"
-      "\022\r\n\teBackward\020\002"
+      "\022\r\n\teBackward\020\002*\335\002\n\tStep_type\022\017\n\013eAlloc_"
+      "step\020\000\022\021\n\reMeasure_step\020\001\022\021\n\reCompare_st"
+      "ep\020\002\022\022\n\016eDispatch_step\020\003\022\021\n\reConfirm_ste"
+      "p\020\004\022\020\n\014eSearch_step\020\005\022\016\n\neWait_step\020\006\022\021\n"
+      "\reRelease_step\020\007\022\r\n\teComplete\020\010\022\025\n\021eBack"
+      "Confirm_step\020\t\022\026\n\022eBack_compare_step\020\n\022\025"
+      "\n\021eBackMeasure_step\020\013\022\023\n\017eBackAlloc_step"
+      "\020\014\022\022\n\016eBackWait_step\020\r\022\026\n\022eBackDispatch_"
+      "step\020\016\022\024\n\020eBackSearch_step\020\017\022\021\n\reBackCom"
+      "plete\020\020*C\n\nStep_statu\022\014\n\010eWaiting\020\000\022\014\n\010e"
+      "Working\020\001\022\n\n\006eError\020\002\022\r\n\teFinished\020\003"
   };
   ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
-      descriptor, 2295);
+      descriptor, 2716);
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
     "message_base.proto", &protobuf_RegisterTypes);
 }
@@ -515,6 +525,51 @@ bool Direction_IsValid(int value) {
   }
 }
 
+const ::google::protobuf::EnumDescriptor* Step_type_descriptor() {
+  protobuf_message_5fbase_2eproto::protobuf_AssignDescriptorsOnce();
+  return protobuf_message_5fbase_2eproto::file_level_enum_descriptors[6];
+}
+bool Step_type_IsValid(int value) {
+  switch (value) {
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+    case 4:
+    case 5:
+    case 6:
+    case 7:
+    case 8:
+    case 9:
+    case 10:
+    case 11:
+    case 12:
+    case 13:
+    case 14:
+    case 15:
+    case 16:
+      return true;
+    default:
+      return false;
+  }
+}
+
+const ::google::protobuf::EnumDescriptor* Step_statu_descriptor() {
+  protobuf_message_5fbase_2eproto::protobuf_AssignDescriptorsOnce();
+  return protobuf_message_5fbase_2eproto::file_level_enum_descriptors[7];
+}
+bool Step_statu_IsValid(int value) {
+  switch (value) {
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+      return true;
+    default:
+      return false;
+  }
+}
+
 
 // ===================================================================
 

+ 65 - 0
message/message_base.pb.h

@@ -235,6 +235,61 @@ inline bool Direction_Parse(
   return ::google::protobuf::internal::ParseNamedEnum<Direction>(
     Direction_descriptor(), name, value);
 }
+enum Step_type {
+  eAlloc_step = 0,
+  eMeasure_step = 1,
+  eCompare_step = 2,
+  eDispatch_step = 3,
+  eConfirm_step = 4,
+  eSearch_step = 5,
+  eWait_step = 6,
+  eRelease_step = 7,
+  eComplete = 8,
+  eBackConfirm_step = 9,
+  eBack_compare_step = 10,
+  eBackMeasure_step = 11,
+  eBackAlloc_step = 12,
+  eBackWait_step = 13,
+  eBackDispatch_step = 14,
+  eBackSearch_step = 15,
+  eBackComplete = 16
+};
+bool Step_type_IsValid(int value);
+const Step_type Step_type_MIN = eAlloc_step;
+const Step_type Step_type_MAX = eBackComplete;
+const int Step_type_ARRAYSIZE = Step_type_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* Step_type_descriptor();
+inline const ::std::string& Step_type_Name(Step_type value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    Step_type_descriptor(), value);
+}
+inline bool Step_type_Parse(
+    const ::std::string& name, Step_type* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<Step_type>(
+    Step_type_descriptor(), name, value);
+}
+enum Step_statu {
+  eWaiting = 0,
+  eWorking = 1,
+  eError = 2,
+  eFinished = 3
+};
+bool Step_statu_IsValid(int value);
+const Step_statu Step_statu_MIN = eWaiting;
+const Step_statu Step_statu_MAX = eFinished;
+const int Step_statu_ARRAYSIZE = Step_statu_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* Step_statu_descriptor();
+inline const ::std::string& Step_statu_Name(Step_statu value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    Step_statu_descriptor(), value);
+}
+inline bool Step_statu_Parse(
+    const ::std::string& name, Step_statu* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<Step_statu>(
+    Step_statu_descriptor(), name, value);
+}
 // ===================================================================
 
 class Base_info : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:message.Base_info) */ {
@@ -2266,6 +2321,16 @@ template <>
 inline const EnumDescriptor* GetEnumDescriptor< ::message::Direction>() {
   return ::message::Direction_descriptor();
 }
+template <> struct is_proto_enum< ::message::Step_type> : ::google::protobuf::internal::true_type {};
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ::message::Step_type>() {
+  return ::message::Step_type_descriptor();
+}
+template <> struct is_proto_enum< ::message::Step_statu> : ::google::protobuf::internal::true_type {};
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ::message::Step_statu>() {
+  return ::message::Step_statu_descriptor();
+}
 
 }  // namespace protobuf
 }  // namespace google

+ 39 - 1
message/message_base.proto

@@ -125,6 +125,7 @@ message Locate_information
     optional bool locate_correct = 9;		    //整车的校准标记位
 }
 
+//车辆基本信息
 message Car_info
 {
     optional float                      car_length=1;           //车长
@@ -148,7 +149,7 @@ enum Direction
     eBackward = 2;
 }
 
-//单个车位基本信息与状态信息
+//单个车位基本信息与状态信息,车位信息以及车位上的车辆信息
 message Parkspace_info
 {
     optional int32              parkspace_id=1;         //车位编号
@@ -163,3 +164,40 @@ message Parkspace_info
     optional string             entry_time=10;          //入场时间
     optional string             leave_time=11;          //离场时间
 }
+
+/*
+*流程中的步骤类型, 例如:停车流程包含5个步骤 , 分配车位-测量-检验结果-搬运-更新车位表
+*/
+enum Step_type
+{
+    eAlloc_step=0;
+    eMeasure_step=1;
+    eCompare_step=2;
+    eDispatch_step=3;
+    eConfirm_step=4;
+
+    eSearch_step=5;        //查询数据库
+    eWait_step=6;             //等待车辆离开
+    eRelease_step=7;          //释放车位
+
+    eComplete=8;              //完成
+
+    eBackConfirm_step=9;
+    eBack_compare_step=10;
+    eBackMeasure_step=11;
+    eBackAlloc_step=12;
+
+    eBackWait_step=13;
+    eBackDispatch_step=14;
+    eBackSearch_step=15;
+
+    eBackComplete=16;
+}
+//步骤状态,每个步骤有四中可能状态 ,等待中-执行中-完成或者错误  四个状态
+enum Step_statu
+{
+    eWaiting=0;               //完成/空闲
+    eWorking=1;
+    eError=2;
+    eFinished=3;
+}

+ 3 - 21
message/process_message.pb.cc

@@ -581,7 +581,6 @@ void InitDefaultsPicking_process_statu_msg() {
 }
 
 ::google::protobuf::Metadata file_level_metadata[20];
-const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[1];
 
 const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
   GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::message::Alloc_space_step_statu, _has_bits_),
@@ -906,7 +905,7 @@ void protobuf_AssignDescriptors() {
   ::google::protobuf::MessageFactory* factory = NULL;
   AssignDescriptors(
       "process_message.proto", schemas, file_default_instances, TableStruct::offsets, factory,
-      file_level_metadata, file_level_enum_descriptors, NULL);
+      file_level_metadata, NULL, NULL);
 }
 
 void protobuf_AssignDescriptorsOnce() {
@@ -1031,11 +1030,10 @@ void AddDescriptorsImpl() {
       "_step\030\n \001(\0132&.message.Back_release_space"
       "_step_statu\022K\n\034back_search_space_step_st"
       "atu\030\013 \001(\0132%.message.Back_search_space_st"
-      "ep_statu*C\n\nStep_statu\022\014\n\010eWaiting\020\000\022\014\n\010"
-      "eWorking\020\001\022\n\n\006eError\020\002\022\r\n\teFinished\020\003"
+      "ep_statu"
   };
   ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
-      descriptor, 4397);
+      descriptor, 4328);
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
     "process_message.proto", &protobuf_RegisterTypes);
   ::protobuf_message_5fbase_2eproto::AddDescriptors();
@@ -1053,22 +1051,6 @@ struct StaticDescriptorInitializer {
 } static_descriptor_initializer;
 }  // namespace protobuf_process_5fmessage_2eproto
 namespace message {
-const ::google::protobuf::EnumDescriptor* Step_statu_descriptor() {
-  protobuf_process_5fmessage_2eproto::protobuf_AssignDescriptorsOnce();
-  return protobuf_process_5fmessage_2eproto::file_level_enum_descriptors[0];
-}
-bool Step_statu_IsValid(int value) {
-  switch (value) {
-    case 0:
-    case 1:
-    case 2:
-    case 3:
-      return true;
-    default:
-      return false;
-  }
-}
-
 
 // ===================================================================
 

+ 0 - 34
message/process_message.pb.h

@@ -28,7 +28,6 @@
 #include <google/protobuf/message.h>
 #include <google/protobuf/repeated_field.h>  // IWYU pragma: export
 #include <google/protobuf/extension_set.h>  // IWYU pragma: export
-#include <google/protobuf/generated_enum_reflection.h>
 #include <google/protobuf/unknown_field_set.h>
 #include "message_base.pb.h"
 // @@protoc_insertion_point(includes)
@@ -171,27 +170,6 @@ extern Waitfor_leave_step_statuDefaultTypeInternal _Waitfor_leave_step_statu_def
 }  // namespace message
 namespace message {
 
-enum Step_statu {
-  eWaiting = 0,
-  eWorking = 1,
-  eError = 2,
-  eFinished = 3
-};
-bool Step_statu_IsValid(int value);
-const Step_statu Step_statu_MIN = eWaiting;
-const Step_statu Step_statu_MAX = eFinished;
-const int Step_statu_ARRAYSIZE = Step_statu_MAX + 1;
-
-const ::google::protobuf::EnumDescriptor* Step_statu_descriptor();
-inline const ::std::string& Step_statu_Name(Step_statu value) {
-  return ::google::protobuf::internal::NameOfEnum(
-    Step_statu_descriptor(), value);
-}
-inline bool Step_statu_Parse(
-    const ::std::string& name, Step_statu* value) {
-  return ::google::protobuf::internal::ParseNamedEnum<Step_statu>(
-    Step_statu_descriptor(), name, value);
-}
 // ===================================================================
 
 class Alloc_space_step_statu : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:message.Alloc_space_step_statu) */ {
@@ -7423,18 +7401,6 @@ inline void Picking_process_statu_msg::set_allocated_back_search_space_step_stat
 
 }  // namespace message
 
-namespace google {
-namespace protobuf {
-
-template <> struct is_proto_enum< ::message::Step_statu> : ::google::protobuf::internal::true_type {};
-template <>
-inline const EnumDescriptor* GetEnumDescriptor< ::message::Step_statu>() {
-  return ::message::Step_statu_descriptor();
-}
-
-}  // namespace protobuf
-}  // namespace google
-
 // @@protoc_insertion_point(global_scope)
 
 #endif  // PROTOBUF_process_5fmessage_2eproto__INCLUDED

+ 0 - 9
message/process_message.proto

@@ -2,15 +2,6 @@ syntax = "proto2";
 package message;
 import "message_base.proto";
 
-enum Step_statu
-{
-    eWaiting=0;               //完成/空闲
-    eWorking=1;
-    eError=2;
-    eFinished=3;
-}
-
-
 //分配车位步骤状态
 message Alloc_space_step_statu
 {

+ 8 - 6
solve_exception/exception_solver.cpp

@@ -132,7 +132,7 @@ Error_manager Exception_solver::waitfor_manual_operate_msg(Process_task* task,me
         {
             if(msg.has_base_info() && msg.has_license() && msg.has_operate_type() && msg.has_step_type())
             {
-                if(msg.license()==task->license()&& msg.step_type()==task->step_type()) {
+                if(msg.license()==task->license()&& msg.step_type()==task->current_step_type()) {
                     LOG(INFO) << " 查询到: " << task->license()<<"  操作类型:"<<Process_operation_type_Name(msg.operate_type());
                     return SUCCESS;
                 }
@@ -159,7 +159,7 @@ Error_manager Exception_solver::solve_exception(Error_manager code,Process_task*
         //关闭出入口
         if(task->GetCategory()==message::eStoring) {
             Command_manager::get_instance_pointer()->enable_entrance(task->terminal_id(),Command_manager::Entrance_statu::Disable);
-            LOG(ERROR)<<"关闭入口:"<<task->terminal_id()<<"   四级故障  !!!!!!  等待手动操作 ... ";
+            LOG(ERROR)<<"关闭入口:"<<task->terminal_id()<<"   故障  !!!!!!  等待手动操作 ... ";
             message::Process_manual_operation_msg operate_msg;
             code_operate=waitfor_manual_operate_msg(task,operate_msg);
             if(code_operate!=SUCCESS)
@@ -171,14 +171,16 @@ Error_manager Exception_solver::solve_exception(Error_manager code,Process_task*
                 {
                     LOG(INFO) << "手动消息 ,车牌号  : " << task->license()<<"  操作类型:"<<Process_operation_type_Name(operate_msg.operate_type());
                     task->Cancel();
-                    Command_manager::get_instance_pointer()->enable_entrance(task->terminal_id(),
-                            Command_manager::Entrance_statu::Enable);
                     break;
                 }
                 case message::eManual_retry:{
                     LOG(INFO) << "手动消息 ,车牌号  : " << task->license()<<"  操作类型:"<<Process_operation_type_Name(operate_msg.operate_type());
-                    Command_manager::get_instance_pointer()->enable_entrance(task->terminal_id(),
-                                                                             Command_manager::Entrance_statu::Enable);
+                    break;
+                }
+                case message::eManual_ignore:
+                {
+                    LOG(INFO) << "手动消息 ,车牌号  : " << task->license()<<"  操作类型:"<<Process_operation_type_Name(operate_msg.operate_type());
+                    task->next_step();
                     break;
                 }
             }

+ 75 - 41
system/PickupProcessTask.cpp

@@ -38,7 +38,7 @@ Error_manager PickupProcessTask::init_task()
     m_process_msg.set_terminal_id(m_terminor_id);
     m_process_msg.set_license(m_car_info.license());
 
-    m_step_type=eSearch_step;
+    m_current_step_type=message::eSearch_step;
     ///创建状态发布线程
     if(m_publish_statu_thread== nullptr)
     {
@@ -94,7 +94,6 @@ Error_manager PickupProcessTask::search_space()
 
     code = Parkspace_communicator::get_instance_pointer()->search_request(request,
             m_search_response_msg,m_cancel_condition);
-    m_step_type=eDispatch_step;
     return code;
 }
 
@@ -106,33 +105,68 @@ Error_manager PickupProcessTask::back_search_space_step()
     return SUCCESS;
 }
 
+/*
+     * 控制流程到下一步
+     */
+Error_manager PickupProcessTask::next_step()
+{
+    if(m_current_step_statu==message::eWaiting || m_current_step_statu== message::eWorking)
+        return Error_manager(ERROR,MINOR_ERROR,"当前状态禁止改变步骤类型");
+    switch (m_current_step_type)
+    {
+        case message::eSearch_step:
+            m_current_step_type=(m_current_step_statu==message::eFinished)?message::eDispatch_step:message::eBackComplete;
+            break;
+        case message::eDispatch_step:
+            m_current_step_type=(m_current_step_statu==message::eFinished)?message::eWait_step:message::eBackSearch_step;
+            break;
+        case message::eWait_step:
+            m_current_step_type=(m_current_step_statu==message::eFinished)?message::eComplete:message::eBackDispatch_step;
+            break;
+        case message::eComplete:
+            break;
+        case message::eBackDispatch_step:
+            m_current_step_type=message::eBackSearch_step;
+            break;
+        case message::eBackSearch_step:
+            m_current_step_type=message::eBackComplete;
+            break;
+        case message::eBackComplete:
+            break;
+        default:
+            LOG(ERROR)<<"  取车流程未知步骤 : "<<message::Step_type_Name(m_current_step_type);
+            break;
+    }
+    return SUCCESS;
+}
+
 void PickupProcessTask::Main()
 {
     Error_manager code;
     //进入取车流程
-
-    while(1)
+    m_current_step_type = message::eDispatch_step;
+    while(is_canceled()==false)
     {
-        if(m_step_type== eDispatch_step)
+        if(m_current_step_type== message::eDispatch_step)
         {
             code=dispatch_step();
-            usleep(1000*1000*(rand()%3));
+            usleep(1000*1000);
             LOG_IF(ERROR, code != SUCCESS) << "取车调度失败,取车终端:"<<m_terminor_id
                                            <<", 车位id:"<<m_search_response_msg.car_position().parkspace_id()
                                            <<", 车位楼层:"<<m_search_response_msg.car_position().floor()
                                            <<", 车位序号:"<<m_search_response_msg.car_position().index()
                                            <<", 车牌号:"<<m_car_info.license()
                                            <<", 库内车牌号:"<<m_search_response_msg.car_position().car_info().license();
-            m_step_type = (code != SUCCESS) ?  eBackDispatch_step :  eWait_step;
+            m_current_step_type = (code != SUCCESS) ?  message::eBackDispatch_step :  message::eWait_step;
         }
-        if(m_step_type== eWait_step)
+        if(m_current_step_type== message::eWait_step)
         {
             code=wait_for_leave_step();
             LOG_IF(ERROR, code != SUCCESS) << "等待车辆离开失败,取车终端:"<<m_terminor_id
                                            <<", 车牌号:"<<m_car_info.license();
-            m_step_type = (code != SUCCESS) ?  eBackWait_step :  eRelease_step;
+            m_current_step_type = (code != SUCCESS) ?  message::eBackWait_step :  message::eRelease_step;
         }
-        if(m_step_type== eRelease_step)
+        if(m_current_step_type== message::eRelease_step)
         {
             code=release_space_step();
             LOG_IF(ERROR, code != SUCCESS) << "取车释放车位失败,取车终端:"<<m_terminor_id
@@ -144,16 +178,16 @@ void PickupProcessTask::Main()
             }
             else
             {
-                m_step_type= eComplete;
+                m_current_step_type= message::eComplete;
             }
         }
-        if(m_step_type==eComplete) {
+        if(m_current_step_type==message::eComplete) {
             //至少发送一次流程完成状态
             updata_step_statu_msg();
             System_communicator::get_instance_pointer()->post_process_statu(m_process_msg);
             break;
         }
-        if(m_step_type== eBackWait_step)
+        if(m_current_step_type== message::eBackWait_step)
         {
             code=back_wait_for_leave_step();
             if(code!=SUCCESS)
@@ -163,10 +197,10 @@ void PickupProcessTask::Main()
             }
             else
             {
-                m_step_type= eBackDispatch_step;
+                m_current_step_type= message::eBackDispatch_step;
             }
         }
-        if(m_step_type== eBackDispatch_step)
+        if(m_current_step_type== message::eBackDispatch_step)
         {
             code=back_dispatch_step();
             if(code!=SUCCESS)
@@ -176,10 +210,10 @@ void PickupProcessTask::Main()
             }
             else
             {
-                m_step_type= eBackSearch_step;
+                m_current_step_type= message::eBackSearch_step;
             }
         }
-        if(m_step_type== eBackSearch_step)
+        if(m_current_step_type== message::eBackSearch_step)
         {
             code=back_search_space_step();
             if(code!=SUCCESS)
@@ -189,10 +223,10 @@ void PickupProcessTask::Main()
             }
             else
             {
-                m_step_type= eBackComplete;
+                m_current_step_type= message::eBackComplete;
             }
         }
-        if(m_step_type== eBackComplete)
+        if(m_current_step_type== message::eBackComplete)
             break;
 
     }
@@ -200,14 +234,14 @@ void PickupProcessTask::Main()
     /*
       * 跳出循环后,判断状态,是否正常结束, 循环跳出状态只有可能是 eBackComplete(异常结束),eComplete(正常结束)
       */
-    if(m_step_type== eBackComplete)
+    if(m_current_step_type== message::eBackComplete)
     {
         //异常结束
-        usleep(1000*5000);
+        usleep(1000*1000);
         LOG(ERROR)<<"异常停车,回退结束"<<"车牌号:"<<m_car_info.license()
                   <<",xxxxxxxxxxxxxx  终端:"<<m_terminor_id<<"  xxxxxxxxxxxxxx";
     }
-    if(m_step_type== eComplete)
+    if(m_current_step_type== message::eComplete)
     {
         //正常结束
         usleep(1000*1000);
@@ -359,57 +393,57 @@ void PickupProcessTask::updata_step_statu_msg()
     wait_step_statu.set_step_statu(message::eWaiting);
     release_step_statu.set_step_statu(message::eWaiting);
 
-    switch (m_step_type) {
-        case  eSearch_step: {
+    switch (m_current_step_type) {
+        case  message::eSearch_step: {
             search_step_statu.set_step_statu(message::eWorking);
-            if(m_step_type==eSearch_step)
+            if(m_current_step_type==message::eSearch_step)
                 break;
         }
-        case  eDispatch_step: {
+        case  message::eDispatch_step: {
             search_step_statu.set_step_statu(message::eFinished);
             dispatch_step_statu.set_step_statu(message::eWorking);
             dispatch_step_statu.mutable_space_info()->CopyFrom(m_search_response_msg.car_position());
-            if(m_step_type==eDispatch_step)
+            if(m_current_step_type==message::eDispatch_step)
                 break;
         }
-        case  eWait_step: {
+        case  message::eWait_step: {
             dispatch_step_statu.set_step_statu(message::eFinished);
             wait_step_statu.set_step_statu(message::eWorking);
             wait_step_statu.mutable_car_info()->CopyFrom(m_car_info);
-            if(m_step_type== eWait_step)
+            if(m_current_step_type== message::eWait_step)
                 break;
         }
-        case  eRelease_step:
+        case  message::eRelease_step:
         {
             wait_step_statu.set_step_statu(message::eFinished);
             release_step_statu.set_step_statu(message::eWorking);
             release_step_statu.mutable_space_info()->CopyFrom(m_search_response_msg.car_position());
-            if(m_step_type== eRelease_step)
+            if(m_current_step_type== message::eRelease_step)
                 break;
         }
-        case  eComplete: {
+        case  message::eComplete: {
             release_step_statu.set_step_statu(message::eFinished);
-            if(m_step_type==eComplete)
+            if(m_current_step_type==message::eComplete)
                 break;
         }
-        case  eBackWait_step :{
+        case  message::eBackWait_step :{
             wait_step_statu.set_step_statu(message::eError);
-            if(m_step_type== eBackWait_step)
+            if(m_current_step_type== message::eBackWait_step)
                 break;
         }
-        case eBackDispatch_step: {
+        case message::eBackDispatch_step: {
             dispatch_step_statu.set_step_statu(message::eError);
-            if(m_step_type==eBackDispatch_step)
+            if(m_current_step_type==message::eBackDispatch_step)
                 break;
         }
-        case eBackSearch_step: {
+        case message::eBackSearch_step: {
             search_step_statu.set_step_statu(message::eError);
-            if(m_step_type==eBackSearch_step)
+            if(m_current_step_type==message::eBackSearch_step)
                 break;
         }
-        case eBackComplete: {
+        case message::eBackComplete: {
             release_step_statu.set_step_statu(message::eFinished);
-            if(m_step_type==eBackComplete)
+            if(m_current_step_type==message::eBackComplete)
                 break;
         }
         default:

+ 5 - 0
system/PickupProcessTask.h

@@ -19,6 +19,11 @@ public:
     Error_manager init_task();
     virtual tq::TaskCategory GetCategory() const{ return message::ePicking;}
 
+    /*
+     * 控制流程到下一步
+     */
+    virtual Error_manager next_step();
+
     /*
      * 查询车位
      */

+ 117 - 86
system/StoreProcessTask.cpp

@@ -44,7 +44,7 @@ Error_manager StoreProcessTask::init_task(message::Locate_information locate_inf
     m_process_msg.set_terminal_id(m_terminor_id);
     m_process_msg.set_license(m_car_info.license());
 
-    m_step_type=eAlloc_step;
+    m_current_step_type=message::eAlloc_step;
     ///创建状态发布线程
     if(m_publish_statu_thread== nullptr)
     {
@@ -194,11 +194,11 @@ Error_manager StoreProcessTask::alloc_space()
     /*
      * 检查是否有测量数据
      */
-    m_step_type=eAlloc_step;
-    updata_step_statu_msg(message::eWorking);
+    m_current_step_type=message::eAlloc_step;
+    updata_step_statu(message::eWorking);
     if(m_locate_info.has_locate_height()==false||m_locate_info.has_locate_width()==false)
     {
-        updata_step_statu_msg(message::eError);
+        updata_step_statu(message::eError);
         return Error_manager(FAILED,MINOR_ERROR,"停车请求缺少车辆高度和宽度信息");
     }
     /*
@@ -207,7 +207,7 @@ Error_manager StoreProcessTask::alloc_space()
     Error_manager code=Parkspace_communicator::get_instance_pointer()->check_statu();
     if(code!=SUCCESS)
     {
-        updata_step_statu_msg(message::eError);
+        updata_step_statu(message::eError);
         return code;
     }
 
@@ -229,7 +229,7 @@ Error_manager StoreProcessTask::alloc_space()
 
     if(code!=SUCCESS)
     {
-        updata_step_statu_msg(message::eError);
+        updata_step_statu(message::eError);
         return code;
     }
 
@@ -240,14 +240,13 @@ Error_manager StoreProcessTask::alloc_space()
         {
             return Error_manager(ERROR,MINOR_ERROR,"分配车位反馈的车辆信息不匹配");
         }
-        updata_step_statu_msg(message::eFinished);
+        updata_step_statu(message::eFinished);
         //置步骤状态为测量状态.
-        m_step_type=eMeasure_step;
         return SUCCESS;
     }
     else
     {
-        updata_step_statu_msg(message::eError);
+        updata_step_statu(message::eError);
         Error_code  t_code=(Error_code)m_parcspace_alloc_response_msg.error_manager().error_code();
         Error_level t_level=(Error_level)m_parcspace_alloc_response_msg.error_manager().error_level();
         return Error_manager(t_code,t_level,"分配车位反馈结果错误");
@@ -365,6 +364,53 @@ Error_manager StoreProcessTask::back_alloc_space_step()
     }
 }
 
+/*
+     * 控制流程到下一步
+     */
+Error_manager StoreProcessTask::next_step()
+{
+    if(m_current_step_statu==message::eWaiting || m_current_step_statu== message::eWorking)
+        return Error_manager(ERROR,MINOR_ERROR,"当前状态禁止改变步骤类型");
+    switch (m_current_step_type)
+    {
+        case message::eAlloc_step:
+            m_current_step_type=(m_current_step_statu==message::eFinished)?message::eMeasure_step:message::eBackComplete;
+            break;
+        case message::eMeasure_step:
+            m_current_step_type=(m_current_step_statu==message::eFinished)?message::eCompare_step:message::eBackAlloc_step;
+            break;
+        case message::eCompare_step:
+            m_current_step_type=(m_current_step_statu==message::eFinished)?message::eDispatch_step:message::eBackMeasure_step;
+            break;
+        case message::eDispatch_step:
+            m_current_step_type=(m_current_step_statu==message::eFinished)?message::eConfirm_step:message::eBack_compare_step;
+            break;
+        case message::eConfirm_step:
+            m_current_step_type=(m_current_step_statu==message::eFinished)?message::eComplete:message::eBackDispatch_step;
+            break;
+        case message::eComplete:
+            break;
+        case message::eBackDispatch_step:
+            m_current_step_type=message::eBack_compare_step;
+            break;
+        case message::eBack_compare_step:
+            m_current_step_type=message::eBackMeasure_step;
+            break;
+        case message::eBackMeasure_step:
+            m_current_step_type=message::eBackAlloc_step;
+            break;
+        case message::eBackAlloc_step:
+            m_current_step_type=message::eBackComplete;
+            break;
+        case message::eBackComplete:
+            break;
+    }
+    return SUCCESS;
+}
+
+/*
+ * 流程函数
+ */
 void StoreProcessTask::Main()
 {
     /*
@@ -373,172 +419,156 @@ void StoreProcessTask::Main()
     Error_manager code;
 
     //开始执行停车指令
-    while(m_cancel_condition.wait_for_millisecond(1)==false)
+    while(is_canceled()==false)
     {
         //第一步,测量
-        if (m_step_type ==  eMeasure_step)
+        if (m_current_step_type ==  message::eMeasure_step)
         {
             //开始定位
-            updata_step_statu_msg(message::eWorking);
+            updata_step_statu(message::eWorking);
             code = locate_step();
-            usleep(1000 * 1000 * (rand() % 5 + 1));
-            code!=SUCCESS?updata_step_statu_msg(message::eError):updata_step_statu_msg(message::eFinished);
+            usleep(1000 * 1000 );
+            code!=SUCCESS?updata_step_statu(message::eError):updata_step_statu(message::eFinished);
 
             LOG_IF(ERROR, code != SUCCESS) << "测量失败:" <<m_car_info.license()<< code.get_error_description();
-            m_step_type = (code != SUCCESS) ?  eBackAlloc_step :  eCompare_step;
         }
-        if(m_step_type== eCompare_step)
+        if(m_current_step_type== message::eCompare_step)
         {
-            updata_step_statu_msg(message::eWorking);
+            updata_step_statu(message::eWorking);
             code=compare_step();
             usleep(500*1000);
-            code!=SUCCESS?updata_step_statu_msg(message::eError):updata_step_statu_msg(message::eFinished);
-            LOG_IF(ERROR, code != SUCCESS) << "检验失败:"<<m_car_info.license() << code.get_error_description();
-            m_step_type = (code != SUCCESS) ?  eBackMeasure_step :  eDispatch_step;
+            code!=SUCCESS?updata_step_statu(message::eError):updata_step_statu(message::eFinished);
 
+            LOG_IF(ERROR, code != SUCCESS) << "检验失败:"<<m_car_info.license() << code.get_error_description();
         }
         //第二步,调度
-        if (m_step_type ==  eDispatch_step)
+        if (m_current_step_type ==  message::eDispatch_step)
         {
             //开始调度
-            updata_step_statu_msg(message::eWorking);
+            updata_step_statu(message::eWorking);
             code = dispatch_step();
-            usleep(1000 * 1000 * (rand() % 5));
-            code!=SUCCESS?updata_step_statu_msg(message::eError):updata_step_statu_msg(message::eFinished);
+            usleep(1000 * 2000 );
+            code!=SUCCESS?updata_step_statu(message::eError):updata_step_statu(message::eFinished);
             LOG_IF(ERROR, code != SUCCESS) << "调度失败:"<<m_car_info.license() << code.get_error_description();
-            m_step_type = (code != SUCCESS) ?  eBack_compare_step :  eConfirm_step;
         }
         //第三步,占据车位
-        if (m_step_type ==  eConfirm_step)
+        if (m_current_step_type ==  message::eConfirm_step)
         {
-            updata_step_statu_msg(message::eWorking);
+            updata_step_statu(message::eWorking);
             code = confirm_space_step();
             usleep(1000 * 1000);
-            code!=SUCCESS?updata_step_statu_msg(message::eError):updata_step_statu_msg(message::eFinished);
+            code!=SUCCESS?updata_step_statu(message::eError):updata_step_statu(message::eFinished);
             LOG_IF(ERROR, code != SUCCESS) << "终端号:" << m_terminor_id << "停车流程:" << code.get_error_description() <<
                                            " 车位id :"
                                            << m_parcspace_alloc_response_msg.allocated_space_info().parkspace_id()
                                            << ",车牌:" << m_car_info.license()<<code.to_string();
-            m_step_type = (code != SUCCESS) ?  eBackDispatch_step :  eComplete;
         }
         //第四步,完成,退出循环
-        if (m_step_type ==  eComplete)
+        if (m_current_step_type ==  message::eComplete)
         {
             //流程结束前,保证至少发送一次流程完成状态
-            updata_step_statu_msg(message::eFinished);
+            updata_step_statu(message::eFinished);
             break;
         }
 
         //回退confirm  ------------------------------------华丽的分割线------------------------------------------
 
-        if (m_step_type ==  eBackConfirm_step)
+        if (m_current_step_type ==  message::eBackConfirm_step)
         {
-            updata_step_statu_msg(message::eWorking);
+            updata_step_statu(message::eWorking);
             usleep(1000*1000);
-            updata_step_statu_msg(message::eFinished);
-            m_step_type= eBackDispatch_step;
+            updata_step_statu(message::eFinished);
+
         }
-        if(m_step_type== eBackDispatch_step)
+        if(m_current_step_type== message::eBackDispatch_step)
         {
-            updata_step_statu_msg(message::eWorking);
+            updata_step_statu(message::eWorking);
             code=back_dispatch_step();
             usleep(1000*1000);
-            code!=SUCCESS?updata_step_statu_msg(message::eError):updata_step_statu_msg(message::eFinished);
+            code!=SUCCESS?updata_step_statu(message::eError):updata_step_statu(message::eFinished);
             if(code.get_error_level()>=MAJOR_ERROR)
             {
                 //提升错误等级为四级
                 LOG(ERROR)<<" 回退调度失败 ------进入异常处理,  车牌号:"<<m_car_info.license();
                 Exception_solver::get_instance_pointer()->solve_exception(code,this);
+                continue;
             }
-            else
-            {
-                m_step_type= eBack_compare_step;
-            }
-
         }
 
-        if(m_step_type== eBack_compare_step)
+        if(m_current_step_type== message::eBack_compare_step)
         {
-            updata_step_statu_msg(message::eWorking);
+            updata_step_statu(message::eWorking);
             code=back_compare_step();
             usleep(1000*1000);
-            code!=SUCCESS?updata_step_statu_msg(message::eError):updata_step_statu_msg(message::eFinished);
+            code!=SUCCESS?updata_step_statu(message::eError):updata_step_statu(message::eFinished);
             if(code.get_error_level()>=MAJOR_ERROR)
             {
                 LOG(ERROR)<<" 回退对比失败 ------进入异常处理,  车牌号:"<<m_car_info.license();
                 Exception_solver::get_instance_pointer()->solve_exception(code,this);
                 LOG(WARNING)<<" 手动处理 结果对比,  继续 ..........车牌:"<<m_car_info.license();
-            }
-            else
-            {
-                m_step_type= eBackMeasure_step;
+                continue;
             }
         }
 
-        if(m_step_type== eBackMeasure_step)
+        if(m_current_step_type== message::eBackMeasure_step)
         {
-            updata_step_statu_msg(message::eWorking);
+            updata_step_statu(message::eWorking);
             code=back_locate_step();
             usleep(1000*1000);
-            code!=SUCCESS?updata_step_statu_msg(message::eError):updata_step_statu_msg(message::eFinished);
+            code!=SUCCESS?updata_step_statu(message::eError):updata_step_statu(message::eFinished);
             if(code.get_error_level()>=MAJOR_ERROR)
             {
                 //提升错误等级为四级
                 LOG(ERROR)<<" 回退测量失败 ------进入异常处理,  车牌号:"<<m_car_info.license();
                 Exception_solver::get_instance_pointer()->solve_exception(code,this);
-            }
-            else
-            {
-                m_step_type= eBackAlloc_step;
+                continue;
             }
         }
-        if(m_step_type== eBackAlloc_step)
+        if(m_current_step_type== message::eBackAlloc_step)
         {
-            updata_step_statu_msg(message::eWorking);
+            updata_step_statu(message::eWorking);
             code=back_alloc_space_step();
             usleep(1000*1000);
-            code!=SUCCESS?updata_step_statu_msg(message::eError):updata_step_statu_msg(message::eFinished);
+            code!=SUCCESS?updata_step_statu(message::eError):updata_step_statu(message::eFinished);
             if(code.get_error_level()>=MAJOR_ERROR)
             {
                 //提升错误等级为四级
                 LOG(ERROR)<<" 回退分配车位失败 ------进入异常处理,  车牌号:"<<m_car_info.license();
                 Exception_solver::get_instance_pointer()->solve_exception(code,this);
-            }
-            else
-            {
-                m_step_type= eBackComplete;
+                continue;
             }
         }
-        if(m_step_type== eBackComplete)
+        if(m_current_step_type== message::eBackComplete)
         {
             break;
         }
+        next_step();
     }
 
     /*
      * 跳出循环后,判断状态,是否正常结束, 循环跳出状态只有可能是 eBackComplete(异常结束),eComplete(正常结束),任务取消状态
      */
-    updata_step_statu_msg(message::eFinished);
+    updata_step_statu(message::eFinished);
     publish_step_status();
 
     if(m_cancel_condition.wait_for_millisecond(1)==true) {
         LOG(ERROR) << "停车任务被强制取消,车牌号:" << m_car_info.license()
                    << ",  终端号:" << m_terminor_id;
-        usleep(1000*500);
+        usleep(1000*200);
         return ;
     }
 
-    if(m_step_type== eBackComplete)
+    if(m_current_step_type== message::eBackComplete)
     {
         //异常结束
-        usleep(1000*1000);
+        usleep(1000*200);
         LOG(ERROR)<<"异常停车,回退结束"<<"车牌号:"<<m_car_info.license()
             <<",xxxxxxxxxxxxxx  终端:"<<m_terminor_id<<"  xxxxxxxxxxxxxx";
     }
-    if(m_step_type== eComplete)
+    if(m_current_step_type== message::eComplete)
     {
         //正常结束
-        usleep(1000*500);
+        usleep(1000*200);
         LOG(INFO)<<"停车结束,"<<"车牌号:"<<m_car_info.license()
             <<",--------------  终端:"<<m_terminor_id<<"  --------------";
     }
@@ -556,26 +586,27 @@ void StoreProcessTask::publish_step_status() {
 }
 
 /*
-     * 根据当前流程状态,生成状态消息
+     * 根据当前流程状态,并修改状态消息
      */
-void StoreProcessTask::updata_step_statu_msg(message::Step_statu statu)
+void StoreProcessTask::updata_step_statu(message::Step_statu statu)
 {
+    m_current_step_statu=statu;
     std::lock_guard<std::mutex>         lock(m_process_msg_lock);
-    switch (m_step_type) {
-        case  eAlloc_step: {
+    switch (m_current_step_type) {
+        case  message::eAlloc_step: {
                 message::Alloc_space_step_statu alloc_step_statu;
                 alloc_step_statu.set_step_statu(statu);
                 m_process_msg.mutable_alloc_space_step()->CopyFrom(alloc_step_statu);
             break;
         }
-        case  eMeasure_step: {
+        case  message::eMeasure_step: {
                 message::Measure_step_statu measure_step_statu;
                 measure_step_statu.set_step_statu(statu);
                 measure_step_statu.mutable_locate_info()->CopyFrom(m_locate_info);
                 m_process_msg.mutable_measure_step()->CopyFrom(measure_step_statu);
            break;
         }
-        case  eCompare_step:{
+        case  message::eCompare_step:{
             message::Compare_step_statu     compare_step;
             compare_step.mutable_locate_info_wj()->CopyFrom(m_locate_info);
             compare_step.mutable_locate_info_dj()->CopyFrom(m_measure_response_msg.locate_information());
@@ -584,7 +615,7 @@ void StoreProcessTask::updata_step_statu_msg(message::Step_statu statu)
             m_process_msg.mutable_compare_step()->CopyFrom(compare_step);
             break;
         }
-        case  eDispatch_step: {
+        case  message::eDispatch_step: {
             message::Dispatch_store_step_statu          dispatch_step_statu;
             dispatch_step_statu.set_step_statu(statu);
             dispatch_step_statu.mutable_locate_info()->CopyFrom(m_locate_info);
@@ -592,24 +623,24 @@ void StoreProcessTask::updata_step_statu_msg(message::Step_statu statu)
             m_process_msg.mutable_dispatch_step()->CopyFrom(dispatch_step_statu);
             break;
         }
-        case  eConfirm_step: {
+        case  message::eConfirm_step: {
             message::Confirm_space_step_statu           confirm_step_type;
             confirm_step_type.set_step_statu(statu);
             confirm_step_type.mutable_space_info()->CopyFrom(m_parcspace_alloc_response_msg.allocated_space_info());
             m_process_msg.mutable_confirm_space_step()->CopyFrom(confirm_step_type);
             break;
         }
-        case  eComplete: {
+        case  message::eComplete: {
             m_process_msg.set_completed(true);
             break;
         }
-        case  eBackConfirm_step: {
+        case  message::eBackConfirm_step: {
                 message::Back_confirm_space_step_statu back_confirm_step_type;
                 back_confirm_step_type.set_step_statu(statu);
                 m_process_msg.mutable_back_confirm_step()->CopyFrom(back_confirm_step_type);
             break;
         }
-        case  eBackDispatch_step: {
+        case  message::eBackDispatch_step: {
             message::Back_dispatch_store_step_statu   back_dispatch_step_statu;
             back_dispatch_step_statu.set_step_statu(statu);
             back_dispatch_step_statu.mutable_space_info()->CopyFrom(m_parcspace_alloc_response_msg.allocated_space_info());
@@ -617,7 +648,7 @@ void StoreProcessTask::updata_step_statu_msg(message::Step_statu statu)
             m_process_msg.mutable_back_dispatch_step()->CopyFrom(back_dispatch_step_statu);
             break;
         }
-        case  eBack_compare_step:{
+        case  message::eBack_compare_step:{
             message::Back_compare_step_statu    back_compare_step_statu;
             back_compare_step_statu.set_step_statu(statu);
             back_compare_step_statu.mutable_locate_info_wj()->CopyFrom(m_locate_info);
@@ -626,20 +657,20 @@ void StoreProcessTask::updata_step_statu_msg(message::Step_statu statu)
             m_process_msg.mutable_back_compare_step()->CopyFrom(back_compare_step_statu);
             break;
         }
-        case  eBackMeasure_step: {
+        case  message::eBackMeasure_step: {
             message::Back_measure_step_statu        back_measure_step_statu;
             back_measure_step_statu.set_step_statu(statu);
             m_process_msg.mutable_back_measure_step()->CopyFrom(back_measure_step_statu);
             break;
         }
-        case  eBackAlloc_step: {
+        case  message::eBackAlloc_step: {
             message::Back_alloc_space_step_statu    back_alloc_step_statu;
             back_alloc_step_statu.set_step_statu(statu);
             back_alloc_step_statu.mutable_space_info()->CopyFrom(m_parcspace_alloc_response_msg.allocated_space_info());
             m_process_msg.mutable_back_alloc_space_step()->CopyFrom(back_alloc_step_statu);
             break;
         }
-        case  eBackComplete: {
+        case  message::eBackComplete: {
             m_process_msg.set_back_completed(true);
             break;
         }

+ 7 - 2
system/StoreProcessTask.h

@@ -33,6 +33,11 @@ public:
      */
     virtual tq::TaskCategory GetCategory() const{ return message::eStoring;}
 
+    /*
+     * 控制流程到下一步
+     */
+    virtual Error_manager next_step();
+
 
 protected:
     virtual void Main();
@@ -77,9 +82,9 @@ protected:
 
     virtual void publish_step_status();
     /*
-     * 根据当前流程状态,生成状态消息
+     * 根据当前流程状态,修改状态消息
      */
-    void updata_step_statu_msg(message::Step_statu statu);
+    void updata_step_statu(message::Step_statu statu);
 
 protected:
 

+ 12 - 10
system/command_manager.cpp

@@ -177,7 +177,7 @@ Error_manager Command_manager::execute_store_command(message::Store_command_requ
         error_msg.set_error_code(ERROR);
         error_msg.set_error_description("bug,线程池未初始化");
         response.mutable_code()->CopyFrom(error_msg);
-        return Error_manager(ERROR, CRITICAL_ERROR, "线程池未初始化,bug");
+        return Error_manager(ERROR, MINOR_ERROR, "线程池未初始化,bug");
     }
 
     if(m_system_paused==true)
@@ -185,7 +185,7 @@ Error_manager Command_manager::execute_store_command(message::Store_command_requ
         error_msg.set_error_code(PAUSE);
         error_msg.set_error_description("急停");
         response.mutable_code()->CopyFrom(error_msg);
-        return Error_manager(PAUSE, CRITICAL_ERROR, "系统已急停");
+        return Error_manager(PAUSE, MINOR_ERROR, "系统已急停");
     }
 
     //判断入口是否开放
@@ -194,13 +194,13 @@ Error_manager Command_manager::execute_store_command(message::Store_command_requ
         error_msg.set_error_code(ERROR);
         error_msg.set_error_description("terminal_id 参数设置错误");
         response.mutable_code()->CopyFrom(error_msg);
-        return Error_manager(ERROR, CRITICAL_ERROR, "terminal id 设置错误");
+        return Error_manager(ERROR, MINOR_ERROR, "terminal id 设置错误");
     }
     if(m_input_entrance_statu[request.terminal_id()]!=Enable) {
         error_msg.set_error_code(ERROR);
         error_msg.set_error_description("入口已关闭 Disable");
         response.mutable_code()->CopyFrom(error_msg);
-        return Error_manager(ERROR, CRITICAL_ERROR, "入口已禁止使用 Disable");
+        return Error_manager(ERROR, MINOR_ERROR, "入口已禁止使用 Disable");
     }
 
     if (request.base_info().msg_type() == message::eStore_command_request_msg
@@ -254,7 +254,7 @@ Error_manager Command_manager::execute_store_command(message::Store_command_requ
 
                         LOG(INFO) << "收到停车,车牌:"<< request.car_info().license() <<
                                   ",终端:" << request.terminal_id()<<"............................";
-                        tq::BaseTask *ptask = new StoreProcessTask(request.terminal_id(),request.car_info());
+                        Process_task *ptask = new StoreProcessTask(request.terminal_id(),request.car_info());
                         StoreProcessTask *pStore_task = (StoreProcessTask *) ptask;
                         //初始化流程
                         pStore_task->init_task(locate_info);
@@ -262,6 +262,7 @@ Error_manager Command_manager::execute_store_command(message::Store_command_requ
                         //获取车位
                         Error_manager code = pStore_task->alloc_space();
                         if (code == SUCCESS) {
+                            pStore_task->next_step();
                             m_thread_queue_process->AddTask(pStore_task);
                             response.mutable_code()->CopyFrom(error_msg);
                             return SUCCESS;
@@ -308,7 +309,7 @@ Error_manager Command_manager::execute_pickup_command(message::Pickup_command_re
         error_msg.set_error_code(ERROR);
         error_msg.set_error_description("bug,线程池未初始化");
         response.mutable_code()->CopyFrom(error_msg);
-        return Error_manager(ERROR, CRITICAL_ERROR, "线程池未初始化,bug");
+        return Error_manager(ERROR, MINOR_ERROR, "线程池未初始化,bug");
     }
 
     if(m_system_paused==true)
@@ -316,7 +317,7 @@ Error_manager Command_manager::execute_pickup_command(message::Pickup_command_re
         error_msg.set_error_code(PAUSE);
         error_msg.set_error_description("急停");
         response.mutable_code()->CopyFrom(error_msg);
-        return Error_manager(PAUSE, CRITICAL_ERROR, "急停");
+        return Error_manager(PAUSE, MINOR_ERROR, "急停");
     }
 
 
@@ -326,14 +327,14 @@ Error_manager Command_manager::execute_pickup_command(message::Pickup_command_re
         error_msg.set_error_code(ERROR);
         error_msg.set_error_description("出口 id 设置错误");
         response.mutable_code()->CopyFrom(error_msg);
-        return Error_manager(ERROR, CRITICAL_ERROR, "出口 id 设置错误");
+        return Error_manager(ERROR, MINOR_ERROR, "出口 id 设置错误");
     }
     if(m_output_entrance_statu[request.terminal_id()]!=Enable)
     {
         error_msg.set_error_code(ERROR);
         error_msg.set_error_description("中控出口已停止使用");
         response.mutable_code()->CopyFrom(error_msg);
-        return Error_manager(ERROR, CRITICAL_ERROR, "中控出口已停止使用");
+        return Error_manager(ERROR, MINOR_ERROR, "中控出口已停止使用");
     }
 
     if(request.base_info().msg_type()==message::ePickup_command_request_msg
@@ -367,7 +368,7 @@ Error_manager Command_manager::execute_pickup_command(message::Pickup_command_re
         //一切正常,接受指令
         Error_manager code;
         LOG(WARNING)<<"收到取车-----------------------------"<<request.car_info().license();
-        tq::BaseTask* ptask=new PickupProcessTask(request.terminal_id(),request.car_info());
+        Process_task* ptask=new PickupProcessTask(request.terminal_id(),request.car_info());
         PickupProcessTask* pPick_task=(PickupProcessTask*)ptask;
         //初始化流程
         code=pPick_task->init_task();
@@ -376,6 +377,7 @@ Error_manager Command_manager::execute_pickup_command(message::Pickup_command_re
 
         if(code==SUCCESS)
         {
+            pPick_task->next_step();
             m_thread_queue_process->AddTask(pPick_task);
             response.mutable_code()->CopyFrom(error_msg);
             return SUCCESS;

+ 1 - 1
system/process_task.cpp

@@ -30,7 +30,7 @@ Process_task::~Process_task()
  */
 void Process_task::Cancel()
 {
-    m_step_type= eBackComplete;
+    m_current_step_type= message::eBackComplete;
     m_cancel_condition.set_pass_ever(true);
     tq::BaseTask::Cancel();
 }

+ 11 - 29
system/process_task.h

@@ -4,6 +4,8 @@
 
 #ifndef NNXX_TESTS_PROCESS_TASK_H
 #define NNXX_TESTS_PROCESS_TASK_H
+
+#include <error_code.h>
 #include "thread_condition.h"
 #include "TaskQueue/BaseTask.h"
 #include "process_message.pb.h"
@@ -14,40 +16,14 @@
  * 派生出 停车任务类(StoreProcessTask)与取车任务类(PickupProcessTask)
  */
 class Process_task : public tq::BaseTask{
-protected:
-    enum EStep_type
-    {
-        eAlloc_step=0,
-        eMeasure_step,
-        eCompare_step,
-        eDispatch_step,
-        eConfirm_step,
-
-        eSearch_step,         //查询数据库
-        eWait_step,             //等待车辆离开
-        eRelease_step,          //释放车位
-
-        eComplete,              //完成
-
-        eBackConfirm_step,
-        eBack_compare_step,
-        eBackMeasure_step,
-        eBackAlloc_step,
-
-        eBackWait_step,
-        eBackDispatch_step,
-        eBackSearch_step,
-
-        eBackComplete
-    };
-
 
 public:
     Process_task(unsigned int command_id,message::Car_info car_info);
     virtual ~Process_task();
     unsigned int terminal_id(){return m_terminor_id;}
     std::string license(){ return m_car_info.license();}
-    EStep_type step_type(){return m_step_type;}
+    message::Step_type current_step_type(){return m_current_step_type;}
+    message::Step_statu current_step_statu(){return m_current_step_statu;}
     /*
      * 取消任务
      */
@@ -58,6 +34,11 @@ public:
      */
     virtual bool is_canceled();
 
+    /*
+     * 控制流程到下一步
+     */
+    virtual Error_manager next_step()=0;
+
 protected:
     /*
      * 发布进度消息
@@ -69,7 +50,8 @@ protected:
 protected:
     unsigned int                            m_terminor_id;
     message::Car_info                       m_car_info;                         //当前流程的车辆信息
-    EStep_type                              m_step_type;
+    message::Step_type                      m_current_step_type;                //当前流程正在哪一步
+    message::Step_statu                     m_current_step_statu;               //当前步骤所处的状态
 
     std::thread*                            m_publish_statu_thread;             //广播状态线程
     Thread_condition				        m_publish_exit_condition;			//发送的条件变量

+ 21 - 12
test/Terminal_communication.cpp

@@ -5,6 +5,7 @@
 #include "Terminal_communication.h"
 #include "process_message.pb.h"
 #include <condition_variable>
+#include <central_control_message.pb.h>
 
 Terminal_communication::Terminal_communication()
     :m_update_msg_map_thread(nullptr)
@@ -64,11 +65,8 @@ Error_manager Terminal_communication::execute_msg(Communication_message* p_msg)
         if(base_info.sender()==message::eMain && base_info.receiver()==message::eTerminor)
         {
             message::Error_manager error_code=response.code();
-            if(error_code.error_code()==0)
-            {
-                m_store_response_msg=response;
-                return SUCCESS;
-            }
+            m_store_response_msg=response;
+            return SUCCESS;
         }
     }
 
@@ -83,11 +81,8 @@ Error_manager Terminal_communication::execute_msg(Communication_message* p_msg)
         if(base_info.sender()==message::eMain && base_info.receiver()==message::eTerminor)
         {
             message::Error_manager error_code=response.code();
-            if(error_code.error_code()==0)
-            {
-                m_pickup_response_msg=response;
-                return SUCCESS;
-            }
+            m_pickup_response_msg=response;
+            return SUCCESS;
         }
     }
 
@@ -96,7 +91,7 @@ Error_manager Terminal_communication::execute_msg(Communication_message* p_msg)
         message::Storing_process_statu_msg msg;
         if(msg.ParseFromString(p_msg->get_message_buf())==false)
         {
-            std::cout<<" ERROR : Storing_process_statu_msg 失败"<<std::endl;
+            return Error_manager(ERROR,CRITICAL_ERROR,"停车流程状态信息解析错误");
         }
         message::Base_info base_info=msg.base_info();
         if(base_info.sender()==message::eMain)
@@ -118,7 +113,7 @@ Error_manager Terminal_communication::execute_msg(Communication_message* p_msg)
         message::Picking_process_statu_msg msg;
         if(msg.ParseFromString(p_msg->get_message_buf())==false)
         {
-            std::cout<<" ERROR : Picking_process_statu_msg 失败"<<std::endl;
+            return Error_manager(ERROR,CRITICAL_ERROR,"取车流程状态信息解析错误");
         }
         message::Base_info base_info=msg.base_info();
         if(base_info.sender()==message::eMain)
@@ -133,6 +128,20 @@ Error_manager Terminal_communication::execute_msg(Communication_message* p_msg)
         }
     }
 
+    if(p_msg->get_message_type()==Communication_message::eCentral_controller_statu_msg)
+    {
+        message::Central_controller_statu_msg msg;
+        if(msg.ParseFromString(p_msg->get_message_buf())==false)
+        {
+            return Error_manager(ERROR,CRITICAL_ERROR,"中控状态信息解析错误");
+        }
+        message::Base_info base_info=msg.base_info();
+        if(base_info.sender()==message::eMain)
+        {
+
+        }
+    }
+
     return SUCCESS;
 
     return Error_manager(FAILED,MINOR_ERROR,"terminal communication 未知消息");

+ 1 - 1
test/terminal_client.cpp

@@ -130,7 +130,7 @@ int main() {
 
        {
 
-            usleep(1000*1000*in_count);
+            usleep(1000*500*in_count);
             std::this_thread::yield();
         }
     }