diff --git a/PrintC/Communication/G4PurifierClient.cpp b/PrintC/Communication/G4PurifierClient.cpp index 020edc9..6a746a6 100644 --- a/PrintC/Communication/G4PurifierClient.cpp +++ b/PrintC/Communication/G4PurifierClient.cpp @@ -3,6 +3,7 @@ #include "../SystemInfo.h" #include "../utils/DataByte.h" //#include "../PLC/SignalService.h" +#include "../DataManage/DataHandle.h" G4PurifierClient::G4PurifierClient(void* pconfig) :PurifierClient(pconfig) { @@ -445,34 +446,37 @@ G4PurifierClient::~G4PurifierClient() // ppw->m_OxygenWriteValue[3] = foxygen.data[0]; //} -//void G4PurifierClient::SetCoverWind(bool bvalue) -//{ -// EnterCriticalSection(&m_RtcCS); -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 557 * 8 + 4; -// items[0].WordLen = S7WLBit; -// items[0].Amount = 1; -// bool* tempv = new bool[1]; -// tempv[0] = bvalue; -// items[0].pdata = tempv; -// pcommand->m_Ref = this; -// pcommand->m_waitTime = 0; -// pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -//} +void G4PurifierClient::SetCoverWind(bool bvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetCoverWind", to_string(bvalue), iBOOL); + //EnterCriticalSection(&m_RtcCS); + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 557 * 8 + 4; + //items[0].WordLen = S7WLBit; + //items[0].Amount = 1; + //bool* tempv = new bool[1]; + //tempv[0] = bvalue; + //items[0].pdata = tempv; + //pcommand->m_Ref = this; + //pcommand->m_waitTime = 0; + //pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); +} -//void G4PurifierClient::SetCoverWindOffset(float offset) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(600, offset); -//} +void G4PurifierClient::SetCoverWindOffset(float offset) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetCoverWindOffset", to_string(offset), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(600, offset); +} -//void G4PurifierClient::SetProtectionPressure(bool bvalue) -//{ -// if (!IsServerConnected())return; -// SetBit(1000 * 8 + 4, bvalue); -//} \ No newline at end of file +void G4PurifierClient::SetProtectionPressure(bool bvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetProtectionPressure", to_string(bvalue), iBOOL); + //if (!IsServerConnected())return; + //SetBit(1000 * 8 + 4, bvalue); +} \ No newline at end of file diff --git a/PrintC/Communication/G4PurifierClient.h b/PrintC/Communication/G4PurifierClient.h index cecacc0..0a678bd 100644 --- a/PrintC/Communication/G4PurifierClient.h +++ b/PrintC/Communication/G4PurifierClient.h @@ -8,9 +8,9 @@ public: ~G4PurifierClient(); void SetHopperClean(bool bvalue) {} - //void SetCoverWind(bool bvalue); - //void SetCoverWindOffset(float offset); - //void SetProtectionPressure(bool bvalue); + void SetCoverWind(bool bvalue); + void SetCoverWindOffset(float offset); + void SetProtectionPressure(bool bvalue); private: //void InitCommand(); //static void ProcSetPressureValue(void* pobject, Command* pcommand); diff --git a/PrintC/Communication/HBDPurifierClient.cpp b/PrintC/Communication/HBDPurifierClient.cpp index 838013d..7c9c4e6 100644 --- a/PrintC/Communication/HBDPurifierClient.cpp +++ b/PrintC/Communication/HBDPurifierClient.cpp @@ -1,6 +1,7 @@ #include "HBDPurifierClient.h" //#include "S7Command.h" #include "../global.h" +#include "../DataManage/DataHandle.h" HBDPurifierClient::HBDPurifierClient(void* pconfig) :S7Client(pconfig) { @@ -182,97 +183,101 @@ HBDPurifierClient::~HBDPurifierClient() // //} -//void HBDPurifierClient::SetDeoxygen(bool enable) -//{ -// if (g_isDebug) { -// m_Stat.isDeoxygen = enable; -// } -// if (!m_BaseStat.isConnected)return; -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 111 * 8 + 7; -// items[0].WordLen = S7WLBit; -// items[0].Amount = 1; -// bool* tempv = new bool[1]; -// tempv[0] = enable; -// items[0].pdata = tempv; -// pcommand->m_Ref = this; -// pcommand->m_Fun = &HBDPurifierClient::ProcWriteValue; -// EnterCriticalSection(&m_RtcCS); -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -// -//} -// -//void HBDPurifierClient::SetBlowBack(bool enable) -//{ -// if (g_isDebug) { -// m_Stat.isBlowBack = enable; -// } -// if (!m_BaseStat.isConnected)return; -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 113 * 8 + 7; -// items[0].WordLen = S7WLBit; -// items[0].Amount = 1; -// bool* tempv = new bool[1]; -// tempv[0] = enable; -// items[0].pdata = tempv; -// pcommand->m_Ref = this; -// pcommand->m_Fun = &HBDPurifierClient::ProcWriteValue; -// EnterCriticalSection(&m_RtcCS); -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -//} -// -//void HBDPurifierClient::SetDedusting(bool enable) -//{ -// if (g_isDebug) { -// m_Stat.isDedusting = enable; -// m_Stat.cycleEnter = enable ? HBDPurifierStat::OpenPosition : HBDPurifierStat::ClosePosition; -// m_Stat.cycleExit = enable ? HBDPurifierStat::OpenPosition : HBDPurifierStat::ClosePosition; -// } -// if (!m_BaseStat.isConnected)return; -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 115 * 8 + 7; -// items[0].WordLen = S7WLBit; -// items[0].Amount = 1; -// bool* tempv = new bool[1]; -// tempv[0] = enable; -// items[0].pdata = tempv; -// pcommand->m_Ref = this; -// pcommand->m_Fun = &HBDPurifierClient::ProcWriteValue; -// EnterCriticalSection(&m_RtcCS); -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -//} -// -//void HBDPurifierClient::ResetSpinFilterUseTime(bool enable) -//{ -// if (!m_BaseStat.isConnected)return; -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 114 * 8 + 7; -// items[0].WordLen = S7WLBit; -// items[0].Amount = 1; -// bool* tempv = new bool[1]; -// tempv[0] = enable; -// items[0].pdata = tempv; -// pcommand->m_Ref = this; -// pcommand->m_Fun = &HBDPurifierClient::ProcWriteValue; -// EnterCriticalSection(&m_RtcCS); -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -//} +void HBDPurifierClient::SetDeoxygen(bool enable) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetDeoxygen", to_string(enable), iBOOL); + //if (g_isDebug) { + // m_Stat.isDeoxygen = enable; + //} + //if (!m_BaseStat.isConnected)return; + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 111 * 8 + 7; + //items[0].WordLen = S7WLBit; + //items[0].Amount = 1; + //bool* tempv = new bool[1]; + //tempv[0] = enable; + //items[0].pdata = tempv; + //pcommand->m_Ref = this; + //pcommand->m_Fun = &HBDPurifierClient::ProcWriteValue; + //EnterCriticalSection(&m_RtcCS); + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); + +} + +void HBDPurifierClient::SetBlowBack(bool enable) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetBlowBack", to_string(enable), iBOOL); + //if (g_isDebug) { + // m_Stat.isBlowBack = enable; + //} + //if (!m_BaseStat.isConnected)return; + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 113 * 8 + 7; + //items[0].WordLen = S7WLBit; + //items[0].Amount = 1; + //bool* tempv = new bool[1]; + //tempv[0] = enable; + //items[0].pdata = tempv; + //pcommand->m_Ref = this; + //pcommand->m_Fun = &HBDPurifierClient::ProcWriteValue; + //EnterCriticalSection(&m_RtcCS); + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); +} + +void HBDPurifierClient::SetDedusting(bool enable) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetDedusting", to_string(enable), iBOOL); + //if (g_isDebug) { + // m_Stat.isDedusting = enable; + // m_Stat.cycleEnter = enable ? HBDPurifierStat::OpenPosition : HBDPurifierStat::ClosePosition; + // m_Stat.cycleExit = enable ? HBDPurifierStat::OpenPosition : HBDPurifierStat::ClosePosition; + //} + //if (!m_BaseStat.isConnected)return; + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 115 * 8 + 7; + //items[0].WordLen = S7WLBit; + //items[0].Amount = 1; + //bool* tempv = new bool[1]; + //tempv[0] = enable; + //items[0].pdata = tempv; + //pcommand->m_Ref = this; + //pcommand->m_Fun = &HBDPurifierClient::ProcWriteValue; + //EnterCriticalSection(&m_RtcCS); + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); +} + +void HBDPurifierClient::ResetSpinFilterUseTime(bool enable) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "ResetSpinFilterUseTime", to_string(enable), iBOOL); + //if (!m_BaseStat.isConnected)return; + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 114 * 8 + 7; + //items[0].WordLen = S7WLBit; + //items[0].Amount = 1; + //bool* tempv = new bool[1]; + //tempv[0] = enable; + //items[0].pdata = tempv; + //pcommand->m_Ref = this; + //pcommand->m_Fun = &HBDPurifierClient::ProcWriteValue; + //EnterCriticalSection(&m_RtcCS); + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); +} void HBDPurifierClient::GetStat(HBDPurifierStat& stat) { diff --git a/PrintC/Communication/HBDPurifierG3Client.cpp b/PrintC/Communication/HBDPurifierG3Client.cpp index 425e4bd..53de110 100644 --- a/PrintC/Communication/HBDPurifierG3Client.cpp +++ b/PrintC/Communication/HBDPurifierG3Client.cpp @@ -3,6 +3,7 @@ #include "../SystemInfo.h" #include "../utils/DataByte.h" //#include "../PLC/SignalService.h" +#include "../DataManage/DataHandle.h" HBDPurifierG3Client::HBDPurifierG3Client(void* pconfig):PurifierClient(pconfig) { @@ -445,34 +446,37 @@ HBDPurifierG3Client::~HBDPurifierG3Client() // ppw->m_OxygenWriteValue[3] = foxygen.data[0]; //} // -//void HBDPurifierG3Client::SetCoverWind(bool bvalue) -//{ -// EnterCriticalSection(&m_RtcCS); -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 557 * 8 + 4; -// items[0].WordLen = S7WLBit; -// items[0].Amount = 1; -// bool* tempv = new bool[1]; -// tempv[0] = bvalue; -// items[0].pdata = tempv; -// pcommand->m_Ref = this; -// pcommand->m_waitTime = 0; -// pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -//} -// -//void HBDPurifierG3Client::SetCoverWindOffset(float offset) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(600, offset); -//} -// -//void HBDPurifierG3Client::SetProtectionPressure(bool bvalue) -//{ -// if (!IsServerConnected())return; -// SetBit(1000 * 8 + 4, bvalue); -//} \ No newline at end of file +void HBDPurifierG3Client::SetCoverWind(bool bvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetCoverWind", to_string(bvalue), iBOOL); + //EnterCriticalSection(&m_RtcCS); + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 557 * 8 + 4; + //items[0].WordLen = S7WLBit; + //items[0].Amount = 1; + //bool* tempv = new bool[1]; + //tempv[0] = bvalue; + //items[0].pdata = tempv; + //pcommand->m_Ref = this; + //pcommand->m_waitTime = 0; + //pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); +} + +void HBDPurifierG3Client::SetCoverWindOffset(float offset) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetCoverWindOffset", to_string(offset), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(600, offset); +} + +void HBDPurifierG3Client::SetProtectionPressure(bool bvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetProtectionPressure", to_string(bvalue), iFLOAT); + //if (!IsServerConnected())return; + //SetBit(1000 * 8 + 4, bvalue); +} \ No newline at end of file diff --git a/PrintC/Communication/HBDPurifierG3Client.h b/PrintC/Communication/HBDPurifierG3Client.h index 55527c8..31f0988 100644 --- a/PrintC/Communication/HBDPurifierG3Client.h +++ b/PrintC/Communication/HBDPurifierG3Client.h @@ -9,9 +9,9 @@ public: void SetHopperClean(bool bvalue) {} - //void SetCoverWind(bool bvalue); - //void SetCoverWindOffset(float offset); - //void SetProtectionPressure(bool bvalue); + void SetCoverWind(bool bvalue); + void SetCoverWindOffset(float offset); + void SetProtectionPressure(bool bvalue); private: //void InitCommand(); //static void ProcSetPressureValue(void *pobject, Command* pcommand); diff --git a/PrintC/Communication/PowerMeterClient.h b/PrintC/Communication/PowerMeterClient.h index 3ed573d..b4c685a 100644 --- a/PrintC/Communication/PowerMeterClient.h +++ b/PrintC/Communication/PowerMeterClient.h @@ -150,6 +150,7 @@ public: char m_endFlag; }; +#pragma pack() class PowerMeterClient:public TcpClient { diff --git a/PrintC/Communication/PurifierClient.cpp b/PrintC/Communication/PurifierClient.cpp index f939770..05a0e8e 100644 --- a/PrintC/Communication/PurifierClient.cpp +++ b/PrintC/Communication/PurifierClient.cpp @@ -426,11 +426,11 @@ PurifierClient::~PurifierClient() void PurifierClient::SetDedust(bool bvalue) { - if (g_isDebug) { - m_Stat.isDedusting->SetValue(bvalue); - } - if (!IsServerConnected())return; - DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, m_Stat.isDedusting->GetCode(), bvalue ? "1" : "0", iBOOL); + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetDedust", to_string(bvalue), iBOOL); + //if (g_isDebug) { + // m_Stat.isDedusting->SetValue(bvalue); + //} + //if (!IsServerConnected())return; //if (bvalue)SetMKBit(10 * 8 + 0,500); //else SetMKBit(10 * 8 + 1, 500); @@ -438,63 +438,70 @@ void PurifierClient::SetDedust(bool bvalue) void PurifierClient::SetBlowBack(bool bvalue) { - if (!IsServerConnected())return; - DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, m_Stat.isBlowBack->GetCode(), bvalue ? "1" : "0", iBOOL); + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetBlowBack", to_string(bvalue), iBOOL); + //if (!IsServerConnected())return; //if (bvalue)SetMKBit(10 * 8 + 2, 500); //else SetMKBit(10 * 8 + 3, 500); } void PurifierClient::SetFilterDiscard(bool bvalue) { - if (!IsServerConnected())return; - DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, m_Stat.isFilterDiscarding->GetCode(), bvalue ? "1" : "0", iBOOL); + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetFilterDiscard", to_string(bvalue), iBOOL); + //if (!IsServerConnected())return; + //if (bvalue)SetMKBit(10 * 8 + 4, 500); //else SetMKBit(10 * 8 + 5, 500); } void PurifierClient::SetBoxClean(bool bvalue) { - if (!IsServerConnected())return; - if (bvalue)SetMKBit(4, 500); - else SetMKBit(5, 500); + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetBoxClean", to_string(bvalue), iBOOL); + //if (!IsServerConnected())return; + //if (bvalue)SetMKBit(4, 500); + //else SetMKBit(5, 500); } void PurifierClient::SetFilterClean(bool bvalue) { - if (!IsServerConnected())return; - if (bvalue)SetMKBit(10 * 8 + 6, 500); - else SetMKBit(10 * 8 + 7, 500); + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetFilterClean", to_string(bvalue), iBOOL); + //if (!IsServerConnected())return; + //if (bvalue)SetMKBit(10 * 8 + 6, 500); + //else SetMKBit(10 * 8 + 7, 500); } void PurifierClient::SetHopperClean(bool bvalue) { - if (!IsServerConnected())return; - if (bvalue)SetMKBit(11 * 8 + 0, 500); - else SetMKBit(11 * 8 + 1, 500); + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetHopperClean", to_string(bvalue), iBOOL); + //if (!IsServerConnected())return; + //if (bvalue)SetMKBit(11 * 8 + 0, 500); + //else SetMKBit(11 * 8 + 1, 500); } void PurifierClient::SetPurify(bool bvalue) { - if (g_isDebug) { - m_Stat.isPurifying->SetValue(bvalue); - } - if (!IsServerConnected())return; - if (bvalue)SetMKBit(4 * 8 + 6, 3000); - else SetMKBit(4 * 8 + 7, 3000); + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetPurify", to_string(bvalue), iBOOL); + //if (g_isDebug) { + // m_Stat.isPurifying->SetValue(bvalue); + //} + //if (!IsServerConnected())return; + //if (bvalue)SetMKBit(4 * 8 + 6, 3000); + //else SetMKBit(4 * 8 + 7, 3000); } -//void PurifierClient::ResetFilterTime() -//{ -// if (!IsServerConnected())return; -// SetMKBit(4 * 8 , 500); -//} -// -//void PurifierClient::ClearHopperAlarm() -//{ -// if (!IsServerConnected())return; -// SetMKBit(2 * 8, 500); -//} +void PurifierClient::ResetFilterTime() +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "ResetFilterTime", "", UNKNOW); + //if (!IsServerConnected())return; + //SetMKBit(4 * 8 , 500); +} + +void PurifierClient::ClearHopperAlarm() +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "ClearHopperAlarm", "", UNKNOW); + //if (!IsServerConnected())return; + //SetMKBit(2 * 8, 500); +} // //void PurifierClient::SetDBFloat(int dindex, float fvalue) { // EnterCriticalSection(&m_RtcCS); @@ -540,152 +547,168 @@ void PurifierClient::SetPurify(bool bvalue) //} // // -//void PurifierClient::SetBoxPressureUpLimit(float fvalue) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(28, fvalue); -//} -// -//void PurifierClient::SetBoxPressureDownLimit(float fvalue) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(32, fvalue); -//} -// -//void PurifierClient::SetMidPressureDifAlarmValue(float fvalue) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(64, fvalue); -//} -// -//void PurifierClient::SetHighPressureDifAlarmValue(float fvalue) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(68, fvalue); -//} -// -//void PurifierClient::SetPrintCleanOxygenSetValue(float fvalue) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(142, fvalue); -//} -// -//void PurifierClient::SetWindValue(float fvalue) -//{ -// if (g_isDebug)m_Stat.windActualValue->SetValue(fvalue); -// if (!IsServerConnected())return; -// SetDBFloat(146, fvalue); -//} -// -//void PurifierClient::SetPrintOxygenDownSetValue(float fvalue) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(154, fvalue); -//} -// -//void PurifierClient::SetPrintOxygenUpSetValue(float fvalue) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(76, fvalue); -//} -// -//void PurifierClient::SetfilterCleanOxygenSetValue(float fvalue) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(158, fvalue); -//} -// -//void PurifierClient::SetMidTempHighSetValue(float fvalue) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(166, fvalue); -//} -// -//void PurifierClient::SetMidTempUltraSetValue(float fvalue) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(170, fvalue); -//} -// -//void PurifierClient::SetHighTempHighSetValue(float fvalue) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(174, fvalue); -//} -// -//void PurifierClient::SetMaxWindValue(float fvalue) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(550, fvalue); -//} +void PurifierClient::SetBoxPressureUpLimit(float fvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetBoxPressureUpLimit", to_string(fvalue), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(28, fvalue); +} + +void PurifierClient::SetBoxPressureDownLimit(float fvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetBoxPressureDownLimit", to_string(fvalue), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(32, fvalue); +} + +void PurifierClient::SetMidPressureDifAlarmValue(float fvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetMidPressureDifAlarmValue", to_string(fvalue), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(64, fvalue); +} + +void PurifierClient::SetHighPressureDifAlarmValue(float fvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetHighPressureDifAlarmValue", to_string(fvalue), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(68, fvalue); +} + +void PurifierClient::SetPrintCleanOxygenSetValue(float fvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetPrintCleanOxygenSetValue", to_string(fvalue), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(142, fvalue); +} + +void PurifierClient::SetWindValue(float fvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetWindValue", to_string(fvalue), iFLOAT); + //if (g_isDebug)m_Stat.windActualValue->SetValue(fvalue); + //if (!IsServerConnected())return; + //SetDBFloat(146, fvalue); +} + +void PurifierClient::SetPrintOxygenDownSetValue(float fvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetPrintOxygenDownSetValue", to_string(fvalue), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(154, fvalue); +} + +void PurifierClient::SetPrintOxygenUpSetValue(float fvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetPrintOxygenUpSetValue", to_string(fvalue), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(76, fvalue); +} + +void PurifierClient::SetfilterCleanOxygenSetValue(float fvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetfilterCleanOxygenSetValue", to_string(fvalue), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(158, fvalue); +} + +void PurifierClient::SetMidTempHighSetValue(float fvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetMidTempHighSetValue", to_string(fvalue), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(166, fvalue); +} + +void PurifierClient::SetMidTempUltraSetValue(float fvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetMidTempUltraSetValue", to_string(fvalue), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(170, fvalue); +} + +void PurifierClient::SetHighTempHighSetValue(float fvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetHighTempHighSetValue", to_string(fvalue), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(174, fvalue); +} + +void PurifierClient::SetMaxWindValue(float fvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetMaxWindValue", to_string(fvalue), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(550, fvalue); +} /*void PurifierClient::SetHighTempUltraSetValue(float fvalue) { SetDBFloat(178, fvalue); }*/ -//void PurifierClient::SetHopperCleanRemind(unsigned short value) -//{ -// if (!IsServerConnected())return; -// EnterCriticalSection(&m_RtcCS); -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 118; -// items[0].WordLen = S7WLByte; -// items[0].Amount = 2; -// unsigned char* pdata= new unsigned char[2]; -// pdata[0] = (unsigned char)(value >> 8); -// pdata[1] = (unsigned char)value; -// items[0].pdata = pdata; -// pcommand->m_Ref = this; -// pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -//} -// -//void PurifierClient::SetBoxWashDelayTime(unsigned short value) -//{ -// if (!IsServerConnected())return; -// EnterCriticalSection(&m_RtcCS); -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 114; -// items[0].WordLen = S7WLByte; -// items[0].Amount = 2; -// unsigned char* pdata = new unsigned char[2]; -// pdata[0] = (unsigned char)(value >> 8); -// pdata[1] = (unsigned char)value; -// items[0].pdata = pdata; -// pcommand->m_Ref = this; -// pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -//} -// -//void PurifierClient::SetDedustingWashDelayTime(unsigned short value) -//{ -// if (!IsServerConnected())return; -// EnterCriticalSection(&m_RtcCS); -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 116; -// items[0].WordLen = S7WLByte; -// items[0].Amount = 2; -// unsigned char* pdata = new unsigned char[2]; -// pdata[0] = (unsigned char)(value >> 8); -// pdata[1] = (unsigned char)value; -// items[0].pdata = pdata; -// pcommand->m_Ref = this; -// pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -//} +void PurifierClient::SetHopperCleanRemind(unsigned short value) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetHopperCleanRemind", to_string(value), iUSHORT); + //if (!IsServerConnected())return; + //EnterCriticalSection(&m_RtcCS); + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 118; + //items[0].WordLen = S7WLByte; + //items[0].Amount = 2; + //unsigned char* pdata= new unsigned char[2]; + //pdata[0] = (unsigned char)(value >> 8); + //pdata[1] = (unsigned char)value; + //items[0].pdata = pdata; + //pcommand->m_Ref = this; + //pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); +} + +void PurifierClient::SetBoxWashDelayTime(unsigned short value) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetBoxWashDelayTime", to_string(value), iUSHORT); + //if (!IsServerConnected())return; + //EnterCriticalSection(&m_RtcCS); + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 114; + //items[0].WordLen = S7WLByte; + //items[0].Amount = 2; + //unsigned char* pdata = new unsigned char[2]; + //pdata[0] = (unsigned char)(value >> 8); + //pdata[1] = (unsigned char)value; + //items[0].pdata = pdata; + //pcommand->m_Ref = this; + //pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); +} + +void PurifierClient::SetDedustingWashDelayTime(unsigned short value) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetDedustingWashDelayTime", to_string(value), iUSHORT); + //if (!IsServerConnected())return; + //EnterCriticalSection(&m_RtcCS); + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 116; + //items[0].WordLen = S7WLByte; + //items[0].Amount = 2; + //unsigned char* pdata = new unsigned char[2]; + //pdata[0] = (unsigned char)(value >> 8); + //pdata[1] = (unsigned char)value; + //items[0].pdata = pdata; + //pcommand->m_Ref = this; + //pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); +} void PurifierClient::GetStat(Purifierstat_XT& stat) { @@ -801,187 +824,201 @@ void PurifierClient::GetStat(Purifierstat_XT& stat) -//void PurifierClient::SetPressureRangeUpLimit(float value) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(182, value); -//} -// -//void PurifierClient::SetPressureRangeDownLimit(float value) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(186, value); -//} -// -//void PurifierClient::SetOxygenAlarmValue(float value) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(190, value); -//} -// -//void PurifierClient::SetUseArgon(bool buse) -//{ -// if (!IsServerConnected())return; -// SetBit(557 * 8 + 1, buse); -//} -// -// -//void PurifierClient::SetCoverWind(bool bvalue) -//{ -// if (!IsServerConnected())return; -// EnterCriticalSection(&m_RtcCS); -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 557 * 8 + 6; -// items[0].WordLen = S7WLBit; -// items[0].Amount = 1; -// bool* tempv = new bool[1]; -// tempv[0] = bvalue; -// items[0].pdata = tempv; -// pcommand->m_Ref = this; -// pcommand->m_waitTime = 0; -// pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -//} -// -//void PurifierClient::SetCoverWindOffset(float offset) -//{ -// if (!IsServerConnected())return; -// SetDBFloat(812, offset); -//} -// -//void PurifierClient::SetShieldMonitorPrintPressure(bool bvalue) { -// if (g_isDebug)m_Stat.shieldMonitorPrintPressure->SetValue(bvalue); -// if (!IsServerConnected())return; -// SetBit(557 * 8, bvalue); -//} -// -//void PurifierClient::SetWindSlowFinishSignal(bool bvalue) -//{ -// if (!IsServerConnected())return; -// EnterCriticalSection(&m_RtcCS); -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 594 * 8 + 6; -// items[0].WordLen = S7WLBit; -// items[0].Amount = 1; -// bool* tempv = new bool[1]; -// tempv[0] = bvalue; -// items[0].pdata = tempv; -// pcommand->m_Ref = this; -// pcommand->m_waitTime = 0; -// pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -//} -// -//void PurifierClient::SetWindResumeFinishSignal(bool bvalue) -//{ -// if (!IsServerConnected())return; -// EnterCriticalSection(&m_RtcCS); -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 594 * 8 + 7; -// items[0].WordLen = S7WLBit; -// items[0].Amount = 1; -// bool* tempv = new bool[1]; -// tempv[0] = bvalue; -// items[0].pdata = tempv; -// pcommand->m_Ref = this; -// pcommand->m_waitTime = 0; -// pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -//} -// -//void PurifierClient::SetBlowBackBlowTime(unsigned short value) -//{ -// if (!IsServerConnected())return; -// EnterCriticalSection(&m_RtcCS); -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 430; -// items[0].WordLen = S7WLByte; -// items[0].Amount = 2; -// unsigned char* pdata = new unsigned char[2]; -// pdata[0] = (unsigned char)(value >> 8); -// pdata[1] = (unsigned char)value; -// items[0].pdata = pdata; -// pcommand->m_Ref = this; -// pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -//} -// -//void PurifierClient::SetBlowBackSetTimes(unsigned short value) -//{ -// if (!IsServerConnected())return; -// EnterCriticalSection(&m_RtcCS); -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 434; -// items[0].WordLen = S7WLByte; -// items[0].Amount = 2; -// unsigned char* pdata = new unsigned char[2]; -// pdata[0] = (unsigned char)(value >> 8); -// pdata[1] = (unsigned char)value; -// items[0].pdata = pdata; -// pcommand->m_Ref = this; -// pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -//} -// -//void PurifierClient::SetProtectionPressureSetTime(unsigned short value) -//{ -// if (!IsServerConnected())return; -// EnterCriticalSection(&m_RtcCS); -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 658; -// items[0].WordLen = S7WLByte; -// items[0].Amount = 2; -// unsigned char* pdata = new unsigned char[2]; -// pdata[0] = (unsigned char)(value >> 8); -// pdata[1] = (unsigned char)value; -// items[0].pdata = pdata; -// pcommand->m_Ref = this; -// pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -//} -// -//void PurifierClient::SetUnLock() -//{ -// if (!IsServerConnected())return; -// EnterCriticalSection(&m_RtcCS); -// S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); -// TS7DataItem* items = pcommand->getDataItems(); -// items[0].Area = S7AreaDB; -// items[0].DBNumber = 1; -// items[0].Start = 660; -// items[0].WordLen = S7WLByte; -// items[0].Amount = 2; -// unsigned char* pdata = new unsigned char[2]; -// pdata[0] = 0; -// pdata[1] = 0; -// items[0].pdata = pdata; -// pcommand->m_Ref = this; -// pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; -// m_RTCommands.push(pcommand); -// LeaveCriticalSection(&m_RtcCS); -// -//} \ No newline at end of file +void PurifierClient::SetPressureRangeUpLimit(float value) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetPressureRangeUpLimit", to_string(value), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(182, value); +} + +void PurifierClient::SetPressureRangeDownLimit(float value) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetPressureRangeDownLimit", to_string(value), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(186, value); +} + +void PurifierClient::SetOxygenAlarmValue(float value) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetOxygenAlarmValue", to_string(value), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(190, value); +} + +void PurifierClient::SetUseArgon(bool buse) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetUseArgon", to_string(buse), iBOOL); + //if (!IsServerConnected())return; + //SetBit(557 * 8 + 1, buse); +} + + +void PurifierClient::SetCoverWind(bool bvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetCoverWind", to_string(bvalue), iBOOL); + //if (!IsServerConnected())return; + //EnterCriticalSection(&m_RtcCS); + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 557 * 8 + 6; + //items[0].WordLen = S7WLBit; + //items[0].Amount = 1; + //bool* tempv = new bool[1]; + //tempv[0] = bvalue; + //items[0].pdata = tempv; + //pcommand->m_Ref = this; + //pcommand->m_waitTime = 0; + //pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); +} + +void PurifierClient::SetCoverWindOffset(float offset) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetCoverWindOffset", to_string(offset), iFLOAT); + //if (!IsServerConnected())return; + //SetDBFloat(812, offset); +} + +void PurifierClient::SetShieldMonitorPrintPressure(bool bvalue) { + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetShieldMonitorPrintPressure", to_string(bvalue), iBOOL); + //if (g_isDebug)m_Stat.shieldMonitorPrintPressure->SetValue(bvalue); + //if (!IsServerConnected())return; + //SetBit(557 * 8, bvalue); +} + +void PurifierClient::SetWindSlowFinishSignal(bool bvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetWindSlowFinishSignal", to_string(bvalue), iBOOL); + //if (!IsServerConnected())return; + //EnterCriticalSection(&m_RtcCS); + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 594 * 8 + 6; + //items[0].WordLen = S7WLBit; + //items[0].Amount = 1; + //bool* tempv = new bool[1]; + //tempv[0] = bvalue; + //items[0].pdata = tempv; + //pcommand->m_Ref = this; + //pcommand->m_waitTime = 0; + //pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); +} + +void PurifierClient::SetWindResumeFinishSignal(bool bvalue) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetWindResumeFinishSignal", to_string(bvalue), iBOOL); + //if (!IsServerConnected())return; + //EnterCriticalSection(&m_RtcCS); + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 594 * 8 + 7; + //items[0].WordLen = S7WLBit; + //items[0].Amount = 1; + //bool* tempv = new bool[1]; + //tempv[0] = bvalue; + //items[0].pdata = tempv; + //pcommand->m_Ref = this; + //pcommand->m_waitTime = 0; + //pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); +} + +void PurifierClient::SetBlowBackBlowTime(unsigned short value) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetBlowBackBlowTime", to_string(value), iUSHORT); + + /*if (!IsServerConnected())return; + EnterCriticalSection(&m_RtcCS); + S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + TS7DataItem* items = pcommand->getDataItems(); + items[0].Area = S7AreaDB; + items[0].DBNumber = 1; + items[0].Start = 430; + items[0].WordLen = S7WLByte; + items[0].Amount = 2; + unsigned char* pdata = new unsigned char[2]; + pdata[0] = (unsigned char)(value >> 8); + pdata[1] = (unsigned char)value; + items[0].pdata = pdata; + pcommand->m_Ref = this; + pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; + m_RTCommands.push(pcommand); + LeaveCriticalSection(&m_RtcCS);*/ +} + +void PurifierClient::SetBlowBackSetTimes(unsigned short value) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetBlowBackSetTimes", to_string(value), iUSHORT); + //if (!IsServerConnected())return; + //EnterCriticalSection(&m_RtcCS); + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 434; + //items[0].WordLen = S7WLByte; + //items[0].Amount = 2; + //unsigned char* pdata = new unsigned char[2]; + + //pdata[0] = (unsigned char)(value >> 8); + //pdata[1] = (unsigned char)value; + //items[0].pdata = pdata; + //pcommand->m_Ref = this; + //pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); +} +void PurifierClient::SetProtectionPressureSetTime(unsigned short value) +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetProtectionPressureSetTime", to_string(value), iUSHORT); + //if (!IsServerConnected())return; + //EnterCriticalSection(&m_RtcCS); + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 658; + //items[0].WordLen = S7WLByte; + //items[0].Amount = 2; + //unsigned char* pdata = new unsigned char[2]; + //pdata[0] = (unsigned char)(value >> 8); + //pdata[1] = (unsigned char)value; + //items[0].pdata = pdata; + //pcommand->m_Ref = this; + //pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); +} + +void PurifierClient::SetUnLock() +{ + DataHandle::Instance()->SetPushMsg(PURIFIERPARAMW, "SetUnLock", "", UNKNOW); + //if (!IsServerConnected())return; + //EnterCriticalSection(&m_RtcCS); + //S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1); + //TS7DataItem* items = pcommand->getDataItems(); + //items[0].Area = S7AreaDB; + //items[0].DBNumber = 1; + //items[0].Start = 660; + //items[0].WordLen = S7WLByte; + //items[0].Amount = 2; + //unsigned char* pdata = new unsigned char[2]; + //pdata[0] = 0; + //pdata[1] = 0; + //items[0].pdata = pdata; + //pcommand->m_Ref = this; + //pcommand->m_Fun = &PurifierClient::ProcWriteValueXT; + //m_RTCommands.push(pcommand); + //LeaveCriticalSection(&m_RtcCS); + +} \ No newline at end of file diff --git a/PrintC/Communication/PurifierClient.h b/PrintC/Communication/PurifierClient.h index 3b71fe1..bcba526 100644 --- a/PrintC/Communication/PurifierClient.h +++ b/PrintC/Communication/PurifierClient.h @@ -587,43 +587,43 @@ public: void SetFilterClean(bool bvalue); //滤芯清洗 void SetHopperClean(bool bvalue); //料斗清洗启动或停止 void SetPurify(bool bvalue); //一键清洗(除氧) -// void SetBoxClean(bool bvalue); -// void ResetFilterTime(); -// void ClearHopperAlarm(); -// -// void SetBoxPressureUpLimit(float fvalue); //箱体压力上限设定 -// void SetBoxPressureDownLimit(float fvalue); //箱体压力下限设定 -// void SetMidPressureDifAlarmValue(float fvalue); //中效过滤器压差报警设 -// void SetHighPressureDifAlarmValue(float fvalue); //高效过滤器压差报警设 -// void SetPrintCleanOxygenSetValue(float fvalue); //打印室氧清洗氧含量设 -// void SetWindValue(float fvalue); //风速设定 -// void SetMaxWindValue(float fvalue); //最大风速设定 -// void SetPrintOxygenDownSetValue(float fvalue); //打印氧下限设定 -// void SetPrintOxygenUpSetValue(float fvalue); //打印氧上限设定 -// void SetfilterCleanOxygenSetValue(float fvalue); //过滤器清洗氧含量设定 -// void SetMidTempHighSetValue(float fvalue); //中效高温报警设定 -// void SetMidTempUltraSetValue(float fvalue); //中效超高温报警设定 -// void SetHighTempHighSetValue(float fvalue); //高效高温报警设定 -//// void SetHighTempUltraSetValue(float fvalue); //高效超高温报警设定 -// void SetHopperCleanRemind(unsigned short value); //清理料斗提醒设定 -// void SetBoxWashDelayTime(unsigned short value); -// void SetDedustingWashDelayTime(unsigned short value); -// void SetPressureRangeUpLimit(float value); //压力量程上限设定 -// void SetPressureRangeDownLimit(float value); //压力量程下限设定 -// void SetOxygenAlarmValue(float value); //打印氧超上限设定 -// void SetUseArgon(bool buse); -// -// void SetBlowBackBlowTime(unsigned short value); -// void SetBlowBackSetTimes(unsigned short value); - //void SetProtectionPressureSetTime(unsigned short value); - //void SetUnLock(); + void SetBoxClean(bool bvalue); + void ResetFilterTime(); + void ClearHopperAlarm(); - //virtual void SetCoverWind(bool bvalue); - //virtual void SetCoverWindOffset(float offset); + void SetBoxPressureUpLimit(float fvalue); //箱体压力上限设定 + void SetBoxPressureDownLimit(float fvalue); //箱体压力下限设定 + void SetMidPressureDifAlarmValue(float fvalue); //中效过滤器压差报警设 + void SetHighPressureDifAlarmValue(float fvalue); //高效过滤器压差报警设 + void SetPrintCleanOxygenSetValue(float fvalue); //打印室氧清洗氧含量设 + void SetWindValue(float fvalue); //风速设定 + void SetMaxWindValue(float fvalue); //最大风速设定 + void SetPrintOxygenDownSetValue(float fvalue); //打印氧下限设定 + void SetPrintOxygenUpSetValue(float fvalue); //打印氧上限设定 + void SetfilterCleanOxygenSetValue(float fvalue); //过滤器清洗氧含量设定 + void SetMidTempHighSetValue(float fvalue); //中效高温报警设定 + void SetMidTempUltraSetValue(float fvalue); //中效超高温报警设定 + void SetHighTempHighSetValue(float fvalue); //高效高温报警设定 +// void SetHighTempUltraSetValue(float fvalue); //高效超高温报警设定 + void SetHopperCleanRemind(unsigned short value); //清理料斗提醒设定 + void SetBoxWashDelayTime(unsigned short value); + void SetDedustingWashDelayTime(unsigned short value); + void SetPressureRangeUpLimit(float value); //压力量程上限设定 + void SetPressureRangeDownLimit(float value); //压力量程下限设定 + void SetOxygenAlarmValue(float value); //打印氧超上限设定 + void SetUseArgon(bool buse); - //virtual void SetWindSlowFinishSignal(bool bvalue); - //virtual void SetWindResumeFinishSignal(bool bvalue); - //virtual void SetShieldMonitorPrintPressure(bool bvalue); + void SetBlowBackBlowTime(unsigned short value); + void SetBlowBackSetTimes(unsigned short value); + void SetProtectionPressureSetTime(unsigned short value); + void SetUnLock(); + + virtual void SetCoverWind(bool bvalue); + virtual void SetCoverWindOffset(float offset); + + virtual void SetWindSlowFinishSignal(bool bvalue); + virtual void SetWindResumeFinishSignal(bool bvalue); + virtual void SetShieldMonitorPrintPressure(bool bvalue); virtual void SetProtectionPressure(bool bvalue) {} //virtual void ResetWindSlowFinishSignal(); diff --git a/PrintC/DataManage/DataHandle.h b/PrintC/DataManage/DataHandle.h index 0b10c89..9dd6722 100644 --- a/PrintC/DataManage/DataHandle.h +++ b/PrintC/DataManage/DataHandle.h @@ -25,19 +25,19 @@ public: void SetPushMsg(WRITETYPE dataType) { if (m_streamClient) { - WriteData* msg = new WriteData(); - msg->dataType = dataType; + WriteData msg; + msg.dataType = dataType; m_streamClient->SetPushMsg(msg); } } void SetPushMsg(WRITETYPE dataType,const string& nameKey,const string& strValue,DATATYPE valueType) { if (m_streamClient) { - WriteData* msg = new WriteData(); - msg->dataType = dataType; - msg->nameKey = nameKey; - msg->strValue = strValue; - msg->valueType = valueType; + WriteData msg ; + msg.dataType = dataType; + msg.nameKey = nameKey; + msg.strValue = strValue; + msg.valueType = valueType; m_streamClient->SetPushMsg(msg); } } diff --git a/PrintC/DataManage/RWData.h b/PrintC/DataManage/RWData.h index 5a67c46..b731989 100644 --- a/PrintC/DataManage/RWData.h +++ b/PrintC/DataManage/RWData.h @@ -127,6 +127,7 @@ enum WRITETYPE { IOSIGNAL, //io 信号 RESETELEC, //PowerMeterClient PURIFIERPARAMW, //净化器参数写入 + LAYERDATAREQ, //layer数据请求 }; diff --git a/PrintC/DataManage/StreamClient.cpp b/PrintC/DataManage/StreamClient.cpp index b3bdffc..9932ae0 100644 --- a/PrintC/DataManage/StreamClient.cpp +++ b/PrintC/DataManage/StreamClient.cpp @@ -40,17 +40,16 @@ bool StreamClient::GetPushMsg(WriteData& msg) { return false; } else { - msg = (*m_msgList.front()); - delete m_msgList.front(); + msg = m_msgList.front(); m_msgList.pop_front(); return true; } } -void StreamClient::SetPushMsg(WriteData* msg) { +void StreamClient::SetPushMsg(const WriteData& msg) { std::lock_guard lock(m_msgLock); - m_msgList.push_back(msg); + m_msgList.emplace_back(msg); } diff --git a/PrintC/DataManage/StreamClient.h b/PrintC/DataManage/StreamClient.h index c75a646..5301511 100644 --- a/PrintC/DataManage/StreamClient.h +++ b/PrintC/DataManage/StreamClient.h @@ -29,7 +29,7 @@ public: m_dataCallBack = dataCallBack; } - void SetPushMsg(WriteData* msg); + void SetPushMsg(const WriteData& msg); private: bool GetPushMsg(WriteData& msg); @@ -44,7 +44,7 @@ private: std::thread m_connectTd; - std::list m_msgList; //信息缓存区 + std::list m_msgList; //信息缓存区 std::mutex m_msgLock; //信息锁 void* m_handlePtr; diff --git a/PrintC/Purifier/BasePurifier.cpp b/PrintC/Purifier/BasePurifier.cpp index c74b902..0776676 100644 --- a/PrintC/Purifier/BasePurifier.cpp +++ b/PrintC/Purifier/BasePurifier.cpp @@ -2,7 +2,7 @@ #include "../config/ConfigManager.h" #include "../SystemInfo.h" #include -#include "../ScannerCtrl/BaseCtrl.h" +//#include "../ScannerCtrl/BaseCtrl.h" BasePurifier::BasePurifier() @@ -10,9 +10,9 @@ BasePurifier::BasePurifier() , m_RunFlag(false) , m_PurifierWinShow(false) { - m_ExtCfg = ConfigManager::GetInstance()->GetExtCfg(); - m_IOCfgWrapper = ConfigManager::GetInstance()->GetIoCfgWrapper(); - m_AlarmCfgWrapper = ConfigManager::GetInstance()->GetAlarmCfg(); + m_ExtCfg = ConfigManager::Instance()->GetExtCfg(); + m_IOCfgWrapper = ConfigManager::Instance()->GetIoCfgWrapper(); + m_AlarmCfgWrapper = ConfigManager::Instance()->GetAlarmCfg(); m_CycleTick = 80; } @@ -50,13 +50,13 @@ void BasePurifier::WorkRun() { while (m_RunFlag) { UpdateShowStat(); - if (BaseCtrl::IsStart() || BaseCtrl::IsPause()) { - AutoCtrlWhenPrint(); - } - else if (BaseCtrl::IsStandBy()) - { - AutoCtrlWhenStanby(); - } + //if (BaseCtrl::IsStart() || BaseCtrl::IsPause()) { + // AutoCtrlWhenPrint(); + //} + //else if (BaseCtrl::IsStandBy()) + //{ + // AutoCtrlWhenStanby(); + //} UpdateShowStat(); AutoCtrl(); diff --git a/PrintC/Purifier/G4Purifier.cpp b/PrintC/Purifier/G4Purifier.cpp index c520a64..2b9906a 100644 --- a/PrintC/Purifier/G4Purifier.cpp +++ b/PrintC/Purifier/G4Purifier.cpp @@ -5,10 +5,10 @@ #include "../Toast.h" #include "../SystemInfo.h" #include "../Logger.h" -#include "../plc/SignalService.h" +//#include "../plc/SignalService.h" #include "../DataManage/DataHandle.h" -G4Purifier::G4Purifier(ScannerCtrl* scannerCtrl) :XTPurifier(scannerCtrl) +G4Purifier::G4Purifier(void* scannerCtrl) :XTPurifier(scannerCtrl) { } @@ -19,17 +19,17 @@ G4Purifier::~G4Purifier() void G4Purifier::Init() { - //m_HasFan = false; - map* cfg = ConfigManager::GetInstance()->GetCommunicationCfg(); - m_RunCfg = ConfigManager::GetInstance()->GetRunCfg(); - m_MachineCfg = ConfigManager::GetInstance()->GetMachineCfg(); - m_IOCfgWrapper = ConfigManager::GetInstance()->GetIoCfgWrapper(); - m_AlarmCfgWrapper = ConfigManager::GetInstance()->GetAlarmCfg(); - m_Client = new G4PurifierClient((*cfg)["PURIFIER_G4"]); - m_Client->Init(); - ConfigManager::GetInstance()->AddComRefCfg(m_Client->GetConfig(), m_Client); - m_Client->GetConfig()->m_Enable = true; - if (m_Client->GetConfig()->m_Enable)m_Client->Startup(); + ////m_HasFan = false; + //map* cfg = ConfigManager::GetInstance()->GetCommunicationCfg(); + //m_RunCfg = ConfigManager::GetInstance()->GetRunCfg(); + //m_MachineCfg = ConfigManager::GetInstance()->GetMachineCfg(); + //m_IOCfgWrapper = ConfigManager::GetInstance()->GetIoCfgWrapper(); + //m_AlarmCfgWrapper = ConfigManager::GetInstance()->GetAlarmCfg(); + //m_Client = new G4PurifierClient((*cfg)["PURIFIER_G4"]); + //m_Client->Init(); + //ConfigManager::GetInstance()->AddComRefCfg(m_Client->GetConfig(), m_Client); + //m_Client->GetConfig()->m_Enable = true; + //if (m_Client->GetConfig()->m_Enable)m_Client->Startup(); } //void G4Purifier::DrawUI() @@ -1104,10 +1104,10 @@ void G4Purifier::DrawAdminUI() { if (!purifierstatXT.isBlowBack) { bool isok = true; - if (!BaseCtrl::IsStandBy()) { - g_Toast->AddToast(new ToastBean(_(u8"系统在非就绪状态下不能执行反吹").c_str(), 4000, Toast::COLOR_RED)); - isok = false; - } + //if (!BaseCtrl::IsStandBy()) { //wxxtest + // g_Toast->AddToast(new ToastBean(_(u8"系统在非就绪状态下不能执行反吹").c_str(), 4000, Toast::COLOR_RED)); + // isok = false; + //} if (isok) { if (purifierstatXT.IsAlarm()) { g_Toast->AddToast(new ToastBean(_(u8"净化器存在报警不能执行反吹").c_str(), 4000, Toast::COLOR_RED)); @@ -1190,10 +1190,10 @@ void G4Purifier::CheckInternalAlarm() if (hasAlarm) { m_AlarmCfgWrapper->m_PurifierInternalAlarm->m_AlarmInfo = ss.str().c_str(); - SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierInternalAlarm, true); + //SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierInternalAlarm, true); } else { m_AlarmCfgWrapper->m_PurifierInternalAlarm->m_AlarmInfo = ""; - SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierInternalAlarm, false); + //SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierInternalAlarm, false); } } \ No newline at end of file diff --git a/PrintC/Purifier/G4Purifier.h b/PrintC/Purifier/G4Purifier.h index 6d2ad5a..78c9584 100644 --- a/PrintC/Purifier/G4Purifier.h +++ b/PrintC/Purifier/G4Purifier.h @@ -1,9 +1,9 @@ -#pragma once +#pragma once #include "XTPurifier.h" class G4Purifier :public XTPurifier { public: - G4Purifier(ScannerCtrl* scannerCtrl); + G4Purifier(void* scannerCtrl); ~G4Purifier(); void Init(); diff --git a/PrintC/Purifier/HBD3Purifier.cpp b/PrintC/Purifier/HBD3Purifier.cpp index f162f45..8b0eb49 100644 --- a/PrintC/Purifier/HBD3Purifier.cpp +++ b/PrintC/Purifier/HBD3Purifier.cpp @@ -5,9 +5,9 @@ #include "../Toast.h" #include "../SystemInfo.h" #include "../Logger.h" -#include "../plc/SignalService.h" +//#include "../plc/SignalService.h" -HBD3Purifier::HBD3Purifier(ScannerCtrl* scannerCtrl):XTPurifier(scannerCtrl) +HBD3Purifier::HBD3Purifier(void* scannerCtrl):XTPurifier(scannerCtrl) { } @@ -18,17 +18,17 @@ HBD3Purifier::~HBD3Purifier() void HBD3Purifier::Init() { - //m_HasFan = false; - map* cfg = ConfigManager::GetInstance()->GetCommunicationCfg(); - m_RunCfg = ConfigManager::GetInstance()->GetRunCfg(); - m_MachineCfg = ConfigManager::GetInstance()->GetMachineCfg(); - m_IOCfgWrapper = ConfigManager::GetInstance()->GetIoCfgWrapper(); - m_AlarmCfgWrapper = ConfigManager::GetInstance()->GetAlarmCfg(); - m_Client = new HBDPurifierG3Client((*cfg)["HBD_PURIFIER_G3"]); - m_Client->Init(); - ConfigManager::GetInstance()->AddComRefCfg(m_Client->GetConfig(), m_Client); - m_Client->GetConfig()->m_Enable = true; - if (m_Client->GetConfig()->m_Enable)m_Client->Startup(); + ////m_HasFan = false; + //map* cfg = ConfigManager::Instance()->GetCommunicationCfg(); + //m_RunCfg = ConfigManager::GetInstance()->GetRunCfg(); + //m_MachineCfg = ConfigManager::GetInstance()->GetMachineCfg(); + //m_IOCfgWrapper = ConfigManager::GetInstance()->GetIoCfgWrapper(); + //m_AlarmCfgWrapper = ConfigManager::GetInstance()->GetAlarmCfg(); + //m_Client = new HBDPurifierG3Client((*cfg)["HBD_PURIFIER_G3"]); + //m_Client->Init(); + //ConfigManager::GetInstance()->AddComRefCfg(m_Client->GetConfig(), m_Client); + //m_Client->GetConfig()->m_Enable = true; + //if (m_Client->GetConfig()->m_Enable)m_Client->Startup(); } //void HBD3Purifier::DrawUI() @@ -1178,10 +1178,10 @@ void HBD3Purifier::CheckInternalAlarm() if (hasAlarm) { m_AlarmCfgWrapper->m_PurifierInternalAlarm->m_AlarmInfo = ss.str().c_str(); - SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierInternalAlarm, true); + //SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierInternalAlarm, true); } else { m_AlarmCfgWrapper->m_PurifierInternalAlarm->m_AlarmInfo = ""; - SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierInternalAlarm, false); + //SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierInternalAlarm, false); } } \ No newline at end of file diff --git a/PrintC/Purifier/HBD3Purifier.h b/PrintC/Purifier/HBD3Purifier.h index a4f2cf4..d71316e 100644 --- a/PrintC/Purifier/HBD3Purifier.h +++ b/PrintC/Purifier/HBD3Purifier.h @@ -4,7 +4,7 @@ class HBD3Purifier:public XTPurifier { public: - HBD3Purifier(ScannerCtrl* scannerCtrl); + HBD3Purifier(void* scannerCtrl); ~HBD3Purifier(); void Init(); diff --git a/PrintC/Purifier/XTPurifier.cpp b/PrintC/Purifier/XTPurifier.cpp index 321426a..b387af5 100644 --- a/PrintC/Purifier/XTPurifier.cpp +++ b/PrintC/Purifier/XTPurifier.cpp @@ -198,201 +198,201 @@ bool XTPurifier::IsAutoDeoxygen() else return false; } -bool XTPurifier::HandleReadyPrint(bool startAfterPause, unsigned int& deoxytime) -{ - //DWORD startTick = GetTickCount64(); - //if (m_IOCfgWrapper->m_PrintAirSupply) { - // if (!m_IOCfgWrapper->m_PrintAirSupply->IsActive()) { - // m_IOCfgWrapper->m_PrintAirSupply->SetActive(true); - // } - //} - - if (m_State.isBlowBack) { - g_Toast->AddToast(new ToastBean(_(u8"终止:检测到正在反吹"), 5000, Toast::COLOR_RED)); - return false; - } - - float judgeOxygen = m_RunCfg->m_TargeOxygen; - if (startAfterPause) { - judgeOxygen = m_RunCfg->m_WarnOxygen; - } - //g_Toast->AddToast(new ToastBean(_(u8"开启除氧").c_str(), 3000)); - EnterCriticalSection(&g_SystemInfo->m_InfoCs); - bool isUpperTarge = (g_SystemInfo->m_ComPrintOxygen1 > judgeOxygen) || (g_SystemInfo->m_ComPrintOxygen2 > judgeOxygen) || (m_State.filterOxygenValue > m_State.filterCleanOxygenSetValue); - LeaveCriticalSection(&g_SystemInfo->m_InfoCs); - SignalState ss; - SignalService::GetInstance().GetSignalState(ss); - bool cylinderNeedDeoxygen = (!ss.m_MoldDeoxygenFinished && ss.m_MoldDeoxygenEnable && m_RunCfg->m_MoldDeoxygenEnable); - if (isUpperTarge || cylinderNeedDeoxygen) { - if (m_State.isDedusting) { - m_Client->SetDedust(false); - Sleep(2000); - } - UpdateShowStat(); - if (!m_State.isPurifying) { - if(isUpperTarge)g_Toast->AddToast(new ToastBean(_(u8"开启打印室除氧"), 3000, ImVec4(0, 1, 0, 1))); - - m_Client->SetPurify(true); - - m_IsDeoxygenStarted = true; - m_LastStartDeoxygenTime = GetTickCount64(); - m_HadCalcDeoxygenTime = false; - Sleep(3000); - } - if (cylinderNeedDeoxygen) - { - SignalService::GetInstance().StartCylinderDeoxygen(); - g_Toast->AddToast(new ToastBean(_(u8"开启缸体除氧"), 3000, ImVec4(0, 1, 0, 1))); - Sleep(2000); - } - } - - UpdateShowStat(); - BaseCtrl::SetPreState(BaseCtrl::Purifying); - SignalService::GetInstance().GetSignalState(ss); - int dcount = 0; - while ((BaseCtrl::GetPreState() == ScannerCtrl::Purifying && m_State.isPurifying) || ss.m_MoldDeoxygenRun) - { - if (!BaseCtrl::IsPrePrint()) { - break; - } - judgeOxygen = m_RunCfg->m_TargeOxygen; - if (startAfterPause) { - judgeOxygen = m_RunCfg->m_WarnOxygen; - } - Sleep(500); - EnterCriticalSection(&g_SystemInfo->m_InfoCs); - bool isLowerTarge = ((g_SystemInfo->m_ComPrintOxygen1 <= judgeOxygen) && (g_SystemInfo->m_ComPrintOxygen2 <= judgeOxygen) && (m_State.filterOxygenValue <= m_State.filterCleanOxygenSetValue)); - LeaveCriticalSection(&g_SystemInfo->m_InfoCs); - SignalService::GetInstance().GetSignalState(ss); - if (isLowerTarge) { - if (cylinderNeedDeoxygen) { - if (ss.m_MoldDeoxygenRun && !ss.m_MoldDeoxygenFinished) { - if ((dcount % 20) == 0) { - dcount = 0; - g_Toast->AddToast(new ToastBean(_(u8"等待缸体除氧完成"), 3000, Toast::COLOR_ORANGE)); - } - } - else { - break; - } - } - else break; - } - else { - if ((dcount % 20) == 0) { - dcount = 0; - g_Toast->AddToast(new ToastBean(_(u8"等待打印室和净化器除氧完成"), 3000, Toast::COLOR_ORANGE)); - } - } - dcount++; - } - Sleep(500); - if (!BaseCtrl::IsPrePrint()) { - return false; - } - - if (m_State.isPurifying) { - m_Client->SetPurify(false); - Sleep(2000); - } - - //DWORD stoptick = GetTickCount64(); - //deoxytime = (stoptick - startTick) / 1000; - if (m_IsDeoxygenStarted && !m_HadCalcDeoxygenTime) { - m_LastDeoxygenTime = (GetTickCount64() - m_LastStartDeoxygenTime) / 1000.0f / 60.0f; - m_HadCalcDeoxygenTime = true; - } - deoxytime = m_LastDeoxygenTime * 60; - - if (!m_State.isDedusting) { - m_Client->SetDedust(true); - g_Toast->AddToast(new ToastBean(_(u8"开启除尘").c_str(), 3000, ImVec4(0, 1, 0, 1))); - Sleep(3000); - } - UpdateShowStat(); - BaseCtrl::SetPreState(BaseCtrl::Dedusting); - int count = 0; - while (BaseCtrl::IsPrePrint() && BaseCtrl::GetPreState() == ScannerCtrl::Dedusting) { - Sleep(500); - - UpdateShowStat(); - if (!m_State.isDedusting) { - if ((g_SystemInfo->GetComPrintOxygen1() < m_RunCfg->m_AlarmOxygen) && (g_SystemInfo->GetComPrintOxygen2() < m_RunCfg->m_AlarmOxygen)) - { - if (m_State.isPurifying) { - m_Client->SetPurify(false); - Sleep(1000); - } - m_Client->SetDedust(true); - Sleep(1000); - } - else { - if ((count % 20) == 0) { - if (!m_State.isPurifying) - { - m_Client->SetPurify(true); - Sleep(1000); - } - count = 0; - g_Toast->AddToast(new ToastBean(_(u8"正在等待循环重启"), 3000, Toast::COLOR_ORANGE)); - } - count++; - continue; - } - } - - FanFit* al = m_ExtCfg->m_FanWindFit[m_ExtCfg->m_SelectedFanWindFit]; - if ((m_State.windSetValue - m_State.windActualValue) > al->checkWindOffset) { - if ((count % 20) == 0) { - count = 0; - g_Toast->AddToast(new ToastBean(_(u8"正在等待风速").c_str(), 3000, Toast::COLOR_ORANGE)); - } - count++; - continue; - } - - - judgeOxygen = m_RunCfg->m_WarnOxygen; - - if ((g_SystemInfo->m_ComPrintOxygen1 > judgeOxygen) || (g_SystemInfo->m_ComPrintOxygen2 > judgeOxygen)) { - if ((count % 20) == 0) { - count = 0; - g_Toast->AddToast(new ToastBean(_(u8"正在等待氧含量").c_str(), 3000, Toast::COLOR_ORANGE)); - } - count++; - continue; - } - - if (m_AlarmCfgWrapper->m_InverterRunSignalAlarm&&m_AlarmCfgWrapper->m_InverterRunSignalAlarm->m_IsEnable) - { - if (m_AlarmCfgWrapper->m_InverterRunSignalAlarm->m_IsAlarm) { - if ((count % 20) == 0) { - count = 0; - g_Toast->AddToast(new ToastBean(_(u8"正在变频器运行信号"), 3000, Toast::COLOR_ORANGE)); - } - count++; - continue; - } - } - if (m_AlarmCfgWrapper->m_PrintSignalAlarm&&m_AlarmCfgWrapper->m_PrintSignalAlarm->m_IsEnable) - { - if (m_AlarmCfgWrapper->m_PrintSignalAlarm->m_IsAlarm) { - if ((count % 20) == 0) { - count = 0; - g_Toast->AddToast(new ToastBean(_(u8"正在等待可打印信号"), 3000, Toast::COLOR_ORANGE)); - } - count++; - continue; - } - } - break; - } - if (!BaseCtrl::IsPrePrint()) { - return false; - } - return true; -} +//bool XTPurifier::HandleReadyPrint(bool startAfterPause, unsigned int& deoxytime) +//{ +// //DWORD startTick = GetTickCount64(); +// //if (m_IOCfgWrapper->m_PrintAirSupply) { +// // if (!m_IOCfgWrapper->m_PrintAirSupply->IsActive()) { +// // m_IOCfgWrapper->m_PrintAirSupply->SetActive(true); +// // } +// //} +// +// if (m_State.isBlowBack) { +// g_Toast->AddToast(new ToastBean(_(u8"终止:检测到正在反吹"), 5000, Toast::COLOR_RED)); +// return false; +// } +// +// float judgeOxygen = m_RunCfg->m_TargeOxygen; +// if (startAfterPause) { +// judgeOxygen = m_RunCfg->m_WarnOxygen; +// } +// //g_Toast->AddToast(new ToastBean(_(u8"开启除氧").c_str(), 3000)); +// EnterCriticalSection(&g_SystemInfo->m_InfoCs); +// bool isUpperTarge = (g_SystemInfo->m_ComPrintOxygen1 > judgeOxygen) || (g_SystemInfo->m_ComPrintOxygen2 > judgeOxygen) || (m_State.filterOxygenValue > m_State.filterCleanOxygenSetValue); +// LeaveCriticalSection(&g_SystemInfo->m_InfoCs); +// SignalState ss; +// SignalService::GetInstance().GetSignalState(ss); +// bool cylinderNeedDeoxygen = (!ss.m_MoldDeoxygenFinished && ss.m_MoldDeoxygenEnable && m_RunCfg->m_MoldDeoxygenEnable); +// if (isUpperTarge || cylinderNeedDeoxygen) { +// if (m_State.isDedusting) { +// m_Client->SetDedust(false); +// Sleep(2000); +// } +// UpdateShowStat(); +// if (!m_State.isPurifying) { +// if(isUpperTarge)g_Toast->AddToast(new ToastBean(_(u8"开启打印室除氧"), 3000, ImVec4(0, 1, 0, 1))); +// +// m_Client->SetPurify(true); +// +// m_IsDeoxygenStarted = true; +// m_LastStartDeoxygenTime = GetTickCount64(); +// m_HadCalcDeoxygenTime = false; +// Sleep(3000); +// } +// if (cylinderNeedDeoxygen) +// { +// SignalService::GetInstance().StartCylinderDeoxygen(); +// g_Toast->AddToast(new ToastBean(_(u8"开启缸体除氧"), 3000, ImVec4(0, 1, 0, 1))); +// Sleep(2000); +// } +// } +// +// UpdateShowStat(); +// BaseCtrl::SetPreState(BaseCtrl::Purifying); +// SignalService::GetInstance().GetSignalState(ss); +// int dcount = 0; +// while ((BaseCtrl::GetPreState() == ScannerCtrl::Purifying && m_State.isPurifying) || ss.m_MoldDeoxygenRun) +// { +// if (!BaseCtrl::IsPrePrint()) { +// break; +// } +// judgeOxygen = m_RunCfg->m_TargeOxygen; +// if (startAfterPause) { +// judgeOxygen = m_RunCfg->m_WarnOxygen; +// } +// Sleep(500); +// EnterCriticalSection(&g_SystemInfo->m_InfoCs); +// bool isLowerTarge = ((g_SystemInfo->m_ComPrintOxygen1 <= judgeOxygen) && (g_SystemInfo->m_ComPrintOxygen2 <= judgeOxygen) && (m_State.filterOxygenValue <= m_State.filterCleanOxygenSetValue)); +// LeaveCriticalSection(&g_SystemInfo->m_InfoCs); +// SignalService::GetInstance().GetSignalState(ss); +// if (isLowerTarge) { +// if (cylinderNeedDeoxygen) { +// if (ss.m_MoldDeoxygenRun && !ss.m_MoldDeoxygenFinished) { +// if ((dcount % 20) == 0) { +// dcount = 0; +// g_Toast->AddToast(new ToastBean(_(u8"等待缸体除氧完成"), 3000, Toast::COLOR_ORANGE)); +// } +// } +// else { +// break; +// } +// } +// else break; +// } +// else { +// if ((dcount % 20) == 0) { +// dcount = 0; +// g_Toast->AddToast(new ToastBean(_(u8"等待打印室和净化器除氧完成"), 3000, Toast::COLOR_ORANGE)); +// } +// } +// dcount++; +// } +// Sleep(500); +// if (!BaseCtrl::IsPrePrint()) { +// return false; +// } +// +// if (m_State.isPurifying) { +// m_Client->SetPurify(false); +// Sleep(2000); +// } +// +// //DWORD stoptick = GetTickCount64(); +// //deoxytime = (stoptick - startTick) / 1000; +// if (m_IsDeoxygenStarted && !m_HadCalcDeoxygenTime) { +// m_LastDeoxygenTime = (GetTickCount64() - m_LastStartDeoxygenTime) / 1000.0f / 60.0f; +// m_HadCalcDeoxygenTime = true; +// } +// deoxytime = m_LastDeoxygenTime * 60; +// +// if (!m_State.isDedusting) { +// m_Client->SetDedust(true); +// g_Toast->AddToast(new ToastBean(_(u8"开启除尘").c_str(), 3000, ImVec4(0, 1, 0, 1))); +// Sleep(3000); +// } +// UpdateShowStat(); +// BaseCtrl::SetPreState(BaseCtrl::Dedusting); +// int count = 0; +// while (BaseCtrl::IsPrePrint() && BaseCtrl::GetPreState() == ScannerCtrl::Dedusting) { +// Sleep(500); +// +// UpdateShowStat(); +// if (!m_State.isDedusting) { +// if ((g_SystemInfo->GetComPrintOxygen1() < m_RunCfg->m_AlarmOxygen) && (g_SystemInfo->GetComPrintOxygen2() < m_RunCfg->m_AlarmOxygen)) +// { +// if (m_State.isPurifying) { +// m_Client->SetPurify(false); +// Sleep(1000); +// } +// m_Client->SetDedust(true); +// Sleep(1000); +// } +// else { +// if ((count % 20) == 0) { +// if (!m_State.isPurifying) +// { +// m_Client->SetPurify(true); +// Sleep(1000); +// } +// count = 0; +// g_Toast->AddToast(new ToastBean(_(u8"正在等待循环重启"), 3000, Toast::COLOR_ORANGE)); +// } +// count++; +// continue; +// } +// } +// +// FanFit* al = m_ExtCfg->m_FanWindFit[m_ExtCfg->m_SelectedFanWindFit]; +// if ((m_State.windSetValue - m_State.windActualValue) > al->checkWindOffset) { +// if ((count % 20) == 0) { +// count = 0; +// g_Toast->AddToast(new ToastBean(_(u8"正在等待风速").c_str(), 3000, Toast::COLOR_ORANGE)); +// } +// count++; +// continue; +// } +// +// +// judgeOxygen = m_RunCfg->m_WarnOxygen; +// +// if ((g_SystemInfo->m_ComPrintOxygen1 > judgeOxygen) || (g_SystemInfo->m_ComPrintOxygen2 > judgeOxygen)) { +// if ((count % 20) == 0) { +// count = 0; +// g_Toast->AddToast(new ToastBean(_(u8"正在等待氧含量").c_str(), 3000, Toast::COLOR_ORANGE)); +// } +// count++; +// continue; +// } +// +// if (m_AlarmCfgWrapper->m_InverterRunSignalAlarm&&m_AlarmCfgWrapper->m_InverterRunSignalAlarm->m_IsEnable) +// { +// if (m_AlarmCfgWrapper->m_InverterRunSignalAlarm->m_IsAlarm) { +// if ((count % 20) == 0) { +// count = 0; +// g_Toast->AddToast(new ToastBean(_(u8"正在变频器运行信号"), 3000, Toast::COLOR_ORANGE)); +// } +// count++; +// continue; +// } +// } +// if (m_AlarmCfgWrapper->m_PrintSignalAlarm&&m_AlarmCfgWrapper->m_PrintSignalAlarm->m_IsEnable) +// { +// if (m_AlarmCfgWrapper->m_PrintSignalAlarm->m_IsAlarm) { +// if ((count % 20) == 0) { +// count = 0; +// g_Toast->AddToast(new ToastBean(_(u8"正在等待可打印信号"), 3000, Toast::COLOR_ORANGE)); +// } +// count++; +// continue; +// } +// } +// break; +// } +// if (!BaseCtrl::IsPrePrint()) { +// return false; +// } +// return true; +//} void XTPurifier::UpdateShowStat() { @@ -400,159 +400,159 @@ void XTPurifier::UpdateShowStat() } -void XTPurifier::AutoCtrl() -{ - if (m_IsDeoxygenStarted && !m_State.isPurifying) - { - m_IsDeoxygenStarted = false; - if (!m_HadCalcDeoxygenTime) { - m_LastDeoxygenTime = (GetTickCount64() - m_LastStartDeoxygenTime) /1000.0f/ 60.0f; - m_HadCalcDeoxygenTime = true; - } - } - if (!BaseCtrl::IsStandBy() || m_State.isPurifying || m_State.isDedusting) - { - if (m_State.isBlowBack) { - g_Toast->AddToast(new ToastBean(_(u8"存在不允许反吹条件,反吹中断"), 3000, Toast::COLOR_RED)); - m_Client->SetBlowBack(false); - Sleep(500); - } - } - - /*if (((g_SystemInfo->m_ComPrintOxygen1 > m_RunCfg->m_AlarmOxygen) || (g_SystemInfo->m_ComPrintOxygen2 > m_RunCfg->m_AlarmOxygen)) && !m_RunCfg->m_IsDebugMode) { - if (m_State.isDedusting) { - g_Toast->AddToast(new ToastBean(u8"氧含量越限,循环关闭", 3000, Toast::COLOR_RED)); - m_Client->SetDedust(false); - Sleep(1000); - UpdateShowStat(); - } - }*/ - - if (!m_ManualCheckAirTightness) { - if (m_State.isPurifying || m_State.isDedusting) { - if (m_IOCfgWrapper->m_PurifierCoolerPower) { - m_IOCfgWrapper->m_PurifierCoolerPower->SetActive(true); - } - if (m_IOCfgWrapper->m_PrintAssistGas && !m_IOCfgWrapper->m_PrintAssistGas->IsActive()) { - m_IOCfgWrapper->m_PrintAssistGas->SetActive(true); - } - - } - else { - if (m_IOCfgWrapper->m_PurifierCoolerPower) { - m_IOCfgWrapper->m_PurifierCoolerPower->SetActive(false); - } - if (m_IOCfgWrapper->m_PrintAssistGas && m_IOCfgWrapper->m_PrintAssistGas->IsActive()) { - m_IOCfgWrapper->m_PrintAssistGas->SetActive(false); - } - } - m_IOCfgWrapper->m_PrintAirEvacuation->SetActive(m_State.isPurifying); - } - - bool isDedustingStopAlarm = !m_State.isDedusting; - - if (isDedustingStopAlarm) { - uint64_t tnow = GetTickCount64(); - if (tnow - m_DudestingAlarmTick > 1500) { - g_SystemInfo->SetDedustingStopAlarm(true); - } - } - else { - m_DudestingAlarmTick = GetTickCount64(); - g_SystemInfo->SetDedustingStopAlarm(false); - } - - if (m_AlarmCfgWrapper->m_PurifierKeepAliveAlarm) - { - int tick = m_RunCfg->m_PurifierKeepAliveAlarmJudgeSecond * 1000 / m_CycleTick; - if (m_State.keepAlive == m_LastKeepAlive) { - m_AlarmCfgWrapper->m_PurifierKeepAliveAlarm->m_AlarmContinueTick++; - if (m_AlarmCfgWrapper->m_PurifierKeepAliveAlarm->m_AlarmContinueTick > tick) { - m_AlarmCfgWrapper->m_PurifierKeepAliveAlarm->m_AlarmContinueTick = tick+1; - SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierKeepAliveAlarm,true); - } - } - else { - m_AlarmCfgWrapper->m_PurifierKeepAliveAlarm->m_AlarmContinueTick = 0; - SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierKeepAliveAlarm, false); - } - m_LastKeepAlive = m_State.keepAlive; - } - - if (m_AlarmCfgWrapper->m_WindOverLimitAlarm && m_AlarmCfgWrapper->m_WindOverLimitJudgeFlag > 600) { - float alarmPercent = m_ExtCfg->m_FanWindFit[m_ExtCfg->m_SelectedFanWindFit]->checkAlarmPercent; - float minAlarm = m_State.windSetValue * (1.0f - alarmPercent / 100.0f); - float maxAlarm = m_State.windSetValue * (1.0f + alarmPercent / 100.0f); - float actV = m_State.windActualValue; - if ((actV > maxAlarm || actV < minAlarm)) { - m_AlarmCfgWrapper->m_WindOverLimitAlarm->m_AlarmInfo = to_string(actV); - m_AlarmCfgWrapper->m_WindOverLimitAlarm->m_IsAlarm = true; - } - else - { - m_AlarmCfgWrapper->m_WindOverLimitAlarm->m_AlarmInfo = ""; - m_AlarmCfgWrapper->m_WindOverLimitAlarm->m_IsAlarm = false; - } - } - - m_AlarmCfgWrapper->m_WindOverLimitJudgeFlag++; - if (m_AlarmCfgWrapper->m_WindOverLimitJudgeFlag > 700)m_AlarmCfgWrapper->m_WindOverLimitJudgeFlag = 700; - - CheckInternalAlarm(); - //关闭补气阀 - - SignalState ss; - SignalService::GetInstance().GetSignalState(ss); - if (m_RunCfg->m_PrintAutoRenewalGas) { - if (BaseCtrl::IsStart()|| BaseCtrl::IsPause()) { - if (m_Client->IsComConnected()) - { - if (ss.m_PrintAirRenewalEnable) - { - if (!m_State.shieldMonitorPrintPressure) { - m_Client->SetShieldMonitorPrintPressure(true); - } - if (!ss.m_PrintAirRenewalTrigger) { - SignalService::GetInstance().SetPrintAirRenewalTrigger(true); - } - } - else { - if (m_State.shieldMonitorPrintPressure) { - m_Client->SetShieldMonitorPrintPressure(false); - } - if (ss.m_PrintAirRenewalTrigger) { - SignalService::GetInstance().SetPrintAirRenewalTrigger(false); - } - } - } - else { - if (m_State.shieldMonitorPrintPressure) { - m_Client->SetShieldMonitorPrintPressure(false); - } - if (ss.m_PrintAirRenewalTrigger) { - SignalService::GetInstance().SetPrintAirRenewalTrigger(false); - } - } - } - else { - if (m_State.shieldMonitorPrintPressure) { - m_Client->SetShieldMonitorPrintPressure(false); - } - if (ss.m_PrintAirRenewalTrigger) { - SignalService::GetInstance().SetPrintAirRenewalTrigger(false); - } - } - } - else { - if (m_State.shieldMonitorPrintPressure) { - m_Client->SetShieldMonitorPrintPressure(false); - } - if (ss.m_PrintAirRenewalTrigger) { - SignalService::GetInstance().SetPrintAirRenewalTrigger(false); - } - } - -} +//void XTPurifier::AutoCtrl() +//{ +// if (m_IsDeoxygenStarted && !m_State.isPurifying) +// { +// m_IsDeoxygenStarted = false; +// if (!m_HadCalcDeoxygenTime) { +// m_LastDeoxygenTime = (GetTickCount64() - m_LastStartDeoxygenTime) /1000.0f/ 60.0f; +// m_HadCalcDeoxygenTime = true; +// } +// } +// if (!BaseCtrl::IsStandBy() || m_State.isPurifying || m_State.isDedusting) +// { +// if (m_State.isBlowBack) { +// g_Toast->AddToast(new ToastBean(_(u8"存在不允许反吹条件,反吹中断"), 3000, Toast::COLOR_RED)); +// m_Client->SetBlowBack(false); +// Sleep(500); +// } +// } +// +// /*if (((g_SystemInfo->m_ComPrintOxygen1 > m_RunCfg->m_AlarmOxygen) || (g_SystemInfo->m_ComPrintOxygen2 > m_RunCfg->m_AlarmOxygen)) && !m_RunCfg->m_IsDebugMode) { +// if (m_State.isDedusting) { +// g_Toast->AddToast(new ToastBean(u8"氧含量越限,循环关闭", 3000, Toast::COLOR_RED)); +// m_Client->SetDedust(false); +// Sleep(1000); +// UpdateShowStat(); +// } +// }*/ +// +// if (!m_ManualCheckAirTightness) { +// if (m_State.isPurifying || m_State.isDedusting) { +// if (m_IOCfgWrapper->m_PurifierCoolerPower) { +// m_IOCfgWrapper->m_PurifierCoolerPower->SetActive(true); +// } +// if (m_IOCfgWrapper->m_PrintAssistGas && !m_IOCfgWrapper->m_PrintAssistGas->IsActive()) { +// m_IOCfgWrapper->m_PrintAssistGas->SetActive(true); +// } +// +// } +// else { +// if (m_IOCfgWrapper->m_PurifierCoolerPower) { +// m_IOCfgWrapper->m_PurifierCoolerPower->SetActive(false); +// } +// if (m_IOCfgWrapper->m_PrintAssistGas && m_IOCfgWrapper->m_PrintAssistGas->IsActive()) { +// m_IOCfgWrapper->m_PrintAssistGas->SetActive(false); +// } +// } +// m_IOCfgWrapper->m_PrintAirEvacuation->SetActive(m_State.isPurifying); +// } +// +// bool isDedustingStopAlarm = !m_State.isDedusting; +// +// if (isDedustingStopAlarm) { +// uint64_t tnow = GetTickCount64(); +// if (tnow - m_DudestingAlarmTick > 1500) { +// g_SystemInfo->SetDedustingStopAlarm(true); +// } +// } +// else { +// m_DudestingAlarmTick = GetTickCount64(); +// g_SystemInfo->SetDedustingStopAlarm(false); +// } +// +// if (m_AlarmCfgWrapper->m_PurifierKeepAliveAlarm) +// { +// int tick = m_RunCfg->m_PurifierKeepAliveAlarmJudgeSecond * 1000 / m_CycleTick; +// if (m_State.keepAlive == m_LastKeepAlive) { +// m_AlarmCfgWrapper->m_PurifierKeepAliveAlarm->m_AlarmContinueTick++; +// if (m_AlarmCfgWrapper->m_PurifierKeepAliveAlarm->m_AlarmContinueTick > tick) { +// m_AlarmCfgWrapper->m_PurifierKeepAliveAlarm->m_AlarmContinueTick = tick+1; +// SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierKeepAliveAlarm,true); +// } +// } +// else { +// m_AlarmCfgWrapper->m_PurifierKeepAliveAlarm->m_AlarmContinueTick = 0; +// SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierKeepAliveAlarm, false); +// } +// m_LastKeepAlive = m_State.keepAlive; +// } +// +// if (m_AlarmCfgWrapper->m_WindOverLimitAlarm && m_AlarmCfgWrapper->m_WindOverLimitJudgeFlag > 600) { +// float alarmPercent = m_ExtCfg->m_FanWindFit[m_ExtCfg->m_SelectedFanWindFit]->checkAlarmPercent; +// float minAlarm = m_State.windSetValue * (1.0f - alarmPercent / 100.0f); +// float maxAlarm = m_State.windSetValue * (1.0f + alarmPercent / 100.0f); +// float actV = m_State.windActualValue; +// if ((actV > maxAlarm || actV < minAlarm)) { +// m_AlarmCfgWrapper->m_WindOverLimitAlarm->m_AlarmInfo = to_string(actV); +// m_AlarmCfgWrapper->m_WindOverLimitAlarm->m_IsAlarm = true; +// } +// else +// { +// m_AlarmCfgWrapper->m_WindOverLimitAlarm->m_AlarmInfo = ""; +// m_AlarmCfgWrapper->m_WindOverLimitAlarm->m_IsAlarm = false; +// } +// } +// +// m_AlarmCfgWrapper->m_WindOverLimitJudgeFlag++; +// if (m_AlarmCfgWrapper->m_WindOverLimitJudgeFlag > 700)m_AlarmCfgWrapper->m_WindOverLimitJudgeFlag = 700; +// +// CheckInternalAlarm(); +// //关闭补气阀 +// +// SignalState ss; +// SignalService::GetInstance().GetSignalState(ss); +// if (m_RunCfg->m_PrintAutoRenewalGas) { +// if (BaseCtrl::IsStart()|| BaseCtrl::IsPause()) { +// if (m_Client->IsComConnected()) +// { +// if (ss.m_PrintAirRenewalEnable) +// { +// if (!m_State.shieldMonitorPrintPressure) { +// m_Client->SetShieldMonitorPrintPressure(true); +// } +// if (!ss.m_PrintAirRenewalTrigger) { +// SignalService::GetInstance().SetPrintAirRenewalTrigger(true); +// } +// } +// else { +// if (m_State.shieldMonitorPrintPressure) { +// m_Client->SetShieldMonitorPrintPressure(false); +// } +// if (ss.m_PrintAirRenewalTrigger) { +// SignalService::GetInstance().SetPrintAirRenewalTrigger(false); +// } +// } +// } +// else { +// if (m_State.shieldMonitorPrintPressure) { +// m_Client->SetShieldMonitorPrintPressure(false); +// } +// if (ss.m_PrintAirRenewalTrigger) { +// SignalService::GetInstance().SetPrintAirRenewalTrigger(false); +// } +// } +// } +// else { +// if (m_State.shieldMonitorPrintPressure) { +// m_Client->SetShieldMonitorPrintPressure(false); +// } +// if (ss.m_PrintAirRenewalTrigger) { +// SignalService::GetInstance().SetPrintAirRenewalTrigger(false); +// } +// } +// } +// else { +// if (m_State.shieldMonitorPrintPressure) { +// m_Client->SetShieldMonitorPrintPressure(false); +// } +// if (ss.m_PrintAirRenewalTrigger) { +// SignalService::GetInstance().SetPrintAirRenewalTrigger(false); +// } +// } +// +//} void XTPurifier::CheckInternalAlarm() { @@ -611,11 +611,11 @@ void XTPurifier::CheckInternalAlarm() if (hasAlarm) { m_AlarmCfgWrapper->m_PurifierInternalAlarm->m_AlarmInfo = ss.str().c_str(); - SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierInternalAlarm, true); + //SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierInternalAlarm, true); } else { m_AlarmCfgWrapper->m_PurifierInternalAlarm->m_AlarmInfo = ""; - SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierInternalAlarm, false); + //SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierInternalAlarm, false); } } @@ -1693,7 +1693,7 @@ bool XTPurifier::IsCoverWindSlow() void XTPurifier::ResetSlowWind() { - m_Client->SetCoverWind(false); + /*m_Client->SetCoverWind(false);*/ } @@ -1704,16 +1704,16 @@ bool XTPurifier::IsCoverWindSet() return stat.isCoverWind; } -void XTPurifier::ResetSlwoWindSignal(bool precover) -{ - if (precover) - { - m_Client->SetWindSlowFinishSignal(false); - } - else { - m_Client->SetWindResumeFinishSignal(false); - } -} +//void XTPurifier::ResetSlwoWindSignal(bool precover) +//{ +// if (precover) +// { +// m_Client->SetWindSlowFinishSignal(false); +// } +// else { +// m_Client->SetWindResumeFinishSignal(false); +// } +//} int XTPurifier::GetFilterUseTime() { diff --git a/PrintC/Purifier/XTPurifier.h b/PrintC/Purifier/XTPurifier.h index 8638204..f0c50c1 100644 --- a/PrintC/Purifier/XTPurifier.h +++ b/PrintC/Purifier/XTPurifier.h @@ -15,13 +15,13 @@ public: void StartAutoDeoxygen(); void StopAutoDeoxygen(); bool IsAutoDeoxygen(); - void AutoCtrl(); + void AutoCtrl(){} void AutoCtrlWhenPrint(); void AutoCtrlWhenDoorOpen(); void AutoCtrlWhenStanby(); void HandlePrintFinish(); void HandlePrintStop(); - bool HandleReadyPrint(bool startAfterPause, unsigned int& deoxytime); + bool HandleReadyPrint(bool startAfterPause, unsigned int& deoxytime) { return false; } PurifierClient* GetClient() { return m_Client; } double GetWindValue(double dvalue); @@ -36,7 +36,7 @@ public: virtual bool IsCoverWindRecover(); virtual bool IsCoverWindSlow(); virtual void ResetSlowWind(); - virtual void ResetSlwoWindSignal(bool precover); + //virtual void ResetSlwoWindSignal(bool precover); float GetFanFreq() { return m_State.fanFreq; } void CheckInternalAlarm(); diff --git a/PrintC/UI/Controller.cpp b/PrintC/UI/Controller.cpp index 013db8a..5cf92bc 100644 --- a/PrintC/UI/Controller.cpp +++ b/PrintC/UI/Controller.cpp @@ -48,16 +48,16 @@ bool Controller::Init() { switch (m_MachineCfg->m_PulifierType) { case PurifierTypeCfg::XT: { - m_Purifier = new XTPurifier(m_ScannerCtrl); + m_Purifier = new XTPurifier(nullptr); }break; case PurifierTypeCfg::HBD_PURIFIER_3: { - m_Purifier = new HBD3Purifier(m_ScannerCtrl); + m_Purifier = new HBD3Purifier(/*m_ScannerCtrl*/nullptr); }break; case PurifierTypeCfg::G4_PURIFIER: { - m_Purifier = new G4Purifier(m_ScannerCtrl); + m_Purifier = new G4Purifier(/*m_ScannerCtrl*/nullptr); }break; default: - m_Purifier = new XTPurifier(m_ScannerCtrl); + m_Purifier = new XTPurifier(/*m_ScannerCtrl*/nullptr); } m_Purifier->Init(); diff --git a/PrintC/output/Release/log/2024.hbd b/PrintC/output/Release/log/2024.hbd index 54ceacc..e9c05d6 100644 Binary files a/PrintC/output/Release/log/2024.hbd and b/PrintC/output/Release/log/2024.hbd differ diff --git a/PrintC/问题记录.txt b/PrintC/问题记录.txt index e089ad9..a778617 100644 --- a/PrintC/问题记录.txt +++ b/PrintC/问题记录.txt @@ -1,3 +1,5 @@ 辅机的配置信息获取 -m_alarmCfgMp \ No newline at end of file +m_alarmCfgMp + +SignalService::GetInstance().SetAlarm(m_AlarmCfgWrapper->m_PurifierInternalAlarm, true); 注释掉了 \ No newline at end of file diff --git a/PrintS/Communication/BaseClient.cpp b/PrintS/Communication/BaseClient.cpp index 03dd701..11ea487 100644 --- a/PrintS/Communication/BaseClient.cpp +++ b/PrintS/Communication/BaseClient.cpp @@ -148,7 +148,7 @@ void BaseClient::SendToClients(WRITETYPE type,const string& addKey) { ++baseItem; } LeaveCriticalSection(&m_ValueCS); - ClientWrapper::Instance()->PushAllClient(new WriteData(type, its)); + ClientWrapper::Instance()->PushAllClient(WriteData(type, its)); //auto cfgItem = m_alarmCfgMp.begin(); diff --git a/PrintS/Communication/PurifierClient.cpp b/PrintS/Communication/PurifierClient.cpp index b3d270e..ae92c3a 100644 --- a/PrintS/Communication/PurifierClient.cpp +++ b/PrintS/Communication/PurifierClient.cpp @@ -10,6 +10,9 @@ PurifierClient::PurifierClient(CommunicationCfg* pconfig) :S7Client(pconfig) m_RunCfg = ConfigManager::GetInstance()->GetRunCfg(); m_ExtCfg = ConfigManager::GetInstance()->GetExtCfg(); m_AlarmCfgWrapper = ConfigManager::GetInstance()->GetAlarmCfg(); + + + } @@ -979,4 +982,116 @@ void PurifierClient::SetUnLock() m_RTCommands.push(pcommand); LeaveCriticalSection(&m_RtcCS); -} \ No newline at end of file +} + + +//void PurifierClient::SetParamByKey(const ReadData& rd) { +// if (rd.nameKey == "SetDedust") { +// SetDedust((bool)atoi(rd.strValue.c_str())); +// } +// else if (rd.nameKey == "SetBlowBack") { +// SetBlowBack((bool)atoi(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetFilterDiscard") { +// SetFilterDiscard((bool)atoi(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetFilterClean") { +// SetFilterClean((bool)atoi(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetHopperClean") { +// SetHopperClean((bool)atoi(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetPurify") { +// SetPurify((bool)atoi(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetBoxClean") { +// SetBoxClean((bool)atoi(rd.strValue.data())); +// } +// else if (rd.nameKey == "ResetFilterTime") { +// ResetFilterTime(); +// } +// else if (rd.nameKey == "ClearHopperAlarm") { +// ClearHopperAlarm(); +// } +// +// else if (rd.nameKey == "SetBoxPressureUpLimit") { +// SetBoxPressureUpLimit((float)atof(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetBoxPressureDownLimit") { +// SetBoxPressureDownLimit((float)atof(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetMidPressureDifAlarmValue") { +// SetMidPressureDifAlarmValue((float)atof(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetHighPressureDifAlarmValue") { +// SetHighPressureDifAlarmValue((float)atof(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetPrintCleanOxygenSetValue") { +// SetPrintCleanOxygenSetValue((float)atof(rd.strValue.data())); +// } +// +// else if (rd.nameKey == "SetWindValue") { +// SetWindValue((float)atof(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetMaxWindValue") { +// SetMaxWindValue((float)atof(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetPrintOxygenDownSetValue") { +// SetPrintOxygenDownSetValue((float)atof(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetPrintOxygenUpSetValue") { +// SetPrintOxygenUpSetValue((float)atof(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetfilterCleanOxygenSetValue") { +// SetfilterCleanOxygenSetValue((float)atof(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetMidTempHighSetValue") { +// SetMidTempHighSetValue((float)atof(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetMidTempUltraSetValue") { +// SetMidTempUltraSetValue((float)atof(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetHighTempHighSetValue") { +// SetHighTempHighSetValue((float)atof(rd.strValue.data())); +// } +// +// else if (rd.nameKey == "SetHopperCleanRemind") { +// SetHopperCleanRemind((unsigned short)atoi(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetBoxWashDelayTime") { +// SetBoxWashDelayTime((unsigned short)atoi(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetDedustingWashDelayTime") { +// SetDedustingWashDelayTime((unsigned short)atoi(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetPressureRangeUpLimit") { +// SetPressureRangeUpLimit((float)atof(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetPressureRangeDownLimit") { +// SetPressureRangeDownLimit((float)atof(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetOxygenAlarmValue") { +// SetOxygenAlarmValue((float)atof(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetUseArgon") { +// SetUseArgon((bool)atoi(rd.strValue.data())); +// } +// +// else if (rd.nameKey == "SetBlowBackBlowTime") { +// SetBlowBackBlowTime((unsigned short)atoi(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetBlowBackSetTimes") { +// SetBlowBackSetTimes((unsigned short)atoi(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetProtectionPressureSetTime") { +// SetProtectionPressureSetTime((unsigned short)atoi(rd.strValue.data())); +// } +// else if (rd.nameKey == "SetUnLock") { +// SetUnLock(); +// } +// else { +// printf("%s key do not exist...", rd.nameKey.data()); +// } +// +// +//} \ No newline at end of file diff --git a/PrintS/Communication/PurifierClient.h b/PrintS/Communication/PurifierClient.h index 1295f23..729158a 100644 --- a/PrintS/Communication/PurifierClient.h +++ b/PrintS/Communication/PurifierClient.h @@ -573,14 +573,20 @@ public: #pragma pack() + class PurifierClient :public S7Client { + //typedef std::function SetParamFun; + //m_funMap["SetDedust"] = std::bind(&PurifierClient::SetDedustFun,this, std::placeholders::_1, std::placeholders::_2); + //unordered_map m_funMap; public: PurifierClient(CommunicationCfg* pconfig); ~PurifierClient(); void GetStat(Purifierstat_XT& stat); - + + void SetParamByKey(const ReadData& rd); + void SetDedust(bool bvalue); //除尘启动或停止 void SetBlowBack(bool bvalue); //反吹启动或停止 void SetFilterDiscard(bool bvalue); //滤芯废处理 @@ -590,12 +596,51 @@ public: void SetBoxClean(bool bvalue); void ResetFilterTime(); void ClearHopperAlarm(); + //void SetDedustFun(const string& val, DATATYPE type) { + // if (iBOOL == type) SetDedust(atoi(val.c_str())); + //} + //void SetBlowBackFun(const string& val, DATATYPE type) { + // if (iBOOL == type) SetBlowBack(atoi(val.c_str())); + //} + //void SetFilterDiscardFun(const string& val, DATATYPE type) { + // if (iBOOL == type) SetFilterDiscard(atoi(val.c_str())); + //} + //void SetFilterCleanFun(const string& val, DATATYPE type) { + // if (iBOOL == type) SetFilterClean(atoi(val.c_str())); + //} + //void SetHopperCleanFun(const string& val, DATATYPE type) { + // if (iBOOL == type) SetHopperClean(atoi(val.c_str())); + //} + //void SetPurifyFun(const string& val, DATATYPE type) { + // if (iBOOL == type) SetPurify(atoi(val.c_str())); + //} + //void SetBoxCleanFun(const string& val, DATATYPE type) { + // if (iBOOL == type) SetBoxClean(atoi(val.c_str())); + //} + void SetBoxPressureUpLimit(float fvalue); //箱体压力上限设定 void SetBoxPressureDownLimit(float fvalue); //箱体压力下限设定 void SetMidPressureDifAlarmValue(float fvalue); //中效过滤器压差报警设 void SetHighPressureDifAlarmValue(float fvalue); //高效过滤器压差报警设 void SetPrintCleanOxygenSetValue(float fvalue); //打印室氧清洗氧含量设 + //void SetBoxPressureUpLimitFun(const string& val, DATATYPE type) { + // if (iFLOAT == type) SetBoxPressureUpLimit(atof(val.c_str())); + //} + //void SetBoxPressureDownLimitFun(const string& val, DATATYPE type) { + // if (iFLOAT == type) SetBoxPressureDownLimit(atof(val.c_str())); + //} + //void SetMidPressureDifAlarmValueFun(const string& val, DATATYPE type) { + // if (iFLOAT == type) SetMidPressureDifAlarmValue(atof(val.c_str())); + //} + //void SetHighPressureDifAlarmValueFun(const string& val, DATATYPE type) { + // if (iFLOAT == type) SetHighPressureDifAlarmValue(atof(val.c_str())); + //} + //void SetPrintCleanOxygenSetValueFun(const string& val, DATATYPE type) { + // if (iFLOAT == type) SetPrintCleanOxygenSetValue(atof(val.c_str())); + //} + + void SetWindValue(float fvalue); //风速设定 void SetMaxWindValue(float fvalue); //最大风速设定 void SetPrintOxygenDownSetValue(float fvalue); //打印氧下限设定 @@ -604,6 +649,31 @@ public: void SetMidTempHighSetValue(float fvalue); //中效高温报警设定 void SetMidTempUltraSetValue(float fvalue); //中效超高温报警设定 void SetHighTempHighSetValue(float fvalue); //高效高温报警设定 + //void SetWindValueFun(const string& val, DATATYPE type) { + // if (iFLOAT == type) SetWindValue(atof(val.c_str())); + //} + //void SetMaxWindValueFun(const string& val, DATATYPE type) { + // if (iFLOAT == type) SetMaxWindValue(atof(val.c_str())); + //} + //void SetPrintOxygenDownSetValueFun(const string& val, DATATYPE type) { + // if (iFLOAT == type) SetPrintOxygenDownSetValue(atof(val.c_str())); + //} + //void SetPrintOxygenUpSetValueFun(const string& val, DATATYPE type) { + // if (iFLOAT == type) SetPrintOxygenUpSetValue(atof(val.c_str())); + //} + //void SetfilterCleanOxygenSetValueFun(const string& val, DATATYPE type) { + // if (iFLOAT == type) SetfilterCleanOxygenSetValue(atof(val.c_str())); + //} + //void SetMidTempHighSetValueFun(const string& val, DATATYPE type) { + // if (iFLOAT == type) SetMidTempHighSetValue(atof(val.c_str())); + //} + //void SetMidTempUltraSetValueFun(const string& val, DATATYPE type) { + // if (iFLOAT == type) SetMidTempUltraSetValue(atof(val.c_str())); + //} + //void SetHighTempHighSetValueFun(const string& val, DATATYPE type) { + // if (iFLOAT == type) SetHighTempHighSetValue(atof(val.c_str())); + //} + // void SetHighTempUltraSetValue(float fvalue); //高效超高温报警设定 void SetHopperCleanRemind(unsigned short value); //清理料斗提醒设定 void SetBoxWashDelayTime(unsigned short value); @@ -648,8 +718,11 @@ protected: RunCfg* m_RunCfg; ExtCfg* m_ExtCfg; AlarmCfgWrapper* m_AlarmCfgWrapper; + + private: + static const unsigned int READ_ITEM_COUNT = 2; static const unsigned int READ_ITEM_COUNT2 = 6; }; diff --git a/PrintS/Controller/Controller.cpp b/PrintS/Controller/Controller.cpp index 4ca0af3..064ed79 100644 --- a/PrintS/Controller/Controller.cpp +++ b/PrintS/Controller/Controller.cpp @@ -63,7 +63,6 @@ void Controller::Init(){ m_CoreCommunication->Init(); m_CoreCommunication->Startup(); - m_SignalStateWrapper = new SignalStateWrapper(); m_Machine = ConfigManager::GetInstance()->GetMachine(); m_Machine->InitSignal(m_SignalStateWrapper, m_CoreCommunication); diff --git a/PrintS/DataManage/ClientInfo.cpp b/PrintS/DataManage/ClientInfo.cpp index 447c4c4..c39151a 100644 --- a/PrintS/DataManage/ClientInfo.cpp +++ b/PrintS/DataManage/ClientInfo.cpp @@ -40,11 +40,11 @@ void ClientWrapper::Clear() { } -void ClientWrapper::PushAllClient(WriteData* wd) { +void ClientWrapper::PushAllClient(const WriteData& wd) { std::lock_guard lck(m_mux); auto client = m_clientList.begin(); while (client != m_clientList.end()) { - (*client)->PushMsg(wd); + (*client)->PushMsg(new WriteData(wd)); ++client; } } diff --git a/PrintS/DataManage/ClientInfo.h b/PrintS/DataManage/ClientInfo.h index 650b854..8245010 100644 --- a/PrintS/DataManage/ClientInfo.h +++ b/PrintS/DataManage/ClientInfo.h @@ -23,6 +23,13 @@ public: ~ClientInfo() { m_readQuitFlag = true; m_writeQuitFlag = true; + + std::lock_guard lock(m_msgLock); + auto lst = m_msgList.begin(); + while (lst != m_msgList.end()) { + delete (*lst); + } + m_msgList.clear(); } bool IsConnect() { @@ -73,7 +80,7 @@ public: void Clear(); //清空客户端 - void PushAllClient(WriteData* wd); + void PushAllClient(const WriteData& wd); bool IsExist(ClientInfo* ci); diff --git a/PrintS/DataManage/DataHandle.cpp b/PrintS/DataManage/DataHandle.cpp index 551de7e..267b594 100644 --- a/PrintS/DataManage/DataHandle.cpp +++ b/PrintS/DataManage/DataHandle.cpp @@ -51,7 +51,7 @@ void DataHandle::Init() { m_testTd = std::thread ([this] { static float i = 10.12540f; while (!m_testFlag) { - ClientWrapper::Instance()->PushAllClient(new WriteData(RESPOND, { {string("hello"),std::to_string(i),iFLOAT}})); + ClientWrapper::Instance()->PushAllClient(WriteData(RESPOND, { {string("hello"),std::to_string(i),iFLOAT}})); std::this_thread::sleep_for(std::chrono::seconds(1)); } }); @@ -213,6 +213,8 @@ void DataHandle::DataCallBackHandle(const ReadData& msg) { case RESETELEC: m_controller->m_ComServer->m_PowerMeterClient->ResetElec(); + case PURIFIERPARAMW: + m_controller->m_Purifier->SetParam(msg); default: break; diff --git a/PrintS/DataManage/RWData.h b/PrintS/DataManage/RWData.h index 4f8a6c1..eba8c2b 100644 --- a/PrintS/DataManage/RWData.h +++ b/PrintS/DataManage/RWData.h @@ -44,8 +44,11 @@ enum READTYPE { IOSIGNAL, //io 信号 RESETELEC, //PowerMeterClient + PURIFIERPARAMW, //净化器参数写入 LAYERDATAREQ, //layer数据请求 + + }; enum DATATYPE { @@ -114,6 +117,7 @@ enum WRITETYPE { SCANNERPOWERPARAM, PURIFIERPARAM, //冷水机参数 + }; struct Item { diff --git a/PrintS/DataManage/StreamServer.cpp b/PrintS/DataManage/StreamServer.cpp index d27ba69..d9876b7 100644 --- a/PrintS/DataManage/StreamServer.cpp +++ b/PrintS/DataManage/StreamServer.cpp @@ -21,7 +21,6 @@ StreamServer::~StreamServer() { //回复后连接中断 ::grpc::Status StreamServer::Simple(::grpc::ServerContext* context, const ::stream::RequestInfo* request, ::stream::LayerData* response) { - //MetaData::Layer* pData = nullptr; ReadData readData; readData.dataType = (READTYPE)(request->datatype()); readData.nameKey = request->namekey(); diff --git a/PrintS/PLC/CoreCommunication.cpp b/PrintS/PLC/CoreCommunication.cpp index 4d166c1..05a8516 100644 --- a/PrintS/PLC/CoreCommunication.cpp +++ b/PrintS/PLC/CoreCommunication.cpp @@ -427,7 +427,7 @@ void CoreCommunication::SendProc() { its.emplace_back(Item{ param->first,valStr,dataType}); ++param; } - ClientWrapper::Instance()->PushAllClient(new WriteData(SYSPARAMDATA, its)); + ClientWrapper::Instance()->PushAllClient(WriteData(SYSPARAMDATA, its)); valStr = ""; its.clear(); @@ -439,7 +439,7 @@ void CoreCommunication::SendProc() { } ++ioItem; } - ClientWrapper::Instance()->PushAllClient(new WriteData(SYSPARAMDATA, its)); + ClientWrapper::Instance()->PushAllClient(WriteData(SYSPARAMDATA, its)); int count = 10; while(!m_sendTdExitFlag && count--) { diff --git a/PrintS/Purifier/BasePurifier.h b/PrintS/Purifier/BasePurifier.h index 2fb5f64..5ab4e8c 100644 --- a/PrintS/Purifier/BasePurifier.h +++ b/PrintS/Purifier/BasePurifier.h @@ -53,6 +53,9 @@ public: virtual void DrawFinishReportRel() {} virtual int GetFilterUseTime() { return 0; } virtual void SendToClients() {} + + virtual void SetParam(const ReadData& msg) {} + private: static DWORD WINAPI WorkProc(BasePurifier* _this); void WorkRun(); diff --git a/PrintS/Purifier/G4Purifier.h b/PrintS/Purifier/G4Purifier.h index 6d2ad5a..db077e3 100644 --- a/PrintS/Purifier/G4Purifier.h +++ b/PrintS/Purifier/G4Purifier.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "XTPurifier.h" class G4Purifier :public XTPurifier { @@ -7,10 +7,10 @@ public: ~G4Purifier(); void Init(); - void DrawUI(); + //void DrawUI(); void CheckInternalAlarm(); bool IsLockPurifier(); private: - void DrawUserUI(); - void DrawAdminUI(); + //void DrawUserUI(); + //void DrawAdminUI(); }; diff --git a/PrintS/Purifier/XTPurifier.cpp b/PrintS/Purifier/XTPurifier.cpp index 8dff94a..1ff0f00 100644 --- a/PrintS/Purifier/XTPurifier.cpp +++ b/PrintS/Purifier/XTPurifier.cpp @@ -1748,4 +1748,134 @@ void XTPurifier::DrawFinishReportRel() void XTPurifier::SendToClients() { m_Client->SendToClients(PURIFIERPARAM); +} + + +void XTPurifier::SetParam(const ReadData& rd) { + + if (rd.nameKey == "SetDedust") { + m_Client->SetDedust((bool)atoi(rd.strValue.c_str())); + } + else if (rd.nameKey == "SetBlowBack") { + m_Client->SetBlowBack((bool)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "SetFilterDiscard") { + m_Client->SetFilterDiscard((bool)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "SetFilterClean") { + m_Client->SetFilterClean((bool)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "SetHopperClean") { + m_Client->SetHopperClean((bool)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "SetPurify") { + m_Client->SetPurify((bool)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "SetBoxClean") { + m_Client->SetBoxClean((bool)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "ResetFilterTime") { + m_Client->ResetFilterTime(); + } + else if (rd.nameKey == "ClearHopperAlarm") { + m_Client->ClearHopperAlarm(); + } + else if (rd.nameKey == "SetBoxPressureUpLimit") { + m_Client->SetBoxPressureUpLimit((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetBoxPressureDownLimit") { + m_Client->SetBoxPressureDownLimit((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetMidPressureDifAlarmValue") { + m_Client->SetMidPressureDifAlarmValue((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetHighPressureDifAlarmValue") { + m_Client->SetHighPressureDifAlarmValue((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetPrintCleanOxygenSetValue") { + m_Client->SetPrintCleanOxygenSetValue((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetWindValue") { + m_Client->SetWindValue((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetMaxWindValue") { + m_Client->SetMaxWindValue((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetPrintOxygenDownSetValue") { + m_Client->SetPrintOxygenDownSetValue((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetPrintOxygenUpSetValue") { + m_Client->SetPrintOxygenUpSetValue((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetfilterCleanOxygenSetValue") { + m_Client->SetfilterCleanOxygenSetValue((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetMidTempHighSetValue") { + m_Client->SetMidTempHighSetValue((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetMidTempUltraSetValue") { + m_Client->SetMidTempUltraSetValue((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetHighTempHighSetValue") { + m_Client->SetHighTempHighSetValue((float)atof(rd.strValue.data())); + } + + else if (rd.nameKey == "SetHopperCleanRemind") { + m_Client->SetHopperCleanRemind((unsigned short)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "SetBoxWashDelayTime") { + m_Client->SetBoxWashDelayTime((unsigned short)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "SetDedustingWashDelayTime") { + m_Client->SetDedustingWashDelayTime((unsigned short)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "SetPressureRangeUpLimit") { + m_Client->SetPressureRangeUpLimit((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetPressureRangeDownLimit") { + m_Client->SetPressureRangeDownLimit((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetOxygenAlarmValue") { + m_Client->SetOxygenAlarmValue((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetUseArgon") { + m_Client->SetUseArgon((bool)atoi(rd.strValue.data())); + } + + else if (rd.nameKey == "SetBlowBackBlowTime") { + m_Client->SetBlowBackBlowTime((unsigned short)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "SetBlowBackSetTimes") { + m_Client->SetBlowBackSetTimes((unsigned short)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "SetProtectionPressureSetTime") { + m_Client->SetProtectionPressureSetTime((unsigned short)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "SetUnLock") { + m_Client->SetUnLock(); + } + else if (rd.nameKey == "SetCoverWind") { + m_Client->SetCoverWind((bool)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "SetCoverWindOffset") { + m_Client->SetCoverWindOffset((float)atof(rd.strValue.data())); + } + else if (rd.nameKey == "SetWindSlowFinishSignal") { + m_Client->SetWindSlowFinishSignal((bool)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "SetWindResumeFinishSignal") { + m_Client->SetWindResumeFinishSignal((bool)atoi(rd.strValue.data())); + } + else if (rd.nameKey == "SetShieldMonitorPrintPressure") { + m_Client->SetShieldMonitorPrintPressure((bool)atoi(rd.strValue.data())); + } + //else if (rd.nameKey == "SetDeoxygen") { + // //m_Client->SetDeoxygen((bool)atoi(rd.strValue.data())); + //} + + else { + printf("error, key(%s) do not exist...", rd.nameKey.data()); + } + + } \ No newline at end of file diff --git a/PrintS/Purifier/XTPurifier.h b/PrintS/Purifier/XTPurifier.h index d37d367..08881cd 100644 --- a/PrintS/Purifier/XTPurifier.h +++ b/PrintS/Purifier/XTPurifier.h @@ -43,6 +43,9 @@ public: int GetFilterUseTime(); void SendToClients(); + + void SetParam(const ReadData& msg); + private: //void DrawUserUI(); //void DrawAdminUI(); diff --git a/PrintS/output/Release/log/2024.hbd b/PrintS/output/Release/log/2024.hbd index 95ef38d..3474a9b 100644 Binary files a/PrintS/output/Release/log/2024.hbd and b/PrintS/output/Release/log/2024.hbd differ diff --git a/PrintS/说明.txt b/PrintS/说明.txt index b432755..1dc4de4 100644 --- a/PrintS/说明.txt +++ b/PrintS/说明.txt @@ -17,4 +17,6 @@ plcparam 重复code: ArmFrontLimit -ArmBackLimit \ No newline at end of file +ArmBackLimit + +SendToClients 需要修改 \ No newline at end of file