632 lines
20 KiB
C++
632 lines
20 KiB
C++
|
|
#include "Machine.h"
|
|
#include "../config/ConfigManager.h"
|
|
#include "HBD1000.h"
|
|
#include "HBD1500.h"
|
|
#include "HBD1200OLD.h"
|
|
#include "HBD1200.h"
|
|
#include "HBDE1000.h"
|
|
#include "../external/imgui/imgui.h"
|
|
#include "../external/imgui/imgui_custom.h"
|
|
#include "../LanguageManager.h"
|
|
#include "../SystemInfo.h"
|
|
//#include "../ScannerCtrl/BaseCtrl.h"
|
|
#include "../global.h"
|
|
#include "../Toast.h"
|
|
|
|
//list<ClientInfo*> Machine::m_clientUser;
|
|
|
|
Machine::Machine(MachineTypeCfg::MachineTypeId type)
|
|
: m_Type(type)
|
|
, m_LoadInThread(INVALID_HANDLE_VALUE)
|
|
, m_LoadOutThread(INVALID_HANDLE_VALUE)
|
|
, m_LoadCtrlFlag(false)
|
|
, m_LoadInfo(new StrData("LoadInfo"))
|
|
, m_LoadInProcStep(new IntData("LoadInProcStep"))
|
|
, m_LoadOutProcStep(new IntData("LoadOutProcStep"))
|
|
, m_LoadInResut(new IntData("LoadInResut"))
|
|
, m_LoadOutResut(new IntData("LoadOutResut"))
|
|
, m_WaitConnectBoxCommit(new BoolData("WaitConnectBoxCommit"))
|
|
, m_isLoadIn(new BoolData("IsLoadIn",u8"是否载入"))
|
|
, m_isLoadOut(new BoolData("IsLoadOut",u8"是否载出"))
|
|
, m_NeedWaitSelectOutPos(false)
|
|
, m_WaitSelectOutPosCommit(false)
|
|
{
|
|
InsertMp(&m_LoadInfo, 1);
|
|
InsertMp(&m_LoadInProcStep, 1);
|
|
InsertMp(&m_LoadOutProcStep, 1);
|
|
InsertMp(&m_LoadInResut, 1);
|
|
InsertMp(&m_LoadOutResut, 1);
|
|
InsertMp(&m_WaitConnectBoxCommit, 1);
|
|
InsertMp(&m_isLoadIn, 1);
|
|
InsertMp(&m_isLoadOut, 1);
|
|
|
|
|
|
m_AlarmEnableMap["CarbinDoorOpen"] = true;
|
|
m_AlarmEnableMap["LaserAlarm"] = true;
|
|
m_AlarmEnableMap["Laser1Alarm"] = false;
|
|
m_AlarmEnableMap["Laser2Alarm"] = false;
|
|
m_AlarmEnableMap["ServoAlarm"] = true;
|
|
m_AlarmEnableMap["CoverBreak"] = true;
|
|
m_AlarmEnableMap["MoldLoadOverLimitAlarm"] = true;
|
|
m_AlarmEnableMap["PowderLoadOverLimitAlarm"] = true;
|
|
m_AlarmEnableMap["ArmLoadOverLimitAlarm"] = true;
|
|
|
|
m_AlarmEnableMap["OxygenOverLimit"] = true;
|
|
m_AlarmEnableMap["InnerTempOverLimit"] = true;
|
|
m_AlarmEnableMap["ACWaterLeverAlarm"] = true;
|
|
m_AlarmEnableMap["PowerBreak"] = true;
|
|
m_AlarmEnableMap["PrintSignalAlarm"] = true;
|
|
m_AlarmEnableMap["WindLowerLimit"] = true;
|
|
m_AlarmEnableMap["PowderEmpty"] = true;
|
|
m_AlarmEnableMap["SSRAlarm"] = true;
|
|
m_AlarmEnableMap["MoldMotionTransferAlarm"] = true;
|
|
m_AlarmEnableMap["PowderMotionTransferAlarm"] = true;
|
|
m_AlarmEnableMap["ChillerAlarm"] = true;
|
|
m_AlarmEnableMap["InverterRunSignalAlarm"] = true;
|
|
m_AlarmEnableMap["InverterAlarm"] = true;
|
|
m_AlarmEnableMap["UpDownLimitAlarm"] = true;
|
|
m_AlarmEnableMap["FanVoltageAlarm"] = true;
|
|
|
|
m_CommunicationEnableMap["XT_PURIFIER"] = true;
|
|
m_CommunicationEnableMap["HBD_PURIFIER"] = true;
|
|
m_CommunicationEnableMap["REMOTE"] = true;
|
|
m_CommunicationEnableMap["LASER"] = true;
|
|
m_CommunicationEnableMap["LASER1"] = true;
|
|
m_CommunicationEnableMap["LASER2"] = true;
|
|
m_CommunicationEnableMap["PLATE_TEMP"] = true;
|
|
m_CommunicationEnableMap["OXYGEN"] = true;
|
|
|
|
m_SSRCheckTick = GetTickCount64();
|
|
InitializeCriticalSection(&m_LoadCS);
|
|
}
|
|
|
|
Machine::~Machine() {
|
|
|
|
}
|
|
|
|
void Machine::Init()
|
|
{
|
|
m_AlarmCfgWrapper = ConfigManager::GetInstance()->GetAlarmCfg();
|
|
m_IOCfgWrapper = ConfigManager::GetInstance()->GetIoCfgWrapper();
|
|
m_RunCfg = ConfigManager::GetInstance()->GetRunCfg();
|
|
m_ExtCfg = ConfigManager::GetInstance()->GetExtCfg();
|
|
m_CoverCfg = ConfigManager::GetInstance()->GetCoverCfg();
|
|
m_MoldAxisCfg = ConfigManager::GetInstance()->GetMoldCfg();
|
|
m_LoadAxisCfg = ConfigManager::GetInstance()->GetLoadCfg();
|
|
m_ArmAxisCfg = ConfigManager::GetInstance()->GetArmCfg();
|
|
m_SupplyAxisCfg = ConfigManager::GetInstance()->GetSupplyCfg();
|
|
m_CleanAxisCfg = ConfigManager::GetInstance()->GetCleanCfg();
|
|
m_ParamLimitCfg = ConfigManager::GetInstance()->GetParamLimitCfg();
|
|
}
|
|
|
|
void Machine::CheckIO(vector<string>&ins, IOCfgWrapper* iocfgWrapper, int vid)
|
|
{
|
|
if (m_IoRef.find(vid) != m_IoRef.end()) {
|
|
m_IoRef[vid](ins, iocfgWrapper, GetInsertIOStr(), m_Type);
|
|
}
|
|
else {
|
|
m_IoRef[0](ins, iocfgWrapper, GetInsertIOStr(), m_Type);
|
|
}
|
|
}
|
|
|
|
Machine* Machine::CreateInstance(int type)
|
|
{
|
|
Machine* machine = nullptr;
|
|
if (type == MachineTypeCfg::HBD_1000) {
|
|
machine = new HBD1000(MachineTypeCfg::MachineTypeId(type));
|
|
}
|
|
else if (type == MachineTypeCfg::HBD_1500) {
|
|
machine = new HBD1500(MachineTypeCfg::MachineTypeId(type));
|
|
}
|
|
else if (type == MachineTypeCfg::HBD_1200_OLD) {
|
|
machine = new HBD1200OLD(MachineTypeCfg::MachineTypeId(type));
|
|
}
|
|
else if (type == MachineTypeCfg::HBD_1200) {
|
|
machine = new HBD1200(MachineTypeCfg::MachineTypeId(type));
|
|
}
|
|
else if (type == MachineTypeCfg::HBD_E1000) {
|
|
machine = new HBDE1000(MachineTypeCfg::MachineTypeId(type));
|
|
}
|
|
|
|
return machine;
|
|
}
|
|
|
|
void Machine::InitMachineCfg(MachineCfg* cfg)
|
|
{
|
|
switch (cfg->m_MachineType)
|
|
{
|
|
case MachineTypeCfg::HBD_1000: {
|
|
cfg->m_Name = "HBD1000";
|
|
cfg->m_PlatformWidth = 600;
|
|
cfg->m_PlatformLength = 600;
|
|
}break;
|
|
case MachineTypeCfg::HBD_1500: {
|
|
cfg->m_Name = "HBD1500";
|
|
cfg->m_PlatformWidth = 600;
|
|
cfg->m_PlatformLength = 600;
|
|
}break;
|
|
case MachineTypeCfg::HBD_1200_OLD: {
|
|
cfg->m_Name = "HBD1200_OLD";
|
|
cfg->m_PlatformWidth = 600;
|
|
cfg->m_PlatformLength = 600;
|
|
}break;
|
|
case MachineTypeCfg::HBD_1200: {
|
|
cfg->m_Name = "HBD1200";
|
|
cfg->m_PlatformWidth = 600;
|
|
cfg->m_PlatformLength = 600;
|
|
}break;
|
|
default:break;
|
|
}
|
|
}
|
|
|
|
AxisCfg* Machine::CreateEleAxisCfg()
|
|
{
|
|
AxisCfg* cfg = new AxisCfg(GTS_AXIS_ID_ELE);
|
|
cfg->m_name = "ELE";
|
|
cfg->m_active_direct->SetValue(AxisCfg::UP);
|
|
cfg->m_active_limit->SetValue(50000);
|
|
cfg->m_negactive_limit->SetValue(-1000000);
|
|
cfg->m_OverLoadLimit->SetValue(30.0f);
|
|
cfg->m_ShowPosInv->SetValue(true);
|
|
cfg->m_ShowRefZero->SetValue(0.0);
|
|
cfg->m_IsUse->SetValue(false);
|
|
cfg->m_MaxLoadValue->SetValue(7.0f);
|
|
return cfg;
|
|
}
|
|
|
|
string Machine::GetFindIOStr()
|
|
{
|
|
char buffer[1024];
|
|
string str = "SELECT %s,%s,%s,%s,%s,%s,%s,%s FROM %s WHERE %s=%d ORDER BY %s";
|
|
sprintf_s(buffer, sizeof(buffer), str.c_str(),
|
|
IOCfg::FIELD_ID.c_str(),
|
|
IOCfg::FIELD_MACHINE_TYPE.c_str(),
|
|
IOCfg::FIELD_STATUS_ADDR.c_str(),
|
|
IOCfg::FIELD_CTRL_ADDR.c_str(),
|
|
IOCfg::FIELD_IS_OUTPUT.c_str(),
|
|
IOCfg::FIELD_CODE.c_str(),
|
|
IOCfg::FIELD_CONTENT.c_str(),
|
|
IOCfg::FIELD_AUTH_LESS.c_str(),
|
|
IOCfg::TABLE_NAME.c_str(),
|
|
IOCfg::FIELD_MACHINE_TYPE.c_str(),
|
|
m_Type,IOCfg::FIELD_STATUS_ADDR.c_str());
|
|
return buffer;
|
|
}
|
|
|
|
string Machine::GetInsertIOStr()
|
|
{
|
|
char buffer[1024];
|
|
string strtemp = "INSERT INTO %s(%s,%s,%s,%s,%s,%s,%s) VALUES(%d,";
|
|
sprintf_s(buffer, sizeof(buffer), strtemp.c_str(),
|
|
IOCfg::TABLE_NAME.c_str(),
|
|
IOCfg::FIELD_MACHINE_TYPE.c_str(),
|
|
IOCfg::FIELD_STATUS_ADDR.c_str(),
|
|
IOCfg::FIELD_CTRL_ADDR.c_str(),
|
|
IOCfg::FIELD_IS_OUTPUT.c_str(),
|
|
IOCfg::FIELD_CODE.c_str(),
|
|
IOCfg::FIELD_CONTENT.c_str(),
|
|
IOCfg::FIELD_AUTH_LESS.c_str(),
|
|
m_Type
|
|
);
|
|
string strsql = string(buffer) + "%d,%d,%d,'%s','%s',%d)";
|
|
return strsql;
|
|
}
|
|
|
|
void Machine::GetStartupIO(vector<IOCfg*>& vec)
|
|
{
|
|
vec.push_back(m_IOCfgWrapper->m_LightOn);
|
|
vec.push_back(m_IOCfgWrapper->m_ServoMotor);
|
|
if (!m_RunCfg->m_AutoShutdownPower) {
|
|
vec.push_back(m_IOCfgWrapper->m_Laser);
|
|
}
|
|
}
|
|
|
|
void Machine::BindLaser()
|
|
{
|
|
LaserIO* lio1 = new LaserIO();
|
|
lio1->m_LaserRed = m_IOCfgWrapper->m_Laser1Red;
|
|
lio1->m_LaserStart = m_IOCfgWrapper->m_Laser1Start;
|
|
lio1->m_LaserEnable = m_IOCfgWrapper->m_Laser1Enable;
|
|
m_IOCfgWrapper->m_LaserIOMap[1] = lio1;
|
|
|
|
LaserIO* lio2 = new LaserIO();
|
|
lio2->m_LaserRed = m_IOCfgWrapper->m_Laser2Red;
|
|
lio2->m_LaserStart = m_IOCfgWrapper->m_Laser2Start;
|
|
lio2->m_LaserEnable = m_IOCfgWrapper->m_Laser2Enable;
|
|
m_IOCfgWrapper->m_LaserIOMap[2] = lio2;
|
|
|
|
LaserIO* lio3 = new LaserIO();
|
|
lio3->m_LaserRed = m_IOCfgWrapper->m_Laser3Red;
|
|
lio3->m_LaserStart = m_IOCfgWrapper->m_Laser3Start;
|
|
lio3->m_LaserEnable = m_IOCfgWrapper->m_Laser3Enable;
|
|
m_IOCfgWrapper->m_LaserIOMap[3] = lio3;
|
|
|
|
LaserIO* lio4 = new LaserIO();
|
|
lio4->m_LaserRed = m_IOCfgWrapper->m_Laser4Red;
|
|
lio4->m_LaserStart = m_IOCfgWrapper->m_Laser4Start;
|
|
lio4->m_LaserEnable = m_IOCfgWrapper->m_Laser4Enable;
|
|
m_IOCfgWrapper->m_LaserIOMap[4] = lio4;
|
|
}
|
|
|
|
//void Machine::DrawIO(bool* isShow)
|
|
//{
|
|
//
|
|
// ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4, 6));
|
|
// ImGui::Begin(_(u8"IO调试").c_str(), isShow, ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_AlwaysAutoResize| ImGuiWindowFlags_HorizontalScrollbar);
|
|
// ImGui::PopStyleVar();
|
|
// ImGui::BeginTabBar(u8"IO_TAB");
|
|
// if (ImGui::BeginTabItem(_(u8"输出").c_str())) {
|
|
// int group_cnt = ceil(m_IOCfgWrapper->m_OutputCfgs.size() / 20.0f);
|
|
// for (int i = 0; i < group_cnt; i++) {
|
|
// ImGui::BeginGroup();
|
|
// for (int j = 0; j < 20 && (i * 20 + j) < m_IOCfgWrapper->m_OutputCfgs.size(); j++) {
|
|
// IOCfg* ocfg = m_IOCfgWrapper->m_OutputCfgs[i * 20 + j];
|
|
// if (ImGui::ToggleButton((to_string(ocfg->m_Id) + ocfg->m_Code).c_str(), ocfg->IsActive(), g_Admin>=ocfg->m_AuthLess)) {
|
|
// ocfg->SetActive(!ocfg->IsActive());
|
|
// }
|
|
// ImGui::SameLine();
|
|
// ImGui::Text("%s", ocfg->m_ShowContent.c_str());
|
|
// }
|
|
// ImGui::EndGroup();
|
|
//
|
|
// if (i < group_cnt - 1) {
|
|
// ImGui::SameLine();
|
|
// ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
|
|
// ImGui::SameLine();
|
|
// }
|
|
// }
|
|
// ImGui::EndTabItem();
|
|
// }
|
|
//
|
|
// if (ImGui::BeginTabItem(_(u8"输入").c_str())) {
|
|
// int group_cnt = ceil(m_IOCfgWrapper->m_InputCfgs.size() / 21.0f);
|
|
// for (int i = 0; i < group_cnt; i++) {
|
|
// ImGui::BeginGroup();
|
|
// for (int j = 0; j < 21 && (i * 21 + j) < m_IOCfgWrapper->m_InputCfgs.size(); j++) {
|
|
// IOCfg* ocfg = m_IOCfgWrapper->m_InputCfgs[i * 21 + j];
|
|
// ImGui::ToggleButton((to_string(ocfg->m_Id) + ocfg->m_Code).c_str(), ocfg->IsActive(), false);
|
|
// ImGui::SameLine();
|
|
// ImGui::Text("%s", ocfg->m_ShowContent.c_str());
|
|
// }
|
|
// ImGui::EndGroup();
|
|
//
|
|
// if (i < group_cnt - 1) {
|
|
// ImGui::SameLine();
|
|
// ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
|
|
// ImGui::SameLine();
|
|
// }
|
|
// }
|
|
// ImGui::EndTabItem();
|
|
// }
|
|
// ImGui::EndTabBar();
|
|
//
|
|
//
|
|
// ImGui::End();
|
|
//}
|
|
//
|
|
//void Machine::DrawAnalogExt()
|
|
//{
|
|
// ImGui::SameLine();
|
|
// ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
|
|
// ImGui::SameLine();
|
|
// ImGui::BeginGroup();
|
|
// if (ImGui::InputFloat(_(u8"清粉箱除氧设定值").c_str(), m_SysParamWrapper->GetEnvUIAssist()->m_CleanBoxDeoxygenSetValue->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
|
|
// {
|
|
// m_SysParamWrapper->GetEnvUIAssist()->m_CleanBoxDeoxygenSetValue->SetValue(m_SysParamWrapper->GetEnvUIAssist()->m_CleanBoxDeoxygenSetValue->GetValue());
|
|
// }
|
|
// if (ImGui::InputFloat(_(u8"清粉箱测氧仪下限").c_str(), m_SysParamWrapper->GetEnvUIAssist()->m_CleanBoxOxygenDownLimit->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
|
|
// {
|
|
// m_SysParamWrapper->GetEnvUIAssist()->m_CleanBoxOxygenDownLimit->SetValue(m_SysParamWrapper->GetEnvUIAssist()->m_CleanBoxOxygenDownLimit->GetValue());
|
|
// }
|
|
// if (ImGui::InputFloat(_(u8"清粉箱测氧仪上限").c_str(), m_SysParamWrapper->GetEnvUIAssist()->m_CleanBoxOxygenUpLimit->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
|
|
// {
|
|
// m_SysParamWrapper->GetEnvUIAssist()->m_CleanBoxOxygenUpLimit->SetValue(m_SysParamWrapper->GetEnvUIAssist()->m_CleanBoxOxygenUpLimit->GetValue());
|
|
// }
|
|
// if (ImGui::InputFloat(_(u8"清粉箱泄压值").c_str(), m_SysParamWrapper->GetEnvUIAssist()->m_CleanBoxPressureReleaseValue->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
|
|
// {
|
|
// m_SysParamWrapper->GetEnvUIAssist()->m_CleanBoxPressureReleaseValue->SetValue(m_SysParamWrapper->GetEnvUIAssist()->m_CleanBoxPressureReleaseValue->GetValue());
|
|
// }
|
|
// if (ImGui::InputFloat(_(u8"打印小车1报警重量").c_str(), m_SysParamWrapper->GetEnvUIAssist()->m_PrintCar1AlarmWeight->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
|
|
// {
|
|
// m_SysParamWrapper->GetEnvUIAssist()->m_PrintCar1AlarmWeight->SetValue(m_SysParamWrapper->GetEnvUIAssist()->m_PrintCar1AlarmWeight->GetValue());
|
|
// }
|
|
// if (ImGui::InputFloat(_(u8"打印小车2报警重量").c_str(), m_SysParamWrapper->GetEnvUIAssist()->m_PrintCar2AlarmWeight->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
|
|
// {
|
|
// m_SysParamWrapper->GetEnvUIAssist()->m_PrintCar2AlarmWeight->SetValue(m_SysParamWrapper->GetEnvUIAssist()->m_PrintCar2AlarmWeight->GetValue());
|
|
// }
|
|
// if (ImGui::InputFloat(_(u8"清粉小车1报警重量").c_str(), m_SysParamWrapper->GetEnvUIAssist()->m_CleanCar1AlarmWeight->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
|
|
// {
|
|
// m_SysParamWrapper->GetEnvUIAssist()->m_CleanCar1AlarmWeight->SetValue(m_SysParamWrapper->GetEnvUIAssist()->m_CleanCar1AlarmWeight->GetValue());
|
|
// }
|
|
// if (ImGui::InputFloat(_(u8"清粉小车2报警重量").c_str(), m_SysParamWrapper->GetEnvUIAssist()->m_CleanCar2AlarmWeight->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
|
|
// {
|
|
// m_SysParamWrapper->GetEnvUIAssist()->m_CleanCar2AlarmWeight->SetValue(m_SysParamWrapper->GetEnvUIAssist()->m_CleanCar2AlarmWeight->GetValue());
|
|
// }
|
|
//
|
|
//
|
|
// ImGui::EndGroup();
|
|
//
|
|
// ImGui::SameLine();
|
|
// ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
|
|
// ImGui::SameLine();
|
|
// ImGui::BeginGroup();
|
|
// if (ImGui::InputFloat(_(u8"料位棒长度").c_str(), m_SysParamWrapper->GetEnvUIAssist()->m_PowderLevelLength->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
|
|
// {
|
|
// m_SysParamWrapper->GetEnvUIAssist()->m_PowderLevelLength->SetValue(m_SysParamWrapper->GetEnvUIAssist()->m_PowderLevelLength->GetValue());
|
|
// }
|
|
// if (ImGui::InputFloat(_(u8"料位棒计算长度").c_str(), &m_RunCfg->m_PowderStickCalcLength, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
|
|
// {
|
|
// if (m_RunCfg->m_PowderStickCalcLength <= 0.0f) {
|
|
// m_RunCfg->m_PowderStickCalcLength = 1.0f;
|
|
// }
|
|
// }
|
|
//
|
|
// if (ImGui::InputFloat(_(u8"料位棒当前值").c_str(), m_SysParamWrapper->GetEnvUIAssist()->m_PowderLevelValue->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
|
|
// {
|
|
// m_SysParamWrapper->GetEnvUIAssist()->m_PowderLevelValue->SetValue(m_SysParamWrapper->GetEnvUIAssist()->m_PowderLevelValue->GetValue());
|
|
// }
|
|
//
|
|
// if (ImGui::InputFloat(_(u8"打印室换气泄压值").c_str(), m_SysParamWrapper->GetEnvUIAssist()->m_PrintAirRenewalPresRelValue->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
|
|
// {
|
|
// m_SysParamWrapper->GetEnvUIAssist()->m_PrintAirRenewalPresRelValue->SetValue(m_SysParamWrapper->GetEnvUIAssist()->m_PrintAirRenewalPresRelValue->GetValue());
|
|
// }
|
|
// ImGui::EndGroup();
|
|
//}
|
|
|
|
|
|
void Machine::LoadIn()
|
|
{
|
|
m_RunCfg->m_HadSetBasePlatformPoint = false;
|
|
if (m_LoadInThread != INVALID_HANDLE_VALUE)return;
|
|
m_LoadCtrlFlag = true;
|
|
SetLoadInResult(0, "");
|
|
m_LoadInThread = AtlCreateThread(LoadInProc, this);
|
|
m_isLoadIn->SetValue(true);
|
|
}
|
|
|
|
DWORD WINAPI Machine::LoadInProc(Machine* _this)
|
|
{
|
|
if (_this)
|
|
{
|
|
_this->LoadInRun();
|
|
_this->m_LoadCtrlFlag = false;
|
|
if (_this->m_LoadInThread != INVALID_HANDLE_VALUE)
|
|
{
|
|
CloseHandle(_this->m_LoadInThread);
|
|
_this->m_LoadInThread = INVALID_HANDLE_VALUE;
|
|
_this->m_isLoadIn->SetValue(false);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
void Machine::LoadOut()
|
|
{
|
|
m_RunCfg->m_HadSetBasePlatformPoint = false;
|
|
if (m_LoadOutThread != INVALID_HANDLE_VALUE)return;
|
|
m_LoadCtrlFlag = true;
|
|
SetLoadOutResult(0, "");
|
|
m_WaitConnectBoxCommit->SetValue(false);
|
|
m_WaitSelectOutPosCommit = false;
|
|
m_LoadOutThread = AtlCreateThread(LoadOutProc, this);
|
|
m_isLoadOut->SetValue(true);
|
|
}
|
|
|
|
DWORD WINAPI Machine::LoadOutProc(Machine* _this)
|
|
{
|
|
if (_this)
|
|
{
|
|
_this->LoadOutRun();
|
|
_this->m_LoadCtrlFlag = false;
|
|
if (_this->m_LoadOutThread != INVALID_HANDLE_VALUE)
|
|
{
|
|
CloseHandle(_this->m_LoadOutThread);
|
|
_this->m_LoadOutThread = INVALID_HANDLE_VALUE;
|
|
_this->m_isLoadOut->SetValue(false);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
void Machine::InterceptLoad()
|
|
{
|
|
m_LoadCtrlFlag = false;
|
|
if (m_SignalStateWrapper->m_CylinderDisconnectCleanBoxTriger && m_SignalStateWrapper->m_CylinderDisconnectCleanBoxTriger->GetValue()) {
|
|
m_SignalStateWrapper->m_CylinderDisconnectCleanBoxTriger->SetValue(false);
|
|
}
|
|
if (m_SignalStateWrapper->m_CylinderReachPrintTriger && m_SignalStateWrapper->m_CylinderReachPrintTriger->GetValue()) {
|
|
m_SignalStateWrapper->m_CylinderReachPrintTriger->SetValue(false);
|
|
}
|
|
if (m_SignalStateWrapper->m_MoldConnectCylinderTriger &&m_SignalStateWrapper->m_MoldConnectCylinderTriger->GetValue()) {
|
|
m_SignalStateWrapper->m_MoldConnectCylinderTriger->SetValue(false);
|
|
}
|
|
if (m_SignalStateWrapper->m_CylinderPrintLoadTriger &&m_SignalStateWrapper->m_CylinderPrintLoadTriger->GetValue()) {
|
|
m_SignalStateWrapper->m_CylinderPrintLoadTriger->SetValue(false);
|
|
}
|
|
if (m_SignalStateWrapper->m_CylinderPrintUnloadTriger &&m_SignalStateWrapper->m_CylinderPrintUnloadTriger->GetValue()) {
|
|
m_SignalStateWrapper->m_CylinderPrintUnloadTriger->SetValue(false);
|
|
}
|
|
if (m_SignalStateWrapper->m_MoldDisconnectCylinderTriger &&m_SignalStateWrapper->m_MoldDisconnectCylinderTriger->GetValue()) {
|
|
m_SignalStateWrapper->m_MoldDisconnectCylinderTriger->SetValue(false);
|
|
}
|
|
if (m_SignalStateWrapper->m_CylinderReachCleanTriger &&m_SignalStateWrapper->m_CylinderReachCleanTriger->GetValue()) {
|
|
m_SignalStateWrapper->m_CylinderReachCleanTriger->SetValue(false);
|
|
}
|
|
|
|
if (m_SignalStateWrapper->m_CylinderConnectCleanBoxTriger &&m_SignalStateWrapper->m_CylinderConnectCleanBoxTriger->GetValue()) {
|
|
m_SignalStateWrapper->m_CylinderConnectCleanBoxTriger->SetValue(false);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//移栽轴运动
|
|
void Machine::LoadAxisMove(AxisConfig::ActiveDirect adr, bool isContinue, bool isStart) {
|
|
switch (adr) {
|
|
case AxisConfig::ActiveDirect::UP: break;
|
|
case AxisConfig::ActiveDirect::DOWN: break;
|
|
case AxisConfig::ActiveDirect::LEFT:
|
|
if (!isContinue) {
|
|
//if (IsLoadAxisCanMoveLeft()) {
|
|
m_Axis->m_Load->MovPoint(adr);
|
|
//}
|
|
}
|
|
else {
|
|
if (isStart) {
|
|
m_Axis->m_Load->MovLimitStart(adr);
|
|
}
|
|
else {
|
|
m_Axis->m_Load->MovLimitStop(adr);
|
|
}
|
|
}
|
|
break;
|
|
case AxisConfig::ActiveDirect::RIGHT:
|
|
//if (IsLoadAxisCanMoveRight()) {
|
|
m_Axis->m_Load->MovPoint(adr);
|
|
//}
|
|
break;
|
|
case AxisConfig::ActiveDirect::FRONT: break;
|
|
case AxisConfig::ActiveDirect::BACK: break;
|
|
case AxisConfig::ActiveDirect::ZERO: //清零
|
|
m_Axis->m_Load->GetState()->SetZeroPos(); break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//供粉轴运动
|
|
void Machine::SupplyAxisMove(AxisConfig::ActiveDirect adr, bool isContinue, bool isStart) {
|
|
switch (adr) {
|
|
case AxisConfig::ActiveDirect::UP: break;
|
|
case AxisConfig::ActiveDirect::DOWN: break;
|
|
case AxisConfig::ActiveDirect::LEFT: break;
|
|
case AxisConfig::ActiveDirect::RIGHT: break;
|
|
case AxisConfig::ActiveDirect::FRONT:
|
|
if (!isContinue) {
|
|
//if (IsLoadAxisCanMoveLeft()) {
|
|
m_Axis->m_Supply->MovPoint(adr);
|
|
//}
|
|
}
|
|
else {
|
|
if (isStart) {
|
|
m_Axis->m_Supply->MovLimitStart(adr);
|
|
}
|
|
else {
|
|
m_Axis->m_Supply->MovLimitStop(adr);
|
|
}
|
|
}
|
|
break;
|
|
case AxisConfig::ActiveDirect::BACK:
|
|
if (!isContinue) {
|
|
//if (IsLoadAxisCanMoveLeft()) {
|
|
m_Axis->m_Supply->MovPoint(adr);
|
|
//}
|
|
}
|
|
else {
|
|
if (isStart) {
|
|
m_Axis->m_Supply->MovLimitStart(adr);
|
|
}
|
|
else {
|
|
m_Axis->m_Supply->MovLimitStop(adr);
|
|
}
|
|
}
|
|
break;
|
|
case AxisConfig::ActiveDirect::ZERO: //清零
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//成型缸运动
|
|
void Machine::PrintAxisMove(AxisConfig::ActiveDirect adr, bool isContinue, bool isStart) {
|
|
switch (adr) {
|
|
case AxisConfig::ActiveDirect::UP:
|
|
if (!isContinue) {
|
|
m_Axis->m_Mold->MovPoint(adr);
|
|
}
|
|
else {
|
|
if (isStart) {
|
|
m_Axis->m_Mold->MovLimitStart(adr);
|
|
}
|
|
else {
|
|
m_Axis->m_Mold->MovLimitStop(adr);
|
|
}
|
|
}
|
|
break;
|
|
case AxisConfig::ActiveDirect::DOWN:
|
|
if (!isContinue) {
|
|
m_Axis->m_Mold->MovPoint(adr);
|
|
}
|
|
else {
|
|
if (isStart) {
|
|
m_Axis->m_Mold->MovLimitStart(adr);
|
|
}
|
|
else {
|
|
m_Axis->m_Mold->MovLimitStop(adr);
|
|
}
|
|
}
|
|
break;
|
|
case AxisConfig::ActiveDirect::LEFT: break;
|
|
case AxisConfig::ActiveDirect::RIGHT: break;
|
|
case AxisConfig::ActiveDirect::FRONT: break;
|
|
case AxisConfig::ActiveDirect::BACK: break;
|
|
case AxisConfig::ActiveDirect::ZERO: //清零
|
|
m_Axis->m_Mold->GetState()->SetZeroPos();
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
//铺粉臂运动
|
|
void Machine::ArmAxisMove(AxisConfig::ActiveDirect adr, bool isContinue, bool isStart) {
|
|
|
|
switch (adr) {
|
|
case AxisConfig::ActiveDirect::UP: break;
|
|
case AxisConfig::ActiveDirect::DOWN: break;
|
|
case AxisConfig::ActiveDirect::LEFT: break;
|
|
case AxisConfig::ActiveDirect::RIGHT: break;
|
|
case AxisConfig::ActiveDirect::FRONT:
|
|
if (!isContinue) {
|
|
m_Axis->m_Arm->MovPoint(adr);
|
|
}
|
|
else {
|
|
if (isStart) {
|
|
m_Axis->m_Arm->MovLimitStart(adr);
|
|
}
|
|
else {
|
|
m_Axis->m_Arm->MovLimitStop(adr);
|
|
}
|
|
}
|
|
break;
|
|
case AxisConfig::ActiveDirect::BACK:
|
|
if (!isContinue) {
|
|
m_Axis->m_Arm->MovPoint(adr);
|
|
}
|
|
else {
|
|
if (isStart) {
|
|
m_Axis->m_Arm->MovLimitStart(adr);
|
|
}
|
|
else {
|
|
m_Axis->m_Arm->MovLimitStop(adr);
|
|
}
|
|
}
|
|
break;
|
|
case AxisConfig::ActiveDirect::ZERO: //清零
|
|
m_Axis->m_Arm->GetState()->SetZeroPos();
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
|
|
} |