|
@@ -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_statu=eAlloc_step;
|
|
|
+ m_step_type=eAlloc_step;
|
|
|
///创建状态发布线程
|
|
|
if(m_publish_statu_thread== nullptr)
|
|
|
{
|
|
@@ -112,7 +112,7 @@ Error_manager StoreProcessTask::compare_step()
|
|
|
*/
|
|
|
Error_manager StoreProcessTask::back_compare_step()
|
|
|
{
|
|
|
- int k=rand()%2;
|
|
|
+ int k=rand()%10;
|
|
|
if(k==0)
|
|
|
return Error_manager(ERROR,CRITICAL_ERROR,"回退检验对比失败");
|
|
|
return SUCCESS;
|
|
@@ -192,7 +192,7 @@ Error_manager StoreProcessTask::alloc_space()
|
|
|
/*
|
|
|
* 检查是否有测量数据
|
|
|
*/
|
|
|
- m_step_statu=eAlloc_step;
|
|
|
+ m_step_type=eAlloc_step;
|
|
|
updata_step_statu_msg(message::eWorking);
|
|
|
if(m_locate_info.has_locate_height()==false||m_locate_info.has_locate_width()==false)
|
|
|
{
|
|
@@ -240,7 +240,7 @@ Error_manager StoreProcessTask::alloc_space()
|
|
|
}
|
|
|
updata_step_statu_msg(message::eFinished);
|
|
|
//置步骤状态为测量状态.
|
|
|
- m_step_statu=eMeasure_step;
|
|
|
+ m_step_type=eMeasure_step;
|
|
|
return SUCCESS;
|
|
|
}
|
|
|
else
|
|
@@ -371,7 +371,7 @@ void StoreProcessTask::Main()
|
|
|
while(m_cancel_condition.wait_for_millisecond(1)==false)
|
|
|
{
|
|
|
//第一步,测量
|
|
|
- if (m_step_statu == eMeasure_step)
|
|
|
+ if (m_step_type == eMeasure_step)
|
|
|
{
|
|
|
//开始定位
|
|
|
updata_step_statu_msg(message::eWorking);
|
|
@@ -379,32 +379,32 @@ void StoreProcessTask::Main()
|
|
|
usleep(1000 * 1000 * (rand() % 5 + 1));
|
|
|
code!=SUCCESS?updata_step_statu_msg(message::eError):updata_step_statu_msg(message::eFinished);
|
|
|
|
|
|
- LOG_IF(ERROR, code != SUCCESS) << "测量失败:" << code.get_error_description();
|
|
|
- m_step_statu = (code != SUCCESS) ? eBackAlloc_step : eCompare_step;
|
|
|
+ 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_statu== eCompare_step)
|
|
|
+ if(m_step_type== eCompare_step)
|
|
|
{
|
|
|
updata_step_statu_msg(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) << "检验失败:" << code.get_error_description();
|
|
|
- m_step_statu = (code != SUCCESS) ? eBackMeasure_step : eDispatch_step;
|
|
|
+ LOG_IF(ERROR, code != SUCCESS) << "检验失败:"<<m_car_info.license() << code.get_error_description();
|
|
|
+ m_step_type = (code != SUCCESS) ? eBackMeasure_step : eDispatch_step;
|
|
|
|
|
|
}
|
|
|
//第二步,调度
|
|
|
- if (m_step_statu == eDispatch_step)
|
|
|
+ if (m_step_type == eDispatch_step)
|
|
|
{
|
|
|
//开始调度
|
|
|
updata_step_statu_msg(message::eWorking);
|
|
|
code = dispatch_step();
|
|
|
usleep(1000 * 1000 * (rand() % 5));
|
|
|
code!=SUCCESS?updata_step_statu_msg(message::eError):updata_step_statu_msg(message::eFinished);
|
|
|
- LOG_IF(ERROR, code != SUCCESS) << "调度失败:" << code.get_error_description();
|
|
|
- m_step_statu = (code != SUCCESS) ? eBack_compare_step : eConfirm_step;
|
|
|
+ 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_statu == eConfirm_step)
|
|
|
+ if (m_step_type == eConfirm_step)
|
|
|
{
|
|
|
updata_step_statu_msg(message::eWorking);
|
|
|
code = confirm_space_step();
|
|
@@ -414,10 +414,10 @@ void StoreProcessTask::Main()
|
|
|
" 车位id :"
|
|
|
<< m_parcspace_alloc_response_msg.allocated_space_info().parkspace_id()
|
|
|
<< ",车牌:" << m_car_info.license()<<code.to_string();
|
|
|
- m_step_statu = (code != SUCCESS) ? eBackDispatch_step : eComplete;
|
|
|
+ m_step_type = (code != SUCCESS) ? eBackDispatch_step : eComplete;
|
|
|
}
|
|
|
//第四步,完成,退出循环
|
|
|
- if (m_step_statu == eComplete)
|
|
|
+ if (m_step_type == eComplete)
|
|
|
{
|
|
|
//流程结束前,保证至少发送一次流程完成状态
|
|
|
updata_step_statu_msg(message::eFinished);
|
|
@@ -426,14 +426,14 @@ void StoreProcessTask::Main()
|
|
|
|
|
|
//回退confirm ------------------------------------华丽的分割线------------------------------------------
|
|
|
|
|
|
- if (m_step_statu == eBackConfirm_step)
|
|
|
+ if (m_step_type == eBackConfirm_step)
|
|
|
{
|
|
|
updata_step_statu_msg(message::eWorking);
|
|
|
usleep(1000*1000);
|
|
|
updata_step_statu_msg(message::eFinished);
|
|
|
- m_step_statu= eBackDispatch_step;
|
|
|
+ m_step_type= eBackDispatch_step;
|
|
|
}
|
|
|
- if(m_step_statu== eBackDispatch_step)
|
|
|
+ if(m_step_type== eBackDispatch_step)
|
|
|
{
|
|
|
updata_step_statu_msg(message::eWorking);
|
|
|
code=back_dispatch_step();
|
|
@@ -442,16 +442,17 @@ void StoreProcessTask::Main()
|
|
|
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_statu= eBack_compare_step;
|
|
|
+ m_step_type= eBack_compare_step;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(m_step_statu== eBack_compare_step)
|
|
|
+ if(m_step_type== eBack_compare_step)
|
|
|
{
|
|
|
updata_step_statu_msg(message::eWorking);
|
|
|
code=back_compare_step();
|
|
@@ -459,16 +460,17 @@ void StoreProcessTask::Main()
|
|
|
code!=SUCCESS?updata_step_statu_msg(message::eError):updata_step_statu_msg(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)<<" 手动处理完成, 继续 ..............................";
|
|
|
+ LOG(WARNING)<<" 手动处理 结果对比, 继续 ..........车牌:"<<m_car_info.license();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- m_step_statu= eBackMeasure_step;
|
|
|
+ m_step_type= eBackMeasure_step;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(m_step_statu== eBackMeasure_step)
|
|
|
+ if(m_step_type== eBackMeasure_step)
|
|
|
{
|
|
|
updata_step_statu_msg(message::eWorking);
|
|
|
code=back_locate_step();
|
|
@@ -477,14 +479,15 @@ void StoreProcessTask::Main()
|
|
|
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_statu= eBackAlloc_step;
|
|
|
+ m_step_type= eBackAlloc_step;
|
|
|
}
|
|
|
}
|
|
|
- if(m_step_statu== eBackAlloc_step)
|
|
|
+ if(m_step_type== eBackAlloc_step)
|
|
|
{
|
|
|
updata_step_statu_msg(message::eWorking);
|
|
|
code=back_alloc_space_step();
|
|
@@ -493,14 +496,15 @@ void StoreProcessTask::Main()
|
|
|
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_statu= eBackComplete;
|
|
|
+ m_step_type= eBackComplete;
|
|
|
}
|
|
|
}
|
|
|
- if(m_step_statu== eBackComplete)
|
|
|
+ if(m_step_type== eBackComplete)
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
@@ -519,14 +523,14 @@ void StoreProcessTask::Main()
|
|
|
return ;
|
|
|
}
|
|
|
|
|
|
- if(m_step_statu== eBackComplete)
|
|
|
+ if(m_step_type== eBackComplete)
|
|
|
{
|
|
|
//异常结束
|
|
|
usleep(1000*1000);
|
|
|
LOG(ERROR)<<"异常停车,回退结束"<<"车牌号:"<<m_car_info.license()
|
|
|
<<",xxxxxxxxxxxxxx 终端:"<<m_terminor_id<<" xxxxxxxxxxxxxx";
|
|
|
}
|
|
|
- if(m_step_statu== eComplete)
|
|
|
+ if(m_step_type== eComplete)
|
|
|
{
|
|
|
//正常结束
|
|
|
usleep(1000*500);
|
|
@@ -552,7 +556,7 @@ void StoreProcessTask::publish_step_status() {
|
|
|
void StoreProcessTask::updata_step_statu_msg(message::Step_statu statu)
|
|
|
{
|
|
|
std::lock_guard<std::mutex> lock(m_process_msg_lock);
|
|
|
- switch (m_step_statu) {
|
|
|
+ switch (m_step_type) {
|
|
|
case eAlloc_step: {
|
|
|
message::Alloc_space_step_statu alloc_step_statu;
|
|
|
alloc_step_statu.set_step_statu(statu);
|
|
@@ -560,7 +564,6 @@ void StoreProcessTask::updata_step_statu_msg(message::Step_statu statu)
|
|
|
break;
|
|
|
}
|
|
|
case 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);
|
|
@@ -585,10 +588,10 @@ void StoreProcessTask::updata_step_statu_msg(message::Step_statu statu)
|
|
|
break;
|
|
|
}
|
|
|
case eConfirm_step: {
|
|
|
- message::Confirm_space_step_statu confirm_step_statu;
|
|
|
- confirm_step_statu.set_step_statu(statu);
|
|
|
- confirm_step_statu.mutable_space_info()->CopyFrom(m_parcspace_alloc_response_msg.allocated_space_info());
|
|
|
- m_process_msg.mutable_confirm_space_step()->CopyFrom(confirm_step_statu);
|
|
|
+ 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: {
|
|
@@ -596,9 +599,9 @@ void StoreProcessTask::updata_step_statu_msg(message::Step_statu statu)
|
|
|
break;
|
|
|
}
|
|
|
case eBackConfirm_step: {
|
|
|
- message::Back_confirm_space_step_statu back_confirm_step_statu;
|
|
|
- back_confirm_step_statu.set_step_statu(statu);
|
|
|
- m_process_msg.mutable_back_confirm_step()->CopyFrom(back_confirm_step_statu);
|
|
|
+ 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: {
|