using Aitex.Core.RT.DataCenter; using Aitex.Core.RT.Device; using Aitex.Core.RT.Log; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.Utilities; using CyberX8_RT.Devices.AXIS; using CyberX8_RT.Devices.AXIS.Yaskawa; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CyberX8_RT.Devices.Loader { public class LoaderShuttleAxisInterLock : IAxisInterLock { #region 内部变量 private JetAxisBase _axis; #endregion #region 属性 /// /// 模块名称 /// public string Module { get { return _axis.Module ; } } /// /// 子模块名称 /// public string Name { get { return _axis.Name; } } #endregion #region 内部变量 private LoaderSideDevice _loaderSide = null; #endregion /// /// 构造函数 /// /// /// public LoaderShuttleAxisInterLock(JetAxisBase axis) { _axis = axis; } /// /// 加载LoaderSide对象 /// private void GetLoaderSide() { if (_loaderSide == null) { switch (Name) { case "ShuttleA": _loaderSide = DEVICE.GetDevice($"{Module}.SideA"); break; default: _loaderSide = DEVICE.GetDevice($"{Module}.SideB"); break; } } } /// /// GotoPosition条件检验 /// /// /// /// public bool CheckGotoPosition(string station) { if (!_axis.IsHomed) { LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Name} is not home, Cannot execute GotoSavedPosition"); return false; } return true; //GetLoaderSide(); //JetAxisBase tiltAxis = null; //if(Name=="ShuttleA") //{ // tiltAxis = DEVICE.GetDevice($"{Module}.TiltA"); //} //else //{ // tiltAxis = DEVICE.GetDevice($"{Module}.TiltB"); //} //if (!tiltAxis.IsSwitchOn) //{ // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{tiltAxis.Module} is switch off"); // return false; //} //if (tiltAxis.IsRun) //{ // LOG.WriteLog(eEvent.ERR_LOADER, Module, "tilt is running,Cannot execute GotoSavedPosition"); // return false; //} //if (station.EndsWith("CLOSED")) //{ // double tiltPosition = tiltAxis.MotionData.MotorPosition; // if(!tiltAxis.CheckPositionIsInStation(tiltPosition, "VERT")) // { // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{tiltAxis.Module} {tiltPosition} is not in VERT"); // return false; // } //} ////Puf vertical is park //if (ModuleHelper.IsInstalled(ModuleName.PUF1)) //{ // JetAxisBase puf1VerticalAxis = DEVICE.GetDevice($"{ModuleName.PUF1}.Vertical"); // if (puf1VerticalAxis != null) // { // double puf1VertocalPosition = puf1VerticalAxis.MotionData.MotorPosition; // if (!puf1VerticalAxis.CheckPositionIsInStation(puf1VertocalPosition, "Park")) // { // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{ModuleName.PUF1} Vertical {puf1VertocalPosition} is not in Park, Cannot execute GotoSavedPosition"); // return false; // } // } //} //if (ModuleHelper.IsInstalled(ModuleName.PUF2)) //{ // JetAxisBase puf2VerticalAxis = DEVICE.GetDevice($"{ModuleName.PUF2}.Vertical"); // if (puf2VerticalAxis != null) // { // double puf2VerticalPosition=puf2VerticalAxis.MotionData.MotorPosition; // if (!puf2VerticalAxis.CheckPositionIsInStation(puf2VerticalPosition, "Park")) // { // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{ModuleName.PUF2} Vertical {puf2VerticalPosition} is not in Park, Cannot execute GotoSavedPosition"); // return false; // } // } //} ////Door 在Closed,无法从其他位置运动至Closed位置 //if (_loaderSide.SideData.DoorLowerLocked||_loaderSide.SideData.DoorUpperLocked) //{ // if (station.EndsWith("CLOSED")) // { // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"door locked, {Name} cannot goto CLOSED"); // return false; // } // else // { // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"door locked, {Name} cannot move to other stations"); // return false; // } //} //JetAxisBase rotationAxis = DEVICE.GetDevice($"{Module}.Rotation"); //if (!rotationAxis.IsSwitchOn) //{ // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{rotationAxis.Module} is switch off"); // return false; //} //if (rotationAxis.IsRun) //{ // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"rotation is running,Cannot execute GotoSavedPosition"); // return false; //} //double rotationPosition = rotationAxis.MotionData.MotorPosition; //if (rotationAxis.CheckPositionIsEmpty(rotationPosition)) //{ // //LOG.WriteLog(eEvent.ERR_LOADER, Module, "loader rotation axis is empty, Cannot execute GotoSavedPosition"); // //return false; // return true; //} //else //{ // if (rotationAxis.CheckPositionIsInStation(rotationPosition, "LOADA") || // rotationAxis.CheckPositionIsInStation(rotationPosition, "LOADB")|| // rotationAxis.CheckPositionIsInStation(rotationPosition, "SERVICEB")) // { // return true; // } // else if (rotationAxis.CheckPositionIsInStation(rotationPosition, "CAMERA")) // { // if (station.EndsWith("CAMERA")) // { // return true; // } // else // { // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"loader rotation axis {rotationPosition} is in Camera, {Name} only goto Camera"); // return false; // } // } // else // { // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"loader rotation axis is in {rotationAxis.CurrentStation}, can not go to position"); // return false; // } //} } } }