添加配置相关功能 machinecfg

This commit is contained in:
wangxx1809 2024-05-30 11:18:10 +08:00
parent 6954aa7c50
commit 5143163d14
34 changed files with 426 additions and 273 deletions

View File

@ -16,6 +16,7 @@ public:
virtual void SetValue(const std::string& str) {}
virtual void SetValue(unsigned char uc) {}
virtual void SetValue(double uc) {}
virtual void SetValue(const time_t value) {}
std::string GetCode() { return m_code; }
virtual std::string GetValueStr() { return ""; }
@ -163,3 +164,18 @@ public:
private:
double m_value;
};
class TimetData : public BaseData {
public:
TimetData(const std::string& code, const std::string& context = u8"", const time_t val = 0.0)
: BaseData(code, context), m_value(val) {
}
~TimetData() {}
void SetValue(const time_t value) { m_value = value; }
DATATYPE GetDataType() { return iTIMET; }
time_t GetValue() { return m_value; }
std::string GetValueStr() { return std::to_string(m_value); }
private:
time_t m_value;
};

View File

@ -144,13 +144,13 @@ void ComServer::Init()
}
if (communicationCfg->find("SIMPLE_SUPPLY") != communicationCfg->end()) {
if (m_MachineCfg->m_SupplyMachineVersion == MachineCfg::VERSION_1_0) {
if (m_MachineCfg->m_SupplyMachineVersion->GetValue() == MachineCfg::VERSION_1_0) {
m_SimpleSupplyClient = new PowderSupplySimpleClient((*communicationCfg)["SIMPLE_SUPPLY"]);
}
else if (m_MachineCfg->m_SupplyMachineVersion == MachineCfg::VERSION_2_1) {
else if (m_MachineCfg->m_SupplyMachineVersion->GetValue() == MachineCfg::VERSION_2_1) {
m_SimpleSupplyClient = new PowderSupplySimpleClient2((*communicationCfg)["SIMPLE_SUPPLY"]);
}
else if (m_MachineCfg->m_SupplyMachineVersion == MachineCfg::VERSION_2_2) {
else if (m_MachineCfg->m_SupplyMachineVersion->GetValue() == MachineCfg::VERSION_2_2) {
m_SimpleSupplyClient = new PowderSupplySimpleClient3((*communicationCfg)["SIMPLE_SUPPLY"]);
}
else {
@ -294,13 +294,13 @@ void ComServer::SendToClients() {
}
if (m_SimpleSupplyClient) {
if (m_MachineCfg->m_SupplyMachineVersion == MachineCfg::VERSION_1_0) {
if (m_MachineCfg->m_SupplyMachineVersion->GetValue() == MachineCfg::VERSION_1_0) {
m_SimpleSupplyClient->SendToClients(SIMPLESUPPLYPARAM_V10);
}
else if (m_MachineCfg->m_SupplyMachineVersion == MachineCfg::VERSION_2_1) {
else if (m_MachineCfg->m_SupplyMachineVersion->GetValue() == MachineCfg::VERSION_2_1) {
m_SimpleSupplyClient->SendToClients(SIMPLESUPPLYPARAM_V21);
}
else if (m_MachineCfg->m_SupplyMachineVersion == MachineCfg::VERSION_2_2) {
else if (m_MachineCfg->m_SupplyMachineVersion->GetValue() == MachineCfg::VERSION_2_2) {
m_SimpleSupplyClient->SendToClients(SIMPLESUPPLYPARAM_V22);
}
else {

View File

@ -110,7 +110,7 @@ void ConfigManager::Init()
m_pMachineCfgDao = new MachineCfgDao(m_pDB);
m_pMachineCfgDao->CreateTable();
m_pMachineCfgDao->Find(m_MachineCfg);
m_Machine = Machine::CreateInstance(m_MachineCfg.m_MachineType);
m_Machine = Machine::CreateInstance(m_MachineCfg.m_MachineType->GetValue());
/*m_AxisCfgs[GTS_AXIS_ID_MOLD] = new AxisCfg(GTS_AXIS_ID_MOLD);
m_AxisCfgs[GTS_AXIS_ID_POWDER] = new AxisCfg(GTS_AXIS_ID_POWDER);
@ -164,12 +164,12 @@ bool ConfigManager::InitFromSetup(void)
if (handle == INVALID_HANDLE_VALUE && __argc > 1) {
int cnt = __argc;
m_MachineCfg.m_MachineType = stoi(__wargv[1]);
m_MachineCfg.m_MachineType->SetValue(stoi(__wargv[1]));
Init();
m_MachineCfg.m_MachineType = stoi(__wargv[1]);
m_MachineCfg.m_MachineType->SetValue(stoi(__wargv[1]));
if (__argc > 2)
m_MachineCfg.m_IOVersion = stoi(__wargv[2]);
m_MachineCfg.m_IOVersion->SetValue(stoi(__wargv[2]));
SaveConfig();
return true;
}
@ -217,7 +217,7 @@ void ConfigManager::ReadConfig()
m_pIOCfgDao->Find(m_IOCfgWrapper);
m_IOCfgWrapper->Init();
//m_pComServerDao->Find(m_ComServerCfgMap);
m_pCommunicationCfgDao->Find(m_MachineCfg.m_MachineType);
m_pCommunicationCfgDao->Find(m_MachineCfg.m_MachineType->GetValue());
m_pAlarmCfgDao->Find();
//m_pAlarmCfgDao->FindStop(m_AlarmCfgWrapper);
//m_pAlarmCfgDao->FindPause(m_AlarmCfgWrapper);
@ -226,7 +226,7 @@ void ConfigManager::ReadConfig()
m_pParamSetCfgDao->Find(m_ParamSetCfg);
//m_pLaserCfgDao->FindCfg();
m_ScannerControlCfgDao->FindCfg();
m_PrepareJobCfgDao->Find(m_MachineCfg.m_MachineType, m_PrepareJobCfgs);
m_PrepareJobCfgDao->Find(m_MachineCfg.m_MachineType->GetValue(), m_PrepareJobCfgs);
m_Machine->Init();
m_Machine->BindLaser();
m_IOVersionDao->Find(m_IOVersions);
@ -257,7 +257,7 @@ void ConfigManager::SaveConfig()
m_pParamSetCfgDao->Save(m_ParamSetCfg);
//m_pLaserCfgDao->Save();
m_ScannerControlCfgDao->Save();
m_PrepareJobCfgDao->Save(m_MachineCfg.m_MachineType, m_PrepareJobCfgs);
m_PrepareJobCfgDao->Save(m_MachineCfg.m_MachineType->GetValue(), m_PrepareJobCfgs);
transaction.commit();
}
@ -465,6 +465,8 @@ void ConfigManager::SendCfgToClients() {
m_RunCfg.SendToClients(RUNCFGPARAM);
m_InfraredTempCfg.SendToClients(INFRAREDTEMPCFGPARAM);
m_MachineCfg.SendToClients(MACHINECFGPARAM);
m_MoldCfg->SendToClients(MOLDCFGPARAM);
@ -489,6 +491,8 @@ void ConfigManager::UpdateCfg(const ReadData& rd) {
m_RunCfg.Update(rd, RUNCFGPARAM); break;
case INFRAREDTEMPCFG:
m_InfraredTempCfg.Update(rd, INFRAREDTEMPCFGPARAM); break;
case MACHINECFG:
m_MachineCfg.Update(rd, MACHINECFGPARAM); break;
default:
break;
}

View File

@ -82,12 +82,12 @@ public:
PowderEstimateCfg* GetPowderEstimateCfg() { return &m_PowderEstimateCfg; } //传
map<string, CommunicationCfg*>* GetCommunicationCfg() { return m_pCommunicationCfgDao->GetCommunicationCfg(); } //传
InfraredTempCfg* GetInfraredTempCfg() { //
InfraredTempCfg* GetInfraredTempCfg() { //
return &m_InfraredTempCfg;
}
ParamLimitCfg* GetParamLimitCfg() { return &m_ParamLimitCfg; } //
MachineCfg* GetMachineCfg() { return &m_MachineCfg; }
ParamLimitCfg* GetParamLimitCfg() { return &m_ParamLimitCfg; } //
MachineCfg* GetMachineCfg() { return &m_MachineCfg; } //已传
Machine* GetMachine() { return m_Machine; }
AlarmCfgWrapper* GetAlarmCfg() { return m_AlarmCfgWrapper; }
@ -125,7 +125,7 @@ public:
void UpdateZeroOffset(int id, long value);
map<int, bool>* GetPreJobParamCfg() { return &m_PrepareJobCfgs; }
void SavePreJobParamCfg() { m_PrepareJobCfgDao->Save(m_MachineCfg.m_MachineType, m_PrepareJobCfgs); }
void SavePreJobParamCfg() { m_PrepareJobCfgDao->Save(m_MachineCfg.m_MachineType->GetValue(), m_PrepareJobCfgs); }
void SendCfgToClients();
void UpdateCfg(const ReadData& rd);

View File

@ -117,7 +117,7 @@ IOCfgWrapper::IOCfgWrapper() {
m_IsSystemCtrlPressure = true;
MachineCfg* mcfg = ConfigManager::GetInstance()->GetMachineCfg();
m_IOCtrlIndex = mcfg->m_MachineType * 1000 + mcfg->m_IOVersion;
m_IOCtrlIndex = mcfg->m_MachineType->GetValue() * 1000 + mcfg->m_IOVersion->GetValue();
m_IoVMap[MachineTypeCfg::HBD_1000 * 1000 + HBD1000::IO_V0] = &m_1000v0;
m_IoVMap[MachineTypeCfg::HBD_1000 * 1000 + HBD1000::IO_V1] = &m_1000v1;
m_IoVMap[MachineTypeCfg::HBD_1000 * 1000 + HBD1000::IO_V2] = &m_1000v2;

View File

@ -6,39 +6,81 @@
#include "IOVersion.h"
MachineCfg::MachineCfg()
: m_serial(new StrData("serial", u8""))
, m_Name(new StrData("Name", u8"","HBD E1000"))
, m_language(new IntData("language", u8"", HbdLanguage::zh_CN))
, m_MachineType(new IntData("MachineType", u8"", MachineTypeCfg::HBD_E1000))
, m_ScanControl(new IntData("ScanControl", u8"", RTC5))
, m_IsIntelli(new BoolData("IsIntelli", u8"", true))
, m_PulifierType(new IntData("PulifierType", u8"", PurifierTypeCfg::M1))
, m_fontSize(new FloatData("fontSize", u8"", 25.0f))
, m_fontScale(new FloatData("fontScale", u8"", 1.0f))
, m_lastStartTime(new TimetData("lastStartTime", u8"", time(0)))
, m_lastShutdownTime(new TimetData("lastShutdownTime", u8"", time(0)))
, m_LockPassword(new StrData("LockPassword", u8"", "123"))
, m_LockAlpha(new FloatData("LockAlpha", u8"", 1.0f))
, m_LockIdleTime(new IntData("LockIdleTime", u8"", 10))
, m_ExpriedTime(new TimetData("ExpriedTime", u8"", time(0)))
, m_ConnectPassword(new StrData("ConnectPassword", u8"", "hbd_remote"))
, m_Location(new StrData("Location", u8""))
, m_PlatformShape(new IntData("PlatformShape", u8""))
, m_SupportNonEncMagic(new BoolData("SupportNonEncMagic", u8"",true))
, m_PrintStrategy(new IntData("PrintStrategy", u8"多激光打印策略", DATA))
, m_PlatformLength(new IntData("PlatformLength", u8"", 600))
, m_PlatformWidth(new IntData("PlatformWidth", u8"", 600))
, m_IOVersion(new IntData("IOVersion", u8""))
, m_SupplyMachineVersion(new IntData("SupplyMachineVersion", u8""))
, m_UseTouchScreen(new BoolData("UseTouchScreen", u8"",true))
, m_MachineCode(new StrData("MachineCode", u8""))
, m_MachineCodeAss(new StrData("MachineCodeAss", u8""))
{
m_serial = "";
m_Name = "HBD E1000";
m_language = HbdLanguage::zh_CN;
m_MachineType = MachineTypeCfg::HBD_E1000;
m_ScanControl = RTC5;
m_PulifierType = PurifierTypeCfg::M1;
m_fontSize = 25.0f;
m_fontScale = 1.0f;
m_lastStartTime = time(0);
m_lastShutdownTime = time(0);
m_LockPassword = "123";
m_LockAlpha = 1.0f;
m_LockIdleTime = 10;
m_ExpriedTime = time(0);
//m_IsRemoteConnect = true;
m_ConnectPassword = "hbd_remote";
m_Location = "";
m_PlatformShape = 0;
m_SupportNonEncMagic = true;
m_PrintStrategy = DATA; //多激光打印策略
m_PlatformLength = 600;
m_PlatformWidth = 600;
m_IsIntelli = true;
m_IOVersion = 0;
m_MachineCode = "";
//m_serial = "";
//m_Name = "HBD E1000";
//m_language = HbdLanguage::zh_CN;
//m_MachineType = MachineTypeCfg::HBD_E1000;
//m_ScanControl = RTC5;
//m_PulifierType = PurifierTypeCfg::M1;
//m_fontSize = 25.0f;
//m_fontScale = 1.0f;
//m_lastStartTime = time(0);
//m_lastShutdownTime = time(0);
//m_LockPassword = "123";
//m_LockAlpha = 1.0f;
//m_LockIdleTime = 10;
//m_ExpriedTime = time(0);
////m_IsRemoteConnect = true;
//m_ConnectPassword = "hbd_remote";
//m_Location = "";
//m_PlatformShape = 0;
//m_SupportNonEncMagic = true;
//m_PrintStrategy = DATA; //多激光打印策略
//m_PlatformLength = 600;
//m_PlatformWidth = 600;
//m_IsIntelli = true;
//m_IOVersion = 0;
//m_MachineCode = "";
m_CodeMap[MachineTypeCfg::HBD_1000].push_back("HBD 1000");
m_CodeMap[MachineTypeCfg::HBD_1200].push_back("HBD 1200");
m_CodeMap[MachineTypeCfg::HBD_1200_OLD].push_back("HBD 1200V0");
m_CodeMap[MachineTypeCfg::HBD_1500].push_back("HBD 1500");
m_CodeMap[MachineTypeCfg::HBD_E1000].push_back("HBD E1000");
m_UseTouchScreen = true;
size_t ptrSize = sizeof(nullptr); //指针大小
void* startPtr = &m_startFlag + 1;
size_t count = ((size_t)&m_endFlag - (size_t)startPtr) / ptrSize;
InsertMp(startPtr, count);
auto item = m_CodeMap.begin();
while(item != m_CodeMap.end()) {
//#pragma pack(1)
string key = to_string(item->first);
BaseData* p = new StrData(key, u8"", item->second[0]);
//#pragma pack()
InsertMp(key,p);
++item;
}
}
@ -51,76 +93,76 @@ void MachineCfg::GetUpdateSql(vector<string>& ups)
char buffer[512];
string updateSql = "UPDATE " + TABLE_NAME + " SET " + FIELD_VALUE + "='%s' WHERE " + FIELD_CODE + "='%s'";
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_serial.c_str(), CODE_SERIAL.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_serial->GetValueStr().c_str(), CODE_SERIAL.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_Name.c_str(), CODE_NAME.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_Name->GetValueStr().c_str(), CODE_NAME.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_language).c_str(), CODE_LANGUAGE.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_language->GetValueStr().c_str(), CODE_LANGUAGE.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_MachineType).c_str(), CODE_MACHINE_TYPE.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_MachineType->GetValueStr().c_str(), CODE_MACHINE_TYPE.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_ScanControl).c_str(), CODE_SCAN_CONTROL.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_ScanControl->GetValue()).c_str(), CODE_SCAN_CONTROL.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_PulifierType).c_str(), CODE_PULIFIER_TYPE.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_PulifierType->GetValue()).c_str(), CODE_PULIFIER_TYPE.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_lastStartTime).c_str(), CODE_LAST_START_TIME.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_lastStartTime->GetValue()).c_str(), CODE_LAST_START_TIME.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_lastShutdownTime).c_str(), CODE_LAST_SHUTDOWN_TIME.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_lastShutdownTime->GetValue()).c_str(), CODE_LAST_SHUTDOWN_TIME.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_LockPassword.c_str(), CODE_LOCK_PASSWORD.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_LockPassword->GetValueStr().c_str(), CODE_LOCK_PASSWORD.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_LockAlpha).c_str(), CODE_LOCK_ALPHA.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_LockAlpha->GetValue()).c_str(), CODE_LOCK_ALPHA.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_LockIdleTime).c_str(), CODE_LOCK_IDLE_TIME.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_LockIdleTime->GetValue()).c_str(), CODE_LOCK_IDLE_TIME.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_ExpriedTime).c_str(), CODE_EXPIRED_TIME.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_ExpriedTime->GetValue()).c_str(), CODE_EXPIRED_TIME.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_ConnectPassword.c_str(), CODE_CONNECT_PASSWORD.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_ConnectPassword->GetValueStr().c_str(), CODE_CONNECT_PASSWORD.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_Location.c_str(), CODE_LOCATION.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_Location->GetValueStr().c_str(), CODE_LOCATION.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_PlatformShape).c_str(), CODE_SHAPE.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_PlatformShape->GetValue()).c_str(), CODE_SHAPE.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_SupportNonEncMagic).c_str(), CODE_SUPPORT_NON_ENC_MAGIC.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_SupportNonEncMagic->GetValue()).c_str(), CODE_SUPPORT_NON_ENC_MAGIC.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_PrintStrategy).c_str(), CODE_PRINT_STRATEGY.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_PrintStrategy->GetValue()).c_str(), CODE_PRINT_STRATEGY.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_PlatformLength).c_str(), CODE_PLATFORM_LENGTH.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_PlatformLength->GetValue()).c_str(), CODE_PLATFORM_LENGTH.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_PlatformWidth).c_str(), CODE_PLATFORM_WIDTH.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_PlatformWidth->GetValue()).c_str(), CODE_PLATFORM_WIDTH.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_IsIntelli ? "1" : "0", CODE_IS_INTELLI.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_IsIntelli->GetValue() ? "1" : "0", CODE_IS_INTELLI.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_IOVersion).c_str(), CODE_IO_VERSION.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_IOVersion->GetValue()).c_str(), CODE_IO_VERSION.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_SupplyMachineVersion).c_str(), CODE_SUPPLY_MACHINE_VERSION.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_SupplyMachineVersion->GetValue()).c_str(), CODE_SUPPLY_MACHINE_VERSION.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_UseTouchScreen).c_str(), CODE_USE_TOUCH_SCREEN.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), to_string(m_UseTouchScreen->GetValue()).c_str(), CODE_USE_TOUCH_SCREEN.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_MachineCode.c_str(), CODE_MACHINE_CODE.c_str());
sprintf_s(buffer, sizeof(buffer), updateSql.c_str(), m_MachineCode->GetValueStr().c_str(), CODE_MACHINE_CODE.c_str());
ups.push_back(buffer);
}

View File

@ -2,10 +2,13 @@
#include <string>
#include <vector>
#include <map>
#include "../Controller/Base.h"
#include "../Communication/BaseData.h"
using namespace std;
class MachineCfg
#pragma pack(1)
class MachineCfg : public Base
{
public:
enum PrintStrategy {
@ -35,14 +38,14 @@ public:
}
bool IsDataSeqStragegy() {
if (m_PrintStrategy == DATA_SEQ_OPT) {
if (m_PrintStrategy->GetValue() == DATA_SEQ_OPT) {
return true;
}
else return false;
}
bool IsMassStrategy() {
if (m_PrintStrategy == Mass_Production_Strategy)
if (m_PrintStrategy->GetValue() == Mass_Production_Strategy)
{
return true;
}
@ -50,33 +53,35 @@ public:
}
public:
string m_serial;
string m_Name;
int m_language;
int m_MachineType;
int m_ScanControl;
bool m_IsIntelli;
int m_PulifierType;
float m_fontSize;
float m_fontScale;
time_t m_lastStartTime;
time_t m_lastShutdownTime;
string m_LockPassword;
float m_LockAlpha;
int m_LockIdleTime;
time_t m_ExpriedTime;
string m_ConnectPassword;
string m_Location;
int m_PlatformShape;
bool m_SupportNonEncMagic;
int m_PrintStrategy;
int m_PlatformLength;
int m_PlatformWidth;
int m_IOVersion;
int m_SupplyMachineVersion;
bool m_UseTouchScreen;
string m_MachineCode;
char m_MachineCodeAss[64];
char m_startFlag;
StrData* m_serial;
StrData* m_Name;
IntData* m_language;
IntData* m_MachineType;
IntData* m_ScanControl;
BoolData* m_IsIntelli;
IntData* m_PulifierType;
FloatData* m_fontSize;
FloatData* m_fontScale;
TimetData* m_lastStartTime;
TimetData* m_lastShutdownTime;
StrData* m_LockPassword;
FloatData* m_LockAlpha;
IntData* m_LockIdleTime;
TimetData* m_ExpriedTime;
StrData* m_ConnectPassword;
StrData* m_Location;
IntData* m_PlatformShape;
BoolData* m_SupportNonEncMagic;
IntData* m_PrintStrategy;
IntData* m_PlatformLength;
IntData* m_PlatformWidth;
IntData* m_IOVersion;
IntData* m_SupplyMachineVersion;
BoolData* m_UseTouchScreen;
StrData* m_MachineCode;
StrData* m_MachineCodeAss; //最少长度64
char m_endFlag; //结束标记
public:
static const string TABLE_NAME;
static const string FIELD_CODE;
@ -113,4 +118,5 @@ public:
static map<int, vector<string>> m_CodeMap;
};
#pragma pack()

View File

@ -1,4 +1,4 @@
#include "IOCfgDao.h"
#include "IOCfgDao.h"
#include "../ConfigManager.h"
@ -72,7 +72,7 @@ void IOCfgDao::Find(IOCfgWrapper* iowrapper)
}
vector<string> ins;
MachineCfg* mc = ConfigManager::GetInstance()->GetMachineCfg();
machine->CheckIO(ins, iowrapper, mc->m_IOVersion);
machine->CheckIO(ins, iowrapper, mc->m_IOVersion->GetValue());
if (!ins.empty()) {
SQLite::Transaction transaction(*m_pDB);

View File

@ -40,168 +40,164 @@ void MachineCfgDao::Find(MachineCfg& mcfg)
values[query.getColumn(MachineCfg::FIELD_CODE.c_str()).getString()] = query.getColumn(MachineCfg::FIELD_VALUE.c_str()).getString();
}
if (values.find(MachineCfg::CODE_SERIAL.c_str()) != values.end())mcfg.m_serial = values[MachineCfg::CODE_SERIAL];
if (values.find(MachineCfg::CODE_SERIAL.c_str()) != values.end())mcfg.m_serial->SetValue(values[MachineCfg::CODE_SERIAL]);
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_SERIAL.c_str(), mcfg.m_serial.c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_SERIAL.c_str(), mcfg.m_serial->GetValueStr().c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_NAME.c_str()) != values.end())mcfg.m_Name = values[MachineCfg::CODE_NAME];
if (values.find(MachineCfg::CODE_NAME.c_str()) != values.end())mcfg.m_Name->SetValue(values[MachineCfg::CODE_NAME]);
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_NAME.c_str(), mcfg.m_Name.c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_NAME.c_str(), mcfg.m_Name->GetValueStr().c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_LANGUAGE.c_str()) != values.end())mcfg.m_language = stoi(values[MachineCfg::CODE_LANGUAGE]);
if (values.find(MachineCfg::CODE_LANGUAGE.c_str()) != values.end())mcfg.m_language->SetValue(stoi(values[MachineCfg::CODE_LANGUAGE]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_LANGUAGE.c_str(), to_string(mcfg.m_language).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_LANGUAGE.c_str(), to_string(mcfg.m_language->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_MACHINE_TYPE.c_str()) != values.end())mcfg.m_MachineType = stoi(values[MachineCfg::CODE_MACHINE_TYPE]);
if (values.find(MachineCfg::CODE_MACHINE_TYPE.c_str()) != values.end())mcfg.m_MachineType->SetValue(stoi(values[MachineCfg::CODE_MACHINE_TYPE]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_MACHINE_TYPE.c_str(), to_string(mcfg.m_MachineType).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_MACHINE_TYPE.c_str(), to_string(mcfg.m_MachineType->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_SCAN_CONTROL.c_str()) != values.end())mcfg.m_ScanControl = stoi(values[MachineCfg::CODE_SCAN_CONTROL]);
if (values.find(MachineCfg::CODE_SCAN_CONTROL.c_str()) != values.end())mcfg.m_ScanControl->SetValue(stoi(values[MachineCfg::CODE_SCAN_CONTROL]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_SCAN_CONTROL.c_str(), to_string(mcfg.m_ScanControl).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_SCAN_CONTROL.c_str(), to_string(mcfg.m_ScanControl->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_PULIFIER_TYPE.c_str()) != values.end())mcfg.m_PulifierType = stoi(values[MachineCfg::CODE_PULIFIER_TYPE]);
if (values.find(MachineCfg::CODE_PULIFIER_TYPE.c_str()) != values.end())mcfg.m_PulifierType->SetValue(stoi(values[MachineCfg::CODE_PULIFIER_TYPE]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_PULIFIER_TYPE.c_str(), to_string(mcfg.m_PulifierType).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_PULIFIER_TYPE.c_str(), to_string(mcfg.m_PulifierType->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_FONT_SIZE.c_str()) != values.end())mcfg.m_fontSize = stof(values[MachineCfg::CODE_FONT_SIZE]);
if (values.find(MachineCfg::CODE_FONT_SIZE.c_str()) != values.end())mcfg.m_fontSize->SetValue(stof(values[MachineCfg::CODE_FONT_SIZE]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_FONT_SIZE.c_str(), to_string(mcfg.m_fontSize).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_FONT_SIZE.c_str(), to_string(mcfg.m_fontSize->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_FONT_SCALE.c_str()) != values.end())mcfg.m_fontScale = stof(values[MachineCfg::CODE_FONT_SCALE]);
if (values.find(MachineCfg::CODE_FONT_SCALE.c_str()) != values.end())mcfg.m_fontScale->SetValue(stof(values[MachineCfg::CODE_FONT_SCALE]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_FONT_SCALE.c_str(), to_string(mcfg.m_fontScale).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_FONT_SCALE.c_str(), to_string(mcfg.m_fontScale->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_LAST_START_TIME.c_str()) != values.end())mcfg.m_lastStartTime = stoll(values[MachineCfg::CODE_LAST_START_TIME]);
if (values.find(MachineCfg::CODE_LAST_START_TIME.c_str()) != values.end())mcfg.m_lastStartTime->SetValue(stoll(values[MachineCfg::CODE_LAST_START_TIME]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_LAST_START_TIME.c_str(), to_string(mcfg.m_lastStartTime).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_LAST_START_TIME.c_str(), to_string(mcfg.m_lastStartTime->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_LAST_SHUTDOWN_TIME.c_str()) != values.end())mcfg.m_lastShutdownTime = stoll(values[MachineCfg::CODE_LAST_SHUTDOWN_TIME]);
if (values.find(MachineCfg::CODE_LAST_SHUTDOWN_TIME.c_str()) != values.end())mcfg.m_lastShutdownTime->SetValue(stoll(values[MachineCfg::CODE_LAST_SHUTDOWN_TIME]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_LAST_SHUTDOWN_TIME.c_str(), to_string(mcfg.m_lastShutdownTime).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_LAST_SHUTDOWN_TIME.c_str(), to_string(mcfg.m_lastShutdownTime->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_LOCK_PASSWORD.c_str()) != values.end())mcfg.m_LockPassword = values[MachineCfg::CODE_LOCK_PASSWORD];
if (values.find(MachineCfg::CODE_LOCK_PASSWORD.c_str()) != values.end())mcfg.m_LockPassword->SetValue(values[MachineCfg::CODE_LOCK_PASSWORD]);
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_LOCK_PASSWORD.c_str(), mcfg.m_LockPassword.c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_LOCK_PASSWORD.c_str(), mcfg.m_LockPassword->GetValueStr().c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_LOCK_ALPHA.c_str()) != values.end())mcfg.m_LockAlpha = stof(values[MachineCfg::CODE_LOCK_ALPHA]);
if (values.find(MachineCfg::CODE_LOCK_ALPHA.c_str()) != values.end())mcfg.m_LockAlpha->SetValue(stof(values[MachineCfg::CODE_LOCK_ALPHA]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_LOCK_ALPHA.c_str(), to_string(mcfg.m_LockAlpha).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_LOCK_ALPHA.c_str(), to_string(mcfg.m_LockAlpha->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_LOCK_IDLE_TIME.c_str()) != values.end())mcfg.m_LockIdleTime = stoi(values[MachineCfg::CODE_LOCK_IDLE_TIME]);
if (values.find(MachineCfg::CODE_LOCK_IDLE_TIME.c_str()) != values.end())mcfg.m_LockIdleTime->SetValue(stoi(values[MachineCfg::CODE_LOCK_IDLE_TIME]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_LOCK_IDLE_TIME.c_str(), to_string(mcfg.m_LockIdleTime).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_LOCK_IDLE_TIME.c_str(), to_string(mcfg.m_LockIdleTime->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_EXPIRED_TIME.c_str()) != values.end())mcfg.m_ExpriedTime = stoul(values[MachineCfg::CODE_EXPIRED_TIME]);
if (values.find(MachineCfg::CODE_EXPIRED_TIME.c_str()) != values.end())mcfg.m_ExpriedTime->SetValue(stoul(values[MachineCfg::CODE_EXPIRED_TIME]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_EXPIRED_TIME.c_str(), to_string(mcfg.m_ExpriedTime).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_EXPIRED_TIME.c_str(), to_string(mcfg.m_ExpriedTime->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_CONNECT_PASSWORD.c_str()) != values.end())mcfg.m_ConnectPassword = values[MachineCfg::CODE_CONNECT_PASSWORD];
if (values.find(MachineCfg::CODE_CONNECT_PASSWORD.c_str()) != values.end())mcfg.m_ConnectPassword->SetValue(values[MachineCfg::CODE_CONNECT_PASSWORD]);
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_CONNECT_PASSWORD.c_str(), mcfg.m_ConnectPassword.c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_CONNECT_PASSWORD.c_str(), mcfg.m_ConnectPassword->GetValueStr().c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_LOCATION.c_str()) != values.end())mcfg.m_Location = values[MachineCfg::CODE_LOCATION];
if (values.find(MachineCfg::CODE_LOCATION.c_str()) != values.end())mcfg.m_Location->SetValue(values[MachineCfg::CODE_LOCATION]);
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_LOCATION.c_str(), mcfg.m_Location.c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_LOCATION.c_str(), mcfg.m_Location->GetValueStr().c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_SHAPE.c_str()) != values.end())mcfg.m_PlatformShape = stoi(values[MachineCfg::CODE_SHAPE]);
if (values.find(MachineCfg::CODE_SHAPE.c_str()) != values.end())mcfg.m_PlatformShape->SetValue(stoi(values[MachineCfg::CODE_SHAPE]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_SHAPE.c_str(), to_string(mcfg.m_PlatformShape).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_SHAPE.c_str(), to_string(mcfg.m_PlatformShape->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_SUPPORT_NON_ENC_MAGIC.c_str()) != values.end())mcfg.m_SupportNonEncMagic = (stoi(values[MachineCfg::CODE_SUPPORT_NON_ENC_MAGIC]) > 0 ? true : false);
if (values.find(MachineCfg::CODE_SUPPORT_NON_ENC_MAGIC.c_str()) != values.end())mcfg.m_SupportNonEncMagic->SetValue(stoi(values[MachineCfg::CODE_SUPPORT_NON_ENC_MAGIC]) > 0 ? true : false);
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_SUPPORT_NON_ENC_MAGIC.c_str(), to_string(mcfg.m_SupportNonEncMagic).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_SUPPORT_NON_ENC_MAGIC.c_str(), to_string(mcfg.m_SupportNonEncMagic->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_PRINT_STRATEGY.c_str()) != values.end())mcfg.m_PrintStrategy = MachineCfg::PrintStrategy(stoi(values[MachineCfg::CODE_PRINT_STRATEGY]));
if (values.find(MachineCfg::CODE_PRINT_STRATEGY.c_str()) != values.end())mcfg.m_PrintStrategy->SetValue(MachineCfg::PrintStrategy(stoi(values[MachineCfg::CODE_PRINT_STRATEGY])));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_PRINT_STRATEGY.c_str(), to_string(mcfg.m_PrintStrategy).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_PRINT_STRATEGY.c_str(), to_string(mcfg.m_PrintStrategy->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_PLATFORM_WIDTH.c_str()) != values.end())mcfg.m_PlatformWidth = stoi(values[MachineCfg::CODE_PLATFORM_WIDTH]);
if (values.find(MachineCfg::CODE_PLATFORM_WIDTH.c_str()) != values.end())mcfg.m_PlatformWidth->SetValue(stoi(values[MachineCfg::CODE_PLATFORM_WIDTH]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_PLATFORM_WIDTH.c_str(), to_string(mcfg.m_PlatformWidth).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_PLATFORM_WIDTH.c_str(), to_string(mcfg.m_PlatformWidth->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_PLATFORM_LENGTH.c_str()) != values.end())mcfg.m_PlatformLength = stoi(values[MachineCfg::CODE_PLATFORM_LENGTH]);
if (values.find(MachineCfg::CODE_PLATFORM_LENGTH.c_str()) != values.end())mcfg.m_PlatformLength->SetValue(stoi(values[MachineCfg::CODE_PLATFORM_LENGTH]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_PLATFORM_LENGTH.c_str(), to_string(mcfg.m_PlatformLength).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_PLATFORM_LENGTH.c_str(), to_string(mcfg.m_PlatformLength->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_IS_INTELLI.c_str()) != values.end())mcfg.m_IsIntelli = (stoi(values[MachineCfg::CODE_IS_INTELLI]) > 0 ? true : false);
if (values.find(MachineCfg::CODE_IS_INTELLI.c_str()) != values.end())mcfg.m_IsIntelli->SetValue(stoi(values[MachineCfg::CODE_IS_INTELLI]) > 0 ? true : false);
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_IS_INTELLI.c_str(), mcfg.m_IsIntelli ? "1" : "0");
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_IS_INTELLI.c_str(), mcfg.m_IsIntelli->GetValue() ? "1" : "0");
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_IO_VERSION.c_str()) != values.end())mcfg.m_IOVersion = stoi(values[MachineCfg::CODE_IO_VERSION]);
if (values.find(MachineCfg::CODE_IO_VERSION.c_str()) != values.end())mcfg.m_IOVersion->SetValue(stoi(values[MachineCfg::CODE_IO_VERSION]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_IO_VERSION.c_str(), to_string(mcfg.m_IOVersion).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_IO_VERSION.c_str(), to_string(mcfg.m_IOVersion->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_SUPPLY_MACHINE_VERSION.c_str()) != values.end())mcfg.m_SupplyMachineVersion = stoi(values[MachineCfg::CODE_SUPPLY_MACHINE_VERSION]);
if (values.find(MachineCfg::CODE_SUPPLY_MACHINE_VERSION.c_str()) != values.end())mcfg.m_SupplyMachineVersion->SetValue(stoi(values[MachineCfg::CODE_SUPPLY_MACHINE_VERSION]));
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_SUPPLY_MACHINE_VERSION.c_str(), to_string(mcfg.m_SupplyMachineVersion).c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_SUPPLY_MACHINE_VERSION.c_str(), to_string(mcfg.m_SupplyMachineVersion->GetValue()).c_str());
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_USE_TOUCH_SCREEN.c_str()) != values.end())mcfg.m_UseTouchScreen = (stoi(values[MachineCfg::CODE_USE_TOUCH_SCREEN]) > 0 ? true : false);
if (values.find(MachineCfg::CODE_USE_TOUCH_SCREEN.c_str()) != values.end())mcfg.m_UseTouchScreen->SetValue(stoi(values[MachineCfg::CODE_USE_TOUCH_SCREEN]) > 0 ? true : false);
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_USE_TOUCH_SCREEN.c_str(), mcfg.m_UseTouchScreen ? "1" : "0");
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_USE_TOUCH_SCREEN.c_str(), mcfg.m_UseTouchScreen->GetValue() ? "1" : "0");
ins.push_back(buffer);
}
if (values.find(MachineCfg::CODE_MACHINE_CODE.c_str()) != values.end())
mcfg.m_MachineCode = values[MachineCfg::CODE_MACHINE_CODE];
mcfg.m_MachineCode->SetValue(values[MachineCfg::CODE_MACHINE_CODE]);
else {
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_MACHINE_CODE.c_str(), mcfg.m_MachineCode.c_str());
sprintf_s(buffer, sizeof(buffer), insertSql.c_str(), MachineCfg::CODE_MACHINE_CODE.c_str(), mcfg.m_MachineCode->GetValueStr().c_str());
ins.push_back(buffer);
}
memset(&mcfg.m_MachineCodeAss, '\0', sizeof(mcfg.m_MachineCodeAss));
for (int i = 0; i < mcfg.m_MachineCode.length(); i++) {
mcfg.m_MachineCodeAss[i] = mcfg.m_MachineCode[i];
}
mcfg.m_MachineCodeAss->SetValue(mcfg.m_MachineCode->GetValueStr());
if (!ins.empty()) {
SQLite::Transaction transaction(*m_pDB);

View File

@ -25,6 +25,14 @@ protected:
else { m_baseMp.insert(make_pair(key, bd)); }
}
}
void InsertMp(const std::string& key, BaseData* baseData, const std::string& suff = "") {
if (m_baseMp.find(key) != m_baseMp.end()) {
printf("%s is repeated...\n", key.data());
}
else { m_baseMp.insert(make_pair(key, baseData)); }
}
public:
Base() {}
virtual ~Base() {
@ -80,6 +88,9 @@ public:
else if (rd.valueType == iDOUBLE) {
m_baseMp[rd.nameKey]->SetValue(ConverType::TryToD(rd.strValue));
}
else if (rd.valueType == iTIMET) {
m_baseMp[rd.nameKey]->SetValue((time_t)ConverType::TryToLL(rd.strValue));
}
}
else {
printf("error, %s do not find...", rd.nameKey.c_str());

View File

@ -105,7 +105,7 @@ void Controller::Init(){
m_ScannerCtrl->SetMachineCtrl(m_MachineCtrl);
switch (m_MachineCfg->m_PulifierType)
switch (m_MachineCfg->m_PulifierType->GetValue())
{
//case PurifierTypeCfg::HBD_PURIFIER_1: {
// m_Purifier = new HBD1Purifier(m_GTSController->GetDacState(),m_ScannerCtrl);

View File

@ -34,6 +34,7 @@ void ClientWrapper::Clear() {
std::lock_guard<std::mutex> lck(m_mux);
auto client = m_clientList.begin();
while (client != m_clientList.end()) {
(*client)->m_context->TryCancel();
if (*client) delete (*client);
++client;
}

View File

@ -81,8 +81,10 @@ void DataHandle::Run() {
void DataHandle::Stop() {
if(m_streamServer) m_streamServer->Stop();
if (m_controller) m_controller->StopSend();
if(m_streamServer) m_streamServer->Stop();
}
@ -124,6 +126,9 @@ void DataHandle::DataCallBackHandle(const ReadData& msg) {
case INFRAREDTEMPCFG:
ConfigManager::GetInstance()->GetInfraredTempCfg()->Update(msg, INFRAREDTEMPCFGPARAM);
break;
case MACHINECFG:
ConfigManager::GetInstance()->GetMachineCfg()->Update(msg, MACHINECFGPARAM);
break;
case REQUEST:
if (msg.nameKey == "36") {
printf("error,36 需要释放ScannerCtrl::Init()内部代码块...\n");
@ -135,6 +140,7 @@ void DataHandle::DataCallBackHandle(const ReadData& msg) {
else {
ConfigManager::GetInstance()->SendCfgToClients(); //发送配置到客户端
}
break;
default: break;

View File

@ -25,6 +25,7 @@ enum READTYPE {
EXTCFG,
RUNCFG,
INFRAREDTEMPCFG,
MACHINECFG,
LOADPARAM, //装载参数
@ -45,6 +46,7 @@ enum DATATYPE {
iUCHAR,
iWORD,
iDOUBLE,
iTIMET,
UNKNOW,
};
@ -95,6 +97,7 @@ enum WRITETYPE {
EXTCFGPARAM,
RUNCFGPARAM, //runcfg 参数
INFRAREDTEMPCFGPARAM, //InfraredTempCfg 参数
MACHINECFGPARAM, //MachineCfg 参数
MOLDCFGPARAM,
LOADCFGPARAM,

View File

@ -125,13 +125,17 @@ void StreamServer::Run() {
builder.RegisterService(this);
m_server = builder.BuildAndStart();
m_server->Wait();
});
}
void StreamServer::Stop() {
ClientWrapper::Instance()->Clear();
if(m_server.get())
m_server->Shutdown();
if (m_listenTd.joinable()) {
m_listenTd.join();
}
@ -140,5 +144,5 @@ void StreamServer::Stop() {
if (m_checkCloseTd.joinable())
m_checkCloseTd.join();
ClientWrapper::Instance()->Clear();
}

View File

@ -48,7 +48,7 @@ void HBDSystem::Init() {
g_LngManager->Init();
ConfigManager::GetInstance()->Init();
g_SystemInfo = new SystemInfo();
g_LngManager->Translation(HbdLanguage::Language(ConfigManager::GetInstance()->GetMachineCfg()->m_language));
g_LngManager->Translation(HbdLanguage::Language(ConfigManager::GetInstance()->GetMachineCfg()->m_language->GetValue()));
g_Toast = new Toast();

View File

@ -139,27 +139,27 @@ Machine* Machine::CreateInstance(int type)
void Machine::InitMachineCfg(MachineCfg* cfg)
{
switch (cfg->m_MachineType)
switch (cfg->m_MachineType->GetValue())
{
case MachineTypeCfg::HBD_1000: {
cfg->m_Name = "HBD1000";
cfg->m_PlatformWidth = 600;
cfg->m_PlatformLength = 600;
cfg->m_Name->SetValue("HBD1000");
cfg->m_PlatformWidth->SetValue( 600);
cfg->m_PlatformLength ->SetValue(600);
}break;
case MachineTypeCfg::HBD_1500: {
cfg->m_Name = "HBD1500";
cfg->m_PlatformWidth = 600;
cfg->m_PlatformLength = 600;
cfg->m_Name->SetValue("HBD1500");
cfg->m_PlatformWidth->SetValue(600);
cfg->m_PlatformLength->SetValue(600);
}break;
case MachineTypeCfg::HBD_1200_OLD: {
cfg->m_Name = "HBD1200_OLD";
cfg->m_PlatformWidth = 600;
cfg->m_PlatformLength = 600;
cfg->m_Name->SetValue("HBD1200_OLD");
cfg->m_PlatformWidth->SetValue(600);
cfg->m_PlatformLength->SetValue(600);
}break;
case MachineTypeCfg::HBD_1200: {
cfg->m_Name = "HBD1200";
cfg->m_PlatformWidth = 600;
cfg->m_PlatformLength = 600;
cfg->m_Name->SetValue("HBD1200");
cfg->m_PlatformWidth->SetValue(600);
cfg->m_PlatformLength->SetValue(600);
}break;
default:break;
}

View File

@ -778,11 +778,11 @@ bool RecoatCheck::CheckWP(MetaData* metadata, unsigned int layer, unsigned char*
cv::Point2f tempTri[4], dstTri[4];
// Mat warp_mat = getPerspectiveTransform(srcTri, dstTri);
float plr = (float)mcfg->m_PlatformLength / mcfg->m_PlatformWidth;
float plr = (float)mcfg->m_PlatformLength->GetValue() / mcfg->m_PlatformWidth->GetValue();
int wwidth = 1000;
int wheight = 1000.0f / plr;
float wr = 1000.0 / mcfg->m_PlatformLength;
float wh = (float)wheight / mcfg->m_PlatformWidth;
float wr = 1000.0 / mcfg->m_PlatformLength->GetValue();
float wh = (float)wheight / mcfg->m_PlatformWidth->GetValue();
tempTri[0] = cv::Point2f(0.0f, 0.0f);
tempTri[1] = cv::Point2f(wwidth, 0.0f);
tempTri[2] = cv::Point2f(wwidth, wheight);
@ -909,8 +909,8 @@ bool RecoatCheck::CheckWP(MetaData* metadata, unsigned int layer, unsigned char*
return true;
}
float halfWidth = (float)mcfg->m_PlatformLength / 2.0f;
float halfHigh = (float)mcfg->m_PlatformWidth / 2.0f;
float halfWidth = (float)mcfg->m_PlatformLength->GetValue() / 2.0f;
float halfHigh = (float)mcfg->m_PlatformWidth->GetValue() / 2.0f;
//imwrite("g:/testimage/ffc8.bmp", dataimg);

View File

@ -23,12 +23,12 @@ void Registration::Init()
Registration::RegType Registration::CheckReg(time_t time)
{
if (ConfigManager::GetInstance()->GetMachineCfg()->m_serial == m_key.get_key()) {
if (ConfigManager::GetInstance()->GetMachineCfg()->m_serial->GetValueStr() == m_key.get_key()) {
if (ConfigManager::GetInstance()->GetMachineCfg()->m_ExpriedTime == 0) {
return REG_SUCCESS;
}
else if ((time > ConfigManager::GetInstance()->GetMachineCfg()->m_lastShutdownTime) &&
(time < ConfigManager::GetInstance()->GetMachineCfg()->m_ExpriedTime)) {
else if ((time > ConfigManager::GetInstance()->GetMachineCfg()->m_lastShutdownTime->GetValue()) &&
(time < ConfigManager::GetInstance()->GetMachineCfg()->m_ExpriedTime->GetValue())) {
return REG_TRIAL;
}
}
@ -104,7 +104,7 @@ Registration::RegType Registration::CheckRegKey(std::string reg_file)
{
if (reg_key[32] == 'N')
{
ConfigManager::GetInstance()->GetMachineCfg()->m_serial = str_reg_key;
ConfigManager::GetInstance()->GetMachineCfg()->m_serial->SetValue(str_reg_key);
ConfigManager::GetInstance()->GetMachineCfg()->m_ExpriedTime = 0;
ConfigManager::GetInstance()->SaveMachineConfig();
return REG_SUCCESS;
@ -118,8 +118,8 @@ Registration::RegType Registration::CheckRegKey(std::string reg_file)
return REG_FAIL;
else
{
ConfigManager::GetInstance()->GetMachineCfg()->m_serial = str_reg_key;
ConfigManager::GetInstance()->GetMachineCfg()->m_ExpriedTime = expried_time;
ConfigManager::GetInstance()->GetMachineCfg()->m_serial->SetValue(str_reg_key);
ConfigManager::GetInstance()->GetMachineCfg()->m_ExpriedTime->SetValue(expried_time);
ConfigManager::GetInstance()->SaveMachineConfig();
return REG_TRIAL;
}

View File

@ -253,18 +253,18 @@ bool RemoteClient::CheckLogin()
if (!m_Client.IsOpen())return false;
PrinterMsg::HMessage message;
MachineMsg* machineMsg=message.mutable_request()->mutable_machinemsg();
machineMsg->set_machineid(m_MachineCfg->m_serial);
machineMsg->set_machinetype(MachineMsg_MachineType(m_MachineCfg->m_MachineType));
machineMsg->set_purifiertype(MachineMsg_PurifierType(m_MachineCfg->m_PulifierType));
machineMsg->set_laststarttime(m_MachineCfg->m_lastStartTime);
machineMsg->set_lastshutdowntime(m_MachineCfg->m_lastShutdownTime);
machineMsg->set_machineid(m_MachineCfg->m_serial->GetValueStr());
machineMsg->set_machinetype(MachineMsg_MachineType(m_MachineCfg->m_MachineType->GetValue()));
machineMsg->set_purifiertype(MachineMsg_PurifierType(m_MachineCfg->m_PulifierType->GetValue()));
machineMsg->set_laststarttime(m_MachineCfg->m_lastStartTime->GetValue());
machineMsg->set_lastshutdowntime(m_MachineCfg->m_lastShutdownTime->GetValue());
//machineMsg->set_language(m_MachineCfg->m_language);
machineMsg->set_language(0);
machineMsg->set_password(m_MachineCfg->m_ConnectPassword);
machineMsg->set_name(m_MachineCfg->m_Name);
machineMsg->set_location(m_MachineCfg->m_Location);
machineMsg->set_password(m_MachineCfg->m_ConnectPassword->GetValueStr());
machineMsg->set_name(m_MachineCfg->m_Name->GetValueStr());
machineMsg->set_location(m_MachineCfg->m_Location->GetValueStr());
message.set_type(PrinterMsg::LOGIN_REQUEST);
message.set_mcode(m_MachineCfg->m_MachineCode);
message.set_mcode(m_MachineCfg->m_MachineCode->GetValueStr());
// unsigned char sendBuffer[2048];
unsigned char rendBuffer[1024];
@ -326,11 +326,11 @@ void RemoteClient::PushError(PrinterMsg::MSG msg,string id)
PrinterMsg::HMessage* respMsg = new PrinterMsg::HMessage();
respMsg->set_type(msg);
respMsg->set_id(id);
respMsg->set_mcode(m_MachineCfg->m_MachineCode);
respMsg->set_mcode(m_MachineCfg->m_MachineCode->GetValueStr());
PrinterMsg::Response* resp = respMsg->mutable_response();
resp->set_result(false);
ErrorMsg* emsg = resp->mutable_errormsg();
emsg->set_machineid(m_MachineCfg->m_serial);
emsg->set_machineid(m_MachineCfg->m_serial->GetValueStr());
AddSendMessage(respMsg);
}
@ -340,7 +340,7 @@ void RemoteClient::HandleStateRequest(RemoteClient* client,PrinterMsg::HMessage*
PrinterMsg::HMessage* respMsg = new PrinterMsg::HMessage();
respMsg->set_type(PrinterMsg::STATE_RESPONSE);
respMsg->set_id(msg->id());
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode);
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode->GetValueStr());
EnvInfo info;
g_SystemInfo->GetEnvInfo(info);
StateMsg* stateMsg= respMsg->mutable_response()->mutable_statemsg();
@ -359,7 +359,7 @@ void RemoteClient::HandleStateRequest(RemoteClient* client,PrinterMsg::HMessage*
std::bitset<32> limit;
stateMsg->set_limitflag(limit.to_ulong());
stateMsg->set_machineid(client->m_MachineCfg->m_serial);
stateMsg->set_machineid(client->m_MachineCfg->m_serial->GetValueStr());
stateMsg->set_isdoorclose(info.m_EnvState.m_IsPrintCabinDoorClose);
stateMsg->set_acctime(g_SystemInfo->m_StateBean.realCostSeconds*1000);
stateMsg->set_remaintime(g_SystemInfo->m_StateBean.remainMil);
@ -386,13 +386,13 @@ void RemoteClient::HandleJobInfoRequest(RemoteClient* client, PrinterMsg::HMessa
PrinterMsg::HMessage* respMsg = new PrinterMsg::HMessage();
respMsg->set_type(PrinterMsg::JOB_INFO_RESPONSE);
respMsg->set_id(msg->id());
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode);
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode->GetValueStr());
EnterCriticalSection(&client->m_JobController->m_cs);
if (client->m_JobController->GetJob()==nullptr) {
PrinterMsg::Response* resp = respMsg->mutable_response();
resp->set_result(false);
ErrorMsg* emsg = resp->mutable_errormsg();
emsg->set_machineid(client->m_MachineCfg->m_serial);
emsg->set_machineid(client->m_MachineCfg->m_serial->GetValueStr());
client->AddSendMessage(respMsg);
LeaveCriticalSection(&client->m_JobController->m_cs);
return;
@ -434,7 +434,7 @@ void RemoteClient::HandleJobInfoRequest(RemoteClient* client, PrinterMsg::HMessa
}
metaData->UnLockPart();
respMsg->mutable_response()->set_result(true);
jobmsg->set_machineid(client->m_MachineCfg->m_serial);
jobmsg->set_machineid(client->m_MachineCfg->m_serial->GetValueStr());
LeaveCriticalSection(&client->m_JobController->m_cs);
time_t tnow;
time(&tnow);
@ -447,7 +447,7 @@ void RemoteClient::HandleCtrlSystemPause(RemoteClient* client, PrinterMsg::HMess
PrinterMsg::HMessage* respMsg = new PrinterMsg::HMessage();
respMsg->set_type(PrinterMsg::CTRL_SYSTEM_PAUSE);
respMsg->set_id(msg->id());
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode);
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode->GetValueStr());
PrinterMsg::Response* resp = respMsg->mutable_response();
if (!BaseCtrl::IsStandBy()) {
bool rel=client->m_ScannerCtrl->PauseWork();
@ -458,14 +458,14 @@ void RemoteClient::HandleCtrlSystemPause(RemoteClient* client, PrinterMsg::HMess
else {
resp->set_result(false);
ErrorMsg* emsg = resp->mutable_errormsg();
emsg->set_machineid(client->m_MachineCfg->m_serial);
emsg->set_machineid(client->m_MachineCfg->m_serial->GetValueStr());
emsg->set_errormsg(client->m_ScannerCtrl->m_PauseMsg);
}
}
else {
resp->set_result(false);
ErrorMsg* emsg = resp->mutable_errormsg();
emsg->set_machineid(client->m_MachineCfg->m_serial);
emsg->set_machineid(client->m_MachineCfg->m_serial->GetValueStr());
emsg->set_errormsg(u8"就绪状态不能暂停");
}
client->AddSendMessage(respMsg);
@ -476,7 +476,7 @@ void RemoteClient::HandleCtrlSystemStop(RemoteClient* client, PrinterMsg::HMessa
PrinterMsg::HMessage* respMsg = new PrinterMsg::HMessage();
respMsg->set_type(PrinterMsg::CRTL_SYSTEM_STOP);
respMsg->set_id(msg->id());
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode);
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode->GetValueStr());
PrinterMsg::Response* resp = respMsg->mutable_response();
if (!BaseCtrl::IsStop() && (BaseCtrl::GetState() != BaseCtrl::STANDBY_STOP)) {
bool rel = client->m_ScannerCtrl->StopWork();
@ -486,14 +486,14 @@ void RemoteClient::HandleCtrlSystemStop(RemoteClient* client, PrinterMsg::HMessa
else {
resp->set_result(false);
ErrorMsg* emsg = resp->mutable_errormsg();
emsg->set_machineid(client->m_MachineCfg->m_serial);
emsg->set_machineid(client->m_MachineCfg->m_serial->GetValueStr());
emsg->set_errormsg(client->m_ScannerCtrl->m_StopMsg);
}
}
else {
resp->set_result(false);
ErrorMsg* emsg = resp->mutable_errormsg();
emsg->set_machineid(client->m_MachineCfg->m_serial);
emsg->set_machineid(client->m_MachineCfg->m_serial->GetValueStr());
emsg->set_errormsg(u8"状态不能暂停");
}
client->AddSendMessage(respMsg);
@ -572,11 +572,11 @@ void RemoteClient::HandleLayerDataRequest(RemoteClient* client, PrinterMsg::HMes
PrinterMsg::HMessage* respMsg = new PrinterMsg::HMessage();
respMsg->set_type(PrinterMsg::LAYER_DATA_RESPONSE);
respMsg->set_id(msg->id());
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode);
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode->GetValueStr());
PrinterMsg::Response* rep= respMsg->mutable_response();
rep->set_result(true);
LayerDataRespMsg* ldrm= rep->mutable_layerdatamsg();
ldrm->set_machineid(client->m_MachineCfg->m_serial);
ldrm->set_machineid(client->m_MachineCfg->m_serial->GetValueStr());
ldrm->set_total(total);
ldrm->set_index(index);
ldrm->set_partid(part->id);
@ -663,7 +663,7 @@ void RemoteClient::HandleCameraDataRequest(RemoteClient* client, PrinterMsg::HMe
PrinterMsg::HMessage* respMsg = new PrinterMsg::HMessage();
respMsg->set_type(PrinterMsg::CAMERA_DATA_RESPONSE);
respMsg->set_id(msg->id());
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode);
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode->GetValueStr());
HBDCamera* cam = client->m_Camera;
PrinterMsg::Response* resp = respMsg->mutable_response();
CameraDataMsg* cdm = resp->mutable_cameradata();
@ -779,7 +779,7 @@ void RemoteClient::HandleCameraDataRequest(RemoteClient* client, PrinterMsg::HMe
}
else {
resp->set_result(true);
cdm->set_machineid(client->m_MachineCfg->m_serial);
cdm->set_machineid(client->m_MachineCfg->m_serial->GetValueStr());
cdm->set_imageformat("jpg");
cdm->set_imagewidth(fixImage.cols);
cdm->set_imageheight(fixImage.rows);
@ -816,8 +816,8 @@ void RemoteClient::SendStateChangeMsg()
return;
PrinterMsg::HMessage* respMsg = new PrinterMsg::HMessage();
respMsg->set_type(PrinterMsg::STATE_CHANGE);
respMsg->set_id(m_MachineCfg->m_serial);
respMsg->set_mcode(m_MachineCfg->m_MachineCode);
respMsg->set_id(m_MachineCfg->m_serial->GetValueStr());
respMsg->set_mcode(m_MachineCfg->m_MachineCode->GetValueStr());
EnvInfo info;
g_SystemInfo->GetEnvInfo(info);
StateChangeMsg* stateMsg = respMsg->mutable_response()->mutable_statechangemsg();
@ -835,7 +835,7 @@ void RemoteClient::SendStateChangeMsg()
std::bitset<32> limit;
stateMsg->set_limitflag(limit.to_ulong());
stateMsg->set_machineid(m_MachineCfg->m_serial);
stateMsg->set_machineid(m_MachineCfg->m_serial->GetValueStr());
stateMsg->set_isdoorclose(info.m_EnvState.m_IsPrintCabinDoorClose);
stateMsg->set_acctime(g_SystemInfo->m_StateBean.realCostSeconds * 1000);
stateMsg->set_remaintime(g_SystemInfo->m_StateBean.remainMil);
@ -875,8 +875,8 @@ void RemoteClient::SendAlarmMsg(AlarmShowInfo* info)
PrinterMsg::HMessage* respMsg = new PrinterMsg::HMessage();
respMsg->set_type(PrinterMsg::ALARM_NOTIFY_REQUEST);
respMsg->set_id(m_MachineCfg->m_serial);
respMsg->set_mcode(m_MachineCfg->m_MachineCode);
respMsg->set_id(m_MachineCfg->m_serial->GetValueStr());
respMsg->set_mcode(m_MachineCfg->m_MachineCode->GetValueStr());
AlarmNotifyMsg* msg = respMsg->mutable_request()->mutable_alarmnotifymsg();
msg->set_jobname(m_AlarmInfo.m_JobName);
@ -900,7 +900,7 @@ void RemoteClient::HandleRecordTasksMsg(RemoteClient* client, PrinterMsg::HMessa
PrinterMsg::HMessage* respMsg = new PrinterMsg::HMessage();
respMsg->set_type(PrinterMsg::LOG_RESPONSE_RECORD_TASK);
respMsg->set_id(msg->id());
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode);
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode->GetValueStr());
PrinterMsg::Response* resp = respMsg->mutable_response();
vector<JobBean*> logs;
@ -939,7 +939,7 @@ void RemoteClient::HandleRecordTasksListMsg(RemoteClient* client, PrinterMsg::HM
PrinterMsg::HMessage* respMsg = new PrinterMsg::HMessage();
respMsg->set_type(PrinterMsg::LOG_RESPONSE_RECORD_TASK_LIST);
respMsg->set_id(msg->id());
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode);
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode->GetValueStr());
PrinterMsg::Response* resp = respMsg->mutable_response();
tm begin;
time_t begin_t = msg->request().reqrecordtasklistmsg().beginsecond();
@ -951,7 +951,7 @@ void RemoteClient::HandleRecordTasksListMsg(RemoteClient* client, PrinterMsg::HM
if (end_t <= begin_t || (end_t-begin_t)>60*60*24*90) {
respMsg->mutable_response()->set_result(true);
ErrorMsg* emsg = resp->mutable_errormsg();
emsg->set_machineid(client->m_MachineCfg->m_serial);
emsg->set_machineid(client->m_MachineCfg->m_serial->GetValueStr());
emsg->set_errormsg("error time params");
time_t tnow;
time(&tnow);
@ -998,7 +998,7 @@ void RemoteClient::HandleVersionResMsg(RemoteClient* client, PrinterMsg::HMessag
PrinterMsg::HMessage* respMsg = new PrinterMsg::HMessage();
respMsg->set_type(PrinterMsg::VERSION_RESPONSE);
respMsg->set_id(msg->id());
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode);
respMsg->set_mcode(client->m_MachineCfg->m_MachineCode->GetValueStr());
PrinterMsg::Response* resp = respMsg->mutable_response();
VersionInfoResMsg* versionInfo = resp->mutable_versioninforesmsg();
versionInfo->set_version(g_SystemInfo->m_ProductVersion);

View File

@ -171,7 +171,7 @@ bool RTC5Scanner::Init()
n_set_end_of_list(m_ScannerControlCfg->m_ControlNo);
ListExecute(1, true);
if (m_MachineCfg->m_IsIntelli) {
if (m_MachineCfg->m_IsIntelli->GetValue()) {
StartGetScanInfo();
}
@ -615,7 +615,7 @@ void RTC5Scanner::ListNop() {
void RTC5Scanner::CheckAlarm()
{
if (!m_MachineCfg->m_IsIntelli)return;
if (!m_MachineCfg->m_IsIntelli->GetValue())return;
n_control_command(m_ScannerControlCfg->m_ControlNo, 1, 1, CurrentOperationStateLowAddr);
Sleep(2);
int xlowstate = n_get_value(m_ScannerControlCfg->m_ControlNo, 1);
@ -707,7 +707,7 @@ void RTC5Scanner::CheckAlarm()
void RTC5Scanner::UpdateScannerInfo()
{
if (!m_MachineCfg->m_IsIntelli)return;
if (!m_MachineCfg->m_IsIntelli->GetValue())return;
n_control_command(m_ScannerControlCfg->m_ControlNo, 1, 1, ActualPositionAddr);
Sleep(2);

View File

@ -1193,7 +1193,7 @@ void Scanner::WaitHeatingScanner()
void Scanner::StartGetScanInfo()
{
if (!m_MachineCfg->m_IsIntelli)return;
if (!m_MachineCfg->m_IsIntelli->GetValue())return;
if (m_InfoThread != INVALID_HANDLE_VALUE) {
m_IsAutoInfo = false;
m_InfoRunFlag = false;

View File

@ -100,7 +100,7 @@ bool ScannerCtrl::Init() {
cfg->m_SeqNo = scannerControlCfgsMap->size() + 1;
cfg->m_CardName = "Laser" + to_string(cfg->m_SeqNo);
cfg->m_ControlNo = s->first;
cfg->m_ControlType = m_MachineCfg->m_ScanControl;
cfg->m_ControlType = m_MachineCfg->m_ScanControl->GetValue();
cfg->m_SerialNo = s->second;
cfg->m_HadMatch = false;
cfg->m_IsEnable = true;
@ -119,6 +119,11 @@ bool ScannerCtrl::Init() {
{
g_log->TraceError(g_LngManager->Log_NoScannerCtrl->ShowText());
m_InitErrorInfos.push_back(g_LngManager->Log_NoScannerCtrl->ShowText());
//for (int i = 0; i < 4; ++i) { //wxxtest
// Scanner* scanner = new RTC5Scanner(nullptr, i);
// m_scan.push_back(scanner);
//}
return false;
}
@ -1241,7 +1246,7 @@ void ScannerCtrl::DispatchDataBlock()
if (m_IsDownSkinContinue)m_DownSkinStopFlag++;
else m_DownSkinStopFlag = 1;
if (m_MachineCfg->m_IsIntelli) {
if (m_MachineCfg->m_IsIntelli->GetValue()) {
vector<ScannerStatus*> scannerStatus;
vector<FocusStatus*> focusStatus;

View File

@ -800,9 +800,9 @@ void InfraredTemp::CalcPrintPlatform()
cv::Point2f srcTri[4];
srcTri[0] = cv::Point2f(0, 0);
srcTri[1] = cv::Point2f(m_MachineCfg->m_PlatformLength, 0);
srcTri[2] = cv::Point2f(0, m_MachineCfg->m_PlatformWidth);
srcTri[3] = cv::Point2f(m_MachineCfg->m_PlatformLength, m_MachineCfg->m_PlatformWidth);
srcTri[1] = cv::Point2f(m_MachineCfg->m_PlatformLength->GetValue(), 0);
srcTri[2] = cv::Point2f(0, m_MachineCfg->m_PlatformWidth->GetValue());
srcTri[3] = cv::Point2f(m_MachineCfg->m_PlatformLength->GetValue(), m_MachineCfg->m_PlatformWidth->GetValue());
cv::Point2f dstTri[4];
dstTri[0] = cv::Point2f(m_PrintPlatform.pa.x, m_PrintPlatform.pa.y);
dstTri[1] = cv::Point2f(m_PrintPlatform.pb.x, m_PrintPlatform.pb.y);
@ -845,8 +845,8 @@ void InfraredTemp::CalcRefRegion(TempRegion* tr)
{
if (!tr)return;
float halfWidth = (float)m_MachineCfg->m_PlatformLength / 2.0f;
float halfHigh = (float)m_MachineCfg->m_PlatformWidth / 2.0f;
float halfWidth = (float)m_MachineCfg->m_PlatformLength->GetValue() / 2.0f;
float halfHigh = (float)m_MachineCfg->m_PlatformWidth->GetValue() / 2.0f;
float ax = halfWidth + tr->m_PartMinX;
float ay = halfHigh - tr->m_PartMaxY;
float bx = halfWidth + tr->m_PartMaxX;

View File

@ -1,4 +1,4 @@
#include "JobFileProcessor.h"
#include "JobFileProcessor.h"
#include "../utils/StringHelper.h"
#include <direct.h>
#include <io.h>
@ -22,7 +22,7 @@ int JobFileProcessor::Process(string jobfile)
if(!m_job_content.LoadFile(extpath))return BP_ERR_LOAD_CONTENT_FILE_FAILED;
if (m_job_content.m_container_content->container_files->metadata_file->encryption_strategy_ref=="none") {
if (!m_MachineCfg->m_SupportNonEncMagic) {
if (!m_MachineCfg->m_SupportNonEncMagic->GetValue()) {
return BP_ERR_NOT_SUPPORT_DATA;
}
}

View File

@ -224,7 +224,7 @@ void MetaData::ReCalcEvaTime()
}
double milsec = 0.0;
m_RemainTime = 0;
if (m_HasOrder && m_MachineCfg->m_MachineType == MachineTypeCfg::HBD_1000) {
if (m_HasOrder && m_MachineCfg->m_MachineType->GetValue() == MachineTypeCfg::HBD_1000) {
map<int, ScannerControlCfg*>* laserCfgsMap = ConfigManager::GetInstance()->GetScannerControlCfg();
for (size_t layerindex = 0; layerindex < layers->vector_layers.size(); ++layerindex) {
map<int, double> areaTime;

Binary file not shown.

View File

@ -64,5 +64,20 @@ public:
return ret;
}
static long long TryToLL(const std::string& input) {
long long ret = -1;
try {
ret = stoll(input);
return ret;
}
catch (const std::invalid_argument& e) {
printf("input is not long long...error:%s\n", e.what());
}
catch (const std::out_of_range& e) {
printf("input number is out of long long range...error:%s\n", e.what());
}
return ret;
}
};

View File

@ -1,5 +1,6 @@
#include "DataHandle.h"
#include "FunC.h"
#include "../utils/ConverType.h"
#define DELP(p) if(p){delete p; p = nullptr;}
// 假设你的系统支持ANSI颜色代码
@ -29,6 +30,8 @@ DataHandle::DataHandle()
m_dataTypeMp[iCHAR] = "iCHAR";
m_dataTypeMp[iUCHAR] = "iUCHAR";
m_dataTypeMp[iWORD] = "iWORD";
m_dataTypeMp[iDOUBLE] = "iDOUBLE";
m_dataTypeMp[iTIMET] = "iTIMET";
m_dataTypeMp[UNKNOW] = "UNKNOW";
}
@ -55,14 +58,14 @@ void DataHandle::Stop() {
DELP(m_streamClient);
}
void DataHandle::SetPushMsg(WRITETYPE dataType, const string& nameKey, const string& strValue, DATATYPE valueType) {
void DataHandle::PushMsg(WRITETYPE dataType, const string& nameKey, const string& strValue, DATATYPE valueType) {
if (m_streamClient) {
WriteData msg;
msg.dataType = dataType;
msg.nameKey = nameKey;
msg.strValue = strValue;
msg.valueType = valueType;
m_streamClient->SetPushMsg(msg);
m_streamClient->PushMsg(msg);
}
}
@ -147,17 +150,19 @@ void DataHandle::ParamReadUsage() {
printf(" 26: " COLOR_YELLOW "print extcfg param data...\n" COLOR_RESET);
printf(" 27: " COLOR_YELLOW "print runcfg param data...\n" COLOR_RESET);
printf(" 28: " COLOR_YELLOW "print infraredtemp cfg param data...\n" COLOR_RESET);
printf(" 29: " COLOR_YELLOW "print moldcfg param data...\n" COLOR_RESET);
printf(" 30: " COLOR_YELLOW "print loadcfg param data...\n" COLOR_RESET);
printf(" 31: " COLOR_YELLOW "print armcfgparam data...\n" COLOR_RESET);
printf(" 32: " COLOR_YELLOW "print supplycfgparam data...\n" COLOR_RESET);
printf(" 33: " COLOR_YELLOW "print cleancfgparam data...\n" COLOR_RESET);
printf(" 34: " COLOR_YELLOW "print elecfgparam data...\n" COLOR_RESET);
printf(" 35: " COLOR_YELLOW "print loadparamrsp data...\n" COLOR_RESET);
printf(" 36: " COLOR_YELLOW "print scan ctrl state data...\n" COLOR_RESET);
printf(" 37: " COLOR_YELLOW "print scan ctrl Param data...\n" COLOR_RESET);
printf(" 38: " COLOR_YELLOW "print xy scan state data...\n" COLOR_RESET);
printf(" 39: " COLOR_YELLOW "print camera param data...\n" COLOR_RESET);
printf(" 29: " COLOR_YELLOW "print machine cfg param data...\n" COLOR_RESET);
printf(" 30: " COLOR_YELLOW "print moldcfg param data...\n" COLOR_RESET);
printf(" 31: " COLOR_YELLOW "print loadcfg param data...\n" COLOR_RESET);
printf(" 32: " COLOR_YELLOW "print armcfgparam data...\n" COLOR_RESET);
printf(" 33: " COLOR_YELLOW "print supplycfgparam data...\n" COLOR_RESET);
printf(" 34: " COLOR_YELLOW "print cleancfgparam data...\n" COLOR_RESET);
printf(" 35: " COLOR_YELLOW "print elecfgparam data...\n" COLOR_RESET);
printf(" 36: " COLOR_YELLOW "print loadparamrsp data...\n" COLOR_RESET);
printf(" 37: " COLOR_YELLOW "print scan ctrl state data...\n" COLOR_RESET);
printf(" 38: " COLOR_YELLOW "print scan ctrl Param data...\n" COLOR_RESET);
printf(" 39: " COLOR_YELLOW "print xy scan state data...\n" COLOR_RESET);
printf(" 40: " COLOR_YELLOW "print camera param data...\n" COLOR_RESET);
}
int DataHandle::Request(int index) {
@ -191,9 +196,14 @@ int DataHandle::Request(int index) {
continue;
}
else if (userInput == "h") {
ParamReadUsage(); continue;
ParamReadUsage();
}
else if (userInput.find("push") != string::npos) {
UpdateParam(userInput);
}
else {
ParamRequest(ConverType::TryToI(userInput));
}
ParamRequest(stoi(userInput));
}
break;
default:
@ -215,16 +225,16 @@ void DataHandle::AllTest() {
void DataHandle::ParamRequest(int index) {
if (index == VERSIONRSP) {
SetPushMsg(VERSIONREQ); //获取版本信息
PushMsg(VERSIONREQ); //获取版本信息
}
else if (index >= PARAMLIMITCFGPARAM && index <= ELECFGPARAM) {
SetPushMsg(REQUEST);
PushMsg(REQUEST);
}
else if(index == LOADPARAMRSP){
SetPushMsg(LOADPARAM);
PushMsg(LOADPARAM);
}
else if (index == XYSCANSTATE) {
SetPushMsg(REQUEST,to_string(index));
PushMsg(REQUEST,to_string(index));
}
m_printIndex = index;
@ -239,9 +249,37 @@ void DataHandle::ParamRequest(int index) {
}
}
}
//选择一个参数更新到服务
void DataHandle::UpdateParam(const string& input) {
int index = ConverType::TryToI(input.substr(5));
switch (index) {
case PARAMLIMITCFGPARAM:
break;
case EXTCFGPARAM: break;
case RUNCFGPARAM:
PushMsg(RUNCFG, "FanFreqLowLimit", to_string(11), iFLOAT);//runcfg test
break;
case INFRAREDTEMPCFGPARAM:
PushMsg(INFRAREDTEMPCFG, "ReflectTempAssist", to_string(11), iFLOAT); //infraredtempcfg test
break;
case MACHINECFGPARAM:
PushMsg(MACHINECFG, "lastStartTime", to_string(time(nullptr)), iTIMET); //machinecfg test
break;
case ELECFGPARAM:
break;
case LOADPARAMRSP:
break;
case XYSCANSTATE:
break;
default:
break;
}
SetPushMsg(WRITETYPE::RUNCFG, "FanFreqLowLimit", to_string(11), iFLOAT); //runcfg test
SetPushMsg(WRITETYPE::INFRAREDTEMPCFG, "ReflectTempAssist", to_string(11), iFLOAT); //runcfg test
}
@ -249,7 +287,7 @@ void DataHandle::ParamRequest(int index) {
void DataHandle::AxisMoveTest() {
int count =(int)MACHINEFUNC::END0;
for (int i = 0; i < count; ++i) {
SetPushMsg(WRITETYPE::AXISMOVEFUNC,to_string(i));
PushMsg(WRITETYPE::AXISMOVEFUNC,to_string(i));
printf("发送请求%d成功...\n", i);
Sleep(100);
}
@ -263,13 +301,13 @@ void DataHandle::ScanCtrlTest() {
int count = (int)SCANCTRLFUNC::END1;
for (int i = 0; i < count; ++i) {
if (i == REMOVESCANNER) {
SetPushMsg(WRITETYPE::SCANCTRLFUNC, to_string(i), to_string(1),iINT);
PushMsg(WRITETYPE::SCANCTRLFUNC, to_string(i), to_string(1),iINT);
}
else if (i == STOPHEATINGMOTION) {
SetPushMsg(WRITETYPE::SCANCTRLFUNC, to_string(i),to_string(0),iBOOL);
PushMsg(WRITETYPE::SCANCTRLFUNC, to_string(i),to_string(0),iBOOL);
}
else {
SetPushMsg(WRITETYPE::SCANCTRLFUNC, to_string(i));
PushMsg(WRITETYPE::SCANCTRLFUNC, to_string(i));
}
printf("发送请求%d成功...\n", i);
@ -315,8 +353,8 @@ void DataHandle::CameraTest() {
for (int i = 0; i < count; ++i) {
if (i == GETSHOWIMAGE || i == GETSHOWIMAGES) continue;
if(i == SETDEMANDCATPURE) SetPushMsg(CAMERAFUNC, to_string(i),to_string(1),iBOOL);
else SetPushMsg(CAMERAFUNC, to_string(i));
if(i == SETDEMANDCATPURE) PushMsg(CAMERAFUNC, to_string(i),to_string(1),iBOOL);
else PushMsg(CAMERAFUNC, to_string(i));
printf("发送请求%d成功...\n", i);
Sleep(100);
}
@ -343,16 +381,16 @@ void DataHandle::CameraTest() {
Sleep(100);
//修改参数
SetPushMsg(WRITETYPE::CAMERAPARAMUPDATE,"LastMouRefImgPosX", to_string(10),iINT);
SetPushMsg(WRITETYPE::CAMERAPARAMUPDATE,"LastMouRefImgPosY", to_string(100),iINT);
SetPushMsg(WRITETYPE::CAMERAPARAMUPDATE,"ShowFlag", to_string(1),iBOOL);
PushMsg(WRITETYPE::CAMERAPARAMUPDATE,"LastMouRefImgPosX", to_string(10),iINT);
PushMsg(WRITETYPE::CAMERAPARAMUPDATE,"LastMouRefImgPosY", to_string(100),iINT);
PushMsg(WRITETYPE::CAMERAPARAMUPDATE,"ShowFlag", to_string(1),iBOOL);
printf("CAMERAPARAMUPDATE update finish\n");
}
void DataHandle::PurifierTest() {
SetPushMsg(PURIFIERFUNC, to_string(STARTAUTODEOXYGEN));
PushMsg(PURIFIERFUNC, to_string(STARTAUTODEOXYGEN));
printf("STARTAUTODEOXYGEN is called...\n");
SetPushMsg(PURIFIERFUNC, to_string(STOPAUTODEOXYGEN));
PushMsg(PURIFIERFUNC, to_string(STOPAUTODEOXYGEN));
printf("STOPAUTODEOXYGEN is called...\n");
}

View File

@ -19,7 +19,7 @@ public:
static void DataCallBackProc(void* pthis, const ReadData& msg);
void SetPushMsg(WRITETYPE dataType, const string& nameKey = "", const string& strValue = "", DATATYPE valueType = UNKNOW);
void PushMsg(WRITETYPE dataType, const string& nameKey = "", const string& strValue = "", DATATYPE valueType = UNKNOW);
string GetVersion()const {return m_version;}
@ -32,6 +32,8 @@ public:
void CameraTest(); //相机功能测试
void PurifierTest(); //净化器功能测试
void UpdateParam(const string& input);
void Usage();
void ParamReadUsage();

View File

@ -41,6 +41,7 @@ enum READTYPE {
EXTCFGPARAM,
RUNCFGPARAM, //runcfg 参数
INFRAREDTEMPCFGPARAM, //InfraredTempCfg 参数
MACHINECFGPARAM, //MachineCfg 参数
MOLDCFGPARAM,
LOADCFGPARAM,
@ -72,6 +73,7 @@ enum DATATYPE {
iUCHAR,
iWORD,
iDOUBLE,
iTIMET,
UNKNOW,
};
@ -114,6 +116,8 @@ enum WRITETYPE {
EXTCFG,
RUNCFG,
INFRAREDTEMPCFG,
MACHINECFG,
LOADPARAM, //装载参数

View File

@ -55,7 +55,7 @@ bool StreamClient::GetPushMsg(WriteData& msg) {
}
void StreamClient::SetPushMsg(const WriteData& msg) {
void StreamClient::PushMsg(const WriteData& msg) {
std::lock_guard<std::mutex> lock(m_msgLock);
m_msgList.emplace_back(msg);
}

View File

@ -31,7 +31,7 @@ public:
m_dataCallBack = dataCallBack;
}
void SetPushMsg(const WriteData& msg);
void PushMsg(const WriteData& msg);
bool GetLayerByIndex(int index, ::stream::ResponseAny* response);
int RegistRequest(const WriteData& writeData, ::stream::ResponseAny* response);
int Request(const WriteData& writeData, ::stream::ResponseAny* response);

View File

@ -12,10 +12,10 @@ public:
return ret;
}
catch (const std::invalid_argument& e) {
printf("input is not number...\n");
printf("input is not number...error:%s\n", e.what());
}
catch (const std::out_of_range& e) {
printf("input number is out of int range...\n");
printf("input number is out of int range...error:%s\n", e.what());
}
return ret;
}
@ -27,10 +27,10 @@ public:
return ret;
}
catch (const std::invalid_argument& e) {
printf("input is not float...\n");
printf("input is not float...error:%s\n", e.what());
}
catch (const std::out_of_range& e) {
printf("input number is out of float range...\n");
printf("input number is out of float range...error:%s\n", e.what());
}
return ret;
}