| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 | 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;using System;namespace CyberX8_RT.Devices.TransPorter{    public class LoaderTransPorterElevatorAxisInterLock : IAxisInterLock    {        #region 内部变量        private JetAxisBase _axis;        #endregion        #region 属性        /// <summary>        /// 模块名称        /// </summary>        public string Module { get { return _axis.Module; } }        /// <summary>        /// 子模块名称        /// </summary>        public string Name { get { return _axis.Name; } }        #endregion        /// <summary>        /// 栣函数        /// </summary>        /// <param name="moduleName"></param>        /// <param name="name"></param>        public LoaderTransPorterElevatorAxisInterLock(JetAxisBase axis)        {            _axis = axis;        }        /// <summary>        /// GotoPosition条件检验        /// </summary>        /// <param name="station"></param>        /// <returns></returns>        /// <exception cref="NotImplementedException"></exception>        public bool CheckGotoPosition(string station)        {            if (!AxisManager.Instance.CheckModuleAxisSwitchOn(Module, Name))            {                return false;            }                        //ProcessTransporter Home            if (ModuleHelper.IsInstalled(ModuleName.Transporter1))            {                TransporterEntity processTransporterEntity = Singleton<RouteManager>.Instance.GetModule<TransporterEntity>(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<RouteManager>.Instance.GetModule<TransporterEntity>(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;                }            }            //LoaderTransporter Gantry is not run            JetAxisBase gantryAxis = DEVICE.GetDevice<JetAxisBase>($"{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;            //}            //是否在Load位            if (gantryAxis.CheckPositionIsInStation(gantryPosition, "Loader"))            {                JetAxisBase rotationAxis = DEVICE.GetDevice<JetAxisBase>($"Loader1.Rotation");                double rotationPosition = rotationAxis.MotionData.MotorPosition;                if (!rotationAxis.CheckPositionIsInStation(rotationPosition, "TRNPA") && !rotationAxis.CheckPositionIsInStation(rotationPosition, "TRNPB"))                {                    if(station != "UP" && station != "CELLTOP")                    {                        LOG.WriteLog(eEvent.ERR_TRANSPORTER, Module, $"Loader Rotation is not in TRNP, {Module} Gantry only can go to UP or CELLTOP");                        return false;                    }                }            }                      return true;        }    }}
 |