|
@@ -1,4 +1,3 @@
|
|
|
-
|
|
|
#include <string>
|
|
|
#include <thread>
|
|
|
#include "card_person.h"
|
|
@@ -16,13 +15,16 @@
|
|
|
#include"common_tool.h"
|
|
|
#include"db/db_tool.h"
|
|
|
#include "forbid_staff_down_mine.h"
|
|
|
+#include <config_file.h>
|
|
|
|
|
|
+extern config_file config;
|
|
|
+int person::m_limit_detained_time=config.get("service.detained_time",10);
|
|
|
person::person(const std::string &type,uint32_t cardid,uint16_t needdisplay,int16_t t,int32_t deptid,int32_t level_id,uint32_t cid,int wl,const std::string &sname,const std::string &dname,int worketype_id)
|
|
|
:card_location_base(type,cardid,needdisplay,t,deptid,level_id,cid)
|
|
|
,m_workLine(wl)
|
|
|
+ ,m_worktype_id(worketype_id)
|
|
|
,m_stafferName(sname)
|
|
|
,m_deptName(dname)
|
|
|
- ,m_worktype_id(worketype_id)
|
|
|
{
|
|
|
m_message_handle.reset(new card_message_handle(this));
|
|
|
m_his_location_card.reset(new location_staff(m_id,m_type,cid));
|
|
@@ -128,7 +130,7 @@ void person::on_timer()
|
|
|
cp.work_time = m_mine_tool->get_work_time();
|
|
|
cp.is_on_duty= m_mine_tool->is_on_duty();
|
|
|
upt_card_pos(cp,pt);
|
|
|
- log_info("on_timer here ...%d,%lld,%.2f,%.2f,%d,%d--",m_id,_time,pt.x,pt.y,cp.map_id,cp.area_info.size());
|
|
|
+ log_info("on_timer here ...%d,%lld,%.2f,%.2f,%d,%d--%d",m_id,_time,pt.x,pt.y,cp.map_id,cp.area_info.size(),person::m_limit_detained_time);
|
|
|
int sid=0;
|
|
|
if(auto st=m_area_tool->m_site)sid=st->m_area_id;
|
|
|
m_his_location_card->push(_time,pt,sid,cp.map_id);
|
|
@@ -146,8 +148,37 @@ void person::on_timer()
|
|
|
m_upmine_flag=0;
|
|
|
m_area_tool->on_leave(shared_from_this());
|
|
|
}
|
|
|
+ print_card_detained();
|
|
|
}
|
|
|
+//***********************************************
|
|
|
+//整点打印入井超过设定时长(默认10h)
|
|
|
+//进入盲区超过2h的卡
|
|
|
+void person::print_card_detained()
|
|
|
+{
|
|
|
+ static point p(4677,-193.7);
|
|
|
+ static double limit_dist=45.0;
|
|
|
+ int h=tool_time::get_hour();
|
|
|
+ uint64_t _now=tool_time::now_to_ms();
|
|
|
+ uint64_t work_time=m_mine_tool->get_work_time();
|
|
|
+ uint64_t lost_time=_now>m_time?_now-m_time:m_time-_now;
|
|
|
+ if(m_thour != h && (work_time > static_cast<uint64_t>(person::m_limit_detained_time*60*60*1000)) && lost_time>2*60*60*1000)
|
|
|
+ {
|
|
|
+ m_thour=h;
|
|
|
+ auto start = m_mine_tool->m_attendance_start_time;
|
|
|
+ std::string enter_time=tool_time::to_str(start);
|
|
|
+ uint32_t min=work_time/1000/60;
|
|
|
+ uint32_t lmin=lost_time/1000/60;
|
|
|
+ double dist=p.dist(*this);
|
|
|
+ std::string last_time=tool_time::to_str_ex(m_time);
|
|
|
+ std::string alarm_time{"No Alarm."};
|
|
|
+ auto event_power=event_list::instance()->get_event_card(m_id,m_type,ET_CARD_LOW_POWER_SERIOUS);
|
|
|
+ if(event_power)
|
|
|
+ alarm_time=tool_time::to_str(event_power->m_cur_time);
|
|
|
|
|
|
+ log_warn("[card_detained]卡号:%03d%010d,分站:%d,入井时间点:%s,入井时长:%d小时%d分钟,(%.2f,%.2f)是否在处在井底范围内:%s,最后接收时间点:%s,进入盲区时长:%d小时%d分钟,是否低电量告警:%s,低电量开始时间点:%s",
|
|
|
+ m_type,m_id,m_area_tool->get_site_id(),enter_time.c_str(),min/60,min%60,x,y,dist<limit_dist?"True":"False",last_time.c_str(),lmin/60,lmin%60,event_power?"Ture":"False",alarm_time.c_str());
|
|
|
+ }
|
|
|
+}
|
|
|
point person::getSmoothPoint(uint64_t& t)
|
|
|
{
|
|
|
point pt;
|