MainStatusViewModel.cs 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.Util;
  3. using Caliburn.Micro;
  4. using Caliburn.Micro.Core;
  5. using MECF.Framework.Common.DataCenter;
  6. using MECF.Framework.Common.Equipment;
  7. using MECF.Framework.Common.OperationCenter;
  8. using MECF.Framework.UI.Client.ClientBase;
  9. using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
  10. using System.Collections.Generic;
  11. using System.Collections.ObjectModel;
  12. using System.Linq;
  13. using System.Windows;
  14. using System.Windows.Media;
  15. using FurnaceUI.Client;
  16. using FurnaceUI.Models;
  17. using FurnaceUI.Views.Jobs;
  18. using FurnaceUI.Views.Recipes;
  19. using FurnaceUI.Views.Editors;
  20. using MECF.Framework.Common.SubstrateTrackings;
  21. using FurnaceUI.Views.Status;
  22. using OpenSEMI.ClientBase;
  23. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  24. namespace FurnaceUI.Views.Operations
  25. {
  26. public class MainStatusViewModel : FurnaceUIViewModelBase
  27. {
  28. #region Property
  29. [Subscription("LP1.CurrentLotId")]
  30. public string LP1CurrentLotId { get; set; }
  31. [Subscription("LP1.WaitLotId")]
  32. public List<string> LP1WaitLotId { get; set; }
  33. [Subscription("LP2.CurrentLotId")]
  34. public string LP2CurrentLotId { get; set; }
  35. [Subscription("LP2.WaitLotId")]
  36. public List<string> LP2WaitLotId { get; set; }
  37. [Subscription("TransferState", "LP1")]
  38. public string TransferStateLp1 { get; set; }
  39. [Subscription("TransferState", "LP2")]
  40. public string TransferStateLp2 { get; set; }
  41. [Subscription("CarrierIDStatus", "LP1")]
  42. public string CarrierStatusLP1 { get; set; }
  43. [Subscription("CarrierIDStatus", "LP2")]
  44. public string CarrierStatusLP2 { get; set; }
  45. [Subscription("ProcessFlow.Status")]
  46. public string ProcessFlowStatus { get; set; }
  47. double _eDUseWarningLimit;
  48. double _eDUseAlarmLimit;
  49. SolidColorBrush _greenBk = new SolidColorBrush(Colors.LawnGreen);
  50. SolidColorBrush _redBk = new SolidColorBrush(Colors.Red);
  51. SolidColorBrush _transparentBk = new SolidColorBrush(Colors.Transparent);
  52. SolidColorBrush _orangeBk = new SolidColorBrush(Colors.Orange);
  53. SolidColorBrush _blackBk = new SolidColorBrush(Colors.Black);
  54. public SolidColorBrush StandbyBk
  55. {
  56. get
  57. {
  58. if (!IsPM1Process && !IsPM1PostProcess)
  59. return _transparentBk;
  60. return ProcessFlowStatus == "Standby" ? _greenBk : _transparentBk;
  61. }
  62. }
  63. public SolidColorBrush ReadyBk
  64. {
  65. get
  66. {
  67. if (!IsPM1Process && !IsPM1PostProcess)
  68. return _transparentBk;
  69. return (ProcessFlowStatus == "Standby" || ProcessFlowStatus == "Ready") ? _greenBk : _transparentBk;
  70. }
  71. }
  72. public SolidColorBrush EndBk
  73. {
  74. get
  75. {
  76. if (!IsPM1Process && !IsPM1PostProcess)
  77. return _transparentBk;
  78. return ProcessFlowStatus == "End" ? _greenBk : _transparentBk;
  79. }
  80. }
  81. public SolidColorBrush RunBk
  82. {
  83. get
  84. {
  85. if (!IsPM1Process && !IsPM1PostProcess)
  86. return _transparentBk;
  87. return (ProcessFlowStatus == "End" || ProcessFlowStatus == "Run") ? _greenBk : _transparentBk;
  88. }
  89. }
  90. public SolidColorBrush AbortBk
  91. {
  92. get
  93. {
  94. if (!IsPM1Process && !IsPM1PostProcess)
  95. return _transparentBk;
  96. return ProcessFlowStatus == "Abort" ? _redBk : _transparentBk;
  97. }
  98. }
  99. #region Job Staus
  100. [Subscription("System.Batch")]
  101. public string Batch { get; set; }
  102. [Subscription("System.TransferJobStatus")]
  103. public string TransferJobStatus { get; set; }
  104. public SolidColorBrush TransferJobBk
  105. {
  106. get
  107. {
  108. return TransferJobStatus == "Idle" || string.IsNullOrEmpty(TransferJobStatus) ? _transparentBk : _greenBk;
  109. }
  110. }
  111. [Subscription("System.ProcessJobStatus")]
  112. public string ProcessJobStatus { get; set; }
  113. [Subscription("System.Pause")]
  114. public bool IsPause { get; set; }
  115. public string ProcessJobsStatus
  116. {
  117. get
  118. {
  119. return (string.IsNullOrEmpty(Batch) || ProcessJobStatus == "Idle") ? ProcessJobStatus : $"{Batch} : {ProcessJobStatus}";
  120. }
  121. }
  122. public SolidColorBrush ProcessJobBk
  123. {
  124. get
  125. {
  126. if (IsPause)
  127. {
  128. return _orangeBk;
  129. }
  130. else
  131. {
  132. return ProcessJobStatus == "Idle" || string.IsNullOrEmpty(ProcessJobsStatus) ? _transparentBk : _greenBk;
  133. }
  134. return _transparentBk;
  135. }
  136. }
  137. #endregion
  138. #region SMIF
  139. [Subscription("LP1.Status")]
  140. public string LP1Status { get; set; }
  141. public string Lp1StatusBackground
  142. {
  143. get { return ModuleStatusBackground.GetStatusBackground(LP1Status); }
  144. }
  145. [Subscription("Boat.Status")]
  146. public string BoatStatus { get; set; }
  147. public string BoatStatusBackground
  148. {
  149. get { return ModuleStatusBackground.GetStatusBackground(BoatStatus); }
  150. }
  151. [Subscription("LP2.Status")]
  152. public string LP2Status { get; set; }
  153. public string LP2StatusBackground
  154. {
  155. get { return ModuleStatusBackground.GetStatusBackground(LP2Status); }
  156. }
  157. #endregion
  158. #region Stocker
  159. private List<ModuleName> _stokcers;
  160. private List<string> _stokcerWaferType;
  161. private int _cassetteSlot = 0;
  162. private ObservableCollection<string> _stockerSlots;
  163. public ObservableCollection<string> StockerSlots
  164. {
  165. get { return _stockerSlots; }
  166. set
  167. {
  168. _stockerSlots = value;
  169. NotifyOfPropertyChange("StockerSlots");
  170. }
  171. }
  172. private SolidColorBrush _WhiteFill = new SolidColorBrush(Colors.White);
  173. private SolidColorBrush _productionFill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#bedadb"));
  174. private SolidColorBrush _SD_ED_M_Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("LightGray"));
  175. private SolidColorBrush _waringFill = new SolidColorBrush(Colors.Yellow);
  176. private SolidColorBrush _alarmFill = new SolidColorBrush(Colors.Red);
  177. private List<SolidColorBrush> _stockerBackground = new List<SolidColorBrush>();
  178. public List<SolidColorBrush> StockerBackground
  179. {
  180. get => _stockerBackground;
  181. set
  182. {
  183. _stockerBackground = value;
  184. NotifyOfPropertyChange(nameof(StockerBackground));
  185. }
  186. }
  187. [Subscription("Stocker1.CassettePresent")]
  188. public bool IsStocker1CassettePresent { get; set; }
  189. [Subscription("Stocker2.CassettePresent")]
  190. public bool IsStocker2CassettePresent { get; set; }
  191. [Subscription("Stocker3.CassettePresent")]
  192. public bool IsStocker3CassettePresent { get; set; }
  193. [Subscription("Stocker4.CassettePresent")]
  194. public bool IsStocker4CassettePresent { get; set; }
  195. [Subscription("Stocker5.CassettePresent")]
  196. public bool IsStocker5CassettePresent { get; set; }
  197. [Subscription("Stocker6.CassettePresent")]
  198. public bool IsStocker6CassettePresent { get; set; }
  199. [Subscription("Stocker7.CassettePresent")]
  200. public bool IsStocker7CassettePresent { get; set; }
  201. [Subscription("Stocker8.CassettePresent")]
  202. public bool IsStocker8CassettePresent { get; set; }
  203. [Subscription("Stocker9.CassettePresent")]
  204. public bool IsStocker9CassettePresent { get; set; }
  205. [Subscription("Stocker10.CassettePresent")]
  206. public bool IsStocker10CassettePresent { get; set; }
  207. [Subscription("Stocker11.CassettePresent")]
  208. public bool IsStocker11CassettePresent { get; set; }
  209. [Subscription("Stocker12.CassettePresent")]
  210. public bool IsStocker12CassettePresent { get; set; }
  211. [Subscription("Stocker13.CassettePresent")]
  212. public bool IsStocker13CassettePresent { get; set; }
  213. [Subscription("Stocker14.CassettePresent")]
  214. public bool IsStocker14CassettePresent { get; set; }
  215. [Subscription("Stocker15.CassettePresent")]
  216. public bool IsStocker15CassettePresent { get; set; }
  217. [Subscription("Stocker16.CassettePresent")]
  218. public bool IsStocker16CassettePresent { get; set; }
  219. [Subscription("Stocker17.CassettePresent")]
  220. public bool IsStocker17CassettePresent { get; set; }
  221. [Subscription("Stocker18.CassettePresent")]
  222. public bool IsStocker18CassettePresent { get; set; }
  223. [Subscription("Stocker1.Carrier")]
  224. public CarrierInfo Stocker1CarrierData { get; set; }
  225. [Subscription("Stocker2.Carrier")]
  226. public CarrierInfo Stocker2CarrierData { get; set; }
  227. [Subscription("Stocker3.Carrier")]
  228. public CarrierInfo Stocker3CarrierData { get; set; }
  229. [Subscription("Stocker4.Carrier")]
  230. public CarrierInfo Stocker4CarrierData { get; set; }
  231. [Subscription("Stocker5.Carrier")]
  232. public CarrierInfo Stocker5CarrierData { get; set; }
  233. [Subscription("Stocker6.Carrier")]
  234. public CarrierInfo Stocker6CarrierData { get; set; }
  235. [Subscription("Stocker7.Carrier")]
  236. public CarrierInfo Stocker7CarrierData { get; set; }
  237. [Subscription("Stocker8.Carrier")]
  238. public CarrierInfo Stocker8CarrierData { get; set; }
  239. [Subscription("Stocker9.Carrier")]
  240. public CarrierInfo Stocker9CarrierData { get; set; }
  241. [Subscription("Stocker10.Carrier")]
  242. public CarrierInfo Stocker10CarrierData { get; set; }
  243. [Subscription("Stocker11.Carrier")]
  244. public CarrierInfo Stocker11CarrierData { get; set; }
  245. [Subscription("Stocker12.Carrier")]
  246. public CarrierInfo Stocker12CarrierData { get; set; }
  247. [Subscription("Stocker13.Carrier")]
  248. public CarrierInfo Stocker13CarrierData { get; set; }
  249. [Subscription("Stocker14.Carrier")]
  250. public CarrierInfo Stocker14CarrierData { get; set; }
  251. [Subscription("Stocker15.Carrier")]
  252. public CarrierInfo Stocker15CarrierData { get; set; }
  253. [Subscription("Stocker16.Carrier")]
  254. public CarrierInfo Stocker16CarrierData { get; set; }
  255. [Subscription("Stocker17.Carrier")]
  256. public CarrierInfo Stocker17CarrierData { get; set; }
  257. [Subscription("Stocker18.Carrier")]
  258. public CarrierInfo Stocker18CarrierData { get; set; }
  259. public int Stocker1WaferCount { get; set; } = 0;
  260. public int Stocker2WaferCount { get; set; } = 0;
  261. public int Stocker3WaferCount { get; set; } = 0;
  262. public int Stocker4WaferCount { get; set; } = 0;
  263. public int Stocker5WaferCount { get; set; } = 0;
  264. public int Stocker6WaferCount { get; set; } = 0;
  265. public int Stocker7WaferCount { get; set; } = 0;
  266. public int Stocker8WaferCount { get; set; } = 0;
  267. public int Stocker9WaferCount { get; set; } = 0;
  268. public int Stocker10WaferCount { get; set; } = 0;
  269. public int Stocker11WaferCount { get; set; } = 0;
  270. public int Stocker12WaferCount { get; set; } = 0;
  271. public int Stocker13WaferCount { get; set; } = 0;
  272. public int Stocker14WaferCount { get; set; } = 0;
  273. public int Stocker15WaferCount { get; set; } = 0;
  274. public int Stocker16WaferCount { get; set; } = 0;
  275. public int Stocker17WaferCount { get; set; } = 0;
  276. public int Stocker18WaferCount { get; set; } = 0;
  277. #endregion
  278. #region Heater
  279. [Subscription("PM1.Heater1.DeviceData")]
  280. public AITHeaterData Heater1Data { get; set; }
  281. [Subscription("PM1.Heater2.DeviceData")]
  282. public AITHeaterData Heater2Data { get; set; }
  283. [Subscription("PM1.Heater3.DeviceData")]
  284. public AITHeaterData Heater3Data { get; set; }
  285. [Subscription("PM1.Heater4.DeviceData")]
  286. public AITHeaterData Heater4Data { get; set; }
  287. [Subscription("PM1.Heater5.DeviceData")]
  288. public AITHeaterData Heater5Data { get; set; }
  289. [Subscription("PM1.Heater6.DeviceData")]
  290. public AITHeaterData Heater6Data { get; set; }
  291. [Subscription("PM1.Heater7.DeviceData")]
  292. public AITHeaterData Heater7Data { get; set; }
  293. [Subscription("PM1.Heater8.DeviceData")]
  294. public AITHeaterData Heater8Data { get; set; }
  295. [Subscription("PM1.Heater9.DeviceData")]
  296. public AITHeaterData Heater9Data { get; set; }
  297. [Subscription("PM1.Heater10.DeviceData")]
  298. public AITHeaterData Heater10Data { get; set; }
  299. //public double TopHeaterSetPoint => Heater10Data.IsLspModeFeedBack ? Heater10Data.SetPoint : Heater9Data.SetPoint;
  300. //public double TopHeaterFeedback => Heater10Data.IsLspModeFeedBack ? Heater10Data.FeedBack : Heater9Data.FeedBack;
  301. //public double TopCenterHeaterSetPoint => Heater8Data.IsLspModeFeedBack ? Heater8Data.SetPoint : Heater7Data.SetPoint;
  302. //public double TopCenterHeaterFeedback => Heater8Data.IsLspModeFeedBack ? Heater8Data.FeedBack : Heater7Data.FeedBack;
  303. //public double CenterHeaterSetPoint => Heater6Data.IsLspModeFeedBack ? Heater6Data.SetPoint : Heater5Data.SetPoint;
  304. //public double CenterHeaterFeedback => Heater6Data.IsLspModeFeedBack ? Heater6Data.FeedBack : Heater5Data.FeedBack;
  305. //public double CenterBottomHeaterSetPoint => Heater4Data.IsLspModeFeedBack ? Heater4Data.SetPoint : Heater3Data.SetPoint;
  306. //public double CenterBottomHeaterFeedback => Heater4Data.IsLspModeFeedBack ? Heater4Data.FeedBack : Heater3Data.FeedBack;
  307. //public double BottomHeaterSetPoint => Heater2Data.IsLspModeFeedBack ? Heater2Data.SetPoint : Heater1Data.SetPoint;
  308. //public double BottomHeaterFeedback => Heater2Data.IsLspModeFeedBack ? Heater2Data.FeedBack : Heater1Data.FeedBack;
  309. #endregion
  310. #region Robot
  311. [Subscription("WaferRobot.Status")]
  312. public string WaferRobotStatus { get; set; }
  313. public string WaferRobotStatusBackground
  314. {
  315. get { return ModuleStatusBackground.GetStatusBackground(WaferRobotStatus); }
  316. }
  317. [Subscription("CarrierRobot.Status")]
  318. public string CarrierRobotStatus { get; set; }
  319. public string CarrierRobotStatusBackground
  320. {
  321. get { return ModuleStatusBackground.GetStatusBackground(CarrierRobotStatus); }
  322. }
  323. #endregion
  324. #region PM
  325. [Subscription("PM1.Status")]
  326. public string PM1Status { get; set; }
  327. [Subscription("PM1.RecipeStepName")]
  328. public string PM1RecipeStepName { get; set; }
  329. [Subscription("PM1.RecipeStepNumber")]
  330. public int PM1RecipeStepNumber { get; set; }
  331. [Subscription("PM1.RecipeStepElapseTime")]
  332. public int PM1RecipeStepElapseTime { get; set; }
  333. [Subscription("PM1.RecipeStepTime")]
  334. public int PM1RecipeStepTime { get; set; }
  335. [Subscription("PM1.RecipeTotalElapseTime")]
  336. public int PM1RecipeTotalElapseTime { get; set; }
  337. [Subscription("PM1.RecipeTotalTime")]
  338. public int PM1RecipeTotalTime { get; set; }
  339. [Subscription("PM1.RecipeHoldTime")]
  340. public int PM1RecipeHoldTime { get; set; }
  341. [Subscription("PM1.RecipeHold")]
  342. public bool PM1RecipeHold { get; set; }
  343. public bool IsPM1Idle
  344. {
  345. get { return PM1Status == "Idle"; }
  346. }
  347. public bool IsPM1Process
  348. {
  349. get { return PM1Status == "Process"; }
  350. }
  351. public bool IsPM1PostProcess
  352. {
  353. get { return PM1Status == "PostProcess"; }
  354. }
  355. public bool IsPM1PreProcess
  356. {
  357. get { return PM1Status == "PreProcess"; }
  358. }
  359. public string PM1StepNumber
  360. {
  361. get
  362. {
  363. if (!IsPM1Process && !IsPM1PostProcess)
  364. return "--";
  365. return $"{PM1RecipeStepNumber}";
  366. }
  367. }
  368. public string PM1StepName
  369. {
  370. get
  371. {
  372. if (!IsPM1Process && !IsPM1PostProcess)
  373. return "--";
  374. return $"{PM1RecipeStepName}";
  375. }
  376. }
  377. public string PM1StepTime
  378. {
  379. get
  380. {
  381. if (!IsPM1Process && !IsPM1PostProcess)
  382. return "--";
  383. return CalStepTime(PM1RecipeStepElapseTime, PM1RecipeStepTime);
  384. }
  385. }
  386. public string PM1RecipeTime
  387. {
  388. get
  389. {
  390. if (!IsPM1Process && !IsPM1PostProcess)
  391. return "--";
  392. return CalRecipeTime(PM1RecipeTotalElapseTime, PM1RecipeTotalTime);
  393. }
  394. }
  395. public string PM1HoldTime
  396. {
  397. get
  398. {
  399. if (!IsPM1Process && !IsPM1PostProcess)
  400. return "--";
  401. return CalHoldTime(PM1RecipeHoldTime);
  402. }
  403. }
  404. public string HoldName
  405. {
  406. get
  407. {
  408. if (PM1RecipeHold)
  409. return "Continue";
  410. return "Hold";
  411. }
  412. }
  413. public SolidColorBrush HoldForeground
  414. {
  415. get
  416. {
  417. if (PM1RecipeHold)
  418. return _blackBk;
  419. return _redBk;
  420. }
  421. }
  422. [Subscription("PM1.SelectedRecipeName")]
  423. public string PM1SelectedRecipeName
  424. {
  425. get;
  426. set;
  427. }
  428. [Subscription("PM1.MainRecipeName")]
  429. public string PM1MainRecipeName
  430. {
  431. get;
  432. set;
  433. }
  434. public string PM1SelectedRecipeNameDisplay
  435. {
  436. get
  437. {
  438. if (string.IsNullOrEmpty(PM1SelectedRecipeName))
  439. return string.Empty;
  440. if (!IsPM1Process && !IsPM1PostProcess)
  441. return string.Empty;
  442. //return PM1SelectedRecipeName.Substring("Furnace\\Process\\".Length);
  443. return PM1SelectedRecipeName;
  444. }
  445. }
  446. [Subscription("PM1.IsOnline")]
  447. public bool PM1IsOnline { get; set; }
  448. public bool PM1IsOffline
  449. {
  450. get { return !PM1IsOnline; }
  451. }
  452. public bool IsEnableEmergencyAbort
  453. {
  454. get
  455. {
  456. return PM1Status != "Init" && PM1Status != "Idle";
  457. }
  458. }
  459. private string CalStepTime(int elapseTime, int totalTime)
  460. {
  461. string stepTime = string.Empty;
  462. int remainingTime = totalTime - elapseTime;
  463. if (remainingTime < 0)
  464. remainingTime = 0;
  465. string strElapseTimeH = $"{(elapseTime / 3600).ToString().PadLeft(2, '0')}";
  466. string strElapseTimeM = $"{(elapseTime % 3600 / 60).ToString().PadLeft(2, '0')}";
  467. string strElapseTimeS = $"{(elapseTime % 60).ToString().PadLeft(2, '0')}";
  468. string strTotalTimeH = $"{(totalTime / 3600).ToString().PadLeft(2, '0')}";
  469. string strTotalTimeM = $"{(totalTime % 3600 / 60).ToString().PadLeft(2, '0')}";
  470. string strTotalTimeS = $"{(totalTime % 60).ToString().PadLeft(2, '0')}";
  471. stepTime = $"{strElapseTimeH}:{strElapseTimeM}:{strElapseTimeS}/{strTotalTimeH}:{strTotalTimeM}:{strTotalTimeS}";
  472. return stepTime;
  473. }
  474. private string CalRecipeTime(int elapseTime, int totalTime)
  475. {
  476. string recipeTime = string.Empty;
  477. int remainingTime = totalTime - elapseTime;
  478. if (remainingTime < 0)
  479. remainingTime = 0;
  480. string strElapseTimeH = $"{(elapseTime / 3600).ToString().PadLeft(2, '0')}";
  481. string strElapseTimeM = $"{(elapseTime % 3600 / 60).ToString().PadLeft(2, '0')}";
  482. string strElapseTimeS = $"{(elapseTime % 60).ToString().PadLeft(2, '0')}";
  483. string strRemainingTimeH = $"{(remainingTime / 3600).ToString().PadLeft(2, '0')}";
  484. string strRemainingTimeM = $"{(remainingTime % 3600 / 60).ToString().PadLeft(2, '0')}";
  485. string strRemainingTimeS = $"{(remainingTime % 60).ToString().PadLeft(2, '0')}";
  486. recipeTime = $"{strElapseTimeH}:{strElapseTimeM}:{strElapseTimeS}/{strRemainingTimeH}:{strRemainingTimeM}:{strRemainingTimeS}";
  487. return recipeTime;
  488. }
  489. private string CalHoldTime(int totalTime)
  490. {
  491. string holdTime = string.Empty;
  492. string strHoldTimeH = $"{(totalTime / 3600).ToString().PadLeft(2, '0')}";
  493. string strHoldTimeM = $"{(totalTime % 3600 / 60).ToString().PadLeft(2, '0')}";
  494. string strHoldTimeS = $"{(totalTime % 60).ToString().PadLeft(2, '0')}";
  495. holdTime = $"{strHoldTimeH}:{strHoldTimeM}:{strHoldTimeS}";
  496. return holdTime;
  497. }
  498. private string _recipeProgress;
  499. public string RecipeProgress
  500. {
  501. get => _recipeProgress;
  502. set
  503. {
  504. _recipeProgress = value;
  505. NotifyOfPropertyChange(nameof(RecipeProgress));
  506. }
  507. }
  508. private int _recipeProgressValue;
  509. public int RecipeProgressValue
  510. {
  511. get => _recipeProgressValue;
  512. set
  513. {
  514. _recipeProgressValue = value;
  515. NotifyOfPropertyChange(nameof(RecipeProgressValue));
  516. }
  517. }
  518. #endregion
  519. #region Scheduler
  520. public bool IsRtInitialized
  521. {
  522. get
  523. {
  524. return RtStatus != "Init" && RtStatus != "Initializing";
  525. }
  526. }
  527. public bool IsRtRunning
  528. {
  529. get
  530. {
  531. return RtStatus != "Init" && RtStatus != "Idle" && RtStatus != "AutoIdle";
  532. }
  533. }
  534. public bool IsRtError
  535. {
  536. get
  537. {
  538. return RtStatus == "Error";
  539. }
  540. }
  541. public bool IsAuto
  542. {
  543. get { return RtStatus == "Auto_Running" || RtStatus == "Auto_Idle"; }
  544. }
  545. [Subscription("Rt.Status")]
  546. public string RtStatus { get; set; }
  547. public bool _isCycleMode;
  548. public Visibility IsCycleInfoVisibility
  549. {
  550. get { return _isCycleMode ? Visibility.Visible : Visibility.Collapsed; }
  551. }
  552. [Subscription("Scheduler.CycledCount")]
  553. public int CycledCount { get; set; }
  554. [Subscription("Scheduler.CycledWafer")]
  555. public int CycledWafer { get; set; }
  556. [Subscription("Scheduler.CycledTotalWafer")]
  557. public int TotalCycledWafer { get; set; }
  558. [Subscription("Scheduler.CycleSetPoint")]
  559. public int CycleSetPoint { get; set; }
  560. public string CycleCountDisplay
  561. {
  562. get { return (CycleSetPoint > 0 && (CycledCount > CycleSetPoint)) ? $"{CycledCount + 1}/{CycleSetPoint}" : $"{CycledCount}/{CycleSetPoint}"; }
  563. }
  564. #endregion
  565. #region Button Logic
  566. #endregion
  567. #region shutter
  568. [Subscription("AutoShutter.OpenCloseStatus")]
  569. public string AutoShutterOpenCloseStatus { get; set; }
  570. [Subscription("AutoShutter.UpDownStatus")]
  571. public string AutoShutterUpDownStatus { get; set; }
  572. public string AutoShutterStatus => $"{AutoShutterOpenCloseStatus}/{AutoShutterUpDownStatus}";
  573. #endregion
  574. #endregion
  575. #region Gas
  576. [Subscription("PM1.MfcNX.DeviceData")]
  577. public AITMfcData MfcNXData { get; set; }
  578. [Subscription("PM1.MfcNY.DeviceData")]
  579. public AITMfcData MfcNYData { get; set; }
  580. [Subscription("PM1.MfcNN1.DeviceData")]
  581. public AITMfcData MfcNN1Data { get; set; }
  582. [Subscription("PM1.MfcN1.DeviceData")]
  583. public AITMfcData MfcN1Data { get; set; }
  584. [Subscription("PM1.MfcNN2.DeviceData")]
  585. public AITMfcData MfcNN2Data { get; set; }
  586. [Subscription("PM1.MfcN2.DeviceData")]
  587. public AITMfcData MfcN2Data { get; set; }
  588. [Subscription("PM1.MfcM1.DeviceData")]
  589. public AITMfcData MfcM1Data { get; set; }
  590. [Subscription("PM1.MfcD1.DeviceData")]
  591. public AITMfcData MfcD1Data { get; set; }
  592. [Subscription("PM1.MfcXY1.DeviceData")]
  593. public AITMfcData MfcXY1Data { get; set; }
  594. [Subscription("PM1.MfcNXF1.DeviceData")]
  595. public AITMfcData MfcNXF1Data { get; set; }
  596. [Subscription("PM1.MfcXF1.DeviceData")]
  597. public AITMfcData MfcXF1Data { get; set; }
  598. [Subscription("PM1.MfcNV1.DeviceData")]
  599. public AITMfcData MfcNV1Data { get; set; }
  600. [Subscription("PM1.MfcV1.DeviceData")]
  601. public AITMfcData MfcV1Data { get; set; }
  602. [Subscription("PM1.MfmD1.DeviceData")]
  603. public AITWaterFlowMeterData MfmD1FlowData { get; set; }
  604. public string UnitNX
  605. {
  606. get
  607. {
  608. return $"({SystemConfigProvider.Instance.GetValueByName("PM1.MFC.MFCNX.FlowUnit")})";
  609. }
  610. }
  611. public string UnitNY
  612. {
  613. get
  614. {
  615. return $"({SystemConfigProvider.Instance.GetValueByName("PM1.MFC.MFCNY.FlowUnit")})";
  616. }
  617. }
  618. public string UnitNN1
  619. {
  620. get
  621. {
  622. return $"({SystemConfigProvider.Instance.GetValueByName("PM1.MFC.MFCNN1.FlowUnit")})";
  623. }
  624. }
  625. public string UnitN1
  626. {
  627. get
  628. {
  629. return $"({SystemConfigProvider.Instance.GetValueByName("PM1.MFC.MFCN1.FlowUnit")})";
  630. }
  631. }
  632. public string UnitNN2
  633. {
  634. get
  635. {
  636. return $"({SystemConfigProvider.Instance.GetValueByName("PM1.MFC.MFCNN2.FlowUnit")})";
  637. }
  638. }
  639. public string UnitN2
  640. {
  641. get
  642. {
  643. return $"({SystemConfigProvider.Instance.GetValueByName("PM1.MFC.MFCN2.FlowUnit")})";
  644. }
  645. }
  646. public string UnitM1
  647. {
  648. get
  649. {
  650. return $"({SystemConfigProvider.Instance.GetValueByName("PM1.MFC.MFCM1.FlowUnit")})";
  651. }
  652. }
  653. public string UnitD1
  654. {
  655. get
  656. {
  657. return $"({SystemConfigProvider.Instance.GetValueByName("PM1.MFC.MFCD1.FlowUnit")})";
  658. }
  659. }
  660. public string UnitXY1
  661. {
  662. get
  663. {
  664. return $"({SystemConfigProvider.Instance.GetValueByName("PM1.MFC.MFCXY1.FlowUnit")})";
  665. }
  666. }
  667. public string UnitNXF1
  668. {
  669. get
  670. {
  671. return $"({SystemConfigProvider.Instance.GetValueByName("PM1.MFC.MFCNXF1.FlowUnit")})";
  672. }
  673. }
  674. public string UnitXF1
  675. {
  676. get
  677. {
  678. return $"({SystemConfigProvider.Instance.GetValueByName("PM1.MFC.MFCXF1.FlowUnit")})";
  679. }
  680. }
  681. public string UnitNV1
  682. {
  683. get
  684. {
  685. return $"({SystemConfigProvider.Instance.GetValueByName("PM1.MFC.MFCNV1.FlowUnit")})";
  686. }
  687. }
  688. public string UnitV1
  689. {
  690. get
  691. {
  692. return $"({SystemConfigProvider.Instance.GetValueByName("PM1.MFC.MFCV1.FlowUnit")})";
  693. }
  694. }
  695. public string UnitMFMD1
  696. {
  697. get
  698. {
  699. return $"({SystemConfigProvider.Instance.GetValueByName("PM1.MFM.MFMD1.FlowUnit")})";
  700. }
  701. }
  702. #endregion
  703. public Visibility IsStockerVisibility { get; set; }
  704. public Visibility IsLPVisibility { get; set; }
  705. public MainStatusViewModel()
  706. {
  707. this.DisplayName = "MainStatusViewModel";
  708. //ActiveUpdateData = true;
  709. _stokcers = new List<ModuleName>()
  710. {
  711. ModuleName.Stocker1,
  712. ModuleName.Stocker2,
  713. ModuleName.Stocker3,
  714. ModuleName.Stocker4,
  715. ModuleName.Stocker5,
  716. ModuleName.Stocker6,
  717. ModuleName.Stocker7,
  718. ModuleName.Stocker8,
  719. ModuleName.Stocker9,
  720. ModuleName.Stocker10,
  721. ModuleName.Stocker11,
  722. ModuleName.Stocker12,
  723. ModuleName.Stocker13,
  724. ModuleName.Stocker14,
  725. ModuleName.Stocker15,
  726. ModuleName.Stocker16,
  727. ModuleName.Stocker17,
  728. ModuleName.Stocker18,
  729. };
  730. StockerSlots = new ObservableCollection<string>()
  731. {
  732. "",
  733. "",
  734. "",
  735. "",
  736. "",
  737. "",
  738. "",
  739. "",
  740. "",
  741. "",
  742. "",
  743. "",
  744. "",
  745. "",
  746. "",
  747. "",
  748. "",
  749. "",
  750. "",
  751. "",
  752. "",
  753. };
  754. _stokcerWaferType = Enumerable.Repeat("", 21).ToList();
  755. _eDUseWarningLimit = (int)QueryDataClient.Instance.Service.GetConfig("PM1.WaferCycleTime.EDCountWarning");
  756. _eDUseAlarmLimit = (int)QueryDataClient.Instance.Service.GetConfig("PM1.WaferCycleTime.EDCountAlarm");
  757. _stockerBackground = new List<SolidColorBrush>();
  758. for (int i = 0; i < 21; i++)
  759. {
  760. _stockerBackground.Add(_WhiteFill);
  761. }
  762. }
  763. protected override void OnInitialize()
  764. {
  765. base.OnInitialize();
  766. base.InitFOUP();
  767. base.InitLL();
  768. base.InitTM();
  769. base.InitEFEM();
  770. base.InitPM();
  771. base.InitBuffer();
  772. }
  773. protected override void OnActivate()
  774. {
  775. base.OnActivate();
  776. _isCycleMode = (bool)QueryDataClient.Instance.Service.GetConfig("System.IsCycleMode");
  777. _cassetteSlot = (int)QueryDataClient.Instance.Service.GetConfig("System.CassetteSlotCount");
  778. for (int i = 0; i < _stokcers.Count; i++)
  779. {
  780. _stokcerWaferType[i] = (string)QueryDataClient.Instance.Service.GetConfig($"System.Stocker.{_stokcers[i]}WaferType");
  781. }
  782. }
  783. protected override void OnViewLoaded(object view)
  784. {
  785. base.OnViewLoaded(view);
  786. MainStatusView mainStatusView = (MainStatusView)view;
  787. InitMfc(mainStatusView);
  788. }
  789. public GridLength MfcNXHeight { get; set; }
  790. public GridLength MfcNYHeight { get; set; }
  791. public GridLength MfcNN1Height { get; set; }
  792. public GridLength MfcN1Height { get; set; }
  793. public GridLength MfcNN2Height { get; set; }
  794. public GridLength MfcN2Height { get; set; }
  795. public GridLength MfcM1Height { get; set; }
  796. public GridLength MfcD1Height { get; set; }
  797. public GridLength MfcXY1Height { get; set; }
  798. public GridLength MfcNXF1Height { get; set; }
  799. public GridLength MfcXFHeight { get; set; }
  800. public GridLength MfcNV1Height { get; set; }
  801. public GridLength MfcV1Height { get; set; }
  802. public void InitMfc(MainStatusView view)
  803. {
  804. List<AITMfcData> mfcData = new List<AITMfcData>()
  805. {
  806. MfcNXData,
  807. MfcNYData,
  808. MfcNN1Data,
  809. MfcN1Data,
  810. MfcNN2Data,
  811. MfcN2Data,
  812. MfcM1Data,
  813. MfcD1Data,
  814. MfcXY1Data,
  815. MfcNXF1Data,
  816. MfcXF1Data,
  817. MfcNV1Data,
  818. MfcV1Data,
  819. };
  820. for (int i = 0; i < mfcData.Count; i++)
  821. {
  822. var IsMFCInstalled = (bool)QueryDataClient.Instance.Service.GetConfig($"PM1.MFC.{mfcData[i].DeviceName}.IsMFCInstalled");
  823. switch (mfcData[i].DeviceName)
  824. {
  825. case "MfcNX":
  826. MfcNXHeight = IsMFCInstalled ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel);
  827. break;
  828. case "MfcNY":
  829. MfcNYHeight = IsMFCInstalled ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel);
  830. break;
  831. case "MfcNN1":
  832. MfcNN1Height = IsMFCInstalled ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel);
  833. break;
  834. case "MfcN1":
  835. MfcN1Height = IsMFCInstalled ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel);
  836. break;
  837. case "MfcNN2":
  838. MfcNN2Height = IsMFCInstalled ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel);
  839. break;
  840. case "MfcN2":
  841. MfcN2Height = IsMFCInstalled ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel);
  842. break;
  843. case "MfcM1":
  844. MfcM1Height = IsMFCInstalled ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel);
  845. break;
  846. case "MfcD1":
  847. MfcD1Height = IsMFCInstalled ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel);
  848. break;
  849. case "MfcXY1":
  850. MfcXY1Height = IsMFCInstalled ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel);
  851. break;
  852. case "MfcNXF1":
  853. MfcNXF1Height = IsMFCInstalled ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel);
  854. break;
  855. case "MfcXF1":
  856. MfcXFHeight = IsMFCInstalled ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel);
  857. break;
  858. case "MfcNV1":
  859. MfcNV1Height = IsMFCInstalled ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel);
  860. break;
  861. case "MfcV1":
  862. MfcV1Height = IsMFCInstalled ? new GridLength(1, GridUnitType.Star) : new GridLength(0, GridUnitType.Pixel);
  863. break;
  864. default:
  865. break;
  866. }
  867. }
  868. }
  869. public void Start()
  870. {
  871. InvokeClient.Instance.Service.DoOperation("System.StartAutoRun");
  872. }
  873. public void Stop()
  874. {
  875. //InvokeClient.Instance.Service.DoOperation("System.StartAutoRun");
  876. }
  877. public void SwitchPage(string page)
  878. {
  879. var windowManager = IoC.Get<IWindowManager>();
  880. switch (page)
  881. {
  882. case "Stocker":
  883. ClientApp.Instance.SwitchPage("status", "stocker", null);
  884. break;
  885. case "SelfCheck":
  886. ClientApp.Instance.SwitchPage("status", "selfCheck", null);
  887. break;
  888. case "Gas":
  889. {
  890. //ClientApp.Instance.SwitchPage("status", "gas", null);
  891. CGlobal.BoatWaferEditViewEnable = false;
  892. var wm = IoC.Get<IWindowManager>();
  893. GasDetailViewModel gasDetailViewModel = new GasDetailViewModel();
  894. (wm as WindowManager)?.ShowDialogWithTitle(gasDetailViewModel, null, "Gas Detail");
  895. }
  896. break;
  897. case "Temp":
  898. //TemperatureDetailViewModel temperatureDetailViewModel = new TemperatureDetailViewModel();
  899. //if((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(temperatureDetailViewModel, null, "Temperature Detail"))
  900. //{
  901. ClientApp.Instance.SwitchPage("status", "temp", null);
  902. //}
  903. break;
  904. case "MainRecipe":
  905. if (!string.IsNullOrEmpty(PM1MainRecipeName))
  906. {
  907. CGlobal.RecipeProcessEditViewEnable = false;
  908. MECF.Framework.UI.Client.CenterViews.Editors.Recipe.CGlobal.RecipeProcessEditViewEnable = false;
  909. var wm = IoC.Get<IWindowManager>();
  910. var viewProcessRecipe = new RecipeProcessEditViewModel("Furnace\\Process", PM1MainRecipeName);
  911. viewProcessRecipe.RecipeType = "process";
  912. (wm as WindowManager)?.ShowDialogWithTitle(viewProcessRecipe, null, "View Process Recpie");
  913. }
  914. break;
  915. case "LayoutRecipe":
  916. {
  917. CGlobal.BoatWaferEditViewEnable = false;
  918. var wm = IoC.Get<IWindowManager>();
  919. var viewLayoutRecipe = new BoatWaferNoActionViewModel();
  920. (wm as WindowManager)?.ShowDialogWithTitle(viewLayoutRecipe, null, "View Boat Wafer");
  921. }
  922. break;
  923. case "Boat Elevator":
  924. {
  925. BoatElevatorParametersViewModel boatElevatorParametersViewModel = new BoatElevatorParametersViewModel();
  926. (windowManager as WindowManager)?.ShowDialogWithTitle(boatElevatorParametersViewModel, null, "Boat Elevator Parameter Settings");
  927. }
  928. break;
  929. case "CJStatus":
  930. {
  931. ControlJobStatusViewModel controlJobStatusViewModel = new ControlJobStatusViewModel();
  932. (windowManager as WindowManager)?.ShowDialogWithTitle(controlJobStatusViewModel, null, "CJ Status");
  933. }
  934. break;
  935. case "PJStatus":
  936. {
  937. ProcessJobWithDrawingViewModel processJobWithDrawingViewModel = new ProcessJobWithDrawingViewModel();
  938. (windowManager as WindowManager)?.ShowDialogWithTitle(processJobWithDrawingViewModel, null, "PJ Status");
  939. }
  940. break;
  941. case "LoadPortState":
  942. {
  943. LoadPortStateViewModel loadPortStateViewModel = new LoadPortStateViewModel();
  944. (windowManager as WindowManager)?.ShowDialogWithTitle(loadPortStateViewModel, null, "Load Port State");
  945. }
  946. break;
  947. case "CarrierState":
  948. {
  949. CarrierStateViewModel carrierStateViewModel = new CarrierStateViewModel();
  950. (windowManager as WindowManager)?.ShowDialogWithTitle(carrierStateViewModel, null, "Carrier State");
  951. }
  952. break;
  953. case "Equipment Status":
  954. {
  955. EquipmentStatusViewModel equipmentStatusViewModel = new EquipmentStatusViewModel();
  956. (windowManager as WindowManager)?.ShowDialogWithTitle(equipmentStatusViewModel, null, "Equipment Operation State");
  957. }
  958. break;
  959. case "Load Unload State":
  960. {
  961. LoadUnloadStateViewModel loadUnloadStateViewModel = new LoadUnloadStateViewModel();
  962. (windowManager as WindowManager)?.ShowDialogWithTitle(loadUnloadStateViewModel, null, "Load Unload State");
  963. }
  964. break;
  965. case "Boat Detail":
  966. {
  967. BoatWaferViewModel boatWaferViewModel = new BoatWaferViewModel();
  968. (windowManager as WindowManager)?.ShowDialogWithTitle(boatWaferViewModel, null, "Boat Detail");
  969. }
  970. break;
  971. }
  972. }
  973. string[] moduleNames = new string[] { "Stocker1", "Stocker2", "Stocker3", "Stocker4", "Stocker5", "Stocker6", "Stocker7", "Stocker8", "Stocker9",
  974. "Stocker10","Stocker11","Stocker12","Stocker13","Stocker14","Stocker15","Stocker16","Stocker17","Stocker18"};
  975. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  976. {
  977. UpdateStockerSlots();
  978. UpdateRecipeProgress();
  979. var isLoadPortPosition = (string)QueryDataClient.Instance.Service.GetConfig("LoadPort.LoadPortPosition");
  980. if (isLoadPortPosition == "Upper")
  981. {
  982. IsStockerVisibility = Visibility.Hidden;
  983. IsLPVisibility = Visibility.Visible;
  984. }
  985. else
  986. {
  987. IsStockerVisibility = Visibility.Visible;
  988. IsLPVisibility = Visibility.Hidden;
  989. }
  990. foreach (var item in moduleNames)
  991. {
  992. if (ModuleManager.ModuleInfos.ContainsKey(item))
  993. {
  994. this.GetType().GetProperty($"{item}WaferCount").SetValue(this, ModuleManager.ModuleInfos[item].WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count());
  995. }
  996. }
  997. }
  998. private void UpdateStockerSlots()
  999. {
  1000. for (int i = 0; i < _stokcers.Count; i++)
  1001. {
  1002. bool bHaveAbort = false;
  1003. var wafers = ModuleManager.ModuleInfos[_stokcers[i].ToString()].WaferManager.Wafers;
  1004. int waferNumber = 0;
  1005. string waferType = "";
  1006. SolidColorBrush _tempFill = _SD_ED_M_Fill;
  1007. if (wafers != null)
  1008. {
  1009. foreach (var wafer in wafers)
  1010. {
  1011. if (wafer.WaferStatus != 0)
  1012. {
  1013. waferNumber++;
  1014. waferType = wafer.WaferType.ToString();
  1015. if (wafer.WaferStatus == 5) // EnumWaferProcessStatus.Failed
  1016. bHaveAbort = true;
  1017. if (wafer.UseCount >= _eDUseWarningLimit)
  1018. {
  1019. _tempFill = _waringFill;
  1020. }
  1021. if (wafer.UseCount >= _eDUseAlarmLimit)
  1022. {
  1023. _tempFill = _alarmFill;
  1024. }
  1025. }
  1026. }
  1027. }
  1028. StockerSlots[i] = $"{_stokcerWaferType[i]}-{waferNumber}/{_cassetteSlot}";
  1029. if (_stokcerWaferType[i].Contains("P"))
  1030. {
  1031. if (waferNumber > 0)
  1032. {
  1033. if (bHaveAbort)
  1034. StockerBackground[i] = _redBk;
  1035. else
  1036. StockerBackground[i] = _productionFill;
  1037. }
  1038. else
  1039. {
  1040. StockerBackground[i] = _WhiteFill;
  1041. }
  1042. }
  1043. else
  1044. {
  1045. if (waferNumber > 0)
  1046. {
  1047. if (bHaveAbort)
  1048. StockerBackground[i] = _redBk;
  1049. else
  1050. {
  1051. StockerBackground[i] = _tempFill;
  1052. }
  1053. }
  1054. else
  1055. {
  1056. StockerBackground[i] = _WhiteFill;
  1057. }
  1058. }
  1059. }
  1060. }
  1061. private void UpdateRecipeProgress()
  1062. {
  1063. if (!IsPM1Process && !IsPM1PostProcess)
  1064. {
  1065. RecipeProgress = "";
  1066. RecipeProgressValue = 0;
  1067. return;
  1068. }
  1069. if (PM1RecipeTotalTime == 0)
  1070. {
  1071. RecipeProgress = "";
  1072. RecipeProgressValue = 0;
  1073. }
  1074. else
  1075. {
  1076. float totalTime = PM1RecipeTotalTime;
  1077. float elapseTime = PM1RecipeTotalElapseTime;
  1078. RecipeProgress = $"{(int)(elapseTime / totalTime * 100)}%";
  1079. RecipeProgressValue = (int)(elapseTime / totalTime * 100);
  1080. }
  1081. }
  1082. public void PopupPage(string page)
  1083. {
  1084. //var windowManager = IoC.Get<IWindowManager>();
  1085. var windowManager = new WindowManager();
  1086. switch (page)
  1087. {
  1088. case "PortStatus":
  1089. //LoadIOPortViewModel portStatusViewModel = new LoadIOPortViewModel();
  1090. //(windowManager as WindowManager)?.ShowDialogWithTitle(portStatusViewModel, null, "Port Status");
  1091. break;
  1092. case "JobStatus":
  1093. JOBStatusViewModel vm = new JOBStatusViewModel();
  1094. //bool? ret = windowManager.ShowDialog(vm);
  1095. (windowManager as WindowManager)?.ShowDialogWithTitle(vm, null, "Job Status View");
  1096. break;
  1097. default:
  1098. break;
  1099. }
  1100. }
  1101. public void StandbyFactor()
  1102. {
  1103. //if (!string.IsNullOrEmpty(PM1MainRecipeName))
  1104. {
  1105. var windowManager = IoC.Get<IWindowManager>();
  1106. StandbyFactorViewModel standbyFactorViewModel = new StandbyFactorViewModel();
  1107. standbyFactorViewModel.MainRecipeName = PM1MainRecipeName;
  1108. (windowManager as WindowManager)?.ShowDialogWithTitle(standbyFactorViewModel, null, "Standby Factor View");
  1109. }
  1110. }
  1111. public void Skip()
  1112. {
  1113. if (!DialogBox.Confirm("Ara you sure to skip current step?"))
  1114. return;
  1115. InvokeClient.Instance.Service.DoOperation($"PM1.RecipeSkipStep", "");
  1116. }
  1117. public void Jump()
  1118. {
  1119. if (!DialogBox.Confirm("Ara you sure to jump current step?"))
  1120. return;
  1121. var recipes = new RecipeDataBase();
  1122. recipes.PrefixPath = "Furnace\\Process";
  1123. recipes.Name = PM1MainRecipeName;
  1124. RecipeProvider _recipeProvider = new RecipeProvider();
  1125. recipes.Clear();
  1126. var recipeContent = _recipeProvider.LoadRecipe(recipes.PrefixPath, recipes.Name);
  1127. if (string.IsNullOrEmpty(recipeContent))
  1128. {
  1129. MessageBox.Show($"{recipes.PrefixPath}\\{recipes.Name} is empty, please confirm the file is valid.");
  1130. return;
  1131. }
  1132. recipes.RecipeChamberType = "OriginChamber";
  1133. recipes.InitData(recipes.PrefixPath, recipes.Name, recipeContent, "PM1");
  1134. var windowManager = IoC.Get<IWindowManager>();
  1135. RecipeLoopSetViewModel recipeLoopSetViewModel = new RecipeLoopSetViewModel();
  1136. recipeLoopSetViewModel.StepNames = new ObservableCollection<string>(recipes.Steps.OrderBy(x => x.StepNo).Where(x => x.StepNo != PM1RecipeStepNumber).Select(x => x.Name).ToList());
  1137. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeLoopSetViewModel, null, "Jump"))
  1138. {
  1139. InvokeClient.Instance.Service.DoOperation($"PM1.RecipeJumpStep", recipeLoopSetViewModel.SelectedIndex);
  1140. }
  1141. }
  1142. public void Hold()
  1143. {
  1144. if (HoldName == "Hold")
  1145. {
  1146. if (!DialogBox.Confirm("Ara you sure to hold current recipe?"))
  1147. return;
  1148. InvokeClient.Instance.Service.DoOperation($"PM1.RecipePause", "");
  1149. }
  1150. else
  1151. {
  1152. InvokeClient.Instance.Service.DoOperation($"PM1.RecipeContinue", "");
  1153. }
  1154. }
  1155. public void EmergencyAbort()
  1156. {
  1157. if (!DialogBox.Confirm("Ara you sure to execute EmergencyAbort?"))
  1158. return;
  1159. InvokeClient.Instance.Service.DoOperation("PM1.Abort");
  1160. }
  1161. }
  1162. }