diff --git a/dll/mcctrdllD.dll b/dll/mcctrdllD.dll index 16f2fdd..e9fb911 100644 Binary files a/dll/mcctrdllD.dll and b/dll/mcctrdllD.dll differ diff --git a/dll/secsgemdllD.dll b/dll/secsgemdllD.dll index 5ef9d04..2869ba3 100644 Binary files a/dll/secsgemdllD.dll and b/dll/secsgemdllD.dll differ diff --git a/mcctrdll/Include/RunCtrlStructs.h b/mcctrdll/Include/RunCtrlStructs.h new file mode 100644 index 0000000..bc76383 --- /dev/null +++ b/mcctrdll/Include/RunCtrlStructs.h @@ -0,0 +1,20 @@ +#pragma once + +#include + +#include "nlohmann/json.hpp" + +namespace nsRUNCTRL +{ + using stRunEolState = struct _stRunEolState + { + std::string strName; + int bEol{ true }; + }; + + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE( + stRunEolState, + strName, + bEol + ) +} \ No newline at end of file diff --git a/mcctrdll/Include/runctrl.h b/mcctrdll/Include/runctrl.h index cc909da..8b07376 100644 --- a/mcctrdll/Include/runctrl.h +++ b/mcctrdll/Include/runctrl.h @@ -25,6 +25,7 @@ #include "MotorSpeedParser.h" #include "MaintStructs.h" +#include "RunCtrlStructs.h" #define STRING_RELAY_SET_GEN_MSG _T("POSTMSGREPLY") #define RELAY_SET_GEN_MSG_NUM_ARFG 2 @@ -176,6 +177,8 @@ const std::array TLightState{ "OnOff" }; + + class MCCTRDLLCLASS CRunCtrl : public CRunTask { public: @@ -567,6 +570,7 @@ private: // void OnMcStopped(); + void LogEolInProgress(); // Machine State bool CheckMachineState(); void SaveMachineState(); @@ -658,6 +662,9 @@ private: bool m_bCloseLot{ false }; + // For monitoring which run module still Eol In Progress + std::vector m_vecRunEolState{}; + std::array m_lightConfig; std::array m_customLightCfg; diff --git a/mcctrdll/lib/mcctrdllD.lib b/mcctrdll/lib/mcctrdllD.lib index 992017e..357b314 100644 Binary files a/mcctrdll/lib/mcctrdllD.lib and b/mcctrdll/lib/mcctrdllD.lib differ diff --git a/secsgemdll/lib/secsgemdllD.lib b/secsgemdll/lib/secsgemdllD.lib index 3eb864d..229fd88 100644 Binary files a/secsgemdll/lib/secsgemdllD.lib and b/secsgemdll/lib/secsgemdllD.lib differ diff --git a/utility/Include/JsonParser.h b/utility/Include/JsonParser.h new file mode 100644 index 0000000..880d723 --- /dev/null +++ b/utility/Include/JsonParser.h @@ -0,0 +1,96 @@ +#pragma once + +#include + +#include "nlohmann/json.hpp" + +#include "DebugLog.h" + +template +class CJsonParser +{ +public: + bool Deserialize(const std::string& strFile, T& myOption) + { + try + { + // load json file + std::ifstream infile(strFile); + if (!infile.is_open()) + { + return false; + } + + nlohmann::json jf; + + // parse string into json + infile >> jf; + + // deserialize json into object + myOption = jf.template get(); + + return true; + } + catch (std::exception& e) + { + std::string ss = e.what(); + DebugLog("{} : {}", strFile, ss); + return false; + } + } + + bool Serialize(const std::string& strFile, const T& myOption) + { + // convert object into json + nlohmann::json jf(myOption); + + // persist to file + std::ofstream outfile(strFile, std::ofstream::trunc); + + outfile << std::setw(4) << jf; + + return false; + } + + bool Deserialize(const std::string& strFile, std::vector& myOption) + { + try + { + // load json file + std::ifstream infile(strFile); + if (!infile.is_open()) + { + return false; + } + + nlohmann::json jf; + + // parse string into json + infile >> jf; + + // deserialize json into object + myOption = jf.template get>(); + + return true; + } + catch (std::exception& e) + { + std::string ss = e.what(); + DebugLog("{} : {}", strFile, ss); + return false; + } + } + + bool Serialize(const std::string& strFile, const std::vector& myOption) + { + // convert object into json + nlohmann::json jf(myOption); + + // persist to file + std::ofstream outfile(strFile, std::ofstream::trunc); + + outfile << std::setw(4) << jf; + + return false; + } +}; \ No newline at end of file