Browse Source

新增手动操作取消任务消息处理 ...

zx 4 years ago
parent
commit
703fa39df5

+ 2 - 0
main.cpp

@@ -55,6 +55,8 @@ Error_manager init_communicators()
     char bind_string[64]={0};
     sprintf(bind_string,"tcp://%s:%d",system_setting.bind_ip().c_str(),system_setting.exception_handle_port());
     Exception_solver::get_instance_pointer()->communication_bind(bind_string);
+    Exception_solver::get_instance_pointer()->communication_run();
+
     ///初始化与终端通讯的对象
     if(System_communicator::get_instance_pointer()== nullptr)
         return FAILED;

+ 3 - 13
solve_exception/exception_solver.cpp

@@ -66,6 +66,7 @@ Error_manager Exception_solver::execute_msg(Communication_message* p_msg)
                 LOG(ERROR)<<"  手动消息解析失败  !!!";
                 break;
             }
+            LOG(INFO)<<"接收到手动消息//////////////////////////  : "<<msg.license();
             m_manual_msg_map[msg.license()]=msg;
         }
 
@@ -78,19 +79,7 @@ Error_manager Exception_solver::execute_msg(Communication_message* p_msg)
  */
 Error_manager Exception_solver::check_msg(Communication_message* p_msg)
 {
-    //通过 p_msg->get_message_type() 和 p_msg->get_receiver() 判断这条消息是不是给我的.
-    //子类重载时, 增加自己模块的判断逻辑, 以后再写.
-    /*if ( (p_msg->get_message_type() == Communication_message::Message_type::eDispatch_response_msg
-          ||p_msg->get_message_type() == Communication_message::Message_type::eDispatch_status_msg)
-         && p_msg->get_receiver() == Communication_message::Communicator::eMain )
-    {
-        return Error_code::SUCCESS;
-    }
-    else
-    {
-        //认为接受人
-        return Error_code::INVALID_MESSAGE;
-    }*/
+    return SUCCESS;
 }
 /*
  * 心跳发送函数,重载
@@ -120,6 +109,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())
             {
+                LOG(INFO)<<"查询到手动消息|||||||||||||||  : "<<msg.license();
                 return SUCCESS;
             }
         }

+ 5 - 5
system/StoreProcessTask.cpp

@@ -443,7 +443,6 @@ void StoreProcessTask::Main()
             {
                 //提升错误等级为四级
                 Exception_solver::get_instance_pointer()->solve_exception(code,this);
-                break;
             }
             else
             {
@@ -461,7 +460,7 @@ void StoreProcessTask::Main()
             if(code.get_error_level()>=MAJOR_ERROR)
             {
                 Exception_solver::get_instance_pointer()->solve_exception(code,this);
-                break;
+                LOG(WARNING)<<" 手动处理完成,  继续 ..............................";
             }
             else
             {
@@ -479,7 +478,6 @@ void StoreProcessTask::Main()
             {
                 //提升错误等级为四级
                 Exception_solver::get_instance_pointer()->solve_exception(code,this);
-                break;
             }
             else
             {
@@ -496,7 +494,6 @@ void StoreProcessTask::Main()
             {
                 //提升错误等级为四级
                 Exception_solver::get_instance_pointer()->solve_exception(code,this);
-                break;
             }
             else
             {
@@ -505,7 +502,6 @@ void StoreProcessTask::Main()
         }
         if(m_step_statu== eBackComplete)
         {
-            updata_step_statu_msg(message::eFinished);
             break;
         }
     }
@@ -513,9 +509,13 @@ void StoreProcessTask::Main()
     /*
      * 跳出循环后,判断状态,是否正常结束, 循环跳出状态只有可能是 eBackComplete(异常结束),eComplete(正常结束),任务取消状态
      */
+    updata_step_statu_msg(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);
         return ;
     }
 

+ 1 - 1
system/process_task.cpp

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

+ 1 - 1
system/system_setting.proto

@@ -8,7 +8,7 @@ message System_setting
     optional int32          park_space_port=3 [default=30001];
     optional int32          measurer_port=4 [default=30002];
     optional int32          dispatcher_port=5 [default=30003];
-    optional int32          exception_handle_port=6 [default=3004];
+    optional int32          exception_handle_port=6 [default=30004];
 
     required int32          entrance_num=7;
     required int32          export_num=8;