Browse Source

增加一人多卡开关配置

lixioayao 5 years ago
parent
commit
8ae89da21e
4 changed files with 18 additions and 9 deletions
  1. 2 2
      cardMgr.cpp
  2. 1 4
      card_base.cpp
  3. 14 3
      card_person.cpp
  4. 1 0
      card_person.h

+ 2 - 2
cardMgr.cpp

@@ -49,8 +49,8 @@ void cardMgr::handleMessage(const Msg &m)
 {
 {
     //更新卡位置信息
     //更新卡位置信息
 	m_glist.update(m.x,m.y,m.cardid);
 	m_glist.update(m.x,m.y,m.cardid);
-    //排除车卡
-    if(tool_other::is_vehicle( m.type) ) return;
+    //排除车卡 目前车卡不会进来
+    //if(tool_other::is_vehicle( m.type) ) return;
     //查找该卡1个像素点内得卡号信息(有车卡)
     //查找该卡1个像素点内得卡号信息(有车卡)
 	std::vector<uint64_t> rc=m_glist.find_near(m.cardid,1);
 	std::vector<uint64_t> rc=m_glist.find_near(m.cardid,1);
     //打印找到得卡数据信息	
     //打印找到得卡数据信息	

+ 1 - 4
card_base.cpp

@@ -18,7 +18,7 @@
 #include "common_tool.h"
 #include "common_tool.h"
 #include "ant.h"
 #include "ant.h"
 #include "area.h"
 #include "area.h"
-#include "cardMgr.h"
+
 extern config_file config;
 extern config_file config;
 card_location_base::card_location_base(const std::string&type,uint32_t id,uint16_t dis,int16_t t,int32_t deptid,int32_t level_id,uint32_t cid)
 card_location_base::card_location_base(const std::string&type,uint32_t id,uint16_t dis,int16_t t,int32_t deptid,int32_t level_id,uint32_t cid)
 	:card(id,dis,t,deptid,level_id,cid)
 	:card(id,dis,t,deptid,level_id,cid)
@@ -96,9 +96,6 @@ void card_location_base::on_location(const std::vector<point>&vp,const std::vect
 		x = tool_other::round(pt.x,3);
 		x = tool_other::round(pt.x,3);
 		y = tool_other::round(pt.y,3);
 		y = tool_other::round(pt.y,3);
 
 
-		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);
 
 
 		double acc = lm[0].m_acc;
 		double acc = lm[0].m_acc;
         m_acc = lm[0].m_acc;
         m_acc = lm[0].m_acc;

+ 14 - 3
card_person.cpp

@@ -21,6 +21,7 @@
 extern config_file config;
 extern config_file config;
 int person::m_limit_detained_time=-1;
 int person::m_limit_detained_time=-1;
 int person::m_auto_up_mine_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)
 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_workLine(wl)
@@ -31,6 +32,7 @@ person::person(const std::string &type,uint32_t cardid,uint16_t needdisplay,int1
     if(person::m_auto_up_mine_time==-1){
     if(person::m_auto_up_mine_time==-1){
         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_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_message_handle.reset(new card_message_handle(this));
 	//m_his_location_card.reset(new location_staff(m_id,m_type,cid));
 	//m_his_location_card.reset(new location_staff(m_id,m_type,cid));
@@ -59,9 +61,11 @@ void person::clear()
         }
         }
     }
     }
     //清除一人多卡功能内存中的人卡相关数据,
     //清除一人多卡功能内存中的人卡相关数据,
-	Msg m;
-	m.cmd=CMD_CLEAR;m.cardid=m_type<<32|m_id;
-	cardMgr::instance()->tryPut(m);
+    if(m_person_cards_flag){
+    	Msg m;
+    	m.cmd=CMD_CLEAR;m.cardid=m_type<<32|m_id;
+    	cardMgr::instance()->tryPut(m);
+    }
 }
 }
 
 
 void person::set_area_info(int mapid,double scale,int areaid,uint64_t t,int type)
 void person::set_area_info(int mapid,double scale,int areaid,uint64_t t,int type)
@@ -107,6 +111,13 @@ void person::do_business(const std::shared_ptr<site>&site,const point &pt,double
     make_his_location(m_time,pt);
     make_his_location(m_time,pt);
 	m_timeval=m_time;
 	m_timeval=m_time;
 	handle_three_rates(pt);
 	handle_three_rates(pt);
+    //一人多卡数据输入
+
+    if(m_person_cards_flag){
+	    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);
+    }
 }
 }
 
 
 void person::reset(std::shared_ptr<monkey_person> mp)
 void person::reset(std::shared_ptr<monkey_person> mp)

+ 1 - 0
card_person.h

@@ -12,6 +12,7 @@ struct person:card_location_base, card_area
     time_t m_iris_recognition_timeval = 0;
     time_t m_iris_recognition_timeval = 0;
     static int m_limit_detained_time;
     static int m_limit_detained_time;
     static int m_auto_up_mine_time;
     static int m_auto_up_mine_time;
+    static int m_person_cards_flag;
     std::weak_ptr<monkey_person> m_monkeyPerson;
     std::weak_ptr<monkey_person> m_monkeyPerson;
     std::string m_stafferName,m_deptName;
     std::string m_stafferName,m_deptName;
     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 workrype_id);
     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 workrype_id);