|
@@ -43,6 +43,8 @@ Error_manager Dispatch_singlechip::dispatch_singlechip_init(int plc_id, int sing
|
|
|
|
|
|
m_dispatch_singlechip_status = DISPATCH_SINGLECHIP_READY;
|
|
|
|
|
|
+ m_close_outsidedoor_flag = false;
|
|
|
+
|
|
|
return Error_code::SUCCESS;
|
|
|
}
|
|
|
//调度单片机 反初始化
|
|
@@ -260,52 +262,82 @@ void Dispatch_singlechip::execute_thread_fun()
|
|
|
}
|
|
|
|
|
|
//入口外门控制函数
|
|
|
-void Dispatch_singlechip::inlet_outsidedoor_control()
|
|
|
+Error_manager Dispatch_singlechip::inlet_outsidedoor_control()
|
|
|
{
|
|
|
// return;
|
|
|
+ Error_manager t_error;
|
|
|
+
|
|
|
if ( m_dispatch_singlechip_status == DISPATCH_SINGLECHIP_READY )
|
|
|
{
|
|
|
int t_terminal_id = m_plc_id*2 + m_singlechip_id;
|
|
|
int t_singlechip_index = (m_singlechip_direction-1)*2 + m_singlechip_id;
|
|
|
|
|
|
-// int t_outsidedoor_control = Dispatch_communication::get_instance_references().m_singlechip_request_from_plc_to_manager[t_singlechip_index].m_request_outsidedoor_control;
|
|
|
-
|
|
|
-// std::cout << " huli test :::: " << " +++++++++++++++++++++++++++++++++ = " << 1 << std::endl;
|
|
|
-// std::cout << " huli test :::: " << " get_inside_existence_flag() = " << get_inside_existence_flag() << std::endl;
|
|
|
-// std::cout << " huli test :::: " << " t_outsidedoor_control = " << t_outsidedoor_control << std::endl;
|
|
|
-// std::cout << " huli test :::: " << " hhhhhhhh = " << Dispatch_communication::get_instance_references().m_singlechip_request_from_plc_to_manager[t_singlechip_index].m_request_heartbeat << std::endl;
|
|
|
-
|
|
|
- //检查出口取车是否完成, 出口有取车完成指令就返回成功, 否则报错.
|
|
|
- if ( Dispatch_manager::get_instance_references().m_dispatch_command.check_park_is_start(t_terminal_id+1) == Error_code::SUCCESS )
|
|
|
- {
|
|
|
+ std::string t_primary_key_now = "";
|
|
|
+ t_error = Dispatch_manager::get_instance_references().m_dispatch_command.get_primary_key_for_store(t_terminal_id+1, t_primary_key_now);
|
|
|
+ if ( t_error != Error_code::SUCCESS )
|
|
|
+ {
|
|
|
+ return t_error;
|
|
|
+ }
|
|
|
+ else if(t_primary_key_now != "")
|
|
|
+ {
|
|
|
+ int t_plc_outsidedoor_control = Dispatch_communication::get_instance_references().m_singlechip_request_from_plc_to_manager[t_singlechip_index].m_request_outsidedoor_control;
|
|
|
|
|
|
- int t_outsidedoor_control = Dispatch_communication::get_instance_references().m_singlechip_request_from_plc_to_manager[t_singlechip_index].m_request_outsidedoor_control;
|
|
|
-//
|
|
|
-// std::cout << " huli test :::: " << " +++++++++++++++++++++++++++++++++ = " << 1 << std::endl;
|
|
|
-// std::cout << " huli test :::: " << " get_inside_existence_flag() = " << get_inside_existence_flag() << std::endl;
|
|
|
-// std::cout << " huli test :::: " << " t_outsidedoor_control = " << t_outsidedoor_control << std::endl;
|
|
|
+ if ( ( t_primary_key_now != m_primary_key_last && get_inside_existence_flag() == 1)
|
|
|
+ || t_plc_outsidedoor_control == 0 )
|
|
|
+ {
|
|
|
+ m_close_outsidedoor_flag = true;
|
|
|
+ m_primary_key_last = t_primary_key_now;
|
|
|
+ }
|
|
|
|
|
|
- //检测入口是否有车, //有车就开门, 检查门的状态, 并发送关门指令
|
|
|
- if ( get_inside_existence_flag() == 1 || t_outsidedoor_control == 0 )
|
|
|
+ if ( m_close_outsidedoor_flag == true )
|
|
|
+ {
|
|
|
+ //有车就开门, 检查门的状态, 并发送关门指令
|
|
|
+ if ( get_outside_door_status() == message::Outside_door_status::OUTSIDE_DOOR_STATUS_OPEN ||
|
|
|
+ get_outside_door_status() == message::Outside_door_status::OUTSIDE_DOOR_STATUS_RUN )
|
|
|
+ {
|
|
|
+
|
|
|
+ //发送关门指令
|
|
|
+ close_outside_door();
|
|
|
+ }
|
|
|
+ else if (get_outside_door_status() == message::Outside_door_status::OUTSIDE_DOOR_STATUS_CLOSE)
|
|
|
+ {
|
|
|
+ m_close_outsidedoor_flag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- //有车就开门, 检查门的状态, 并发送关门指令
|
|
|
- if ( get_outside_door_status() == message::Outside_door_status::OUTSIDE_DOOR_STATUS_OPEN ||
|
|
|
- get_outside_door_status() == message::Outside_door_status::OUTSIDE_DOOR_STATUS_RUN )
|
|
|
- {
|
|
|
|
|
|
- //发送关门指令
|
|
|
- close_outside_door();
|
|
|
- }
|
|
|
- //else 等待汽车离开
|
|
|
+ return Error_code::SUCCESS; ;
|
|
|
}
|
|
|
- //else 什么也不做
|
|
|
- }
|
|
|
- //else 什么也不做
|
|
|
+
|
|
|
+
|
|
|
+// //检查出口取车是否完成, 出口有取车完成指令就返回成功, 否则报错.
|
|
|
+// if ( Dispatch_manager::get_instance_references().m_dispatch_command.check_park_is_start(t_terminal_id+1) == Error_code::SUCCESS )
|
|
|
+// {
|
|
|
+// int t_outsidedoor_control = Dispatch_communication::get_instance_references().m_singlechip_request_from_plc_to_manager[t_singlechip_index].m_request_outsidedoor_control;
|
|
|
+//
|
|
|
+// //检测入口是否有车, //有车就开门, 检查门的状态, 并发送关门指令
|
|
|
+// if ( get_inside_existence_flag() == 1 || t_outsidedoor_control == 0 )
|
|
|
+// {
|
|
|
+// //有车就开门, 检查门的状态, 并发送关门指令
|
|
|
+// if ( get_outside_door_status() == message::Outside_door_status::OUTSIDE_DOOR_STATUS_OPEN ||
|
|
|
+// get_outside_door_status() == message::Outside_door_status::OUTSIDE_DOOR_STATUS_RUN )
|
|
|
+// {
|
|
|
+//
|
|
|
+// //发送关门指令
|
|
|
+// close_outside_door();
|
|
|
+// }
|
|
|
+// //else 等待汽车离开
|
|
|
+// }
|
|
|
+// //else 什么也不做
|
|
|
+// }
|
|
|
+// //else 什么也不做
|
|
|
}
|
|
|
- return;
|
|
|
+ return Error_code::SUCCESS;
|
|
|
}
|
|
|
//出口外门控制函数
|
|
|
-void Dispatch_singlechip::outlet_outsidedoor_control()
|
|
|
+Error_manager Dispatch_singlechip::outlet_outsidedoor_control()
|
|
|
{
|
|
|
// return;
|
|
|
if ( m_dispatch_singlechip_status == DISPATCH_SINGLECHIP_READY )
|
|
@@ -336,7 +368,7 @@ void Dispatch_singlechip::outlet_outsidedoor_control()
|
|
|
}
|
|
|
//else 什么也不做
|
|
|
}
|
|
|
- return;
|
|
|
+ return Error_code::SUCCESS;;
|
|
|
}
|
|
|
|
|
|
//发送开门指令
|