| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461 | using System;using System.Collections.Generic;using System.Collections.ObjectModel;using System.Linq;using System.Windows;using System.Windows.Input;using Aitex.Core.Common.DeviceData;using Aitex.Core.Util;using Aitex.Core.Utilities;using Aitex.Sorter.Common;using Caliburn.Micro;using MECF.Framework.Common.CommonData;using MECF.Framework.Common.DataCenter;using MECF.Framework.Common.OperationCenter;using MECF.Framework.Common.RecipeCenter;using MECF.Framework.UI.Client.CenterViews.Editors.Sequence;using MECF.Framework.UI.Client.CenterViews.Operations.WaferAssociation;using MECF.Framework.UI.Client.ClientBase;using OpenSEMI.ClientBase;using FurnaceUI.Controls.Common;using FurnaceUI.Models;namespace FurnaceUI.Views{    public class EmptyViewModel : FurnaceUIViewModelBase    {        #region Property           [Subscription("System.IsManualMode")]         public bool IsManualMode { get; set; }        [Subscription("Robot1.State")]        public string Robot1Status { get; set; }        [Subscription("Robot1.RobotSpeed")]        public int Robot1Speed { get; set; }        [Subscription("Robot2.State")]        public string Robot2Status { get; set; }        [Subscription("Robot2.RobotSpeed")]        public int Robot2Speed { get; set; }        [Subscription("System.CurrentSelectSequence")]        public string SelectedSequence { get; set; }        [Subscription("System.TransferCount")]        public int ProcessedWaferCount { get; set; }        [Subscription("System.TranserThroughput")]        public int Througput { get; set; }        [Subscription("System.TransferTime")]        public int ProcessTime { get; set; }        [Subscription("System.TotalWaferCount")]        public string TotalWaferCount { get; set; }        #region EFEM        [Subscription("Aligner.State")]        public string AlignerStatus { get; set; }        [Subscription("Aligner.WaferSize")]        public string AlignerWaferSize { get; set; }        [Subscription("WIDReader1.CurrentLaserMark")]        public string WIDReader1LaserMark { get; set; }        [Subscription("WIDReader1.WIDReaderState")]        public string WIDReader1Status { get; set; }        [Subscription("Buffer1.Status")]        public string Buffer1Status { get; set; }        [Subscription("Buffer1.WaferSize")]        public string Buffer1WaferSize { get; set; }        [Subscription("Buffer2.Status")]        public string Buffer2Status { get; set; }        [Subscription("Buffer2.WaferSize")]        public string Buffer2WaferSize { get; set; }        [Subscription("LP1.WaferSize")]        public string LP1WaferSize { get; set; }        public string WaferSizeLP1        {            get { return IsLP1Placed ? GetWaferSize(LP1WaferSize) : "--"; }        }        [Subscription("LP2.WaferSize")]        public string LP2WaferSize { get; set; }        public string WaferSizeLP2        {            get { return IsLP2Placed ? GetWaferSize(LP2WaferSize) : "--"; }        }        [Subscription("LP3.WaferSize")]        public string LP3WaferSize { get; set; }        public string WaferSizeLP3        {            get { return IsLP3Placed ? GetWaferSize(LP3WaferSize) : "--"; }        }        [Subscription("LP4.WaferSize")]        public string LP4WaferSize { get; set; }        public string WaferSizeLP4        {            get { return IsLP4Placed ? GetWaferSize(LP4WaferSize) : "--"; }        }        [Subscription("LP1.InfoPadCarrierTypeInformation")]        public string LP1CarrierInfo { get; set; }        [Subscription("LP2.InfoPadCarrierTypeInformation")]        public string LP2CarrierInfo { get; set; }        private WaferAssociationInfo _lp1WaferAssociation;        public WaferAssociationInfo LP1WaferAssociation        {            get { return _lp1WaferAssociation; }            set { _lp1WaferAssociation = value; }        }        private WaferAssociationInfo _lp2WaferAssociation;        public WaferAssociationInfo LP2WaferAssociation        {            get { return _lp2WaferAssociation; }            set { _lp2WaferAssociation = value; }        }        private WaferAssociationInfo _lp3WaferAssociation;        public WaferAssociationInfo LP3WaferAssociation        {            get { return _lp3WaferAssociation; }            set { _lp3WaferAssociation = value; }        }        private WaferAssociationInfo _lp4WaferAssociation;        public WaferAssociationInfo LP4WaferAssociation        {            get { return _lp4WaferAssociation; }            set { _lp4WaferAssociation = value; }        }        [Subscription("LP1.CassetteState")]        public LoadportCassetteState LP1CassetteState { get; set; }              [Subscription("LP1.FoupDoorState")]        public FoupDoorState LP1DoorState { get; set; }               [Subscription("LP2.CassetteState")]        public LoadportCassetteState LP2CassetteState { get; set; }        [Subscription("LP2.FoupDoorState")]        public FoupDoorState LP2DoorState { get; set; }        [Subscription("LP3.CassetteState")]        public LoadportCassetteState LP3CassetteState { get; set; }        [Subscription("LP3.FoupDoorState")]        public FoupDoorState LP3DoorState { get; set; }        [Subscription("LP4.CassetteState")]        public LoadportCassetteState LP4CassetteState { get; set; }        [Subscription("LP4.FoupDoorState")]        public FoupDoorState LP4DoorState { get; set; }        [Subscription("Robot1.RobotMoveInfo")]        public RobotMoveInfo EfemRobot1MoveInfo        {            get;            set;        }        [Subscription("Robot2.RobotMoveInfo")]        public RobotMoveInfo EfemRobot2MoveInfo        {            get;            set;        }        [Subscription("LP1.CarrierId")]        public string LP1CarrierId { get; set; }        [Subscription("LP2.CarrierId")]        public string LP2CarrierId { get; set; }        [Subscription("LP3.CarrierId")]        public string LP3CarrierId { get; set; }        [Subscription("LP1.IsPlaced")]        public bool IsLP1Placed { get; set; }        public Visibility Foup1Visibility => IsLP1Placed ? Visibility.Visible : Visibility.Hidden;        [Subscription("LP1.IsMapped")]        public bool IsLP1Mapped { get; set; }        public bool IsLP1MapEnable        {            get { return IsLP1Placed; }        }              [Subscription("LP1.IsDocked")]        public bool IsLP1Docked{get;set;}        [Subscription("LP2.IsMapped")]        public bool IsLP2Mapped { get; set; }        public bool IsLP2MapEnable        {            get { return IsLP2Placed; }        }               [Subscription("LP2.IsDocked")]        public bool IsLP2Docked { get; set; }        [Subscription("LP3.IsMapped")]        public bool IsLP3Mapped { get; set; }        public bool IsLP3MapEnable        {            get { return IsLP3Placed; }        }        [Subscription("LP3.IsDocked")]        public bool IsLP3Docked { get; set; }        [Subscription("LP4.IsMapped")]        public bool IsLP4Mapped { get; set; }        public bool IsLP4MapEnable        {            get { return IsLP4Placed; }        }        [Subscription("LP4.IsDocked")]        public bool IsLP4Docked { get; set; }               [Subscription("LP2.IsPlaced")]        public bool IsLP2Placed { get; set; }        public Visibility Foup2Visibility => IsLP2Placed ? Visibility.Visible : Visibility.Hidden;        [Subscription("LP3.IsPlaced")]        public bool IsLP3Placed { get; set; }        public Visibility Foup3Visibility        {            get { return IsLP3Placed ? Visibility.Visible : Visibility.Hidden; }        }        [Subscription("LP4.IsPlaced")]        public bool IsLP4Placed { get; set; }        public Visibility Foup4Visibility        {            get { return IsLP4Placed ? Visibility.Visible : Visibility.Hidden; }        }        public Dictionary<string, StationPosition> StationPosition        {            get            {                return new Dictionary<string, StationPosition>()                {                    { "System", new StationPosition() {                        StartPosition = new RobotPosition() { X=0, Root = 0, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 0, Arm = 0, Hand = 0 }}                    }                    ,{ "Robot", new StationPosition() {                        StartPosition = new RobotPosition() { X=0, Root = 0, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 0, Arm = 0, Hand = 0 }}                    }                    ,{ "LP1", new StationPosition() {                       StartPosition = new RobotPosition() { X=-330, Root = 180, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 180, Arm = 0, Hand = 0 }}                    }                    ,{ "LP2", new StationPosition() {                       StartPosition = new RobotPosition() { X=-270, Root = 180, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 180, Arm = 0, Hand = 0 }}                    }                    ,{ "LP3", new StationPosition() {                       StartPosition = new RobotPosition() { X=-180, Root = 180, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 180, Arm = 0, Hand = 0 }}                    }                    ,{ "LP4", new StationPosition() {                       StartPosition = new RobotPosition() { X=-310, Root = 0, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 0, Arm = 0, Hand = 0 }}                    }                   ,{ "LP5", new StationPosition() {                        StartPosition = new RobotPosition() { X=-240, Root = 0, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition()  { Root = 0, Arm = 0, Hand = 0 }}                    }                    ,{ "LP6", new StationPosition() {                       StartPosition = new RobotPosition() { X=-170,Root = 0, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 0, Arm = 0, Hand = 0 } }                    }                    ,{ "LP7", new StationPosition() {                         StartPosition = new RobotPosition() { X=-80, Root = 0, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 0, Arm = 0, Hand = 0 }}                    }                };            }        }        public Dictionary<string, StationPosition> StationPosition2        {            get            {                return new Dictionary<string, StationPosition>()                {                    { "System", new StationPosition() {                        StartPosition = new RobotPosition() { X=0, Root = 0, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 0, Arm = 0, Hand = 0 }}                    }                      ,{ "Robot", new StationPosition() {                        StartPosition = new RobotPosition() { X=0, Root = 0, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 0, Arm = 0, Hand = 0 }}                    }                    ,{ "Station1", new StationPosition() {                       StartPosition = new RobotPosition() { X=-110, Root = 180, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 180, Arm = 0, Hand = 0 }}                    }                    ,{ "Station2", new StationPosition() {                       StartPosition = new RobotPosition() { X=-40, Root = 180, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 180, Arm = 0, Hand = 0 }}                    }                    ,{ "Station3", new StationPosition() {                       StartPosition = new RobotPosition() { X=-80, Root = 0, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 180, Arm = 0, Hand = 0 }}                    }                };            }        }        public Dictionary<string, StationPosition> StationPosition3        {            get            {                return new Dictionary<string, StationPosition>()                {                    { "System", new StationPosition() {                        StartPosition = new RobotPosition() { X=0, Root = 0, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 0, Arm = 0, Hand = 0 }}                    }                      ,{ "Robot", new StationPosition() {                        StartPosition = new RobotPosition() { X=0, Root = 0, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 0, Arm = 0, Hand = 0 }}                    }                    ,{ "Station1", new StationPosition() {                       StartPosition = new RobotPosition() { X=-50, Root = 0, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 0, Arm = 0, Hand = 0 }}                    }                    ,{ "Station2", new StationPosition() {                       StartPosition = new RobotPosition() { X=-100, Root = 0, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 0, Arm = 0, Hand = 0 }}                    }                    ,{ "Station3", new StationPosition() {                       StartPosition = new RobotPosition() { X=-260, Root = 0, Arm = 0, Hand = 0 }                        ,EndPosition = new RobotPosition() { Root = 0, Arm = 0, Hand = 0 }}                    }                };            }        }        #endregion        #region Mainframe        [Subscription("PM1.ChamberDoor.OpenFeedback")]        public bool PM1SlitValveOpenFeedback { get; set; }        [Subscription("PM1.ChamberDoor.CloseFeedback")]        public bool PM1SlitValveCloseFeedback { get; set; }        public bool IsPM1SlitValveOpen        {            get            {                if (PM1SlitValveOpenFeedback && !PM1SlitValveCloseFeedback)                    return true;                else if (!PM1SlitValveOpenFeedback && PM1SlitValveCloseFeedback)                    return false;                else                    return false;            }        }        [Subscription("PM2.ChamberDoor.OpenFeedback")]        public bool PM2SlitValveOpenFeedback { get; set; }        [Subscription("PM2.ChamberDoor.CloseFeedback")]        public bool PM2SlitValveCloseFeedback { get; set; }        public bool IsPM2SlitValveOpen        {            get            {                if (PM2SlitValveOpenFeedback && !PM2SlitValveCloseFeedback)                    return true;                else if (!PM2SlitValveOpenFeedback && PM2SlitValveCloseFeedback)                    return false;                else                    return false;            }        }        public FoupDoorState PM1DoorState        {            get            {                return FoupDoorState.Open;            }        }        public FoupDoorState PM2DoorState        {            get            {                if (PM2SlitValveOpenFeedback && !PM2SlitValveCloseFeedback) return FoupDoorState.Open;                if (!PM2SlitValveOpenFeedback && PM2SlitValveCloseFeedback) return FoupDoorState.Close;                return FoupDoorState.Unknown;            }        }               [Subscription("EFEM.Status")]        public string EFEMStatus { get; set; }        [Subscription("LP1.Status")]        public string LP1Status { get; set; }        [Subscription("LP2.Status")]        public string LP2Status { get; set; }        [Subscription("LP3.Status")]        public string LP3Status { get; set; }        [Subscription("LP4.Status")]        public string LP4Status { get; set; }        #endregion        #region PM        [Subscription("PM1.Status")]        public string PM1Status { get; set; }        [Subscription("PM1.RecipeStepName")]        public string PM1RecipeStepName { get; set; }        [Subscription("PM1.RecipeStepNumber")]        public int PM1RecipeStepNumber { get; set; }        [Subscription("PM1.RecipeStepElapseTime")]        public int PM1RecipeStepElapseTime { get; set; }        [Subscription("PM1.RecipeStepTime")]        public int PM1RecipeStepTime { get; set; }        [Subscription("PM1.RecipeTotalElapseTime")]        public int PM1RecipeTotalElapseTime { get; set; }        [Subscription("PM1.RecipeTotalTime")]        public int PM1RecipeTotalTime { get; set; }        public bool IsPM1Idle        {            get { return PM1Status == "Idle"; }        }        public bool IsPM1Process        {            get { return PM1Status == "Process"; }        }        public bool IsPM1PostProcess        {            get { return PM1Status == "PostProcess"; }        }        public bool IsPM1PreProcess        {            get { return PM1Status == "PreProcess"; }        }        public string PM1StepNumber        {            get            {                if (!IsPM1Process && !IsPM1PostProcess)                    return "--";                return $"{PM1RecipeStepNumber}";            }        }        public string PM1StepName        {            get            {                if (!IsPM1Process && !IsPM1PostProcess)                    return "--";                return $"{PM1RecipeStepName}";            }        }        public string PM1StepTime        {            get            {                if (!IsPM1Process && !IsPM1PostProcess)                    return "--";                return $"{PM1RecipeStepElapseTime}/{PM1RecipeStepTime}";            }        }        public string PM1RecipeTime        {            get            {                if (!IsPM1Process && !IsPM1PostProcess)                    return "--";                return $"{PM1RecipeTotalElapseTime}/{PM1RecipeTotalTime}";            }        }        [Subscription("PM1.SelectedRecipeName")]        public string PM1SelectedRecipeName        {            get;            set;        }        public string PM1SelectedRecipeNameDisplay        {            get            {                if (string.IsNullOrEmpty(PM1SelectedRecipeName))                    return string.Empty;                return PM1SelectedRecipeName.Substring("Furnace\\Process\\".Length);            }        }        [Subscription("PM1.ChamberPressure.DeviceData")]        public AITPressureMeterData PM1ChamberPressure { get; set; }        [Subscription("PM1.ChamberMonitorPressure.DeviceData")]        public AITPressureMeterData PM1ChamberMonitorPressure { get; set; }        [Subscription("PM1.VacuumSensorValve.DeviceData")]        public AITValveData PM1VacuumSensorValve { get; set; }        public string PM1ChamberRealPressure        {            get            {                 float value = 1.0f;                //float value = (float)PM1ChamberMonitorPressure.FeedBack;                //if (value < 3.0 && PM1VacuumSensorValve.IsOpen)                //    value = (float)PM1ChamberPressure.FeedBack;                return $"{value:F3}";            }        }        [Subscription("PM1.ChamberHeater.DeviceData")]        public AITHeaterData PM1ChamberHeaterData { get; set; }        [Subscription("PM1.IsOnline")]        public bool PM1IsOnline { get; set; }        public bool PM1IsOffline        {            get { return !PM1IsOnline; }        }        [Subscription("PM2.IsOnline")]        public bool PM2IsOnline { get; set; }        public bool PM2IsOffline        {            get { return !PM2IsOnline; }        }        [Subscription("PM2.Status")]        public string PM2Status { get; set; }        [Subscription("PM2.RecipeStepName")]        public string PM2RecipeStepName { get; set; }        [Subscription("PM2.RecipeStepNumber")]        public int PM2RecipeStepNumber { get; set; }        [Subscription("PM2.RecipeStepElapseTime")]        public int PM2RecipeStepElapseTime { get; set; }        [Subscription("PM2.RecipeStepTime")]        public int PM2RecipeStepTime { get; set; }        [Subscription("PM2.RecipeTotalElapseTime")]        public int PM2RecipeTotalElapseTime { get; set; }        [Subscription("PM2.RecipeTotalTime")]        public int PM2RecipeTotalTime { get; set; }        public bool IsPM2Idle        {            get { return PM2Status == "Idle"; }        }        public bool IsPM2Process        {            get { return PM2Status == "Process"; }        }        public bool IsPM2PostProcess        {            get { return PM2Status == "PostProcess"; }        }        public bool IsPM2PreProcess        {            get { return PM2Status == "PreProcess"; }        }        public string PM2StepNumber        {            get            {                if (!IsPM2Process && !IsPM2PostProcess)                    return "--";                return $"{PM2RecipeStepNumber}";            }        }        public string PM2StepName        {            get            {                if (!IsPM2Process && !IsPM2PostProcess)                    return "--";                return $"{PM2RecipeStepName}";            }        }        public string PM2StepTime        {            get            {                if (!IsPM2Process && !IsPM2PostProcess)                    return "--";                return $"{PM2RecipeStepElapseTime}/{PM2RecipeStepTime}";            }        }        public string PM2RecipeTime        {            get            {                if (!IsPM2Process && !IsPM2PostProcess)                    return "--";                return $"{PM2RecipeTotalElapseTime}/{PM2RecipeTotalTime}";            }        }        [Subscription("PM2.SelectedRecipeName")]        public string PM2SelectedRecipeName        {            get;            set;        }        public string PM2SelectedRecipeNameDisplay        {            get            {                if (string.IsNullOrEmpty(PM2SelectedRecipeName))                    return string.Empty;                return PM2SelectedRecipeName.Substring("Furnace\\Process\\".Length);            }        }        [Subscription("PM2.ChamberPressure.DeviceData")]        public AITPressureMeterData PM2ChamberPressure { get; set; }        [Subscription("PM2.ChamberMonitorPressure.DeviceData")]        public AITPressureMeterData PM2ChamberMonitorPressure { get; set; }        [Subscription("PM2.VacuumSensorValve.DeviceData")]        public AITValveData PM2VacuumSensorValve { get; set; }        public string PM2ChamberRealPressure        {            get            {                float value = 1.0f;                //float value = (float)PM2ChamberMonitorPressure.FeedBack;                //if (value < 3.0 && PM2VacuumSensorValve.IsOpen)                //    value = (float)PM2ChamberPressure.FeedBack;                return $"{value:F3}";            }        }        [Subscription("PM2.ChamberHeater.DeviceData")]        public AITHeaterData PM2ChamberHeaterData { get; set; }        #endregion        #region Scheduler        public bool IsRtInitialized        {            get            {                return RtStatus != "Init" && RtStatus != "Initializing";            }        }        public bool IsRtRunning        {            get            {                return RtStatus != "Init" && RtStatus != "Idle" && RtStatus != "AutoIdle";            }        }        public bool IsRtError        {            get            {                return RtStatus == "Error";            }        }        public bool IsAuto        {            get { return RtStatus == "Auto_Running" || RtStatus == "Auto_Idle"; }        }        [Subscription("Rt.Status")]        public string RtStatus { get; set; }        public bool _isCycleMode;        public Visibility IsCycleInfoVisibility        {            get { return _isCycleMode ? Visibility.Visible : Visibility.Collapsed; }        }        [Subscription("Scheduler.CycledCount")]        public int CycledCount { get; set; }        [Subscription("Scheduler.CycledWafer")]        public int CycledWafer { get; set; }        [Subscription("Scheduler.CycledTime")]        public int TotalCycledTime { get; set; }        public string TotalCycledProduction { get => CycledWafer + "/" + TotalCycledTime; }        [Subscription("Scheduler.CycledTotalWafer")]        public int TotalCycledWafer { get; set; }        [Subscription("Scheduler.CycleSetPoint")]        public int CycleSetPoint { get; set; }        public string CycleCountDisplay        {            get { return (CycleSetPoint > 0 && (CycledCount > CycleSetPoint)) ? $"{CycledCount + 1}/{CycleSetPoint}" : $"{CycledCount}/{CycleSetPoint}"; }        }        [Subscription("PlatformCycle.CycledCount")]        public int PlatformCycledCount { get; set; }        [Subscription("PlatformCycle.CycledWafer")]        public int PlatformCycledWafer { get; set; }        [Subscription("PlatformCycle.CycleSetPoint")]        public int PlatformCycleSetPoint { get; set; }        public string PlatformCycleCountDisplay        {            get { return (PlatformCycleSetPoint > 0 && (PlatformCycledCount > PlatformCycleSetPoint)) ? $"{PlatformCycledCount + 1}/{PlatformCycleSetPoint}" : $"{PlatformCycledCount}/{PlatformCycleSetPoint}"; }        }        [Subscription("LP1.Thickness")]        public string LP1Thickness        {            get;            set;        }        [Subscription("LP2.Thickness")]        public string LP2Thickness        {            get;            set;        }        [Subscription("LP3.Thickness")]        public string LP3Thickness        {            get;            set;        }        [Subscription("LP4.Thickness")]        public string LP4Thickness        {            get;            set;        }        [Subscription("LP1.LocalJobName")]        public string LP1JobName { get; set; }        [Subscription("LP1.LocalJobStatus")]        public string LP1JobStatus { get; set; }        [Subscription("LP2.LocalJobName")]        public string LP2JobName { get; set; }        [Subscription("LP2.LocalJobStatus")]        public string LP2JobStatus { get; set; }        [Subscription("LP3.LocalJobName")]        public string LP3JobName { get; set; }        [Subscription("LP3.LocalJobStatus")]        public string LP3JobStatus { get; set; }        [Subscription("LP4.LocalJobName")]        public string LP4JobName { get; set; }        [Subscription("LP4.LocalJobStatus")]        public string LP4JobStatus { get; set; }        //Queued,Selected,WaitingForStart,Executing,Paused,Completed,        public bool IsLP1JobExecuting        {            get { return LP1JobStatus == "Executing"; }        }        public bool IsLP1JobPaused        {            get { return LP1JobStatus == "Paused"; }        }        public bool IsLP1JobExist        {            get { return !string.IsNullOrEmpty(LP1JobStatus); }        }        public bool IsLP2JobExecuting        {            get { return LP2JobStatus == "Executing"; }        }        public bool IsLP2JobPaused        {            get { return LP2JobStatus == "Paused"; }        }        public bool IsLP2JobExist        {            get { return !string.IsNullOrEmpty(LP2JobStatus); }        }        public bool IsLP3JobExecuting        {            get { return LP3JobStatus == "Executing"; }        }        public bool IsLP3JobPaused        {            get { return LP3JobStatus == "Paused"; }        }        public bool IsLP3JobExist        {            get { return !string.IsNullOrEmpty(LP3JobStatus); }        }        public bool IsLP4JobExecuting        {            get { return LP4JobStatus == "Executing"; }        }        public bool IsLP4JobPaused        {            get { return LP4JobStatus == "Paused"; }        }        public bool IsLP4JobExist        {            get { return !string.IsNullOrEmpty(LP4JobStatus); }        }        #endregion        #region Button Logic        [Subscription("LP1.IsAutoDetectCarrierType")]        public bool LP1IsAutoDetectCarrierType { get; set; }        [Subscription("LP2.IsAutoDetectCarrierType")]        public bool LP2IsAutoDetectCarrierType { get; set; }         [Subscription("LP1.ValidCarrierTypeList")]        public Tuple<int, string>[] LP1ValidCarrierTypeList { get; set; }        [Subscription("LP2.ValidCarrierTypeList")]        public Tuple<int, string>[] LP2ValidCarrierTypeList { get; set; }         public bool IsShowLP1CarrierType        {            get            { return !LP1IsAutoDetectCarrierType; }        }        public bool IsShowLP2CarrierType        {            get            { return !LP2IsAutoDetectCarrierType; }        }          public bool IsEnableJobLP1        {            get { return IsAuto && LP1CassetteState == LoadportCassetteState.Normal; }        }        public bool IsEnableReadIdLP1        {            get { return LP1CassetteState == LoadportCassetteState.Normal && !IsLP1JobExecuting && !IsLP1JobPaused; }        }        public bool IsEnableLoadLP1        {            get { return LP1CassetteState == LoadportCassetteState.Normal && !IsLP1JobExecuting && !IsLP1JobPaused; }        }        public bool IsEnableUnloadLP1        {            get { return LP1CassetteState == LoadportCassetteState.Normal && !IsLP1JobExecuting && !IsLP1JobPaused; }        }        public bool IsEnableJobLP2        {            get { return IsAuto && LP2CassetteState == LoadportCassetteState.Normal; }        }        public bool IsEnableReadIdLP2        {            get { return LP2CassetteState == LoadportCassetteState.Normal && !IsLP2JobExecuting && !IsLP2JobPaused; }        }        public bool IsEnableLoadLP2        {            get { return LP2CassetteState == LoadportCassetteState.Normal && !IsLP2JobExecuting && !IsLP2JobPaused; }        }        public bool IsEnableUnloadLP2        {            get { return LP2CassetteState == LoadportCassetteState.Normal && !IsLP2JobExecuting && !IsLP2JobPaused; }        }        public bool IsEnableJobLP3        {            get { return IsAuto && LP3CassetteState == LoadportCassetteState.Normal; }        }        public bool IsEnableReadIdLP3        {            get { return LP3CassetteState == LoadportCassetteState.Normal && !IsLP3JobExecuting && !IsLP3JobPaused; }        }        public bool IsEnableLoadLP3        {            get { return LP3CassetteState == LoadportCassetteState.Normal && !IsLP3JobExecuting && !IsLP3JobPaused; }        }        public bool IsEnableUnloadLP3        {            get { return LP3CassetteState == LoadportCassetteState.Normal && !IsLP3JobExecuting && !IsLP3JobPaused; }        }        public bool IsEnableJobLP4        {            get { return IsAuto && LP4CassetteState == LoadportCassetteState.Normal; }        }        public bool IsEnableReadIdLP4        {            get { return LP4CassetteState == LoadportCassetteState.Normal && !IsLP4JobExecuting && !IsLP4JobPaused; }        }        public bool IsEnableLoadLP4        {            get { return LP4CassetteState == LoadportCassetteState.Normal && !IsLP4JobExecuting && !IsLP4JobPaused; }        }        public bool IsEnableUnloadLP4        {            get { return LP4CassetteState == LoadportCassetteState.Normal && !IsLP4JobExecuting && !IsLP4JobPaused; }        }        public bool IsEnableAbort        {            get            {                if (IsAuto)                    return IsLP1JobExist || IsLP2JobExist || IsLP3JobExist;                return IsRtRunning && !IsRtError;            }        }        public bool IsEnableAuto        {            get { return !IsAuto && IsRtInitialized && !IsRtError; }        }        public bool IsEnableManual        {            get { return IsAuto && IsRtInitialized && !IsLP1JobExist && !IsLP2JobExist && !IsLP3JobExist && !IsRtError; }        }        public bool IsEnableInitialize        {            get { return !IsAuto && !IsRtRunning && !IsRtError; }        }        public bool IsEnableReturnWafer        {            get { return !IsAuto && !IsRtRunning && IsRtInitialized && !IsRtError; }        }        public Visibility ThicknessVisibility        {            get;            set;        }        #endregion        #endregion        public EmptyViewModel()        {            this.DisplayName = "EmptyViewModel";            //ActiveUpdateData = true;        }        //[IgnorePropertyChange]        //public string LP1CarrierIDSetPoint { get; set; }        [IgnorePropertyChange]        public string LP2CarrierIDSetPoint { get; set; }        protected override void OnInitialize()        {            base.OnInitialize();            base.InitFOUP();            base.InitLL();            base.InitTM();            base.InitEFEM();            base.InitPM();            base.InitBuffer();        }        private void LP2SetCarrierID(string obj)        {            InvokeClient.Instance.Service.DoOperation($"LP2.ManualSetCarrierID", new object[] { obj });        }        public ICommand LP1SetCarrierIDCommand { get; set; }        public ICommand LP2SetCarrierIDCommand { get; set; }        public ICommand SetTransCarrierTypeCommand { get; set; }        protected override void OnActivate()        {            base.OnActivate();            _isCycleMode = (bool)QueryDataClient.Instance.Service.GetConfig("System.IsCycleMode");         }        public void Start()        {            InvokeClient.Instance.Service.DoOperation("System.StartAutoRun");        }        public void Stop()        {            //InvokeClient.Instance.Service.DoOperation("System.StartAutoRun");        }        public void ReturnAllWafer()        {            InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer");        }        public void PlatformCycle()        {            InvokeClient.Instance.Service.DoOperation("System.PlatformCycle");        }        public void StopPlatformCycle()        {            InvokeClient.Instance.Service.DoOperation("System.StopPlatformCycle");        }        public void QuickStartProcess()        {            InvokeClient.Instance.Service.DoOperation("System.QuickStartProcss", null);        }        public void PP_Select()        {            SequenceDialogViewModel dialog = new SequenceDialogViewModel();            dialog.DisplayName = "Select Sequence";            dialog.Files = new ObservableCollection<FileNode>(RecipeSequenceTreeBuilder.GetFiles("",                RecipeClient.Instance.Service.GetSequenceNameList()            ));            WindowManager wm = new WindowManager();            bool? bret = wm.ShowDialog(dialog);            if ((bool)bret)            {                InvokeClient.Instance.Service.DoOperation("System.SelectSequence",new object[] { dialog.DialogResult });                            }        }        protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)        {            if (LP1WaferAssociation == null)            {                LP1WaferAssociation = new WaferAssociationInfo();                LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];            }            if (LP2WaferAssociation == null)            {                LP2WaferAssociation = new WaferAssociationInfo();                LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];            }            if (LP1WaferAssociation.ModuleData == null || LP2WaferAssociation.ModuleData == null) return;             LP1WaferAssociation.JobID = LP1JobName;            LP1WaferAssociation.JobStatus = LP1JobStatus;            LP2WaferAssociation.JobID = LP2JobName;            LP2WaferAssociation.JobStatus = LP2JobStatus;             if (LP1CassetteState != LoadportCassetteState.Normal)            {                foreach (var wafer in LP1WaferAssociation.ModuleData.WaferManager.Wafers)                {                    wafer.SequenceName = "";                }            }            if (LP2CassetteState != LoadportCassetteState.Normal)            {                foreach (var wafer in LP2WaferAssociation.ModuleData.WaferManager.Wafers)                {                    wafer.SequenceName = "";                }            }              //Trace.WriteLine($" RobotMoveInfo, action:{TmRobotMoveInfo.Action}  armTarget:{TmRobotMoveInfo.ArmTarget} bladeTarget:{TmRobotMoveInfo.BladeTarget}");        }        #region LP Operation        private string GetWaferSize(string size)        {            switch (size)            {                case "WS4": return "4'";                case "WS6": return "6'";                default: return "";            }        }        public void SetLP1CarrierID(string carrierID)        {            InvokeClient.Instance.Service.DoOperation($"LP1.LoadportLoad",new object[] { carrierID});        }        public void SetLP2CarrierID(string carrierID)        {            InvokeClient.Instance.Service.DoOperation($"LP2.LoadportLoad", new object[] { carrierID });        }        public void LoadLP(string moduleID)        {            InvokeClient.Instance.Service.DoOperation($"{moduleID}.LoadportLoad");        }        public void ReadCarrierId(string moduleID)        {            InvokeClient.Instance.Service.DoOperation($"{moduleID}.ReadCarrierID");        }        public void UnloadLP(string moduleID)        {            InvokeClient.Instance.Service.DoOperation($"{moduleID}.LoadportUnload");        }        public void SetThickness(string moduleID, string thickness)        {            InvokeClient.Instance.Service.DoOperation($"{moduleID}.SetThickness", thickness);        }        public void Map(string module)        {            InvokeClient.Instance.Service.DoOperation($"System.MapWafer", module);        }        public void HomeAll()        {            InvokeClient.Instance.Service.DoOperation("System.HomeAll");            //InvokeClient.Instance.Service.DoOperation("PM1.Handshake.SetHandshakeCommand", "HMI.InitializeCommand", true);            //InvokeClient.Instance.Service.DoOperation("PM2.Handshake.SetHandshakeCommand", "HMI.InitializeCommand", true);            //InvokeClient.Instance.Service.DoOperation("PM3.Handshake.SetHandshakeCommand", "HMI.InitializeCommand", true);        }        public void Abort()        {            InvokeClient.Instance.Service.DoOperation("System.Abort");        }        public void Auto()        {            InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");        }        public void Pause()        {            InvokeClient.Instance.Service.DoOperation("System.PauseJob");        }        public void Resume()        {            InvokeClient.Instance.Service.DoOperation("System.ResumeJob");        }        public void Manual()        {            InvokeClient.Instance.Service.DoOperation("System.SetManualMode");        }        public void Buffer1Move()        {            InvokeClient.Instance.Service.DoOperation("Buffer1.Move");        }        public void Buffer2To200()        {            InvokeClient.Instance.Service.DoOperation("Buffer2.MoveTo200");        }        public void Buffer2To300()        {            InvokeClient.Instance.Service.DoOperation("Buffer2.MoveTo300");        }        public void Buffer2Home()        {            InvokeClient.Instance.Service.DoOperation("Buffer2.Home");        }        public void Buffer2PickDone()        {            InvokeClient.Instance.Service.DoOperation("Buffer2.PickDone");        }        public void AlignerMoveTo200()        {            InvokeClient.Instance.Service.DoOperation($"Aligner.SetWaferSize", new object[] { "Lower", "WS8" });        }        public void AlignerMoveTo300()        {            InvokeClient.Instance.Service.DoOperation($"Aligner.SetWaferSize", new object[] { "Lower", "WS12" });        }        #endregion        #region Wafer association        #region Sequence operation        public void SelectSequence(WaferAssociationInfo info)        {            SequenceDialogViewModel dialog = new SequenceDialogViewModel();            dialog.DisplayName = "Select Sequence";            dialog.Files = new ObservableCollection<FileNode>(RecipeSequenceTreeBuilder.GetFiles("",                RecipeClient.Instance.Service.GetSequenceNameList()            ));            WindowManager wm = new WindowManager();            bool? bret = wm.ShowDialog(dialog);            if ((bool)bret)            {                info.SequenceName = dialog.DialogResult;            }        }        public void SetSlot(WaferAssociationInfo info)        {            if (InputSlotCheck(info.SlotFrom, info.SlotTo))                AssociateSequence(info, true);        }        public void SkipSlot(WaferAssociationInfo info)        {            if (InputSlotCheck(info.SlotFrom, info.SlotTo))                AssociateSequence(info, false);        }        public void SetAll(WaferAssociationInfo info)        {            info.SlotFrom = 1;            info.SlotTo = 25;            AssociateSequence(info, true);        }        public void DeselectAll(WaferAssociationInfo info)        {            info.SlotFrom = 1;            info.SlotTo = 25;            AssociateSequence(info, false);        }        public void SetSequence(WaferAssociationInfo info, int slotIndex, string seqName)        {            bool flag = string.IsNullOrEmpty(seqName);            AssociateSequence(info, flag, slotIndex - 1);        }        private bool InputSlotCheck(int from, int to)        {            if (from > to)            {                DialogBox.ShowInfo("This index of from slot should be large than the index of to slot.");                return false;            }            if (from < 1 || to > 25)            {                DialogBox.ShowInfo("This input value for from should be between 1 and 25.");                return false;            }            return true;        }        private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)        {            ObservableCollection<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;            if (slot >= 0) //by wafer            {                int index = wafers.Count - slot - 1;                if (index < wafers.Count)                {                    if (flag && HasWaferOnSlot(wafers.ToList(), index))                        wafers[index].SequenceName = info.SequenceName;                    else                        wafers[index].SequenceName = string.Empty;                }            }            else //by from-to            {                for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)                {                    int index = wafers.Count - i - 1;                    if (index < wafers.Count)                    {                        if (flag && HasWaferOnSlot(wafers.ToList(), index))                            wafers[index].SequenceName = info.SequenceName;                        else                            wafers[index].SequenceName = string.Empty;                    }                }            }        }        private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)        {            if (wafers[index].WaferStatus == 0)                return false;            return true;        }        #endregion        #region Job operation        private bool JobCheck(string jobID)        {            if (jobID.Length == 0)            {                DialogBox.ShowWarning("Please create job first.");                return false;            }            else                return true;        }        public void CreateJob(WaferAssociationInfo info)        {            List<string> slotSequence = new List<string>();            foreach (var wafer in info.ModuleData.WaferManager.Wafers)            {                slotSequence.Insert(0, wafer.SequenceName);            }            string jobId = info.LotId.Trim();            if (string.IsNullOrEmpty(jobId))                jobId = "CJ_Local_" + info.ModuleData.ModuleID;            //info.LotId = "test";            info.LotIdSaved = true;            //WaferAssociationProvider.Instance.CreateJob(jobId, info.ModuleData.ModuleID, slotSequence, true);        }        public void AbortJob(string jobID)        {            if (JobCheck(jobID))                WaferAssociationProvider.Instance.AbortJob(jobID);        }        public void Start(string jobID)        {            if (JobCheck(jobID))                WaferAssociationProvider.Instance.Start(jobID);        }        public void Pause(string jobID)        {            if (JobCheck(jobID))                WaferAssociationProvider.Instance.Pause(jobID);        }        public void Resume(string jobID)        {            if (JobCheck(jobID))                WaferAssociationProvider.Instance.Resume(jobID);        }        public void Stop(string jobID)        {            if (JobCheck(jobID))                WaferAssociationProvider.Instance.Stop(jobID);        }        public void StartDispatchMode()        {            InvokeClient.Instance.Service.DoOperation("System.StartDispatchMode");        }        #endregion        #endregion    }}
 |