JOBStatusViewModel.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Media;
  10. using Aitex.Core.Util;
  11. using MECF.Framework.Common.OperationCenter;
  12. using OpenSEMI.ClientBase;
  13. using FurnaceUI.Models;
  14. namespace FurnaceUI.Views.Jobs
  15. {
  16. public class JOBStatusViewModel : FurnaceUIViewModelBase
  17. {
  18. [Subscription("Rt.Status")]
  19. public string RtStatus { get; set; }
  20. [Subscription("System.Pause")]
  21. public bool IsPause { get; set; }
  22. [Subscription("System.Batch")]
  23. public string Batch { get; set; }
  24. [Subscription("System.JobName")]
  25. public string JobName { get; set; }
  26. [Subscription("System.RecipeName")]
  27. public string RecipeName { get; set; }
  28. [Subscription("System.ProcessJobStatus")]
  29. public string ProcessJobStatus { get; set; }
  30. private SolidColorBrush _whiteBk = new SolidColorBrush(Colors.White);
  31. private SolidColorBrush _greenBk = new SolidColorBrush(Colors.Green);
  32. #region TransferJob
  33. [Subscription("System.TransferJobStatus")]
  34. public string TransferJobStatus { get; set; }
  35. public SolidColorBrush LoadingBk
  36. {
  37. get
  38. {
  39. return TransferJobStatus == "Loading" ? _greenBk : _whiteBk;
  40. }
  41. }
  42. public SolidColorBrush UnloadingBk
  43. {
  44. get
  45. {
  46. return TransferJobStatus == "Unloading" ? _greenBk : _whiteBk;
  47. }
  48. }
  49. public bool TransferJobEnabledAbort
  50. {
  51. get
  52. {
  53. return TransferJobStatus != "Idle";
  54. }
  55. }
  56. #endregion
  57. #region ProcessJob1
  58. public SolidColorBrush ProcessJob1ChargingBk
  59. {
  60. get
  61. {
  62. return (ProcessJobStatus == "Charging" && Batch == "A") ? _greenBk : _whiteBk;
  63. }
  64. }
  65. public SolidColorBrush ProcessJob1ProcessingBk
  66. {
  67. get
  68. {
  69. return (ProcessJobStatus == "Processing" && Batch == "A") ? _greenBk : _whiteBk;
  70. }
  71. }
  72. public SolidColorBrush ProcessJob1CoolingBk
  73. {
  74. get
  75. {
  76. return (ProcessJobStatus == "Cooling" && Batch == "A") ? _greenBk : _whiteBk;
  77. }
  78. }
  79. public SolidColorBrush ProcessJob1DischargingBk
  80. {
  81. get
  82. {
  83. return (ProcessJobStatus == "Discharging" && Batch == "A") ? _greenBk : _whiteBk;
  84. }
  85. }
  86. public bool IsProcessJob1EnabledPause
  87. {
  88. get
  89. {
  90. return IsJobStatusEnable && Batch == "A" && !IsPause;
  91. }
  92. }
  93. public bool IsProcessJob1EnabledResume
  94. {
  95. get
  96. {
  97. return IsJobStatusEnable && Batch == "A" && IsPause;
  98. }
  99. }
  100. public bool IsProcessJob1EnabledAbort
  101. {
  102. get
  103. {
  104. return IsJobStatusEnable && Batch == "A";
  105. }
  106. }
  107. public bool IsProcessJob1EnabledWithdraw
  108. {
  109. get
  110. {
  111. return RtStatus == "Idle";
  112. }
  113. }
  114. public string Process1JobName
  115. {
  116. get
  117. {
  118. return Batch == "A" ? JobName : "";
  119. }
  120. }
  121. public string Process1RcpName
  122. {
  123. get
  124. {
  125. return Batch == "A" ? RecipeName : "";
  126. }
  127. }
  128. public string Process1BatchName
  129. {
  130. get
  131. {
  132. return Batch == "A" ? "A Batch" : "";
  133. }
  134. }
  135. #endregion
  136. #region ProcessJob2
  137. public SolidColorBrush ProcessJob2ChargingBk
  138. {
  139. get
  140. {
  141. return (ProcessJobStatus == "Charging" && Batch == "B") ? _greenBk : _whiteBk;
  142. }
  143. }
  144. public SolidColorBrush ProcessJob2ProcessingBk
  145. {
  146. get
  147. {
  148. return (ProcessJobStatus == "Processing" && Batch == "B") ? _greenBk : _whiteBk;
  149. }
  150. }
  151. public SolidColorBrush ProcessJob2CoolingBk
  152. {
  153. get
  154. {
  155. return (ProcessJobStatus == "Cooling" && Batch == "B") ? _greenBk : _whiteBk;
  156. }
  157. }
  158. public SolidColorBrush ProcessJob2DischargingBk
  159. {
  160. get
  161. {
  162. return (ProcessJobStatus == "Discharging" && Batch == "B") ? _greenBk : _whiteBk;
  163. }
  164. }
  165. public bool IsProcessJob2EnabledPause
  166. {
  167. get
  168. {
  169. return IsJobStatusEnable && Batch == "B" && !IsPause;
  170. }
  171. }
  172. public bool IsProcessJob2EnabledResume
  173. {
  174. get
  175. {
  176. return IsJobStatusEnable && Batch == "B" && IsPause;
  177. }
  178. }
  179. public bool IsProcessJob2EnabledAbort
  180. {
  181. get
  182. {
  183. return IsJobStatusEnable && Batch == "B";
  184. }
  185. }
  186. public bool IsProcessJob2EnabledWithdraw
  187. {
  188. get
  189. {
  190. return RtStatus == "Idle";
  191. }
  192. }
  193. public string Process2JobName
  194. {
  195. get
  196. {
  197. return Batch == "B" ? JobName : "";
  198. }
  199. }
  200. public string Process2RcpName
  201. {
  202. get
  203. {
  204. return Batch == "B" ? RecipeName : "";
  205. }
  206. }
  207. public string Process2BatchName
  208. {
  209. get
  210. {
  211. return Batch == "B" ? "B Batch" : "";
  212. }
  213. }
  214. #endregion
  215. #region UI Logic
  216. public bool IsJobStatusEnable => RtStatus == "ChargeProcessDischarging" || RtStatus == "LoadProcessStockering" || RtStatus == "LoadProcessUnloading";
  217. #endregion
  218. public void Pause()
  219. {
  220. InvokeClient.Instance.Service.DoOperation("System.Pause");
  221. }
  222. public void Resume()
  223. {
  224. InvokeClient.Instance.Service.DoOperation("System.Resume");
  225. }
  226. public void Abort()
  227. {
  228. if (!DialogBox.Confirm("Do you abort JOB ?"))
  229. return;
  230. InvokeClient.Instance.Service.DoOperation("System.Abort");
  231. }
  232. public void Withdraw()
  233. {
  234. InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer");
  235. }
  236. public void CloseCmd()
  237. {
  238. ((Window)GetView()).DialogResult = false;
  239. }
  240. }
  241. }