|
@@ -55,7 +55,22 @@ public:
|
|
|
//作为一条结束考勤记录保存到数据库
|
|
|
tool_db::save_attendance(card_ptr);
|
|
|
|
|
|
- person_card_up_mine(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);
|
|
|
+ person_card_clear(card_ptr);
|
|
|
+
|
|
|
+ //升井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);
|
|
|
+
|
|
|
+ tool_other::send_json(JSON_CMD_VALUE_PUSH, tool_json::doc_to_json(doc));
|
|
|
+ }
|
|
|
|
|
|
log_info("人卡考勤结束:卡id=%d,卡type=%d,分站id=%d,分站reader_type_id=%d,stat_attendance=%d",
|
|
|
card_ptr->m_id, card_ptr->m_type,
|
|
@@ -104,6 +119,10 @@ public:
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ 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();
|
|
|
int type = 0;
|
|
|
std::string s_card_id;
|
|
@@ -134,37 +153,38 @@ public:
|
|
|
}
|
|
|
|
|
|
auto area_hover_ptr = card_ptr->get_area_hover();
|
|
|
- if(0!=area_hover_ptr->id() && 0!=area_hover_ptr->mapid())
|
|
|
+ if(area_hover_ptr && 0!=area_hover_ptr->id() && 0!=area_hover_ptr->mapid())
|
|
|
{
|
|
|
module_area::save_his_area_location_leave(card_ptr);
|
|
|
}
|
|
|
|
|
|
- person_card_up_mine(card_ptr);
|
|
|
+ to_json_card_up_one(card_ptr, datas, allocator);
|
|
|
+ person_card_clear(card_ptr);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
log_error("手工升井,在全局列表中找不到卡,卡id=%d,卡type=%d", id, type);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //升井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);
|
|
|
+
|
|
|
+ tool_other::send_json(JSON_CMD_VALUE_PUSH, tool_json::doc_to_json(doc));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
- ///1.人卡升井要发送json串给前端。 具体看card_up_mine函数,
|
|
|
///3.人卡升井要清除卡相关信息,区域相关,分站相关,考勤相关,清除定时器,
|
|
|
///速度,状态 呼救 呼叫 告警相关。即保留基础信息,其他的重置。
|
|
|
- static void person_card_up_mine(std::shared_ptr<card_location_base> card_ptr)
|
|
|
+ static void person_card_clear(std::shared_ptr<card_location_base> card_ptr)
|
|
|
{
|
|
|
- if (card_ptr->m_display)
|
|
|
- {
|
|
|
- std::string str = to_json_card_up(card_ptr);
|
|
|
- if(!str.empty())
|
|
|
- {
|
|
|
- tool_other::send_json(JSON_CMD_VALUE_PUSH, str);
|
|
|
- }
|
|
|
- }
|
|
|
//删除
|
|
|
card_ptr->del_card_pos();
|
|
|
-
|
|
|
// 升井 删除所有报警信息
|
|
|
for(int i=0; i < CARD_EVENT_COUNT_MAX; i++ )
|
|
|
{
|
|
@@ -188,21 +208,19 @@ private:
|
|
|
card_ptr->clear();
|
|
|
}
|
|
|
|
|
|
- ///升井json发给web
|
|
|
- static std::string to_json_card_up(std::shared_ptr<card_location_base> card_ptr)
|
|
|
+ ///升井json
|
|
|
+ static void to_json_card_up_one(std::shared_ptr<card_location_base> card_ptr,
|
|
|
+ rapidjson::Value& out_datas, rapidjson::Document::AllocatorType& allocator)
|
|
|
{
|
|
|
auto site_area_ptr = card_ptr->get_site_area();
|
|
|
- if(!site_area_ptr || site_area_ptr->is_invalid())
|
|
|
+ if(!card_ptr->m_display || !site_area_ptr || site_area_ptr->is_invalid())
|
|
|
{
|
|
|
- return "";
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
auto mine_tool_ptr = card_ptr->get_mine_tool();
|
|
|
|
|
|
- rapidjson::Document doc(rapidjson::kObjectType);
|
|
|
rapidjson::Value data(rapidjson::kArrayType);
|
|
|
- rapidjson::Document::AllocatorType& allocator=doc.GetAllocator();
|
|
|
-
|
|
|
//卡号
|
|
|
std::string id = card_list::to_id64_str(card_ptr->m_type, card_ptr->m_id);
|
|
|
tool_json::push_back(data, id, allocator);
|
|
@@ -240,15 +258,8 @@ private:
|
|
|
//速度
|
|
|
data.PushBack(card_ptr->m_speed, allocator);
|
|
|
|
|
|
- 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, data, allocator);
|
|
|
-
|
|
|
- rapidjson::StringBuffer sb;
|
|
|
- rapidjson::PrettyWriter<rapidjson::StringBuffer> writer(sb);
|
|
|
- doc.Accept(writer);
|
|
|
|
|
|
- return sb.GetString();
|
|
|
+ out_datas.PushBack(data, allocator);
|
|
|
}
|
|
|
};
|
|
|
|