GrpcPrint/PrintS/Config/bean/AxisCfg.cpp

64 lines
2.5 KiB
C++
Raw Normal View History

2024-03-19 17:45:12 +08:00
#include "AxisCfg.h"
AxisCfg::AxisCfg(short id)
:m_axis_id(id)
,m_IsUse(true)
,m_SafeLimit(false)
{
}
AxisCfg::~AxisCfg()
{
}
void AxisCfg::GetUpdateSql(vector<string>& vec)
{
char buffer[2048];
sprintf_s(buffer, sizeof(buffer), "UPDATE %s SET %s=",TABLE_NAME.c_str(),FIELD_VALUE.c_str() );
string strhead = string(buffer);
sprintf_s(buffer, sizeof(buffer), " WHERE %s=%d AND %s=", FIELD_AXIS_ID.c_str(), m_axis_id,FIELD_CODE.c_str());
string strtail = string(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), to_string(m_active_limit).c_str(), strtail.c_str(), CODE_ACTIVE_LIMIT.c_str());
vec.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), to_string(m_negactive_limit).c_str(), strtail.c_str(), CODE_NEGACTIVE_LIMIT.c_str());
vec.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), to_string(m_active_direct).c_str(), strtail.c_str(), CODE_ACTIVE_DIRECT.c_str());
vec.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), to_string(m_OverLoadLimit).c_str(), strtail.c_str(), CODE_OVER_LOAD_LIMIT.c_str());
vec.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), to_string(m_ShowRefZero).c_str(), strtail.c_str(), CODE_SHOW_REF_ZERO.c_str());
vec.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), to_string(m_ShowPosInv).c_str(), strtail.c_str(), CODE_SHOW_POS_INV.c_str());
vec.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), to_string(m_MaxLoadValue).c_str(), strtail.c_str(), CODE_MAX_LOAD_VALUE.c_str());
vec.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'", strhead.c_str(), m_SafeLimit?"1":"0", strtail.c_str(), CODE_SAFE_LIMIT.c_str());
vec.push_back(buffer);
}
string AxisCfg::TABLE_NAME = "AxisConfig";
string AxisCfg::FIELD_ID = "Id";
string AxisCfg::FIELD_AXIS_ID = "Axis_Id";
string AxisCfg::FIELD_CODE = "Axis_Code";
string AxisCfg::FIELD_VALUE = "Axis_Value";
string AxisCfg::CODE_NAME= "Name";
string AxisCfg::CODE_ACTIVE_LIMIT = "Active_Limit";
string AxisCfg::CODE_NEGACTIVE_LIMIT = "Negactive_Limit";
string AxisCfg::CODE_ACTIVE_DIRECT = "acitve_direct";
string AxisCfg::CODE_OVER_LOAD_LIMIT = "OverLoadLimit";
string AxisCfg::CODE_SHOW_POS_INV="ShowPosInv"; //<2F><>ʾλ<CABE><CEBB><EFBFBD>÷<EFBFBD>
string AxisCfg::CODE_SHOW_REF_ZERO="ShowRefZero";
string AxisCfg::CODE_MAX_LOAD_VALUE = "MaxLoadValue";
string AxisCfg::CODE_SAFE_LIMIT = "SafeLimit";