|
@@ -20,12 +20,14 @@
|
|
|
#include "cardMgr.h"
|
|
|
#include "card.h"
|
|
|
#include "db_api/CDBSingletonDefine.h"
|
|
|
+#include "module_service/module_screen.h"
|
|
|
+
|
|
|
extern config_file config;
|
|
|
int person::m_limit_detained_time=-1;
|
|
|
int person::m_auto_up_mine_time=-1;
|
|
|
int person::m_person_cards_flag=-1;
|
|
|
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)
|
|
|
+ :card_location_base(type, cardid, needdisplay, t, deptid, level_id, cid)
|
|
|
,m_workLine(wl)
|
|
|
,m_worktype_id(worketype_id)
|
|
|
,m_stafferName(sname)
|
|
@@ -33,10 +35,10 @@ person::person(const std::string &type,uint32_t cardid,uint16_t needdisplay,int1
|
|
|
{
|
|
|
if(person::m_auto_up_mine_time==-1){
|
|
|
//显示超时的界限 h
|
|
|
- person::m_limit_detained_time=config.get("service.detained_time",10);
|
|
|
+ person::m_limit_detained_time = config.get("service.detained_time",10);
|
|
|
//打印输出超过该时长的数据信息
|
|
|
- person::m_auto_up_mine_time=config.get("service.auto_up_mine_time",20);
|
|
|
- person::m_person_cards_flag=config.get("service.person_cards_flag",0);
|
|
|
+ person::m_auto_up_mine_time = config.get("service.auto_up_mine_time",20);
|
|
|
+ person::m_person_cards_flag = config.get("service.person_cards_flag",0);
|
|
|
}
|
|
|
m_message_handle.reset(new card_message_handle(this));
|
|
|
//m_his_location_card.reset(new location_staff(m_id,m_type,cid));
|
|
@@ -48,8 +50,12 @@ person::~person()
|
|
|
|
|
|
void person::clear()
|
|
|
{
|
|
|
- log_info("make_his_location clear");
|
|
|
+ log_info("%d make_his_location clear", m_id);
|
|
|
make_his_location(m_time,*this,true);
|
|
|
+
|
|
|
+ bool is_att = m_mine_tool->m_is_attendance;
|
|
|
+ std::chrono::system_clock::time_point att_start_time = m_mine_tool->m_attendance_start_time;
|
|
|
+
|
|
|
//初始化区域和井下部分基础信息
|
|
|
m_mine_tool->clear();
|
|
|
m_area_tool->clear();
|
|
@@ -66,22 +72,41 @@ void person::clear()
|
|
|
m_event[i]=0;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//清除一人多卡功能内存中的人卡相关数据,
|
|
|
if(m_person_cards_flag){
|
|
|
Msg m;
|
|
|
- m.cmd=CMD_CLEAR;m.cardid=m_type<<32|m_id;
|
|
|
+ m.cmd = CMD_CLEAR;
|
|
|
+ m.cardid = m_type<<32|m_id;
|
|
|
cardMgr::instance()->tryPut(m);
|
|
|
}
|
|
|
+
|
|
|
+ m_mine_tool->m_is_attendance = is_att;
|
|
|
+ m_mine_tool->m_attendance_start_time = att_start_time;
|
|
|
}
|
|
|
+
|
|
|
//设置区域和地标信息
|
|
|
void person::set_area_info(int mapid,double scale,int areaid,uint64_t t,int type)
|
|
|
{
|
|
|
m_area_tool->set_area_info(mapid,scale,areaid,*this,t,type);
|
|
|
}
|
|
|
+
|
|
|
+/*
|
|
|
+ * @brief 井口虹膜考勤联动以及大屏事宜处理
|
|
|
+ * @parma int sid 分站号
|
|
|
+ * @return 无
|
|
|
+ * @note
|
|
|
+ * @warning
|
|
|
+ * @bug
|
|
|
+ * */
|
|
|
void person::site_hover(int sid)
|
|
|
{
|
|
|
+ // 更新新城金矿大屏所需井口人员的时间信息
|
|
|
+ mine_person p(m_id, m_battery_value);
|
|
|
+ module_screen::instance()->put(p);
|
|
|
IKSDK_DB(sid);
|
|
|
}
|
|
|
+
|
|
|
//虹膜识别入库功能 输入到his_att_interface表.目前主要最小系统输入这个表,与井口闸机联动
|
|
|
void person::IKSDK_DB(int sid)
|
|
|
{
|
|
@@ -114,43 +139,64 @@ std::shared_ptr<mine_tool> person::get_mine_tool()
|
|
|
{
|
|
|
return m_mine_tool;
|
|
|
}
|
|
|
+
|
|
|
+/*
|
|
|
+ * @brief 人卡业务处理
|
|
|
+ * @param const std::shared_ptr<site>& site 分站信息
|
|
|
+ * @param const point& pt 定位点
|
|
|
+ * @param double acc 加速度状态
|
|
|
+ * @return 无
|
|
|
+ * @note
|
|
|
+ * @bug
|
|
|
+ * @warning
|
|
|
+ * */
|
|
|
void person::do_business(const std::shared_ptr<site>&site,const point &pt,double acc)
|
|
|
-{
|
|
|
- m_mine_tool->m_is_attendance = true;
|
|
|
+{
|
|
|
//区域相关逻辑驱动
|
|
|
- m_area_tool->on_point(shared_from_this(),pt);
|
|
|
+ m_area_tool->on_point(shared_from_this(), pt);
|
|
|
//处理历史轨迹
|
|
|
- log_info("make_his_location person");
|
|
|
- make_his_location(m_time,pt);
|
|
|
- m_timeval=m_time;
|
|
|
+ log_info("[person_att] %d is attendance: %d", m_id, (m_mine_tool->m_is_attendance?1:0));
|
|
|
+ make_his_location(m_time, pt);
|
|
|
+ m_timeval = m_time;
|
|
|
//三率数据处理
|
|
|
- handle_three_rates(pt);
|
|
|
+ //handle_three_rates(pt);
|
|
|
//一人多卡数据输入
|
|
|
if(m_person_cards_flag){
|
|
|
Msg m;
|
|
|
- m.type=m_type;
|
|
|
+ m.type = m_type;
|
|
|
m.x=(int)x;
|
|
|
m.y=(int)y;
|
|
|
- m.cmd=CMD_HANDLE;
|
|
|
+ m.cmd = CMD_HANDLE;
|
|
|
m.cardid=m_type<<32|m_id;
|
|
|
cardMgr::instance()->tryPut(m);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//设置人员上猴车
|
|
|
void person::reset(std::shared_ptr<monkey_person> mp)
|
|
|
{
|
|
|
m_monkeyPerson = mp;
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * @brief 处理三率模块
|
|
|
+ * @param const point& pt
|
|
|
+ * @return 无
|
|
|
+ * @note
|
|
|
+ * @bug
|
|
|
+ * @warning
|
|
|
+ * */
|
|
|
void person::handle_three_rates(const point & pt)
|
|
|
{
|
|
|
card_pos cp;
|
|
|
- cp.work_line=m_workLine;
|
|
|
+ cp.work_line = m_workLine;
|
|
|
+ cp.work_type_id = m_worktype_id;
|
|
|
+ m_biz_stat = get_stat();
|
|
|
+ cp.biz_stat = m_biz_stat;
|
|
|
+ cp.x = pt.x;
|
|
|
+ cp.y = pt.y;
|
|
|
+ cp.z = pt.z;
|
|
|
cp.work_type_id = m_worktype_id;
|
|
|
- m_biz_stat=get_stat();
|
|
|
- cp.biz_stat = m_biz_stat;
|
|
|
- cp.x=pt.x;cp.y=pt.y;cp.z=pt.z;
|
|
|
- cp.work_type_id=m_worktype_id;
|
|
|
put_three_rates(cp);
|
|
|
}
|
|
|
|
|
@@ -161,45 +207,55 @@ void person::on_timer()
|
|
|
{
|
|
|
if(m_upmine_flag.load())
|
|
|
{
|
|
|
- log_warn("up_mine:att=false,upmine_flag=%d",m_upmine_flag.load());
|
|
|
+ log_warn("up_mine:att=false,upmine_flag=%d", m_upmine_flag.load());
|
|
|
m_upmine_flag=0;
|
|
|
}
|
|
|
|
|
|
- //log_info("[person] person is not attendance");
|
|
|
+ //log_info("[person_att] person %d is not attendance", m_id);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- YA::_CARD_POS_ cp;
|
|
|
- uint64_t _time=0;
|
|
|
- point pt = getSmoothPoint(_time);
|
|
|
-
|
|
|
- cp.area_info=m_area_tool->m_area_info;
|
|
|
- cp.map_id =m_area_tool->get_mapid();
|
|
|
+ sys::_CARD_POS_ cp;
|
|
|
+ uint64_t _time = 0;
|
|
|
+ //point pt = getSmoothPoint(_time);
|
|
|
+ point pt = point(x, y);
|
|
|
+
|
|
|
+ cp.area_info = m_area_tool->m_area_info;
|
|
|
+ cp.map_id = m_area_tool->get_mapid();
|
|
|
|
|
|
- cp.biz_stat = m_biz_stat;
|
|
|
+ cp.biz_stat = m_biz_stat;
|
|
|
cp.down_time = m_mine_tool->get_down_time();
|
|
|
cp.work_time = m_mine_tool->get_work_time();
|
|
|
cp.is_on_duty= m_mine_tool->is_on_duty();
|
|
|
cp.m_freq = m_freq;
|
|
|
cp.speed = m_speed;
|
|
|
+
|
|
|
+ if(auto site_ptr = m_area_tool->m_site){
|
|
|
+ cp.area_id = site_ptr->m_area_id;
|
|
|
+ }
|
|
|
+ cp.dept_id = m_deptid;
|
|
|
+ //cp.stat = m_battery_value;
|
|
|
+
|
|
|
upt_card_pos(cp,pt);
|
|
|
log_info("on_timer here ...%d,%lld,%.2f,%.2f,%d,%d--%d,speed=%.2f",m_id,_time,pt.x,pt.y,cp.map_id,cp.area_info.size(),person::m_limit_detained_time,m_speed);
|
|
|
//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);
|
|
|
|
|
|
- uint64_t _now=tool_time::now_to_ms();
|
|
|
- uint64_t t=_now>m_timeval?_now-m_timeval:m_timeval-_now;
|
|
|
- if(t>10*1000)
|
|
|
+ uint64_t _now = tool_time::now_to_ms();
|
|
|
+ uint64_t t = _now>m_timeval?_now-m_timeval:m_timeval-_now;
|
|
|
+ if(t > 10*1000)
|
|
|
{
|
|
|
m_area_tool->on_point(shared_from_this(),pt);
|
|
|
m_biz_stat=get_stat();
|
|
|
}
|
|
|
+
|
|
|
print_card_detained();
|
|
|
|
|
|
+ // 自动升井
|
|
|
if(m_upmine_flag.load())
|
|
|
{
|
|
|
- log_info("card=%d user-id=%d up_mine:upmine_flag=%d",m_id,m_cid, m_upmine_flag.load());
|
|
|
+ log_info("card=%d user-id=%d up_mine:upmine_flag=%d",m_id, m_cid, m_upmine_flag.load());
|
|
|
m_area_tool->on_leave(shared_from_this());
|
|
|
- m_upmine_flag=0;
|
|
|
+ m_upmine_flag = 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -222,7 +278,7 @@ void person::print_card_detained()
|
|
|
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 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)
|
|
@@ -235,6 +291,7 @@ void person::print_card_detained()
|
|
|
inc_upmine_flag(2);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//获取web输入坐标点
|
|
|
point person::getSmoothPoint(uint64_t& t)
|
|
|
{
|
|
@@ -243,7 +300,7 @@ point person::getSmoothPoint(uint64_t& t)
|
|
|
m_speed = lp.m_speed;
|
|
|
m_stat = lp.m_stat;
|
|
|
pt.x = lp.x;
|
|
|
- pt.y = -lp.y;
|
|
|
+ pt.y = lp.y;
|
|
|
t=lp.m_time;
|
|
|
if(auto p = m_monkeyPerson.lock() ){
|
|
|
if(p->is_on_bus()){
|
|
@@ -255,6 +312,7 @@ point person::getSmoothPoint(uint64_t& t)
|
|
|
}
|
|
|
return pt;
|
|
|
}
|
|
|
+
|
|
|
//人员显示输入
|
|
|
void person::get_card(bool f)
|
|
|
{
|
|
@@ -262,6 +320,7 @@ void person::get_card(bool f)
|
|
|
return ;
|
|
|
mine_business::inst()->fetch_add(m_display);
|
|
|
}
|
|
|
+
|
|
|
//新协议处理逻辑。
|
|
|
//0-4包为一组处理
|
|
|
//其中0-1为充电时间 2-3 为放电时间 4为电量标识
|
|
@@ -284,7 +343,7 @@ void person::handle_message(uint16_t ct,uint8_t &value)
|
|
|
}
|
|
|
//老卡
|
|
|
if(m_card_generation==1){
|
|
|
- value=value&0x03;
|
|
|
+ value = value&0x03;
|
|
|
return;
|
|
|
}
|
|
|
//新卡继续往下走,获取数据
|