|
@@ -32,7 +32,7 @@ area_business_person_attendance::area_business_person_attendance()
|
|
|
|
|
|
//记录进入时间等信息,结束考勤,根据离开的时间和距离,判断是否记录一条新的考勤记录
|
|
//记录进入时间等信息,结束考勤,根据离开的时间和距离,判断是否记录一条新的考勤记录
|
|
void area_business_person_attendance::on_enter(const std::shared_ptr<area_hover>&a,
|
|
void area_business_person_attendance::on_enter(const std::shared_ptr<area_hover>&a,
|
|
- const std::shared_ptr<card_location_base>&card_ptr,std::shared_ptr<business_data>&ptr)
|
|
|
|
|
|
+ const std::shared_ptr<card_location_base>&card_ptr,std::shared_ptr<business_data>&ptr)
|
|
{
|
|
{
|
|
if(!card_ptr->is_person())
|
|
if(!card_ptr->is_person())
|
|
{
|
|
{
|
|
@@ -49,19 +49,19 @@ void area_business_person_attendance::on_enter(const std::shared_ptr<area_hover>
|
|
//作为一条开始考勤记录保存到数据库
|
|
//作为一条开始考勤记录保存到数据库
|
|
db_tool::save_attendance(card_ptr);
|
|
db_tool::save_attendance(card_ptr);
|
|
|
|
|
|
-// log_info("人卡考勤开始:卡id=%d,卡type=%d,分站id=%d,分站reader_type_id=%d,stat_attendance=%d",
|
|
|
|
-// card_ptr->m_id, card_ptr->m_type,
|
|
|
|
-// site_ptr->m_id,site_ptr->m_reader_type_id,mine_tool_ptr->m_is_attendance);
|
|
|
|
|
|
+ // log_info("人卡考勤开始:卡id=%d,卡type=%d,分站id=%d,分站reader_type_id=%d,stat_attendance=%d",
|
|
|
|
+ // card_ptr->m_id, card_ptr->m_type,
|
|
|
|
+ // site_ptr->m_id,site_ptr->m_reader_type_id,mine_tool_ptr->m_is_attendance);
|
|
}
|
|
}
|
|
|
|
|
|
-// auto ptr_temp = std::make_shared<person_attendance_data>();
|
|
|
|
-// ptr = ptr_temp;
|
|
|
|
|
|
+ // auto ptr_temp = std::make_shared<person_attendance_data>();
|
|
|
|
+ // ptr = ptr_temp;
|
|
|
|
|
|
-// ptr_temp->m_is_attendance = true;
|
|
|
|
-// ptr_temp->m_attendance_start_time = std::chrono::system_clock::now();
|
|
|
|
|
|
+ // ptr_temp->m_is_attendance = true;
|
|
|
|
+ // ptr_temp->m_attendance_start_time = std::chrono::system_clock::now();
|
|
|
|
|
|
-// //作为一条开始考勤记录保存到数据库
|
|
|
|
-// db_tool::save_attendance(card_ptr, ptr_temp->m_is_attendance, ptr_temp->m_attendance_start_time);
|
|
|
|
|
|
+ // //作为一条开始考勤记录保存到数据库
|
|
|
|
+ // db_tool::save_attendance(card_ptr, ptr_temp->m_is_attendance, ptr_temp->m_attendance_start_time);
|
|
}
|
|
}
|
|
|
|
|
|
void area_business_person_attendance::on_hover(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
void area_business_person_attendance::on_hover(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
|
|
@@ -70,36 +70,13 @@ void area_business_person_attendance::on_hover(const std::shared_ptr<area_hover>
|
|
}
|
|
}
|
|
//记录离开考勤区域信息,开始考勤
|
|
//记录离开考勤区域信息,开始考勤
|
|
void area_business_person_attendance::on_leave(const std::shared_ptr<area_hover>&a,
|
|
void area_business_person_attendance::on_leave(const std::shared_ptr<area_hover>&a,
|
|
- const std::shared_ptr<card_location_base>&card_ptr,std::shared_ptr<business_data> ptr)
|
|
|
|
|
|
+ const std::shared_ptr<card_location_base>&card_ptr,std::shared_ptr<business_data> ptr)
|
|
{
|
|
{
|
|
if(!card_ptr->is_person())
|
|
if(!card_ptr->is_person())
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- up_mine(card_ptr, false);
|
|
|
|
-
|
|
|
|
-// if(nullptr == ptr)
|
|
|
|
-// {
|
|
|
|
-// log_error("结束考勤失败:nullptr == ptr");
|
|
|
|
-// return;
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// auto ptr_temp = static_cast<person_attendance_data*>(ptr.get());
|
|
|
|
-
|
|
|
|
-// if(ptr_temp->m_is_attendance)
|
|
|
|
-// {
|
|
|
|
-// ptr_temp->m_is_attendance = false;
|
|
|
|
-
|
|
|
|
-// //作为一条开始考勤记录保存到数据库
|
|
|
|
-// db_tool::save_attendance(card_ptr, ptr_temp->m_is_attendance, ptr_temp->m_attendance_start_time);
|
|
|
|
-// }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-///升井或收到web的删除卡命令 site_ptr==nullptr表示收到web的删除卡命令
|
|
|
|
-/// 保存考勤记录,发升井json,清理卡
|
|
|
|
-void area_business_person_attendance::up_mine(std::shared_ptr<card_location_base> card_ptr, bool is_web_delete)
|
|
|
|
-{
|
|
|
|
auto mine_tool_ptr = card_ptr->get_mine_tool();
|
|
auto mine_tool_ptr = card_ptr->get_mine_tool();
|
|
if(!mine_tool_ptr->m_is_attendance)
|
|
if(!mine_tool_ptr->m_is_attendance)
|
|
{
|
|
{
|
|
@@ -119,9 +96,9 @@ void area_business_person_attendance::up_mine(std::shared_ptr<card_location_base
|
|
_to_json_card_up_one(card_ptr, datas, allocator);
|
|
_to_json_card_up_one(card_ptr, datas, allocator);
|
|
//module_meta_date_changed::clear_card(card_ptr);
|
|
//module_meta_date_changed::clear_card(card_ptr);
|
|
|
|
|
|
- auto rea_tool = card_ptr->get_area_tool();
|
|
|
|
- rea_tool->on_leave(card_ptr);
|
|
|
|
- card_ptr->clear();
|
|
|
|
|
|
+ // auto rea_tool = card_ptr->get_area_tool();
|
|
|
|
+ // rea_tool->on_leave(card_ptr);
|
|
|
|
+ // card_ptr->clear();
|
|
|
|
|
|
//升井json发给web
|
|
//升井json发给web
|
|
if(datas.Size() > 0)
|
|
if(datas.Size() > 0)
|
|
@@ -133,17 +110,23 @@ void area_business_person_attendance::up_mine(std::shared_ptr<card_location_base
|
|
swsClientMgr.send(JSON_CMD_VALUE_PUSH, tool_json::doc_to_json(doc));
|
|
swsClientMgr.send(JSON_CMD_VALUE_PUSH, tool_json::doc_to_json(doc));
|
|
}
|
|
}
|
|
|
|
|
|
-// if(is_web_delete)
|
|
|
|
-// {
|
|
|
|
-// log_info("人卡考勤结束:卡id=%d,卡type=%d,分站id=%d,分站reader_type_id=%d,stat_attendance=%d",
|
|
|
|
-// card_ptr->m_id, card_ptr->m_type,
|
|
|
|
-// site_ptr->m_id,site_ptr->m_reader_type_id,mine_tool_ptr->m_is_attendance);
|
|
|
|
-// }
|
|
|
|
-// else
|
|
|
|
-// {
|
|
|
|
-// log_info("收到web的删除卡命令,人卡考勤结束:卡id=%d,卡type=%d, stat_attendance=%d",
|
|
|
|
-// card_ptr->m_id, card_ptr->m_type, mine_tool_ptr->m_is_attendance);
|
|
|
|
-// }
|
|
|
|
|
|
+ //up_mine(card_ptr, false);
|
|
|
|
+
|
|
|
|
+ // if(nullptr == ptr)
|
|
|
|
+ // {
|
|
|
|
+ // log_error("结束考勤失败:nullptr == ptr");
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // auto ptr_temp = static_cast<person_attendance_data*>(ptr.get());
|
|
|
|
+
|
|
|
|
+ // if(ptr_temp->m_is_attendance)
|
|
|
|
+ // {
|
|
|
|
+ // ptr_temp->m_is_attendance = false;
|
|
|
|
+
|
|
|
|
+ // //作为一条开始考勤记录保存到数据库
|
|
|
|
+ // db_tool::save_attendance(card_ptr, ptr_temp->m_is_attendance, ptr_temp->m_attendance_start_time);
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -158,9 +141,9 @@ void area_business_person_attendance::handle_up_mine(sio::message::ptr const& da
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- rapidjson::Document doc(rapidjson::kObjectType);
|
|
|
|
- rapidjson::Value datas(rapidjson::kArrayType);
|
|
|
|
- rapidjson::Document::AllocatorType& allocator=doc.GetAllocator();
|
|
|
|
|
|
+// rapidjson::Document doc(rapidjson::kObjectType);
|
|
|
|
+// rapidjson::Value datas(rapidjson::kArrayType);
|
|
|
|
+// rapidjson::Document::AllocatorType& allocator=doc.GetAllocator();
|
|
|
|
|
|
std::vector<sio::message::ptr>::const_iterator it_card = card_vec.begin();
|
|
std::vector<sio::message::ptr>::const_iterator it_card = card_vec.begin();
|
|
int type = 0;
|
|
int type = 0;
|
|
@@ -168,7 +151,7 @@ void area_business_person_attendance::handle_up_mine(sio::message::ptr const& da
|
|
for(; it_card != card_vec.end(); ++it_card)
|
|
for(; it_card != card_vec.end(); ++it_card)
|
|
{
|
|
{
|
|
if(!tool_map::try_get_value(s_card_id, JSON_KEY_CALL_CARD_CARD_ID, (*it_card))
|
|
if(!tool_map::try_get_value(s_card_id, JSON_KEY_CALL_CARD_CARD_ID, (*it_card))
|
|
- ||!tool_map::try_get_value(type, JSON_KEY_CALL_CARD_CARD_TYPE_ID, (*it_card)))
|
|
|
|
|
|
+ ||!tool_map::try_get_value(type, JSON_KEY_CALL_CARD_CARD_TYPE_ID, (*it_card)))
|
|
{
|
|
{
|
|
log_error("手工升井,web发来的数据 card_id 或 card_type格式不对");
|
|
log_error("手工升井,web发来的数据 card_id 或 card_type格式不对");
|
|
continue;
|
|
continue;
|
|
@@ -181,22 +164,27 @@ void area_business_person_attendance::handle_up_mine(sio::message::ptr const& da
|
|
std_debug("手工升井,处理,卡id=%d,卡type=%d", id, type);
|
|
std_debug("手工升井,处理,卡id=%d,卡type=%d", id, type);
|
|
log_info("手工升井,处理,卡id=%d,卡type=%d", id, type);
|
|
log_info("手工升井,处理,卡id=%d,卡type=%d", id, type);
|
|
|
|
|
|
- auto mine_tool_ptr = card_ptr->get_mine_tool();
|
|
|
|
- if(mine_tool_ptr->m_is_attendance)
|
|
|
|
- {
|
|
|
|
- //考勤结束
|
|
|
|
- mine_tool_ptr->m_is_attendance=false;
|
|
|
|
|
|
+ module_meta_date_changed::clear_card(card_ptr);
|
|
|
|
+ // auto rea_tool = card_ptr->get_area_tool();
|
|
|
|
+ // rea_tool->on_leave(card_ptr);
|
|
|
|
+ //card_ptr->clear();
|
|
|
|
+
|
|
|
|
+ // auto mine_tool_ptr = card_ptr->get_mine_tool();
|
|
|
|
+ // if(mine_tool_ptr->m_is_attendance)
|
|
|
|
+ // {
|
|
|
|
+ // //考勤结束
|
|
|
|
+ // mine_tool_ptr->m_is_attendance=false;
|
|
|
|
|
|
- //作为一条结束考勤记录保存到数据库
|
|
|
|
- db_tool::save_attendance(card_ptr);
|
|
|
|
- }
|
|
|
|
|
|
+ // //作为一条结束考勤记录保存到数据库
|
|
|
|
+ // db_tool::save_attendance(card_ptr);
|
|
|
|
+ // }
|
|
|
|
|
|
//检查井下是否超员--是否需要取消
|
|
//检查井下是否超员--是否需要取消
|
|
//CMineCardManager::instance()->OnPersonUp(card_ptr);
|
|
//CMineCardManager::instance()->OnPersonUp(card_ptr);
|
|
|
|
|
|
- auto rea_tool = card_ptr->get_area_tool();
|
|
|
|
- rea_tool->on_leave(card_ptr);
|
|
|
|
- card_ptr->clear();
|
|
|
|
|
|
+ // auto rea_tool = card_ptr->get_area_tool();
|
|
|
|
+ // rea_tool->on_leave(card_ptr);
|
|
|
|
+ // card_ptr->clear();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -204,20 +192,20 @@ void area_business_person_attendance::handle_up_mine(sio::message::ptr const& da
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //升井json发给web
|
|
|
|
- if(datas.Size() > 0)
|
|
|
|
- {
|
|
|
|
- doc.AddMember(JSON_ROOT_KEY_CMD,JSON_CMD_VALUE_UP_MINE, allocator);
|
|
|
|
- //doc.AddMember(JSON_ROOT_KEY_VERSION,INTERFACE_VERSION, allocator);
|
|
|
|
- doc.AddMember(JSON_ROOT_KEY_DATA, datas, allocator);
|
|
|
|
|
|
+// //升井json发给web
|
|
|
|
+// if(datas.Size() > 0)
|
|
|
|
+// {
|
|
|
|
+// doc.AddMember(JSON_ROOT_KEY_CMD,JSON_CMD_VALUE_UP_MINE, allocator);
|
|
|
|
+// //doc.AddMember(JSON_ROOT_KEY_VERSION,INTERFACE_VERSION, allocator);
|
|
|
|
+// doc.AddMember(JSON_ROOT_KEY_DATA, datas, allocator);
|
|
|
|
|
|
- swsClientMgr.send(JSON_CMD_VALUE_PUSH, tool_json::doc_to_json(doc));
|
|
|
|
- }
|
|
|
|
|
|
+// swsClientMgr.send(JSON_CMD_VALUE_PUSH, tool_json::doc_to_json(doc));
|
|
|
|
+// }
|
|
}
|
|
}
|
|
|
|
|
|
///升井json
|
|
///升井json
|
|
void area_business_person_attendance::_to_json_card_up_one(std::shared_ptr<card_location_base> card_ptr,
|
|
void area_business_person_attendance::_to_json_card_up_one(std::shared_ptr<card_location_base> card_ptr,
|
|
- rapidjson::Value& out_datas, rapidjson::Document::AllocatorType& allocator)
|
|
|
|
|
|
+ rapidjson::Value& out_datas, rapidjson::Document::AllocatorType& allocator)
|
|
{
|
|
{
|
|
if(!card_ptr->m_display)
|
|
if(!card_ptr->m_display)
|
|
{
|
|
{
|
|
@@ -268,3 +256,54 @@ void area_business_person_attendance::_to_json_card_up_one(std::shared_ptr<card_
|
|
out_datas.PushBack(data, allocator);
|
|
out_datas.PushBack(data, allocator);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+/////升井或收到web的删除卡命令 site_ptr==nullptr表示收到web的删除卡命令
|
|
|
|
+///// 保存考勤记录,发升井json,清理卡
|
|
|
|
+//void area_business_person_attendance::up_mine(std::shared_ptr<card_location_base> card_ptr, bool is_web_delete)
|
|
|
|
+//{
|
|
|
|
+// auto mine_tool_ptr = card_ptr->get_mine_tool();
|
|
|
|
+// if(!mine_tool_ptr->m_is_attendance)
|
|
|
|
+// {
|
|
|
|
+// return;
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// //考勤结束
|
|
|
|
+// mine_tool_ptr->m_is_attendance=false;
|
|
|
|
+
|
|
|
|
+// //作为一条结束考勤记录保存到数据库
|
|
|
|
+// db_tool::save_attendance(card_ptr);
|
|
|
|
+
|
|
|
|
+// rapidjson::Document doc(rapidjson::kObjectType);
|
|
|
|
+// rapidjson::Value datas(rapidjson::kArrayType);
|
|
|
|
+// rapidjson::Document::AllocatorType& allocator=doc.GetAllocator();
|
|
|
|
+
|
|
|
|
+// _to_json_card_up_one(card_ptr, datas, allocator);
|
|
|
|
+// //module_meta_date_changed::clear_card(card_ptr);
|
|
|
|
+
|
|
|
|
+// auto rea_tool = card_ptr->get_area_tool();
|
|
|
|
+// rea_tool->on_leave(card_ptr);
|
|
|
|
+// card_ptr->clear();
|
|
|
|
+
|
|
|
|
+// //升井json发给web
|
|
|
|
+// if(datas.Size() > 0)
|
|
|
|
+// {
|
|
|
|
+// doc.AddMember(JSON_ROOT_KEY_CMD,JSON_CMD_VALUE_UP_MINE, allocator);
|
|
|
|
+// //doc.AddMember(JSON_ROOT_KEY_VERSION,INTERFACE_VERSION, allocator);
|
|
|
|
+// doc.AddMember(JSON_ROOT_KEY_DATA, datas, allocator);
|
|
|
|
+
|
|
|
|
+// swsClientMgr.send(JSON_CMD_VALUE_PUSH, tool_json::doc_to_json(doc));
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+//// if(is_web_delete)
|
|
|
|
+//// {
|
|
|
|
+//// log_info("人卡考勤结束:卡id=%d,卡type=%d,分站id=%d,分站reader_type_id=%d,stat_attendance=%d",
|
|
|
|
+//// card_ptr->m_id, card_ptr->m_type,
|
|
|
|
+//// site_ptr->m_id,site_ptr->m_reader_type_id,mine_tool_ptr->m_is_attendance);
|
|
|
|
+//// }
|
|
|
|
+//// else
|
|
|
|
+//// {
|
|
|
|
+//// log_info("收到web的删除卡命令,人卡考勤结束:卡id=%d,卡type=%d, stat_attendance=%d",
|
|
|
|
+//// card_ptr->m_id, card_ptr->m_type, mine_tool_ptr->m_is_attendance);
|
|
|
|
+//// }
|
|
|
|
+//}
|
|
|
|
+
|