RobotView.xaml.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. using System.Collections.Generic;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using System.Windows.Input;
  5. using Aitex.Core.Common;
  6. using Aitex.Core.UI.MVVM;
  7. using Aitex.Core.UI.View.Common;
  8. using Aitex.Core.Util;
  9. using Aitex.Sorter.Common;
  10. using Aitex.Sorter.UI.Controls;
  11. using Aitex.Sorter.UI.Controls.Common;
  12. using Aitex.Sorter.UI.ViewModel.Maintenance;
  13. using EfemUI.Controls;
  14. using MECF.Framework.Common.Equipment;
  15. using MECF.Framework.Common.OperationCenter;
  16. namespace EfemUI.Views.Maintenance
  17. {
  18. /// <summary>
  19. /// RobotView.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class RobotView : UserControl, IBaseView
  22. {
  23. private RobotViewModel robotViewModel;
  24. public RobotView()
  25. {
  26. InitializeComponent();
  27. robotViewModel = new RobotViewModel2();
  28. //efem.SubscribeKeys(robotViewModel);
  29. //robotControl.Hands = new Hand[] { Hand.Blade1, Hand.Blade2 };
  30. //robotControl.SubscribeKeys(robotViewModel);
  31. DataContext = robotViewModel;
  32. IsVisibleChanged += Robot_IsVisibleChanged;
  33. }
  34. private void Robot_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
  35. {
  36. robotViewModel.EnableTimer(IsVisible);
  37. }
  38. }
  39. public class RobotViewModel2 : RobotViewModel
  40. {
  41. public bool EnablePageControl
  42. {
  43. get { return !IsOnlineMode; }
  44. }
  45. [Subscription("System.Robot.ReadCassetNumber")]
  46. public string ReadCassetNumber { get; set; }
  47. [Subscription("System.Robot.ReadSlotNumber")]
  48. public string ReadSlotNumber { get; set; }
  49. [Subscription("System.Robot.ReadBankNumber")]
  50. public string ReadBankNumber { get; set; }
  51. [Subscription("System.Robot.MappingFirstSlotPosition")]
  52. public string MappingFirstSlotPosition { get; set; }
  53. [Subscription("System.Robot.MappingGateWidth")]
  54. public string MappingGateWidth { get; set; }
  55. [Subscription("System.Robot.MappingMaxDetectWidth")]
  56. public string MappingMaxDetectWidth { get; set; }
  57. [Subscription("System.Robot.MappingMinDetectWidth")]
  58. public string MappingMinDetectWidth { get; set; }
  59. [Subscription("System.Robot.MappingSlotsNumber")]
  60. public string MappingSlotsNumber { get; set; }
  61. [Subscription("System.Robot.MappingSpeed")]
  62. public string MappingSpeed { get; set; }
  63. [Subscription("System.Robot.MappingStopPostion")]
  64. public string MappingStopPostion { get; set; }
  65. [Subscription("System.Robot.MappingTopSlotPostion")]
  66. public string MappingTopSlotPostion { get; set; }
  67. [Subscription("System.Robot.IsMappingSensorON")]
  68. public string IsMappingSensorON { get; set; }
  69. [Subscription("System.Robot.MappingWaferResult")]
  70. public string MappingWaferResult { get; set; }
  71. [Subscription("System.Robot.MappingWidthResult")]
  72. public string MappingWidthResult { get; set; }
  73. [Subscription("System.Robot.ReadParameterMax")]
  74. public string ReadParameterMax { get; set; }
  75. [Subscription("System.Robot.ReadParameterMin")]
  76. public string ReadParameterMin { get; set; }
  77. [Subscription("System.Robot.ReadParameterValue")]
  78. public string ReadParameterValue { get; set; }
  79. [Subscription("System.Robot.CurrentReadRoutine")]
  80. public string CurrentReadRoutine { get; set; }
  81. //[Subscription("System.Robot.CurrentReadSpeedData")]
  82. //public int CurrentReadSpeedData { get; set; }
  83. [Subscription("System.Robot.RobotSpeed")]
  84. public int CurrentReadSpeedData { get; set; }
  85. [Subscription("System.Robot.CurrentReadAData")]
  86. public int CurrentReadAData { get; set; }
  87. [Subscription("System.Robot.Axis1Postion")]
  88. public string RobotPositionX
  89. {
  90. get;set;
  91. }
  92. [Subscription("System.Robot.Axis2Postion")]
  93. public string RobotPositionY
  94. {
  95. get; set;
  96. }
  97. [Subscription("System.Robot.Axis3Postion")]
  98. public string RobotPositionZ
  99. {
  100. get; set;
  101. }
  102. [Subscription("System.Robot.Axis4Postion")]
  103. public string RobotPositionW
  104. {
  105. get; set;
  106. }
  107. [Subscription("System.Robot.LeftarmAndZaxisStatus")]
  108. public string LeftarmAndZaxisStatus
  109. {
  110. get; set;
  111. }
  112. [Subscription("System.Robot.RightarmAndThetaarmStatus")]
  113. public string RightarmAndThetaarmStatus
  114. {
  115. get; set;
  116. }
  117. [Subscription("System.Robot.IsLeftArmPressureSensorON")]
  118. public bool IsLeftArmPressureSensorON
  119. {
  120. get; set;
  121. }
  122. [Subscription("System.Robot.IsRightArmPressureSensorON")]
  123. public bool IsRightArmPressureSensorON
  124. {
  125. get; set;
  126. }
  127. [Subscription("System.Robot.CurrentCompoundCommandStatus")]
  128. public string CurrentCompoundCommandStatus { get; set; }
  129. [Subscription("System.Robot.CurrentExtParaValue")]
  130. public string ExtendedParaValue
  131. {
  132. get;set;
  133. }
  134. [Subscription("System.Robot.State")]
  135. public string RobotState
  136. {
  137. get; set;
  138. }
  139. [Subscription("System.Robot.RobotErrorCode")]
  140. public string RobotErrorCode
  141. {
  142. get; set;
  143. }
  144. [Subscription("System.Robot.RobotIsOnline")]
  145. public string RobotIsOnline
  146. {
  147. get; set;
  148. }
  149. [Subscription("System.Robot.RobotIsManual")]
  150. public string RobotIsManual
  151. {
  152. get; set;
  153. }
  154. [Subscription("System.Robot.RobotIsAuto")]
  155. public string RobotIsAuto
  156. {
  157. get; set;
  158. }
  159. [Subscription("System.Robot.RobotStopSignal")]
  160. public string RobotStopSignal
  161. {
  162. get; set;
  163. }
  164. [Subscription("System.Robot.RobotEMSignal")]
  165. public string RobotEMSignal
  166. {
  167. get; set;
  168. }
  169. [Subscription("System.Robot.RobotZaxisSaftyZone")]
  170. public string RobotZaxisSaftyZone
  171. {
  172. get; set;
  173. }
  174. [Subscription("System.Robot.RobotPositioningCompleted")]
  175. public string RobotPositioningCompleted
  176. {
  177. get; set;
  178. }
  179. [Subscription("System.Robot.RobotACalCompleted")]
  180. public string RobotACalCompleted
  181. {
  182. get; set;
  183. }
  184. [Subscription("System.Robot.RobotExecutionCompleted")]
  185. public string RobotExecutionCompleted
  186. {
  187. get; set;
  188. }
  189. [Subscription("System.Robot.ReadPosLeftArmPostion")]
  190. public string RobotReadXPosition
  191. {
  192. get;set;
  193. }
  194. [Subscription("System.Robot.ReadPosRightArmPostion")]
  195. public string RobotReadYPosition
  196. {
  197. get; set;
  198. }
  199. [Subscription("System.Robot.ReadPosZAxisPostion")]
  200. public string RobotReadZPosition
  201. {
  202. get; set;
  203. }
  204. [Subscription("System.Robot.ReadPosThetaAxisPostion")]
  205. public string RobotReadWPosition
  206. {
  207. get; set;
  208. }
  209. [Subscription("System.Robot.RobotMdata")]
  210. public string RobotMdata
  211. {
  212. get; set;
  213. }
  214. [Subscription("System.Robot.RobotFCode")]
  215. public string RobotFCode
  216. {
  217. get; set;
  218. }
  219. [Subscription("System.Robot.RobotSCode")]
  220. public string RobotSCode
  221. {
  222. get; set;
  223. }
  224. [Subscription("System.Robot.ExtPara_MapWaferCount")]
  225. public string ExtPara_MapWaferCount
  226. {
  227. get; set;
  228. }
  229. [Subscription("System.Robot.ExtPara_WaferThickness")]
  230. public string ExtPara_WaferThickness
  231. {
  232. get; set;
  233. }
  234. [Subscription("System.Robot.ExtPara_PositionRange")]
  235. public string ExtPara_PositionRange
  236. {
  237. get; set;
  238. }
  239. [Subscription("System.Robot.ExtPara_Pitch")]
  240. public string ExtPara_Pitch
  241. {
  242. get; set;
  243. }
  244. [Subscription("System.Robot.ExtPara_Filter")]
  245. public string ExtPara_Filter
  246. {
  247. get; set;
  248. }
  249. [Subscription("System.Robot.ExtPara_WaferMinThickness")]
  250. public string ExtPara_MinThickness
  251. {
  252. get; set;
  253. }
  254. [Subscription("System.IsOnlineMode")]
  255. public bool IsOnlineMode
  256. {
  257. get;
  258. set;
  259. }
  260. [Subscription(ParamName.ModuleWaferList, DeviceName.Buffer1)]
  261. public WaferInfo[] Buffer1Wafers
  262. {
  263. get;
  264. set;
  265. }
  266. public WaferInfo Buffer1Wafer
  267. {
  268. get
  269. {
  270. if (Buffer1Wafers != null)
  271. {
  272. return Buffer1Wafers[0];
  273. }
  274. else
  275. {
  276. return null;
  277. }
  278. }
  279. }
  280. [Subscription(ParamName.IsAutoMode, "System")]
  281. public bool IsAutoMode { get; set; }
  282. [Subscription(ParamName.RTStatus, "System")]
  283. public int RoutManagerState
  284. {
  285. get;
  286. set;
  287. }
  288. public bool IsMaintenanceMode
  289. {
  290. get => RoutManagerState == (int)RtState.Maintenance;
  291. }
  292. public ICommand Command
  293. {
  294. get;
  295. private set;
  296. }
  297. public RobotViewModel2() : base(4)
  298. {
  299. Command = new DelegateCommand<DependencyObject>(DoCommand, x => !IsMaintenanceMode && !IsAutoMode);
  300. RobotMotionType = new List<string>() { "A", "I", "U", "O" };
  301. RobotTargetStation = new List<string>() { "LP1", "LP2","Buffer1", "Buffer2", "LL1", "LL2" ,"CoolingBuffer1", "CoolingBuffer2" ,"Aligner1", "Aligner2" };
  302. RobotActionType = new List<string>() { "Pick", "Place", "Swap" };
  303. RobotArmSelected = new List<string>() { "Lower(Left)", "Upper(Right)"};
  304. RobotSpeedType = new List<string>() { "H(High speed)","L(Low speed)","S(Domain of Acc/Dec)","G(Acc/Dec speed",
  305. "X(Magnification frequency)","D(Pulse position of manual slow down)" };
  306. RobotSelectSlot = new List<string>();
  307. for (int i = 0; i < 25; i++) RobotSelectSlot.Add((i+1).ToString());
  308. MappingParameterType = new List<string>() { "M01", "M02", "M03", "M04", "M05", "M06", "M07", "M08", "M09" };
  309. LoadPortList = new List<string>() { "LP1", "LP2", "LP3", "LP4" };
  310. JelCompaundCommandType = new List<string> { "MainRoutine", "SubRoutine" };
  311. JelMoveBaseType = new List<string> { "0(Absolute position)", "1(Relative postion)" };
  312. JelMoveSpeedType = new List<string> { "(Normal)", "M(Manual slow down)", "L(Low Speed)" };
  313. }
  314. private void DoCommand(DependencyObject sender)
  315. {
  316. var command = CommandHelper.GetCommandItem(sender);
  317. var lstParameter = new List<object>(command.Parameters);
  318. if (command.CommandName == "ReadParameter")
  319. {
  320. if (lstParameter.Count == 0) return;
  321. if(lstParameter[0].ToString() == "ExtParameter")
  322. {
  323. if (lstParameter.Count < 2) return;
  324. if (!uint.TryParse(lstParameter[1].ToString(), out _)) return;
  325. }
  326. }
  327. if (command.CommandName == "SetParameter")
  328. {
  329. if (lstParameter.Count == 0) return;
  330. if (lstParameter[0].ToString() == "ExtParameter")
  331. {
  332. if (lstParameter.Count < 2) return;
  333. if (!uint.TryParse(lstParameter[1].ToString(), out _)) return;
  334. }
  335. }
  336. if(command.CommandName == "RobotGoTo")
  337. {
  338. }
  339. if (command.CommandName == "RobotPlace" || command.CommandName == "RobotPick" || command.CommandName == "RobotExchange")
  340. {
  341. if (lstParameter.Count == 0) return;
  342. if (lstParameter.Count < 3) return;
  343. lstParameter[1] = int.Parse(lstParameter[1].ToString()) - 1;
  344. }
  345. lstParameter.Insert(0, command.Target);
  346. lstParameter.Insert(1, command.CommandName);
  347. InvokeClient.Instance.Service.DoOperation(OperationName.DeviceOperation, lstParameter.ToArray());
  348. }
  349. public List<string> RobotMotionType { get; set; }
  350. public List<string> RobotTargetStation { get; set; }
  351. public List<string> RobotActionType { get; set; }
  352. public List<string> RobotArmSelected { get; set; }
  353. public List<string> RobotSpeedType { get; set; }
  354. public List<string> RobotSelectSlot { get; set; }
  355. public List<string> MappingParameterType { get; set; }
  356. public List<string> LoadPortList { get; private set; }
  357. public List<string> JelCompaundCommandType{ get; private set; }
  358. public List<string> JelMoveBaseType { get; private set; }
  359. public List<string> JelMoveSpeedType { get; private set; }
  360. public override Dictionary<ModuleName, int> Target => new Dictionary<ModuleName, int>() {
  361. { ModuleName.LP1, 25 }
  362. , { ModuleName.LP2, 25 }
  363. , { ModuleName.LP3, 25 }
  364. , { ModuleName.LP4, 25 }
  365. , { ModuleName.Buffer1, 25 }
  366. , { ModuleName.Buffer2, 25 }
  367. , { ModuleName.Buffer3, 25 }
  368. , { ModuleName.Buffer4, 25 }
  369. , { ModuleName.LL1, 1 }
  370. , { ModuleName.LL2, 1 }
  371. , { ModuleName.LL3, 1 }
  372. , { ModuleName.LL4, 1 }
  373. , { ModuleName.LL5, 1 }
  374. , { ModuleName.LL6, 1 }
  375. , { ModuleName.LL7, 1 }
  376. , { ModuleName.LL8, 1 }
  377. , { ModuleName.Aligner, 1 }
  378. };
  379. protected override void InitFoupList()
  380. {
  381. base.InitFoupList();
  382. if (FoupList.Count >= 1) FoupList[0].FoupType = FoupType.OpenCassetteNoReadID;
  383. if (FoupList.Count >= 2) FoupList[1].FoupType = FoupType.OpenCassetteNoReadID;
  384. if (FoupList.Count >= 3) FoupList[2].FoupType = FoupType.OpenCassetteNoReadID;
  385. if (FoupList.Count >= 4) FoupList[3].FoupType = FoupType.OpenCassetteNoReadID;
  386. }
  387. }
  388. }