IRobotHandlerFactory.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using Aitex.Core.RT.Log;
  7. using Aitex.Sorter.Common;
  8. using Aitex.Core.RT.SCCore;
  9. using MECF.Framework.Common.Equipment;
  10. using Aitex.Core.RT.Device;
  11. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot
  12. {
  13. public interface ITransferMsg
  14. {
  15. IDevice Robot { set; }
  16. bool background { get; }
  17. bool evt { get; }
  18. string package(params object[] args);
  19. /// </summary>
  20. /// return value, completed
  21. /// <param name="type"></param>
  22. /// <param name="cmd"></param>
  23. /// <returns></returns>
  24. bool unpackage(string type, string[] cmd);
  25. }
  26. public class TokenGenerator
  27. {
  28. private int _last = 0;
  29. List<int> _pool = new List<int>();
  30. SCConfigItem scToken = null;
  31. public TokenGenerator(string scName)
  32. {
  33. scToken = SC.GetConfigItem(scName);
  34. if (scToken == null)
  35. _last = scToken.IntValue;
  36. Random r = new Random();
  37. _last = r.Next() % 20;
  38. }
  39. public int create()
  40. {
  41. int first = _last;
  42. int token = first;
  43. do
  44. {
  45. token = (token + 1) % 100;
  46. if (_pool.Contains(token))
  47. continue;
  48. _pool.Add(token);
  49. _last = token;
  50. scToken.IntValue = _last;
  51. return _last;
  52. } while (token != first);
  53. throw (new ExcuteFailedException("Get token failed,pool is full"));
  54. }
  55. public void release(int token)
  56. {
  57. _pool.Remove(token);
  58. }
  59. public void release()
  60. {
  61. _last = 0;
  62. _pool.Clear();
  63. }
  64. }
  65. public interface IRobotHandlerFactory
  66. {
  67. IHandler Init();
  68. IHandler Home();
  69. IHandler Event();
  70. IHandler Grip(Hand hand);
  71. IHandler Release(Hand hand);
  72. IHandler QueryState();
  73. IHandler QueryPosition();
  74. IHandler Clear();
  75. IHandler Stop(bool isEmergency);
  76. IHandler Resume();
  77. IHandler SetSpeed(int speed);
  78. IHandler Pick(ModuleName chamber, int slot, Hand hand);
  79. IHandler PickExtend(ModuleName chamber, int slot, Hand hand);
  80. IHandler PickRetract(ModuleName chamber, int slot, Hand hand);
  81. IHandler Place(ModuleName chamber, int slot, Hand hand);
  82. IHandler PlaceExtend(ModuleName chamber, int slot, Hand hand);
  83. IHandler PlaceRetract(ModuleName chamber, int slot, Hand hand);
  84. IHandler Extend(ModuleName chamber, int slot, Hand hand);
  85. IHandler Retract(ModuleName chamber, int slot, Hand hand);
  86. IHandler Exchange(ModuleName chamber, int slot, Hand hand);
  87. IHandler Goto(ModuleName chamber, int slot, Motion next, Hand hand, int x,int y, int z);
  88. IHandler MoveTo(ModuleName chamber, int slot,Hand hand, bool isPick, int x,int y, int z);
  89. IHandler WaferMapping(ModuleName loadport);
  90. IHandler QueryWaferMap(ModuleName loadport);
  91. IHandler PickEx(ModuleName chamber, int slot, Hand hand, int x, int y, int z);
  92. IHandler PlaceEx(ModuleName chamber, int slot, Hand hand, int x, int y, int z);
  93. IHandler ExchangeEx(ModuleName chamber, int slot, Hand hand, int x, int y, int z);
  94. IHandler SetCommunication();
  95. IHandler SetLoad(Hand hand);
  96. IHandler CheckLoad(ModuleName chamber, int slot);
  97. IHandler RequestWaferPresent();
  98. }
  99. }