ProcessJobWithDrawingViewModel.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. using Aitex.Core.UI.MVVM;
  2. using Aitex.Core.Util;
  3. using MECF.Framework.Common.CommonData;
  4. using MECF.Framework.Common.Jobs;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Collections.ObjectModel;
  8. using System.Linq;
  9. using System.Runtime.Serialization;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows;
  13. using System.Windows.Input;
  14. using FurnaceUI.Models;
  15. namespace FurnaceUI.Views.Status
  16. {
  17. class ProcessJobWithDrawingViewModel : FurnaceUIViewModelBase
  18. {
  19. public bool IsPermission { get => this.Permission == 3; }
  20. [Subscription("Scheduler.CurrentProcessJob")]
  21. public ProcessJobInfo CurrentProcessJob
  22. {
  23. get;
  24. set;
  25. }
  26. public string CurrentProcessJobName
  27. {
  28. get
  29. {
  30. if (CurrentProcessJob != null)
  31. {
  32. return CurrentProcessJob.Name.ToString();
  33. }
  34. return null;
  35. }
  36. }
  37. #region CurrentProcessJobState
  38. public string CurrentProcessJobState
  39. {
  40. get
  41. {
  42. if (CurrentProcessJob != null)
  43. {
  44. return CurrentProcessJob.State.ToString();
  45. }
  46. return null;
  47. }
  48. }
  49. public string CurrentProcessJobStateIsQueued
  50. {
  51. get
  52. {
  53. if (CurrentProcessJob == null)
  54. {
  55. return "Transparent";
  56. }
  57. return CurrentProcessJob.State.ToString() == "Queued" ? "Green" : "Transparent";
  58. }
  59. }
  60. public string CurrentProcessJobStateIsSetUp
  61. {
  62. get
  63. {
  64. if (CurrentProcessJob == null)
  65. {
  66. return "Transparent";
  67. }
  68. return CurrentProcessJob.State.ToString() == "SetUp" ? "Green" : "Transparent";
  69. }
  70. }
  71. public string CurrentProcessJobStateIsProcessing
  72. {
  73. get
  74. {
  75. if (CurrentProcessJob == null)
  76. {
  77. return "Transparent";
  78. }
  79. return CurrentProcessJob.State.ToString() == "Processing" ? "Green" : "Transparent";
  80. }
  81. }
  82. public string CurrentProcessJobStateIsProcessingComplete
  83. {
  84. get
  85. {
  86. if (CurrentProcessJob == null)
  87. {
  88. return "Transparent";
  89. }
  90. return CurrentProcessJob.State.ToString() == "ProcessingComplete" ? "Green" : "Transparent";
  91. }
  92. }
  93. public string CurrentProcessJobStateIsStopping
  94. {
  95. get
  96. {
  97. if (CurrentProcessJob == null)
  98. {
  99. return "Transparent";
  100. }
  101. return CurrentProcessJob.State.ToString() == "Stopping" ? "Green" : "Transparent";
  102. }
  103. }
  104. public string CurrentProcessJobStateIsPausing
  105. {
  106. get
  107. {
  108. if (CurrentProcessJob == null)
  109. {
  110. return "Transparent";
  111. }
  112. return CurrentProcessJob.State.ToString() == "Pausing" ? "Transparent" : "Transparent";
  113. }
  114. }
  115. public string CurrentProcessJobStateIsPaused
  116. {
  117. get
  118. {
  119. if (CurrentProcessJob == null)
  120. {
  121. return "Transparent";
  122. }
  123. return CurrentProcessJob.State.ToString() == "Paused" ? "Green" : "Transparent";
  124. }
  125. }
  126. public string CurrentProcessJobStateIsAborting
  127. {
  128. get
  129. {
  130. if (CurrentProcessJob == null)
  131. {
  132. return "Transparent";
  133. }
  134. return CurrentProcessJob.State.ToString() == "Aborting" ? "Green" : "Transparent";
  135. }
  136. }
  137. public string CurrentProcessModeIsProcessJob
  138. {
  139. get
  140. {
  141. if (CurrentProcessJob == null)
  142. {
  143. return "Transparent";
  144. }
  145. return "Green";
  146. }
  147. }
  148. public string CurrentProcessModeIsProcessJobforeGround
  149. {
  150. get
  151. {
  152. if (CurrentProcessModeIsProcessJob == "Green")
  153. {
  154. return "White";
  155. }
  156. return "Black";
  157. }
  158. }
  159. public string CurrentProcessModeIsActive
  160. {
  161. get
  162. {
  163. if (CurrentProcessJob == null)
  164. {
  165. return "Transparent";
  166. }
  167. else if(CurrentProcessJob.State.ToString() != "Queued")
  168. {
  169. return "Green";
  170. }
  171. return "Transparent";
  172. }
  173. }
  174. public string CurrentProcessModeIsActiveforeGround
  175. {
  176. get
  177. {
  178. if(CurrentProcessModeIsActive == "Green")
  179. {
  180. return "White";
  181. }
  182. return "Black";
  183. }
  184. }
  185. public string CurrentProcessModeIsExecuting
  186. {
  187. get
  188. {
  189. if (CurrentProcessJob == null)
  190. {
  191. return "Transparent";
  192. }
  193. else if((CurrentProcessJob.State.ToString() == "SetUp") || (CurrentProcessJob.State.ToString() == "Processing") || (CurrentProcessJob.State.ToString() == "ProcessingComplete"))
  194. {
  195. return "Green";
  196. }
  197. return "Transparent";
  198. }
  199. }
  200. public string CurrentProcessModeIsExecutingforeGround
  201. {
  202. get
  203. {
  204. if (CurrentProcessModeIsExecuting == "Green")
  205. {
  206. return "White";
  207. }
  208. return "Black";
  209. }
  210. }
  211. public string CurrentProcessModeIsPause
  212. {
  213. get
  214. {
  215. if (CurrentProcessJob == null)
  216. {
  217. return "Transparent";
  218. }
  219. else if ((CurrentProcessJob.State.ToString() == "Pausing") || (CurrentProcessJob.State.ToString() == "Paused"))
  220. {
  221. return "Green";
  222. }
  223. return "Transparent";
  224. }
  225. }
  226. public string CurrentProcessModeIsPauseforeGround
  227. {
  228. get
  229. {
  230. if (CurrentProcessModeIsPause == "Green")
  231. {
  232. return "White";
  233. }
  234. return "Black";
  235. }
  236. }
  237. public string CurrentStartMode
  238. {
  239. get
  240. {
  241. if(CurrentProcessJob != null)
  242. {
  243. if((CurrentProcessJob.State.ToString() == "SetUp") || (CurrentProcessJob.State.ToString() == "Processing") || (CurrentProcessJob.State.ToString() == "ProcessingComplete"))
  244. {
  245. return "Executing";
  246. }
  247. else if((CurrentProcessJob.State.ToString() == "Pausing") || (CurrentProcessJob.State.ToString() == "Paused"))
  248. {
  249. return "Pause";
  250. }
  251. return "Process Job";
  252. }
  253. return "Waiting For Start";
  254. }
  255. }
  256. #endregion
  257. #region CurrentProcessJobProcessingState
  258. public string CurrentProcessJobProcessingState
  259. {
  260. get
  261. {
  262. if (CurrentProcessJob != null)
  263. {
  264. return CurrentProcessJob.ProcessingState.ToString();
  265. }
  266. return null;
  267. }
  268. }
  269. public string CurrentProcessJobProcessingStateIsWaitingMaterial
  270. {
  271. get
  272. {
  273. if (CurrentProcessJob == null)
  274. {
  275. return "Transparent";
  276. }
  277. return CurrentProcessJob.ProcessingState.ToString() == "WaitingMaterial" ? "Green" : "Transparent";
  278. }
  279. }
  280. public string CurrentProcessJobProcessingStateIsWaitingCharge
  281. {
  282. get
  283. {
  284. if (CurrentProcessJob == null)
  285. {
  286. return "Transparent";
  287. }
  288. return CurrentProcessJob.ProcessingState.ToString() == "WaitingCharge" ? "Green" : "Transparent";
  289. }
  290. }
  291. public string CurrentProcessJobProcessingStateIsCoolingBeforeCharge
  292. {
  293. get
  294. {
  295. if (CurrentProcessJob == null)
  296. {
  297. return "Transparent";
  298. }
  299. return CurrentProcessJob.ProcessingState.ToString() == "CoolingBeforeCharge" ? "Green" : "Transparent";
  300. }
  301. }
  302. public string CurrentProcessJobProcessingStateIsCharging
  303. {
  304. get
  305. {
  306. if (CurrentProcessJob == null)
  307. {
  308. return "Transparent";
  309. }
  310. return CurrentProcessJob.ProcessingState.ToString() == "Charging" ? "Green" : "Transparent";
  311. }
  312. }
  313. public string CurrentProcessJobProcessingStateIsWaitingProcess
  314. {
  315. get
  316. {
  317. if (CurrentProcessJob == null)
  318. {
  319. return "Transparent";
  320. }
  321. return CurrentProcessJob.ProcessingState.ToString() == "WaitingProcess" ? "Green" : "Transparent";
  322. }
  323. }
  324. public string CurrentProcessJobProcessingStateIsProcessing
  325. {
  326. get
  327. {
  328. if (CurrentProcessJob == null)
  329. {
  330. return "Transparent";
  331. }
  332. return CurrentProcessJob.ProcessingState.ToString() == "Processing" ? "Green" : "Transparent";
  333. }
  334. }
  335. public string CurrentProcessJobProcessingStateIsCoolingBeforeDischarge
  336. {
  337. get
  338. {
  339. if (CurrentProcessJob == null)
  340. {
  341. return "Transparent";
  342. }
  343. return CurrentProcessJob.ProcessingState.ToString() == "CoolingBeforeDischarge" ? "Green" : "Transparent";
  344. }
  345. }
  346. public string CurrentProcessJobProcessingStateIsWaitingDischarge
  347. {
  348. get
  349. {
  350. if (CurrentProcessJob == null)
  351. {
  352. return "Transparent";
  353. }
  354. return CurrentProcessJob.ProcessingState.ToString() == "WaitingDischarge" ? "Green" : "Transparent";
  355. }
  356. }
  357. public string CurrentProcessJobProcessingStateIsDischarging
  358. {
  359. get
  360. {
  361. if (CurrentProcessJob == null)
  362. {
  363. return "Transparent";
  364. }
  365. return CurrentProcessJob.ProcessingState.ToString() == "Discharging" ? "Green" : "Transparent";
  366. }
  367. }
  368. #endregion
  369. public string CurrentProcessJobControlJobName
  370. {
  371. get
  372. {
  373. if (CurrentProcessJob != null)
  374. {
  375. return CurrentProcessJob.ControlJobName.ToString();
  376. }
  377. return null;
  378. }
  379. }
  380. public string CurrentProcessJobControlJobProcessRecipe
  381. {
  382. get
  383. {
  384. if (CurrentProcessJob != null)
  385. {
  386. return CurrentProcessJob.ProcessRecipe.ToString();
  387. }
  388. return null;
  389. }
  390. }
  391. public string CurrentProcessJobControlJobLayoutRecipe
  392. {
  393. get
  394. {
  395. if (CurrentProcessJob != null)
  396. {
  397. return CurrentProcessJob.LayoutRecipe.ToString();
  398. }
  399. return null;
  400. }
  401. }
  402. public ProcessJobWithDrawingViewModel()/* : base("MonitorJobViewModel")*/
  403. {
  404. }
  405. public void ClosedCmd()
  406. {
  407. (GetView() as Window).Close();
  408. }
  409. }
  410. }