|
@@ -10,6 +10,7 @@
|
|
|
#include"ant.h"
|
|
|
#include"card.h"
|
|
|
#include"area.h"
|
|
|
+#include "forbid_staff_down_mine.h"
|
|
|
#include <boost/format.hpp>
|
|
|
#include <boost/tokenizer.hpp>
|
|
|
#include <boost/algorithm/string/split.hpp>
|
|
@@ -34,7 +35,8 @@ void module_meta_date_changed::accept(sio::message::ptr const& data)
|
|
|
std::string op_type="";
|
|
|
tool_map::try_get_value(op_type, JSON_KEY_OP_TYPE, data);
|
|
|
|
|
|
- if(-1 != id && !op_type.empty())
|
|
|
+ //printf("Recv Web Data : name=%s,edit_type=%s id =%lld , %s ...\n",name.c_str(),op_type.c_str(),id,szParam.c_str());
|
|
|
+ if((-1 != id || szParam != "0") && !op_type.empty())
|
|
|
{
|
|
|
EDIT_TYPE_ID edit_type_id;
|
|
|
if(!try_get_edit_type_id(op_type, edit_type_id))
|
|
@@ -85,6 +87,10 @@ void module_meta_date_changed::accept(sio::message::ptr const& data)
|
|
|
{
|
|
|
deal_call_edit_lights_group(id,edit_type_id);///待实现
|
|
|
}
|
|
|
+ else if (JSON_KEY_NAME_FORBID_PERSON_DOWN_MINE == name)
|
|
|
+ {
|
|
|
+ deal_call_edit_forbid_person_down_mine(id,edit_type_id);
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
log_error("web发来的数据: 基础数据name字段错误:name=%s", name.c_str());
|
|
@@ -138,41 +144,39 @@ void module_meta_date_changed::clear_card(std::shared_ptr<card_location_base> ca
|
|
|
}
|
|
|
}
|
|
|
/*
|
|
|
- * 修改车及卡的数据
|
|
|
- * 在 ET_INSERT | ET_DELETE id64 = 卡ID =10000001198
|
|
|
- * ET_UPDATE id64 = 卡ID;员工ID或者车ID=10000001198;101 分号间隔
|
|
|
- */
|
|
|
+ * 修改车及卡的数据
|
|
|
+ * id64 = ;员工ID或者车ID;卡ID=101;10000001198 分号间隔
|
|
|
+ */
|
|
|
void module_meta_date_changed::deal_call_edit_vehicle_or_staff(const std::string & id64, EDIT_TYPE_ID edit_type_id)
|
|
|
{
|
|
|
- // 在 ET_INSERT | ET_DELETE id64 = 卡ID =10000001198
|
|
|
- //ET_UPDATE id64 = 卡ID;员工ID或者车ID=10000001198;101 分号间隔
|
|
|
+ // id64 = ;员工ID或者车ID;卡ID=101;10000001198 分号间隔
|
|
|
+
|
|
|
+ std::vector<std::string> vecSegTag;
|
|
|
+ boost::split(vecSegTag, id64, boost::is_any_of(";"));
|
|
|
+ if (vecSegTag.size() == 1) //数据发生错误
|
|
|
+ {
|
|
|
+ log_errno("Web Send Data Error!(%s)", id64.c_str());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ std::string lsz_card_id = vecSegTag[1];
|
|
|
+ int64_t card_id = std::stoll(lsz_card_id);
|
|
|
+ int cid = std::stoi(vecSegTag[0].c_str());
|
|
|
if(ET_INSERT == edit_type_id || ET_UPDATE == edit_type_id)
|
|
|
{
|
|
|
- int64_t card_id = std::stoll(id64);
|
|
|
if (ET_UPDATE == edit_type_id)
|
|
|
{
|
|
|
- std::vector<std::string> vecSegTag;
|
|
|
- boost::split(vecSegTag, id64,boost::is_any_of(";"));
|
|
|
- if (vecSegTag.size() == 1) //数据发生错误
|
|
|
- {
|
|
|
- log_errno("Web Send Data Error!(%s)",id64.c_str());
|
|
|
- return;
|
|
|
- }
|
|
|
- auto c = card_list::instance()->get_card_by_cid(std::stoi(vecSegTag[1].c_str()));
|
|
|
- if (nullptr != c && tool_other::type_id_to_str(c->m_type,c->m_id) != tool_other::to13str(vecSegTag[0]))
|
|
|
+ auto c = card_list::instance()->get_card_by_cid(cid);
|
|
|
+ if (nullptr != c && tool_other::type_id_to_str(c->m_type,c->m_id) != lsz_card_id)
|
|
|
{
|
|
|
//如果修改了卡号,则删除原来的卡的数据
|
|
|
remove_card(c);
|
|
|
}
|
|
|
- card_id = std::stoll(vecSegTag[0]);
|
|
|
}
|
|
|
card_list::instance()->init_vehicle(card_id);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- std::string card_id = id64;
|
|
|
- auto str = tool_other::to13str(card_id);
|
|
|
- remove_card(tool_other::id64_to_id(str), tool_other::id64_to_type(str));
|
|
|
+ remove_card(tool_other::id64_to_id(lsz_card_id), tool_other::id64_to_type(lsz_card_id));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -189,7 +193,7 @@ void module_meta_date_changed::deal_call_edit_card(std::string & id64, EDIT_TYPE
|
|
|
if (nullptr != c)
|
|
|
{
|
|
|
char id[100] = {0};
|
|
|
- sprintf(id,"%s;%d",lsz.c_str(),c->m_cid);
|
|
|
+ sprintf(id,"%d;%s",c->m_cid,card_id64_str.c_str());
|
|
|
lsz = id;
|
|
|
}
|
|
|
}
|
|
@@ -320,6 +324,19 @@ void module_meta_date_changed::deal_call_edit_lights_group(int id, EDIT_TYPE_ID
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 禁止指定人员下井 id = (rt_person_forbid_down_mine)数据库中自增长ID
|
|
|
+void module_meta_date_changed::deal_call_edit_forbid_person_down_mine(int id,EDIT_TYPE_ID edit_type_id)
|
|
|
+{
|
|
|
+ if(ET_INSERT == edit_type_id || ET_UPDATE == edit_type_id)
|
|
|
+ {
|
|
|
+ forbid_staff_down_mine::instance()->init_forbid_staff(id);
|
|
|
+ }
|
|
|
+ else if(ET_DELETE == edit_type_id)
|
|
|
+ {
|
|
|
+ forbid_staff_down_mine::instance()->del_forbid_data(id);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
void module_meta_date_changed::init_setting()
|
|
|
{
|
|
|
//pRes = getMysqlRes("select setting_id, name, type, value from dat_setting;");
|