| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 | using System;using System.Collections.Generic;using System.Collections.ObjectModel;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows;using System.Windows.Controls;using System.Windows.Media;using Aitex.Core.Util;using MECF.Framework.Common.OperationCenter;using OpenSEMI.ClientBase;using FurnaceUI.Models;namespace FurnaceUI.Views.Jobs{    public class JOBStatusViewModel : FurnaceUIViewModelBase    {        [Subscription("Rt.Status")]        public string RtStatus { get; set; }        [Subscription("System.Pause")]        public bool IsPause { get; set; }        [Subscription("System.Batch")]        public string Batch { get; set; }        [Subscription("System.JobName")]        public string JobName { get; set; }        [Subscription("System.RecipeName")]        public string RecipeName { get; set; }        [Subscription("System.ProcessJobStatus")]        public string ProcessJobStatus { get; set; }        private SolidColorBrush _whiteBk = new SolidColorBrush(Colors.White);        private SolidColorBrush _greenBk = new SolidColorBrush(Colors.Green);        #region TransferJob        [Subscription("System.TransferJobStatus")]        public string TransferJobStatus { get; set; }        public SolidColorBrush LoadingBk        {            get            {                return TransferJobStatus == "Loading" ? _greenBk : _whiteBk;            }        }        public SolidColorBrush UnloadingBk        {            get            {                return TransferJobStatus == "Unloading" ? _greenBk : _whiteBk;            }        }        public bool TransferJobEnabledAbort        {            get            {                return TransferJobStatus != "Idle";            }        }        #endregion        #region ProcessJob1        public SolidColorBrush ProcessJob1ChargingBk        {            get            {                return (ProcessJobStatus == "Charging" && Batch == "A") ? _greenBk : _whiteBk;            }        }        public SolidColorBrush ProcessJob1ProcessingBk        {            get            {                return (ProcessJobStatus == "Processing" && Batch == "A") ? _greenBk : _whiteBk;            }        }        public SolidColorBrush ProcessJob1CoolingBk        {            get            {                return (ProcessJobStatus == "Cooling" && Batch == "A") ? _greenBk : _whiteBk;            }        }         public SolidColorBrush ProcessJob1DischargingBk        {            get            {                return (ProcessJobStatus == "Discharging" && Batch == "A") ? _greenBk : _whiteBk;            }        }                public bool IsProcessJob1EnabledPause        {            get            {                return IsJobStatusEnable && Batch == "A" && !IsPause;            }        }        public bool IsProcessJob1EnabledResume        {            get            {                return IsJobStatusEnable && Batch == "A" && IsPause;            }        }        public bool IsProcessJob1EnabledAbort        {            get            {                return IsJobStatusEnable && Batch == "A";            }        }        public bool IsProcessJob1EnabledWithdraw        {            get            {                return RtStatus == "Idle";            }        }        public string Process1JobName        {            get            {                return Batch == "A" ? JobName : "";            }        }        public string Process1RcpName        {            get            {                return Batch == "A" ? RecipeName : "";            }        }        public string Process1BatchName        {            get            {                return Batch == "A" ? "A Batch" : "";            }        }        #endregion        #region ProcessJob2        public SolidColorBrush ProcessJob2ChargingBk        {            get            {                return (ProcessJobStatus == "Charging" && Batch == "B") ? _greenBk : _whiteBk;            }        }        public SolidColorBrush ProcessJob2ProcessingBk        {            get            {                return (ProcessJobStatus == "Processing" && Batch == "B") ? _greenBk : _whiteBk;            }        }        public SolidColorBrush ProcessJob2CoolingBk        {            get            {                return (ProcessJobStatus == "Cooling" && Batch == "B") ? _greenBk : _whiteBk;            }        }          public SolidColorBrush ProcessJob2DischargingBk        {            get            {                return (ProcessJobStatus == "Discharging" && Batch == "B") ? _greenBk : _whiteBk;            }        }                public bool IsProcessJob2EnabledPause        {            get            {                return IsJobStatusEnable && Batch == "B" && !IsPause;            }        }        public bool IsProcessJob2EnabledResume        {            get            {                return IsJobStatusEnable && Batch == "B" && IsPause;            }        }        public bool IsProcessJob2EnabledAbort        {            get            {                return IsJobStatusEnable && Batch == "B";            }        }        public bool IsProcessJob2EnabledWithdraw        {            get            {                return RtStatus == "Idle";            }        }        public string Process2JobName        {            get            {                return Batch == "B" ? JobName : "";            }        }        public string Process2RcpName        {            get            {                return Batch == "B" ? RecipeName : "";            }        }        public string Process2BatchName        {            get            {                return Batch == "B" ? "B Batch" : "";            }        }        #endregion        #region UI Logic        public bool IsJobStatusEnable => RtStatus == "ChargeProcessDischarging" || RtStatus == "LoadProcessStockering" || RtStatus == "LoadProcessUnloading";        #endregion        public void Pause()        {            InvokeClient.Instance.Service.DoOperation("System.Pause");        }        public void Resume()        {            InvokeClient.Instance.Service.DoOperation("System.Resume");        }        public void Abort()        {            if (!DialogBox.Confirm("Do you abort JOB ?"))                return;            InvokeClient.Instance.Service.DoOperation("System.Abort");        }        public void Withdraw()        {            InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer");        }        public void CloseCmd()        {            ((Window)GetView()).DialogResult = false;        }    }}
 |