using Aitex.Core.RT.Device; using Aitex.Core.RT.Log; using Aitex.Core.Util; using CyberX8_RT.Devices.AXIS; using CyberX8_RT.Modules.Transporter; using CyberX8_RT.Modules; using MECF.Framework.Common.Equipment; namespace CyberX8_RT.Devices.TransPorter { public class ProcessTransporterElevatorAxisInterLock : IAxisInterLock { #region 内部变量 private JetAxisBase _axis; #endregion #region 属性 /// /// 模块名称 /// public string Module { get { return _axis.Module; } } /// /// 子模块名称 /// public string Name { get { return _axis.Name; } } #endregion /// /// 构造函数 /// /// /// public ProcessTransporterElevatorAxisInterLock(JetAxisBase axis) { _axis = axis; } /// /// GotoPosition条件检验 /// /// /// public bool CheckGotoPosition(string station) { if (!AxisManager.Instance.CheckModuleAxisSwitchOn(Module, Name)) { return false; } //ProcessTransporter Home if (ModuleHelper.IsInstalled(ModuleName.Transporter1)) { TransporterEntity processTransporterEntity = Singleton.Instance.GetModule(ModuleName.Transporter1.ToString()); if (processTransporterEntity == null) { LOG.WriteLog(eEvent.ERR_TRANSPORTER, Module, $"{ModuleName.Transporter1.ToString()} entity is null"); return false; } if (!processTransporterEntity.IsHomed) { LOG.WriteLog(eEvent.ERR_TRANSPORTER, Module, $"{ModuleName.Transporter1.ToString()} is not home, Cannot execute GotoSavedPosition"); return false; } } //LoaderTransporter Home if (ModuleHelper.IsInstalled(ModuleName.Transporter2)) { TransporterEntity loaderTransporterEntity = Singleton.Instance.GetModule(ModuleName.Transporter2.ToString()); if (loaderTransporterEntity == null) { LOG.WriteLog(eEvent.ERR_TRANSPORTER, Module, $"{ModuleName.Transporter2.ToString()} entity is null"); return false; } if (!loaderTransporterEntity.IsHomed) { LOG.WriteLog(eEvent.ERR_TRANSPORTER, Module, $"{ModuleName.Transporter2.ToString()} is not home, Cannot execute GotoSavedPosition"); return false; } } //ProcessTransporter Gantry is not run JetAxisBase gantryAxis = DEVICE.GetDevice($"{Module}.Gantry"); if (gantryAxis == null) { LOG.WriteLog(eEvent.ERR_TRANSPORTER, Module, $"{Module} Gantry Axis is null"); return false; } if (gantryAxis.Status == CyberX8_Core.RState.Running) { LOG.WriteLog(eEvent.ERR_TRANSPORTER, Module, $"{Module} Gantry Axis is Run"); return false; } //Check Gantry at station //double gantryPosition = gantryAxis.MotionData.MotorPosition; //if (gantryAxis.CheckPositionIsEmpty(gantryPosition)) //{ // LOG.WriteLog(eEvent.ERR_TRANSPORTER, Module, $"{Module} Gantry is not in any station"); // return false; //} return true; } } }