|
@@ -300,6 +300,14 @@ Error_manager Dispatch_process::dispatch_control_motion()
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
+ case DISPATCH_CONTROL_TASK_WITHDRAW://流程 收回任务单
|
|
|
+ {
|
|
|
+ //发送调度控制答复, 发给调度控制的
|
|
|
+ t_error = dispatch_control_withdraw_task(iter->first, iter->second);
|
|
|
+ //流程正常, 就进入等待状态, 等待调度控制发送动作指令
|
|
|
+ iter->second.m_dispatch_control_status = DISPATCH_CONTROL_RESPONSE;
|
|
|
+ break;
|
|
|
+ }
|
|
|
case DISPATCH_CONTROL_RESPONSE://流程 给调度控制答复
|
|
|
{
|
|
|
//发送调度控制答复, 发给调度控制的
|
|
@@ -312,9 +320,14 @@ Error_manager Dispatch_process::dispatch_control_motion()
|
|
|
{
|
|
|
//断开调度设备, 释放任务单 与设备解除连接
|
|
|
t_error = disconnect_dispatch_device(iter->first, iter->second);
|
|
|
- //流程正常, 就回到 等待状态, 等待调度控制发送动作指令
|
|
|
- iter->second.m_error.error_manager_clear_all();
|
|
|
- iter->second.m_dispatch_control_status = DISPATCH_CONTROL_READY;
|
|
|
+ if ( t_error == Error_code::SUCCESS )
|
|
|
+ {
|
|
|
+ //流程正常, 就回到 等待状态, 等待调度控制发送动作指令
|
|
|
+ iter->second.m_error.error_manager_clear_all();
|
|
|
+ iter->second.m_dispatch_control_status = DISPATCH_CONTROL_READY;
|
|
|
+ }
|
|
|
+ //else 保持不变继续等待
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
default:
|
|
@@ -622,6 +635,15 @@ Error_manager Dispatch_process::excute_dispatch_control(int dispatch_device_type
|
|
|
dispatch_control_node.m_error = t_error;
|
|
|
return t_error;
|
|
|
}
|
|
|
+//流程通知设备 收回任务单
|
|
|
+Error_manager Dispatch_process::dispatch_control_withdraw_task(int dispatch_device_type, Dispatch_control_node & dispatch_control_node)
|
|
|
+{
|
|
|
+ if ( dispatch_control_node.mp_dispatch_device.get() != NULL && dispatch_control_node.mp_dispatch_task.get() != NULL )
|
|
|
+ {
|
|
|
+ dispatch_control_node.mp_dispatch_task->set_task_statu(Task_Base::Task_statu::TASK_WITHDRAW);
|
|
|
+ }
|
|
|
+ return Error_code::SUCCESS;
|
|
|
+}
|
|
|
//发送调度控制答复, 发给调度控制的
|
|
|
Error_manager Dispatch_process::send_dispatch_control_response_msg(int dispatch_device_type, Dispatch_control_node & dispatch_control_node, message::Dispatch_device_task_status dispatch_device_task_status)
|
|
|
{
|
|
@@ -657,9 +679,16 @@ Error_manager Dispatch_process::disconnect_dispatch_device(int dispatch_device_t
|
|
|
{
|
|
|
if ( dispatch_control_node.mp_dispatch_device.get() != NULL && dispatch_control_node.mp_dispatch_task.get() != NULL )
|
|
|
{
|
|
|
- dispatch_control_node.mp_dispatch_task->set_task_statu(Task_Base::Task_statu::TASK_WITHDRAW);
|
|
|
- dispatch_control_node.mp_dispatch_task.reset();
|
|
|
- dispatch_control_node.mp_dispatch_device.reset();
|
|
|
+ if ( dispatch_control_node.mp_dispatch_task->get_task_statu() == Task_Base::Task_statu::TASK_FREE )
|
|
|
+ {
|
|
|
+ dispatch_control_node.mp_dispatch_task.reset();
|
|
|
+ dispatch_control_node.mp_dispatch_device.reset();
|
|
|
+ return Error_code::SUCCESS;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return Error_code::NODATA;
|
|
|
+ }
|
|
|
}
|
|
|
return Error_code::SUCCESS;
|
|
|
}
|