66 lines
2.2 KiB
C++
66 lines
2.2 KiB
C++
|
|
#include <eqpalg/utility/update_data.h>
|
|||
|
|
UpDateData::UpDateData(string Jkey_data, string Jkey_rule_stat) {
|
|||
|
|
this->Jkey_data_ = unitNo_ + "_" + Jkey_data;
|
|||
|
|
this->Jkey_rule_stat_ = "EIS_Rule_stat";
|
|||
|
|
if (logger_ == nullptr) {
|
|||
|
|
logger_ = std::make_unique<LOG>("UpDateData");
|
|||
|
|
}
|
|||
|
|
if (eqp_status_ptr_ == nullptr) {
|
|||
|
|
eqp_status_ptr_ = std::make_unique<EqpStatus>();
|
|||
|
|
}
|
|||
|
|
logger_->Debug() << "UpDateData::UpDateData(string Jkey_data, string "
|
|||
|
|
"Jkey_rule_stat)"
|
|||
|
|
<< endl;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
UpDateData::UpDateData() {
|
|||
|
|
this->Jkey_data_ = unitNo_ + "_" + "EIS_itemtag";
|
|||
|
|
this->Jkey_rule_stat_ = unitNo_ + "_" + "Rule_stat";
|
|||
|
|
this->Jkey_eqp_state_ = unitNo_ + "_" + "Eqp_status";
|
|||
|
|
if (logger_ == nullptr) {
|
|||
|
|
logger_ = std::make_unique<LOG>("UpDateData");
|
|||
|
|
}
|
|||
|
|
if (eqp_status_ptr_ == nullptr) {
|
|||
|
|
eqp_status_ptr_ = std::make_unique<EqpStatus>();
|
|||
|
|
}
|
|||
|
|
logger_->Debug() << "UpDateData::UpDateData()" << endl;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
UpDateData::~UpDateData() {
|
|||
|
|
logger_->Debug() << "UpDateData::~UpDateData() " << endl;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void UpDateData::update_item_data() {
|
|||
|
|
string Jvalue =
|
|||
|
|
SingletonTemplate<GlobaltemSharedMemory>::GetInstance().get_data_json();
|
|||
|
|
auto reSult = m_memclient.Insert(Jkey_data_.c_str(), Jvalue.c_str());
|
|||
|
|
if (1 != reSult) {
|
|||
|
|
this->logger_->Debug()
|
|||
|
|
<< "update_item_data()"
|
|||
|
|
<< "m_memclient.Insert异常[0,set data fail;-1,key=null or value=null]:"
|
|||
|
|
<< reSult << std::endl;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void UpDateData::update_rule_stat_data() {
|
|||
|
|
SingletonTemp<EqpStat>::GetInstance().init();
|
|||
|
|
string Jvalue = SingletonTemp<EqpStat>::GetInstance().get_stat_json();
|
|||
|
|
auto reSult = m_memclient.Insert(Jkey_rule_stat_.c_str(), Jvalue.c_str());
|
|||
|
|
if (1 != reSult) {
|
|||
|
|
this->logger_->Debug()
|
|||
|
|
<< "update_rule_stat_data()"
|
|||
|
|
<< "m_memclient.Insert异常[0,set data fail;-1,key=null or value=null]:"
|
|||
|
|
<< reSult << std::endl;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void UpDateData::update_eqp_status() {
|
|||
|
|
string Jvalue = eqp_status_ptr_->get_data_json();
|
|||
|
|
auto reSult = m_memclient.Insert(Jkey_eqp_state_.c_str(), Jvalue.c_str());
|
|||
|
|
if (1 != reSult) {
|
|||
|
|
this->logger_->Debug()
|
|||
|
|
<< "update_eqp_status()"
|
|||
|
|
<< "m_memclient.Insert异常[0,set data fail;-1,key=null or value=null]:"
|
|||
|
|
<< reSult << std::endl;
|
|||
|
|
}
|
|||
|
|
}
|