|
@@ -203,8 +203,10 @@ struct card_area
|
|
|
struct person:card_location_base, card_area
|
|
|
{
|
|
|
std::weak_ptr<monkey_person> m_monkeyPerson;
|
|
|
- person(std::string type,uint32_t cardid,uint16_t needdisplay,int16_t t,int32_t deptid,int32_t level_id,uint32_t cid)
|
|
|
+ int m_workLine=0;
|
|
|
+ person(std::string type,uint32_t cardid,uint16_t needdisplay,int16_t t,int32_t deptid,int32_t level_id,uint32_t cid,int wl)
|
|
|
:card_location_base(type,cardid,needdisplay,t,deptid,level_id,cid)
|
|
|
+ ,m_workLine(wl)
|
|
|
{
|
|
|
m_message_handle.reset(new card_message_handle(this));
|
|
|
m_his_location_card.reset(new location_staff(m_id,m_type));
|
|
@@ -248,12 +250,11 @@ struct person:card_location_base, card_area
|
|
|
return m_site_area;
|
|
|
}
|
|
|
|
|
|
- virtual void do_business(const point &pt)
|
|
|
+ virtual void do_business(const point &pt,double acc)
|
|
|
{
|
|
|
m_area_tool->on_point(m_id,pt,m_speed,m_type);
|
|
|
m_site_area->on_point(m_id,0,this, m_type);
|
|
|
- card_pos cp;
|
|
|
- three_rates::get_instance()->put(cp);
|
|
|
+ handle_three_rates(pt);
|
|
|
}
|
|
|
void reset(std::shared_ptr<monkey_person> mp)
|
|
|
{
|
|
@@ -261,6 +262,17 @@ struct person:card_location_base, card_area
|
|
|
}
|
|
|
~person(){}
|
|
|
private:
|
|
|
+ void handle_three_rates(const point & pt)
|
|
|
+ {
|
|
|
+ card_pos cp;
|
|
|
+ cp.work_line=m_workLine;
|
|
|
+ cp.biz_stat = get_stat();
|
|
|
+ cp.x=pt.x;cp.y=pt.y;cp.z=pt.z;
|
|
|
+ const auto lm = m_area_tool->getLandmark();
|
|
|
+ cp.enter_time = std::get<0>(lm)*1000;
|
|
|
+ cp.area_id = std::get<3>(lm);
|
|
|
+ put_three_rates(cp);
|
|
|
+ }
|
|
|
void on_timer()
|
|
|
{
|
|
|
if(!m_mine_tool->is_attendance())
|
|
@@ -314,6 +326,7 @@ struct car:card_location_base,card_area
|
|
|
{
|
|
|
int m_vehicle_category_id=0;
|
|
|
int m_vehicle_type_id=0;
|
|
|
+ double m_acc =0;
|
|
|
car(std::string type,uint32_t cardid,uint16_t needdisplay,int16_t t,int32_t deptid,
|
|
|
int32_t categoryid, int type_id,int32_t level_id,uint32_t cid)
|
|
|
:card_location_base(type,cardid,needdisplay,t,deptid,level_id,cid)
|
|
@@ -348,12 +361,13 @@ struct car:card_location_base,card_area
|
|
|
return m_site_area;
|
|
|
}
|
|
|
|
|
|
- virtual void do_business(const point &pt)
|
|
|
+ virtual void do_business(const point &pt,double acc)
|
|
|
{
|
|
|
+ m_acc=acc;
|
|
|
m_area_tool->on_point(m_id,pt,m_speed,m_type);
|
|
|
m_site_area->on_point(m_id,0,this, m_type);
|
|
|
-
|
|
|
m_mine_tool->on_point(m_id, m_type, m_vehicle_category_id);
|
|
|
+ handle_three_rates(pt);
|
|
|
}
|
|
|
|
|
|
int get_vehicle_type_id()
|
|
@@ -363,6 +377,18 @@ struct car:card_location_base,card_area
|
|
|
|
|
|
~car(){}
|
|
|
private:
|
|
|
+ void handle_three_rates(const point &pt)
|
|
|
+ {
|
|
|
+ card_pos cp;
|
|
|
+ cp.biz_stat = get_stat();
|
|
|
+ cp.x=pt.x;cp.y=pt.y;cp.z=pt.z;
|
|
|
+ const auto lm = m_area_tool->getLandmark();
|
|
|
+ cp.enter_time = std::get<0>(lm)*1000;
|
|
|
+ cp.area_id = std::get<3>(lm);
|
|
|
+ cp.map_id = std::get<2>(lm);
|
|
|
+ cp.vibration=m_acc;
|
|
|
+ put_three_rates(cp);
|
|
|
+ }
|
|
|
void on_timer()
|
|
|
{
|
|
|
make_package();
|
|
@@ -434,7 +460,7 @@ void card_list::init_staffer(int32_t id)
|
|
|
{
|
|
|
std::string strategy = config.get("person.strategy","person1");
|
|
|
std::string sql = "SELECT staff_id, s.card_id, c.card_type_id, s.dept_id, s.group_id, s.occupation_id, \
|
|
|
- ol.occupation_level_id,s.worktype_id,s.need_display \
|
|
|
+ ol.occupation_level_id,s.worktype_id,s.need_display,s.work_line\
|
|
|
FROM dat_staff_extend s \
|
|
|
LEFT JOIN dat_card c ON s.card_id = c.card_id \
|
|
|
LEFT JOIN dat_occupation o ON s.occupation_id = o.occupation_id \
|
|
@@ -495,17 +521,19 @@ void card_list::init_staffer(int32_t id)
|
|
|
|
|
|
int need_display = 0;
|
|
|
DBRes.GetField( "need_display",need_display, Error );
|
|
|
-
|
|
|
+
|
|
|
+ int work_line = 0;
|
|
|
+ DBRes.GetField( "work_line",work_line, Error );
|
|
|
//for now;
|
|
|
//staff_id = vsid;
|
|
|
|
|
|
if(-1 == id)
|
|
|
{
|
|
|
std::shared_ptr<card_location_base> clb =
|
|
|
- std::make_shared<person>(strategy,vsid,need_display,card_type_id,dept_id,occupation_level_id,staff_id);
|
|
|
- uint64_t cardid = getId(staff_id,type);
|
|
|
- log_info("cardId:%llu,staff_id:%d dept_id:%d,need_display:%d--c-ard:%s",
|
|
|
- cardid,vsid,dept_id,need_display,card_id.c_str());
|
|
|
+ std::make_shared<person>(strategy,vsid,need_display,card_type_id,dept_id,occupation_level_id,staff_id,work_line);
|
|
|
+ uint64_t cardid = getId(vsid,type);
|
|
|
+ log_info("cardId:%llu,id:%d dept_id:%d,need_display:%d,card:%s:work_line:%d,staff_id:%d,type:%d",
|
|
|
+ cardid,vsid,dept_id,need_display,card_id.c_str(),work_line,staff_id,card_type_id);
|
|
|
map.insert({cardid,clb});
|
|
|
}
|
|
|
else
|
|
@@ -524,7 +552,7 @@ void card_list::init_staffer(int32_t id)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- auto clb = std::make_shared<person>(strategy,vsid,need_display,card_type_id,dept_id,occupation_level_id,staff_id);
|
|
|
+ auto clb = std::make_shared<person>(strategy,vsid,need_display,card_type_id,dept_id,occupation_level_id,staff_id,work_line);
|
|
|
card_list::instance()->add(card_id64, clb);
|
|
|
}
|
|
|
|
|
@@ -632,9 +660,9 @@ void card_list::init_vehicle(int32_t id)
|
|
|
{
|
|
|
auto clb = std::make_shared<car>(strategy,vsid,need_display,card_type_id,
|
|
|
dept_id,vehicle_category_id, vehicle_type_id,vehicle_level_id,vehicle_id);
|
|
|
- uint64_t cardid = getId(vehicle_id,type);
|
|
|
- log_info("cardId:%llu,vehicle_id:%d dept_id:%d,need_display:%d---cardid:%s,categoryid:%d",
|
|
|
- cardid,vsid,dept_id,need_display,card_id.c_str(),vehicle_category_id);
|
|
|
+ uint64_t cardid = getId(vsid,type);
|
|
|
+ log_info("cardId:%llu,id:%d dept_id:%d,need_display:%d-cardid:%s,categoryid:%d,vchile_id:%d,type:%d",
|
|
|
+ cardid,vsid,dept_id,need_display,card_id.c_str(),vehicle_category_id,vehicle_id,card_type_id);
|
|
|
map.insert({cardid,clb});
|
|
|
}
|
|
|
else
|
|
@@ -1146,9 +1174,9 @@ void card_location_base::on_location(const std::vector<point>&vp,const std::vect
|
|
|
Msg m;
|
|
|
m.type=m_type;m.x=(int)x;m.y=(int)y;m.cmd=CMD_HANDLE;m.cardid=m_type<<32|m_id;
|
|
|
cardMgr::instance()->tryPut(m);
|
|
|
-
|
|
|
- log_info("useful:card_id:%d,ct:%d,timestamp:%llu, loc_point,x:%.2f,y:%.2f ",m_id,m_ct,m_time,pt.x,pt.y);
|
|
|
- do_business(pt);
|
|
|
+ double acc = lm[0].m_acc;
|
|
|
+ log_info("useful:card_id:%d,ct:%d,timestamp:%llu, loc_point,x:%.2f,y:%.2f acc:%.2f",m_id,m_ct,m_time,pt.x,pt.y,acc);
|
|
|
+ do_business(pt,acc);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1221,6 +1249,13 @@ void card_location_base::clear()
|
|
|
//m_ct; //ct
|
|
|
m_time=0; //时间戳
|
|
|
}
|
|
|
+void card_location_base::put_three_rates(card_pos & cp)
|
|
|
+{
|
|
|
+ cp.rec_time=m_time;cp.type=m_type;cp.id=m_id;
|
|
|
+ cp.identifier_id=m_cid;cp.running_stat=m_stat;cp.final_v=m_speed;
|
|
|
+ log_info("three_rates:type:%d,id:%d,cid:%d",cp.type,cp.id,cp.identifier_id);
|
|
|
+ three_rates::get_instance()->put(cp);
|
|
|
+}
|
|
|
card_location_base::~card_location_base()
|
|
|
{
|
|
|
}
|