Пример #1
0
        public void AssignAssets(BatteryClass Battery, ChamberClass Chamber, TesterChannelClass TesterChannel)
        {
            //Check if the assets is in use or not first
            if (WaitingList.Count == 0) //Prompt warning
            {
                System.Windows.MessageBox.Show("No waiting tasks to assign assets to!");
                return;
            }
            RequestedSubProgramClass RequestedSubProgram = TopWaitingRequestedSubProgram;
            ExecutorClass            validExecutor       = TopWaitingRequestedSubProgram.TopWaitingRequestedRecipe.ValidExecutor;

            validExecutor.AssignAssets(Battery, Chamber, TesterChannel);
        }
Пример #2
0
 public RequestedRecipeClass(RequestedSubProgramClass RequestedSubProgram, RecipeClass Recipe)
 {
     this.RequestedSubProgram = RequestedSubProgram;
     this.Recipe = Recipe;
     //this.Priority = Priority;
     if (Recipe.ChamberRecipe != null)
     {
         this.Priority = Recipe.ChamberRecipe.Priority;
     }
     else
     {
         this.Priority = 0;      //If no chamber recipe, then make it the most priority task
     }
     this.Executors = new List <ExecutorClass>();
     AddExecutor();
 }
Пример #3
0
        private void Executor_StatusChanged(object sender, EventArgs e)
        {
            try
            {
                ExecutorClass            Executor = (ExecutorClass)sender;
                RequestedSubProgramClass root     = Executor.RequestedRecipe.RequestedSubProgram;
                switch (Executor.Status)
                {
                case ExecutorStatus.Ready:
                    WaitingList.Remove(root);
                    ReadyList.Add(root);
                    break;

                case ExecutorStatus.Executing:
                    ReadyList.Remove(root);
                    RunningList.Add(root);
                    break;

                case ExecutorStatus.Completed:
                    RunningList.Remove(root);
                    if (root.RequestedRecipes.Count == 1)
                    {
                        CompletedList.Add(root);
                    }
                    else if (root.RequestedRecipes.Count > 1)
                    {
                        WaitingList.Insert(0, root);
                    }
                    break;

                case ExecutorStatus.Abandoned:
                    if (ReadyList.Contains(root))
                    {
                        ReadyList.Remove(root);
                    }
                    else if (WaitingList.Contains(root))
                    {
                        WaitingList.Remove(root);
                    }
                    else if (RunningList.Contains(root))
                    {
                        RunningList.Remove(root);
                    }
                    else if (CompletedList.Contains(root))
                    {
                        CompletedList.Remove(root);
                    }
                    break;

                case ExecutorStatus.Invalid:
                    Executor.RequestedRecipe.AddExecutor();
                    if (CompletedList.Contains(root))
                    {
                        CompletedList.Remove(root);
                        WaitingList.Insert(0, root);        //back to the top by default
                    }
                    else if (RunningList.Contains(root))
                    {
                        RunningList.Remove(root);
                        WaitingList.Insert(0, root);        //back to the top by default
                    }
                    break;
                }
            }
            catch
            {
                //sender is not a ExecutorClass type
                return;
            }
        }