using Aitex.Core.RT.Device;
using Aitex.Core.RT.Log;
using MECF.Framework.Common.Equipment;
using PunkHPX8_RT.Devices.AXIS;
using PunkHPX8_RT.Devices.Facilities;
using PunkHPX8_RT.Devices.VpwMain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PunkHPX8_RT.Devices.VpwCell
{
    public class VpwRotationAxisInterLock : IAxisInterLock
    {
        #region 内部变量
        private JetAxisBase _axis;
        #endregion
        #region 属性
        /// 
        /// 模块名称
        /// 
        public string Module { get { return _axis.Module; } }
        /// 
        /// 子模块名称
        /// 
        public string Name { get { return _axis.Name; } }
        #endregion
        /// 
        /// 构造函数
        /// 
        /// 
        /// 
        public VpwRotationAxisInterLock(JetAxisBase axis)
        {
            _axis = axis;
        }
        /// 
        /// GotoPosition判定前置条件
        /// 
        /// 
        /// 
        public bool CheckGotoPosition(string station)
        {
            if (!_axis.IsHomed)
            {
                LOG.WriteLog(eEvent.ERR_AXIS, $"{Module}.{Name}", "axis is not home, Cannot execute GotoSavedPosition");
                return false;
            }
            if (!_axis.IsSwitchOn)
            {
                LOG.WriteLog(eEvent.ERR_AXIS, $"{Module}.{Name}", "axis is switch off, Cannot execute GotoSavedPosition");
                return false;
            }
            
            return true;
        }
    }
}