LoaderCRSAxisInterLock.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using Aitex.Core.RT.Log;
  2. using CyberX8_RT.Devices.AXIS;
  3. using CyberX8_RT.Devices.AXIS.Yaskawa;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace CyberX8_RT.Devices.Loader
  10. {
  11. public class LoaderCRSAxisInterLock : IAxisInterLock
  12. {
  13. #region 内部变量
  14. private JetAxisBase _axis;
  15. #endregion
  16. #region 属性
  17. /// <summary>
  18. /// 模块名称
  19. /// </summary>
  20. public string Module { get { return _axis.Module; } }
  21. /// <summary>
  22. /// 子模块名称
  23. /// </summary>
  24. public string Name { get { return _axis.Name; } }
  25. #endregion
  26. /// <summary>
  27. /// 构造函数
  28. /// </summary>
  29. /// <param name="Module"></param>
  30. /// <param name="name"></param>
  31. public LoaderCRSAxisInterLock(JetAxisBase axis)
  32. {
  33. _axis = axis;
  34. }
  35. /// <summary>
  36. /// GotoPosition
  37. /// </summary>
  38. /// <param name="station"></param>
  39. /// <returns></returns>
  40. public bool CheckGotoPosition(string station)
  41. {
  42. if (!_axis.IsSwitchOn)
  43. {
  44. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Name} is switch off, Cannot execute GotoSavedPosition");
  45. return false;
  46. }
  47. if (!_axis.IsHomed)
  48. {
  49. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Name} is not home, Cannot execute GotoSavedPosition");
  50. return false;
  51. }
  52. if (_axis.Status==CyberX8_Core.RState.Running)
  53. {
  54. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Name} status is running, Cannot execute GotoSavedPosition");
  55. return false;
  56. }
  57. return true;
  58. }
  59. }
  60. }