配置功能修改

This commit is contained in:
wangxx1809 2024-05-06 17:10:57 +08:00
parent 5c3120aca6
commit 94e5ecedef
17 changed files with 1807 additions and 1676 deletions

View File

@ -9285,7 +9285,7 @@ void HBD1000::DrawPowderCtrl(bool *winShow)
tabs.push_back(_(u8"供粉轴")); tabs.push_back(_(u8"供粉轴"));
tabs.push_back(_(u8"铺粉")); tabs.push_back(_(u8"铺粉"));
tabs.push_back(_(u8"控制")); tabs.push_back(_(u8"控制"));
int tabwidth = 0; float tabwidth = 0;
for (size_t tindex = 0; tindex<tabs.size(); tindex++) { for (size_t tindex = 0; tindex<tabs.size(); tindex++) {
tabwidth= tabwidth+ImGui::CalcTextSize(tabs[tindex].c_str(), 0).x+15; tabwidth= tabwidth+ImGui::CalcTextSize(tabs[tindex].c_str(), 0).x+15;
} }
@ -10221,6 +10221,8 @@ void HBD1000::DrawPowderCtrl(bool *winShow)
// ImGui::OpenPopup(u8"移载载入"); // ImGui::OpenPopup(u8"移载载入");
//} //}
MACHINEPARAM mp;
GetMachineParam(mp);
if (ImGui::BeginPopupModal(_(u8"移载载入").c_str(), NULL, ImGuiWindowFlags_AlwaysAutoResize)) { if (ImGui::BeginPopupModal(_(u8"移载载入").c_str(), NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
if (GetLoadInProcStep() == In_Start) { if (GetLoadInProcStep() == In_Start) {
ImGui::Text(_(u8"移载开始载入").c_str()); ImGui::Text(_(u8"移载开始载入").c_str());
@ -10241,22 +10243,23 @@ void HBD1000::DrawPowderCtrl(bool *winShow)
ImGui::Text(_(u8"缸体打印位装载运行中").c_str()); ImGui::Text(_(u8"缸体打印位装载运行中").c_str());
} }
if (GetLoadInResult()== In_Intercept) {
ImGui::TextColored(Toast::COLOR_ORANGE, GetLoadInfo().c_str()); if (mp.m_LoadInResut == In_Intercept) {
ImGui::TextColored(Toast::COLOR_ORANGE, mp.m_LoadInfo.c_str());
if (ImGui::Button(_(u8"确定").c_str(), ImVec2(-1, 0))) if (ImGui::Button(_(u8"确定").c_str(), ImVec2(-1, 0)))
{ {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
} }
else if (GetLoadInResult()== In_Success) { else if (mp.m_LoadInResut == In_Success) {
ImGui::TextColored(Toast::COLOR_GREEN, GetLoadInfo().c_str()); ImGui::TextColored(Toast::COLOR_GREEN, mp.m_LoadInfo.c_str());
if (ImGui::Button(_(u8"确定").c_str(), ImVec2(-1, 0))) if (ImGui::Button(_(u8"确定").c_str(), ImVec2(-1, 0)))
{ {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
} }
else if (GetLoadInResult()> In_Success) { else if (mp.m_LoadInResut > In_Success) {
ImGui::TextColored(Toast::COLOR_RED, GetLoadInfo().c_str()); ImGui::TextColored(Toast::COLOR_RED, mp.m_LoadInfo.c_str());
if (ImGui::Button(_(u8"确定").c_str(), ImVec2(-1, 0))) if (ImGui::Button(_(u8"确定").c_str(), ImVec2(-1, 0)))
{ {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
@ -10300,29 +10303,29 @@ void HBD1000::DrawPowderCtrl(bool *winShow)
ImGui::Text(_(u8"缸体与清粉箱连接中").c_str()); ImGui::Text(_(u8"缸体与清粉箱连接中").c_str());
} }
if (IsWaitConnectBoxCommit()) { if (mp.m_WaitConnectBoxCommit) {
if (ImGui::Button(_(u8"执行缸体与清粉箱连接").c_str())) if (ImGui::Button(_(u8"执行缸体与清粉箱连接").c_str()))
{ {
SetWaitConnectBoxCommit(false); SetWaitConnectBoxCommit(false);
} }
} }
if (GetLoadOutResult() == Out_Intercept) { if (mp.m_LoadOutResut == Out_Intercept) {
ImGui::TextColored(Toast::COLOR_ORANGE, GetLoadInfo().c_str()); ImGui::TextColored(Toast::COLOR_ORANGE, mp.m_LoadInfo.c_str());
if (ImGui::Button(_(u8"确定").c_str(), ImVec2(-1, 0))) if (ImGui::Button(_(u8"确定").c_str(), ImVec2(-1, 0)))
{ {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
} }
else if (GetLoadOutResult() == Out_Success) { else if (mp.m_LoadOutResut == Out_Success) {
ImGui::TextColored(Toast::COLOR_GREEN, GetLoadInfo().c_str()); ImGui::TextColored(Toast::COLOR_GREEN, mp.m_LoadInfo.c_str());
if (ImGui::Button(_(u8"确定").c_str(), ImVec2(-1, 0))) if (ImGui::Button(_(u8"确定").c_str(), ImVec2(-1, 0)))
{ {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
} }
else if (GetLoadOutResult() > Out_Success) { else if (mp.m_LoadOutResut > Out_Success) {
ImGui::TextColored(Toast::COLOR_RED, GetLoadInfo().c_str()); ImGui::TextColored(Toast::COLOR_RED, mp.m_LoadInfo.c_str());
if (ImGui::Button(_(u8"确定").c_str(), ImVec2(-1, 0))) if (ImGui::Button(_(u8"确定").c_str(), ImVec2(-1, 0)))
{ {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();

File diff suppressed because it is too large Load Diff

View File

@ -84,7 +84,7 @@ public:
void InitSysParam(SysParamWrapper* spw, void* cc); void InitSysParam(SysParamWrapper* spw, void* cc);
//void InitPLCCommand(vector<S7Command*>& vecs); //void InitPLCCommand(vector<S7Command*>& vecs);
void GetAlarmState(SignalState& signalState); void GetAlarmState(SignalState& signalState);
//bool CheckPrintMoldReady(); bool CheckPrintMoldReady();
virtual void CheckIO(); virtual void CheckIO();
private: private:

View File

@ -233,6 +233,9 @@ void Machine::Update(const ReadData& rd) {
else if (it->nameKey == "WaitConnectBoxCommit") { else if (it->nameKey == "WaitConnectBoxCommit") {
m_WaitConnectBoxCommit = (bool)stoi(it->strValue); m_WaitConnectBoxCommit = (bool)stoi(it->strValue);
} }
else if (it->nameKey == "NeedWaitSelectOutPos") {
m_NeedWaitSelectOutPos = (bool)stoi(it->strValue);
}
else { else {
printf("error, key %s do not find...", it->nameKey.c_str()); printf("error, key %s do not find...", it->nameKey.c_str());
} }

View File

@ -9,6 +9,20 @@
#include "../UI/UIBean.h" #include "../UI/UIBean.h"
#include "../config/bean/ExtCfg.h" #include "../config/bean/ExtCfg.h"
struct MACHINEPARAM{
int m_LoadInResut;
string m_LoadInfo;
int m_LoadOutResut;
int m_LoadInProcStep;
int m_LoadOutProcStep;
bool m_isLoadIn; //绑定m_LoadInThread
bool m_isLoadOut; //绑定m_LoadOutThread
bool m_WaitConnectBoxCommit;
bool m_NeedWaitSelectOutPos;
bool m_WaitSelectOutPosCommit;
int m_SelectOutPos;
};
class Machine { class Machine {
public: public:
Machine(MachineTypeCfg::MachineTypeId type); Machine(MachineTypeCfg::MachineTypeId type);
@ -45,13 +59,13 @@ protected:
LeaveCriticalSection(&m_LoadCS); LeaveCriticalSection(&m_LoadCS);
return rel; return rel;
} }
int GetLoadOutResult() { //int GetLoadOutResult() {
int rel = 0; // int rel = 0;
EnterCriticalSection(&m_LoadCS); // EnterCriticalSection(&m_LoadCS);
rel = m_LoadOutResut; // rel = m_LoadOutResut;
LeaveCriticalSection(&m_LoadCS); // LeaveCriticalSection(&m_LoadCS);
return rel; // return rel;
} //}
int GetLoadInProcStep() { int GetLoadInProcStep() {
int rel = 0; int rel = 0;
@ -69,21 +83,21 @@ protected:
return rel; return rel;
} }
string GetLoadInfo() { //string GetLoadInfo() {
string rel = ""; // string rel = "";
EnterCriticalSection(&m_LoadCS); // EnterCriticalSection(&m_LoadCS);
rel = m_LoadInfo; // rel = m_LoadInfo;
LeaveCriticalSection(&m_LoadCS); // LeaveCriticalSection(&m_LoadCS);
return rel; // return rel;
} //}
bool IsWaitConnectBoxCommit() { //bool IsWaitConnectBoxCommit() {
bool rel = false; // bool rel = false;
EnterCriticalSection(&m_LoadCS); // EnterCriticalSection(&m_LoadCS);
rel = m_WaitConnectBoxCommit; // rel = m_WaitConnectBoxCommit;
LeaveCriticalSection(&m_LoadCS); // LeaveCriticalSection(&m_LoadCS);
return rel; // return rel;
} //}
void SetWaitConnectBoxCommit(bool commit); void SetWaitConnectBoxCommit(bool commit);
@ -103,6 +117,39 @@ protected:
return rel; return rel;
} }
bool GetMachineParam(MACHINEPARAM& mp) {
EnterCriticalSection(&m_LoadCS);
mp.m_LoadInResut = m_LoadInResut;
mp.m_LoadInfo = m_LoadInfo;
mp.m_LoadOutResut = m_LoadOutResut;
mp.m_LoadInProcStep = m_LoadInProcStep;
mp.m_LoadOutProcStep = m_LoadOutProcStep;
mp.m_isLoadIn = m_isLoadIn;
mp.m_isLoadOut = m_isLoadOut;
mp.m_WaitConnectBoxCommit = m_WaitConnectBoxCommit;
mp.m_NeedWaitSelectOutPos = m_NeedWaitSelectOutPos;
mp.m_WaitSelectOutPosCommit = m_WaitSelectOutPosCommit;
mp.m_SelectOutPos = m_SelectOutPos;
LeaveCriticalSection(&m_LoadCS);
return true;
}
//bool IsWaitConnectBoxCommit() { return m_WaitConnectBoxCommit; }
//void SetWaitConnectBoxCommit(bool res) {
// EnterCriticalSection(&m_LoadCS);
// m_WaitConnectBoxCommit = commit;
// LeaveCriticalSection(&m_LoadCS);
//
// }
//void SetNeedWaitSelectOutPos(bool res) {
// EnterCriticalSection(&m_LoadCS);
// m_NeedWaitSelectOutPos->SetValue(res);
// LeaveCriticalSection(&m_LoadCS);
//}
protected: protected:
MachineTypeCfg::MachineTypeId m_Type; MachineTypeCfg::MachineTypeId m_Type;
SysParamWrapper* m_SysParamWrapper; SysParamWrapper* m_SysParamWrapper;
@ -134,11 +181,12 @@ protected:
int m_LoadOutProcStep; int m_LoadOutProcStep;
bool m_isLoadIn; //是否载入 bool m_isLoadIn; //是否载入
bool m_isLoadOut; //是否载出 bool m_isLoadOut; //是否载出
bool m_WaitConnectBoxCommit; bool m_WaitConnectBoxCommit;
bool m_NeedWaitSelectOutPos;
bool m_WaitSelectOutPosCommit;
int m_SelectOutPos;
CRITICAL_SECTION m_LoadCS; CRITICAL_SECTION m_LoadCS;
}; };

View File

@ -5,6 +5,26 @@
#include "../DataManage/DataHandle.h" #include "../DataManage/DataHandle.h"
AxisState::AxisState() AxisState::AxisState()
: m_ServoOn(new BoolData("ServoOn", u8"轴伺服ON_RW"))
, m_ServoHomeIndexOn(new BoolData("ServoHomeIndexOn", u8"轴伺服成立原点_RW"))
, m_ServoReset(new BoolData("ServoReset", u8"轴伺服复位_RW"))
, m_MoveP(new BoolData("MoveP", u8"轴相对左运动_手动_RW"))
, m_MoveN(new BoolData("MoveN", u8"轴相对右运动_手动_RW"))
, m_MovePContinue(new BoolData("MovePContinue", u8"轴左JOG_手动_RW"))
, m_MoveNContinue(new BoolData("MoveNContinue", u8"轴右JOG_手动_RW"))
, m_MoveAbsPos(new BoolData("MoveAbsPos", u8"轴绝对值运动_手动_RW"))
, m_MotionStop(new BoolData("MotionStop", u8"轴急停_RW"))
, m_ServoRDY(new BoolData("ServoRDY", u8"轴伺服RDY状态_R"))
, m_ServoHomeDone(new BoolData("ServoHomeDone", u8"轴指令运行HOME_Done_R"))
, m_ResetDone(new BoolData("ResetDone", u8"轴指令运行RESET_Done_R"))
, m_ServoBusy(new BoolData("ServoBusy", u8"轴伺服BUSY_R"))
, m_ServoException(new BoolData("ServoException", u8"轴伺服异常_R"))
, m_Runable(new BoolData("Runable", u8"轴可运行状态_R"))
, m_ExceptionCode(new ShortData("ExceptionCode", u8"轴伺服异常字_R"))
, m_Pos(new FloatData("Pos", u8"当前位置"))
, m_Torque(new FloatData("Torque", u8"当前扭矩"))
, m_ShowPos(new FloatData("ShowPos"))
, m_RPos(new FloatData("RPos"))
{ {
size_t ptrSize = sizeof(nullptr); //指针大小 size_t ptrSize = sizeof(nullptr); //指针大小
void* startPtr = &m_startFlag + 1; void* startPtr = &m_startFlag + 1;
@ -41,6 +61,9 @@ void AxisState::GetValue(AxisStateValue& value)
value.Pos = m_Pos->GetValue(); value.Pos = m_Pos->GetValue();
value.Torque = m_Torque->GetValue(); value.Torque = m_Torque->GetValue();
value.ServoBusy = m_ServoBusy->GetValue(); value.ServoBusy = m_ServoBusy->GetValue();
value.ShowPos = m_ShowPos->GetValue();
value.RPos = m_RPos->GetValue();
} }
//void AxisState::Update(unsigned char* addr) //void AxisState::Update(unsigned char* addr)

View File

@ -79,6 +79,8 @@ public:
FloatData* m_Torque; //当前扭矩 FloatData* m_Torque; //当前扭矩
FloatData* m_ShowPos; FloatData* m_ShowPos;
FloatData* m_RPos; FloatData* m_RPos;
char m_endFlag; //结束标志 char m_endFlag; //结束标志
std::shared_mutex mtx; std::shared_mutex mtx;

View File

@ -25,7 +25,7 @@ Controller::~Controller() {
DELP(m_SysParamWrapper); DELP(m_SysParamWrapper);
DELP(m_AxisRecordWrapper); DELP(m_AxisRecordWrapper);
DELP(m_SignalStateWrapper); DELP(m_SignalStateWrapper);
DELP(m_Machine); //DELP(m_Machine);
DELP(m_MachineCfg); DELP(m_MachineCfg);
SysParam::SFini(); SysParam::SFini();

View File

@ -296,7 +296,7 @@ void UIWin::Draw() {
SetupDockSpace(); SetupDockSpace();
DrawTitleBar(); DrawTitleBar();
DrawToolBar(); DrawToolBar();
DrawPowder();
DrawMain(); DrawMain();
} }

View File

@ -36,7 +36,6 @@ private:
IOCfgWrapper* m_IOCfgWrapper; IOCfgWrapper* m_IOCfgWrapper;
MachineCfg* m_MachineCfg; MachineCfg* m_MachineCfg;
RunCfg m_RunCfg; RunCfg m_RunCfg;
//ExtCfg m_ExtCfg;
AlarmCfgWrapper* m_AlarmCfgWrapper; AlarmCfgWrapper* m_AlarmCfgWrapper;
ParamLimitCfgNew m_ParamLimitCfg; ParamLimitCfgNew m_ParamLimitCfg;

View File

@ -14,6 +14,7 @@ using namespace std;
#define GTS_AXIS_ID_CLEAN 5 #define GTS_AXIS_ID_CLEAN 5
#define GTS_AXIS_ID_ELE 6 #define GTS_AXIS_ID_ELE 6
#pragma pack(1)
class AxisCfg : public Base class AxisCfg : public Base
{ {
public: public:
@ -70,4 +71,5 @@ public:
BoolData* m_SafeLimit; BoolData* m_SafeLimit;
char m_endFlag; char m_endFlag;
}; };
#pragma pack()

View File

@ -155,6 +155,7 @@ public:
}; };
#pragma pack(1)
class ParamLimitCfgNew :public Base { class ParamLimitCfgNew :public Base {
public: public:
ParamLimitCfgNew(); ParamLimitCfgNew();
@ -227,4 +228,5 @@ private:
FloatData* m_CoverDistanceMax; FloatData* m_CoverDistanceMax;
char m_endFlag; char m_endFlag;
}; };
#pragma pack()

Binary file not shown.

View File

@ -14166,11 +14166,12 @@ void HBD1000::LoadOutRun()
return; return;
} }
if (m_SignalStateWrapper->m_CylinderState->GetValue() == CylinderInCleanInsidePlatformUnConnectBox) { if (m_SignalStateWrapper->m_CylinderState->GetValue() == CylinderInCleanInsidePlatformUnConnectBox) {
m_WaitConnectBoxCommit->SetValue(true); SetWaitConnectBoxCommit(true);
while (m_LoadCtrlFlag && m_WaitConnectBoxCommit->GetValue()) { MACHINEPARAM mp;
while (m_LoadCtrlFlag && GetMachineParam(mp) && mp.m_WaitConnectBoxCommit) {
Sleep(300); Sleep(300);
} }
if (!m_WaitConnectBoxCommit->GetValue()) if (!(GetMachineParam(mp) && mp.m_WaitConnectBoxCommit))
{ {
SetLoadOutProcStep(Out_CylinderConnectCleanBox); SetLoadOutProcStep(Out_CylinderConnectCleanBox);
m_SignalStateWrapper->m_CylinderConnectCleanBoxTriger->SetValue(true); m_SignalStateWrapper->m_CylinderConnectCleanBoxTriger->SetValue(true);

View File

@ -6692,19 +6692,21 @@ void HBD1200::LoadOutRun()
return; return;
} }
m_WaitSelectOutPosCommit = false; SetWaitSelectOutPosCommit(false);
if (m_RunCfg->m_ShowUnloadHandPos) { if (m_RunCfg->m_ShowUnloadHandPos) {
m_NeedWaitSelectOutPos = true; SetNeedWaitSelectOutPos(true);
while (!m_WaitSelectOutPosCommit && m_LoadCtrlFlag) { MACHINEPARAM mp;
while (!(GetMachineParam(mp) && mp.m_WaitSelectOutPosCommit) && m_LoadCtrlFlag) {
Sleep(300); Sleep(300);
} }
} }
else { else {
m_SelectOutPos = 0; SetSelectOutPos(0);
} }
m_NeedWaitSelectOutPos = false; //m_NeedWaitSelectOutPos->SetValue(false);
SetNeedWaitSelectOutPos(false);
if (!m_LoadCtrlFlag) { if (!m_LoadCtrlFlag) {
SetLoadOutResult(Out_Intercept, _(u8"载出中断").c_str()); SetLoadOutResult(Out_Intercept, _(u8"载出中断").c_str());
return; return;
@ -6762,7 +6764,10 @@ void HBD1200::LoadOutRun()
SetLoadOutResult(Out_Intercept, _(u8"载出中断").c_str()); SetLoadOutResult(Out_Intercept, _(u8"载出中断").c_str());
return; return;
} }
if (m_SelectOutPos == 0) {
MACHINEPARAM mp;
GetMachineParam(mp);
if (mp.m_SelectOutPos == 0) {
if (m_SignalStateWrapper->m_CylinderState->GetValue() == CylinderInCleanConnectedBox) { if (m_SignalStateWrapper->m_CylinderState->GetValue() == CylinderInCleanConnectedBox) {
SetLoadOutResult(Out_Success, _(u8"缸体已载出到清粉位").c_str()); SetLoadOutResult(Out_Success, _(u8"缸体已载出到清粉位").c_str());
@ -6825,11 +6830,12 @@ void HBD1200::LoadOutRun()
return; return;
} }
if (m_SignalStateWrapper->m_CylinderState->GetValue() == CylinderInCleanUnConnectBox) { if (m_SignalStateWrapper->m_CylinderState->GetValue() == CylinderInCleanUnConnectBox) {
m_WaitConnectBoxCommit->SetValue(true); SetWaitConnectBoxCommit(true);
while (m_LoadCtrlFlag && m_WaitConnectBoxCommit->GetValue()) { MACHINEPARAM mp;
while (m_LoadCtrlFlag && GetMachineParam(mp) && mp.m_WaitConnectBoxCommit) {
Sleep(300); Sleep(300);
} }
if (!m_WaitConnectBoxCommit->GetValue()) if (!(GetMachineParam(mp) && mp.m_WaitConnectBoxCommit))
{ {
SetLoadOutProcStep(Out_CylinderConnectCleanBox); SetLoadOutProcStep(Out_CylinderConnectCleanBox);
m_SignalStateWrapper->m_CylinderConnectCleanBoxTriger->SetValue(true); m_SignalStateWrapper->m_CylinderConnectCleanBoxTriger->SetValue(true);
@ -6887,7 +6893,7 @@ void HBD1200::LoadOutRun()
} }
SetLoadOutResult(Out_Success, _(u8"缸体载出已完成").c_str()); SetLoadOutResult(Out_Success, _(u8"缸体载出已完成").c_str());
} }
else if (m_SelectOutPos == 1) { else if (mp.m_SelectOutPos == 1) {
if (m_SignalStateWrapper->m_CylinderState->GetValue() == CylinderInCleanConnectedBox) { if (m_SignalStateWrapper->m_CylinderState->GetValue() == CylinderInCleanConnectedBox) {
SetLoadOutProcStep(Out_CylinderDisconnectCleanBox); SetLoadOutProcStep(Out_CylinderDisconnectCleanBox);

View File

@ -29,8 +29,8 @@ Machine::Machine(MachineTypeCfg::MachineTypeId type)
, m_WaitConnectBoxCommit(new BoolData("WaitConnectBoxCommit")) , m_WaitConnectBoxCommit(new BoolData("WaitConnectBoxCommit"))
, m_isLoadIn(new BoolData("IsLoadIn",u8"是否载入")) , m_isLoadIn(new BoolData("IsLoadIn",u8"是否载入"))
, m_isLoadOut(new BoolData("IsLoadOut",u8"是否载出")) , m_isLoadOut(new BoolData("IsLoadOut",u8"是否载出"))
, m_NeedWaitSelectOutPos(false) , m_NeedWaitSelectOutPos(new BoolData("NeedWaitSelectOutPos"))
, m_WaitSelectOutPosCommit(false) , m_WaitSelectOutPosCommit(new BoolData("WaitSelectOutPosCommit"))
{ {
InsertMp(&m_LoadInfo, 1); InsertMp(&m_LoadInfo, 1);
InsertMp(&m_LoadInProcStep, 1); InsertMp(&m_LoadInProcStep, 1);
@ -40,6 +40,9 @@ Machine::Machine(MachineTypeCfg::MachineTypeId type)
InsertMp(&m_WaitConnectBoxCommit, 1); InsertMp(&m_WaitConnectBoxCommit, 1);
InsertMp(&m_isLoadIn, 1); InsertMp(&m_isLoadIn, 1);
InsertMp(&m_isLoadOut, 1); InsertMp(&m_isLoadOut, 1);
InsertMp(&m_NeedWaitSelectOutPos, 1);
InsertMp(&m_WaitSelectOutPosCommit, 1);
InsertMp(&m_SelectOutPos, 1);
m_AlarmEnableMap["CarbinDoorOpen"] = true; m_AlarmEnableMap["CarbinDoorOpen"] = true;
@ -382,7 +385,7 @@ void Machine::LoadIn()
m_LoadCtrlFlag = true; m_LoadCtrlFlag = true;
SetLoadInResult(0, ""); SetLoadInResult(0, "");
m_LoadInThread = AtlCreateThread(LoadInProc, this); m_LoadInThread = AtlCreateThread(LoadInProc, this);
m_isLoadIn->SetValue(true); SetIsLoadIn(true);
} }
DWORD WINAPI Machine::LoadInProc(Machine* _this) DWORD WINAPI Machine::LoadInProc(Machine* _this)
@ -395,7 +398,7 @@ DWORD WINAPI Machine::LoadInProc(Machine* _this)
{ {
CloseHandle(_this->m_LoadInThread); CloseHandle(_this->m_LoadInThread);
_this->m_LoadInThread = INVALID_HANDLE_VALUE; _this->m_LoadInThread = INVALID_HANDLE_VALUE;
_this->m_isLoadIn->SetValue(false); _this->SetIsLoadIn(false);
} }
} }
return 0; return 0;
@ -407,10 +410,10 @@ void Machine::LoadOut()
if (m_LoadOutThread != INVALID_HANDLE_VALUE)return; if (m_LoadOutThread != INVALID_HANDLE_VALUE)return;
m_LoadCtrlFlag = true; m_LoadCtrlFlag = true;
SetLoadOutResult(0, ""); SetLoadOutResult(0, "");
m_WaitConnectBoxCommit->SetValue(false); SetWaitConnectBoxCommit(false);
m_WaitSelectOutPosCommit = false; SetWaitSelectOutPosCommit(false);
m_LoadOutThread = AtlCreateThread(LoadOutProc, this); m_LoadOutThread = AtlCreateThread(LoadOutProc, this);
m_isLoadOut->SetValue(true); SetIsLoadOut(true);
} }
DWORD WINAPI Machine::LoadOutProc(Machine* _this) DWORD WINAPI Machine::LoadOutProc(Machine* _this)
@ -423,7 +426,7 @@ DWORD WINAPI Machine::LoadOutProc(Machine* _this)
{ {
CloseHandle(_this->m_LoadOutThread); CloseHandle(_this->m_LoadOutThread);
_this->m_LoadOutThread = INVALID_HANDLE_VALUE; _this->m_LoadOutThread = INVALID_HANDLE_VALUE;
_this->m_isLoadOut->SetValue(false); _this->SetIsLoadOut(false);
} }
} }
return 0; return 0;

View File

@ -21,6 +21,20 @@
#include "../LanguageManager.h" #include "../LanguageManager.h"
using namespace std; using namespace std;
struct MACHINEPARAM {
int m_LoadInResut;
string m_LoadInfo;
int m_LoadOutResut;
int m_LoadInProcStep;
int m_LoadOutProcStep;
bool m_isLoadIn; //绑定m_LoadInThread
bool m_isLoadOut; //绑定m_LoadOutThread
bool m_WaitConnectBoxCommit;
bool m_NeedWaitSelectOutPos;
bool m_WaitSelectOutPosCommit;
int m_SelectOutPos;
};
class Machine :public Base { class Machine :public Base {
typedef void(*IoVersionCheck)(vector<string>&, IOCfgWrapper*, string str, int type); typedef void(*IoVersionCheck)(vector<string>&, IOCfgWrapper*, string str, int type);
@ -121,9 +135,6 @@ public:
//virtual bool CheckPrintMoldReady() = 0; //virtual bool CheckPrintMoldReady() = 0;
bool IsWaitConnectBoxCommit() { return m_WaitConnectBoxCommit->GetValue(); }
void SetWaitConnectBoxCommit(bool commit) { m_WaitConnectBoxCommit->SetValue(commit); }
virtual bool CheckPrintHigh(float jobhigh) { virtual bool CheckPrintHigh(float jobhigh) {
return true; return true;
} }
@ -139,28 +150,14 @@ public:
protected: protected:
virtual void LoadOutRun() = 0; virtual void LoadOutRun() = 0;
virtual void LoadInRun() = 0; virtual void LoadInRun() = 0;
bool IsLoadIn() { m_isLoadIn->SetValue(m_LoadInThread != INVALID_HANDLE_VALUE); return m_isLoadIn->GetValue(); }
bool IsLoadOut() { m_isLoadOut->SetValue(m_LoadOutThread != INVALID_HANDLE_VALUE); return m_isLoadOut->GetValue(); }
/*int GetLoadInResult() {
int rel = 0;
EnterCriticalSection(&m_LoadCS);
rel= m_LoadInResut;
LeaveCriticalSection(&m_LoadCS);
return rel;
}
int GetLoadOutResult() {
int rel = 0;
EnterCriticalSection(&m_LoadCS);
rel = m_LoadOutResut;
LeaveCriticalSection(&m_LoadCS);
return rel;
}*/
void SetLoadInResult(int res,string info) { void SetLoadInResult(int res,string info) {
EnterCriticalSection(&m_LoadCS); EnterCriticalSection(&m_LoadCS);
m_LoadInResut->SetValue( res); m_LoadInResut->SetValue( res);
m_LoadInfo ->SetValue( info); m_LoadInfo ->SetValue( info);
LeaveCriticalSection(&m_LoadCS); LeaveCriticalSection(&m_LoadCS);
} }
void SetLoadOutResult(int res,string info) { void SetLoadOutResult(int res,string info) {
EnterCriticalSection(&m_LoadCS); EnterCriticalSection(&m_LoadCS);
m_LoadOutResut->SetValue(res); m_LoadOutResut->SetValue(res);
@ -168,21 +165,24 @@ protected:
LeaveCriticalSection(&m_LoadCS); LeaveCriticalSection(&m_LoadCS);
} }
//int GetLoadInProcStep() { bool GetMachineParam(MACHINEPARAM& mp) {
// int rel = 0; EnterCriticalSection(&m_LoadCS);
// EnterCriticalSection(&m_LoadCS); mp.m_LoadInResut = m_LoadInResut->GetValue();
// rel = m_LoadInProcStep->GetValue(); mp.m_LoadInfo = m_LoadInfo->GetValueStr();
// LeaveCriticalSection(&m_LoadCS); mp.m_LoadOutResut = m_LoadOutResut->GetValue();
// return rel; mp.m_LoadInProcStep = m_LoadInProcStep->GetValue();
//} mp.m_LoadOutProcStep = m_LoadOutProcStep->GetValue();
mp.m_isLoadIn = m_isLoadIn->GetValue();
mp.m_isLoadOut = m_isLoadOut->GetValue();
mp.m_WaitConnectBoxCommit = m_WaitConnectBoxCommit->GetValue();
mp.m_NeedWaitSelectOutPos = m_NeedWaitSelectOutPos->GetValue();
mp.m_WaitSelectOutPosCommit = m_WaitSelectOutPosCommit->GetValue();
mp.m_SelectOutPos = m_SelectOutPos->GetValue();
LeaveCriticalSection(&m_LoadCS);
return true;
}
//int GetLoadOutProcSetp() {
// int rel = 0;
// EnterCriticalSection(&m_LoadCS);
// rel = m_LoadOutProcStep;
// LeaveCriticalSection(&m_LoadCS);
// return rel;
//}
void SetLoadInProcStep(int res) { void SetLoadInProcStep(int res) {
EnterCriticalSection(&m_LoadCS); EnterCriticalSection(&m_LoadCS);
@ -195,13 +195,40 @@ protected:
LeaveCriticalSection(&m_LoadCS); LeaveCriticalSection(&m_LoadCS);
} }
//string GetLoadInfo() { void SetIsLoadIn(bool res) {
// string rel = ""; EnterCriticalSection(&m_LoadCS);
// EnterCriticalSection(&m_LoadCS); m_isLoadIn->SetValue(res);
// rel = m_LoadInfo; LeaveCriticalSection(&m_LoadCS);
// LeaveCriticalSection(&m_LoadCS); }
// return rel; void SetIsLoadOut(bool res) {
//} EnterCriticalSection(&m_LoadCS);
m_isLoadOut->SetValue(res);
LeaveCriticalSection(&m_LoadCS);
}
void SetWaitConnectBoxCommit(bool res) {
EnterCriticalSection(&m_LoadCS);
m_WaitConnectBoxCommit->SetValue(res);
LeaveCriticalSection(&m_LoadCS);
}
void SetNeedWaitSelectOutPos(bool res) {
EnterCriticalSection(&m_LoadCS);
m_NeedWaitSelectOutPos->SetValue(res);
LeaveCriticalSection(&m_LoadCS);
}
void SetWaitSelectOutPosCommit(bool res) {
EnterCriticalSection(&m_LoadCS);
m_WaitSelectOutPosCommit->SetValue(res);
LeaveCriticalSection(&m_LoadCS);
}
void SetSelectOutPos(int res) {
EnterCriticalSection(&m_LoadCS);
m_SelectOutPos->SetValue(res);
LeaveCriticalSection(&m_LoadCS);
}
private: private:
@ -249,16 +276,15 @@ protected:
IntData* m_LoadOutResut; IntData* m_LoadOutResut;
IntData* m_LoadInProcStep; IntData* m_LoadInProcStep;
IntData* m_LoadOutProcStep; IntData* m_LoadOutProcStep;
BoolData* m_WaitConnectBoxCommit;
BoolData* m_isLoadIn; //绑定m_LoadInThread BoolData* m_isLoadIn; //绑定m_LoadInThread
BoolData* m_isLoadOut; //绑定m_LoadOutThread BoolData* m_isLoadOut; //绑定m_LoadOutThread
BoolData* m_WaitConnectBoxCommit;
BoolData* m_NeedWaitSelectOutPos;
bool m_NeedWaitSelectOutPos; BoolData* m_WaitSelectOutPosCommit;
bool m_WaitSelectOutPosCommit; IntData* m_SelectOutPos;
int m_SelectOutPos;
CRITICAL_SECTION m_LoadCS;
CRITICAL_SECTION m_LoadCS;
vector<string> m_AxisTabs; vector<string> m_AxisTabs;
}; };