| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 | using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using Aitex.Core.RT.Event;using Aitex.Core.RT.SCCore;using Aitex.Core.Util;using MECF.Framework.Common.Equipment;using MECF.Framework.Common.Jobs;using FurnaceRT.FAs;namespace FurnaceRT.Equipments.Schedulers{    public class SchedulerFACallback : ISchedulerFACallback    {        private Dictionary<ModuleName, string> PortJobStarted;        private Dictionary<ModuleName, string> PortJobStopped;        private Dictionary<ModuleName, string> PortJobPaused;        private Dictionary<ModuleName, string> PortJobResumed;        private Dictionary<ModuleName, string> PortJobAborted;        private Dictionary<ModuleName, string> PortJobFinished;        private Dictionary<ModuleName, string> PortJobFailed;        private Dictionary<ModuleName, string> PortSequenceSelected;        private Dictionary<ModuleName, string> PortSequenceSelectFailed;        private Dictionary<ModuleName, string> PortId;        public SchedulerFACallback()        {            PortJobStarted = new Dictionary<ModuleName, string>();            PortJobStopped = new Dictionary<ModuleName, string>();            PortJobPaused = new Dictionary<ModuleName, string>();            PortJobResumed = new Dictionary<ModuleName, string>();            PortJobAborted = new Dictionary<ModuleName, string>();            PortJobFinished = new Dictionary<ModuleName, string>();            PortJobFailed = new Dictionary<ModuleName, string>();            PortSequenceSelected = new Dictionary<ModuleName, string>();            PortSequenceSelectFailed = new Dictionary<ModuleName, string>();            PortId = new Dictionary<ModuleName, string>();            for (int i = 1; i < 30; i++)            {                if (!SC.ContainsItem($"System.Stocker.Stocker{i}WaferType"))                    continue;                var module = ModuleHelper.Converter($"Stocker{i}");                EV.Subscribe(new EventItem("Event", $"{module}JobStarted", $"{module}JobStarted"));                EV.Subscribe(new EventItem("Event", $"{module}JobStopped", $"{module}JobStopped"));                EV.Subscribe(new EventItem("Event", $"{module}JobPaused", $"{module}JobPaused"));                EV.Subscribe(new EventItem("Event", $"{module}JobResumed", $"{module}JobResumed"));                EV.Subscribe(new EventItem("Event", $"{module}JobAborted", $"{module}JobAborted"));                EV.Subscribe(new EventItem("Event", $"{module}JobFinished", $"{module}JobFinished"));                EV.Subscribe(new EventItem("Event", $"{module}JobFailed", $"{module}JobFailed"));                EV.Subscribe(new EventItem("Event", $"{module}SequenceSelected", $"{module}SequenceSelected"));                EV.Subscribe(new EventItem("Event", $"{module}SequenceSelectFailed", $"{module}SequenceSelectFailed"));                PortId[module] = i.ToString();                PortJobStarted[module] = $"{module}JobStarted";                PortJobStopped[module] = $"{module}JobStopped";                PortJobPaused[module] = $"{module}JobPaused";                PortJobResumed[module] = $"{module}JobResumed";                PortJobAborted[module] = $"{module}JobAborted";                PortJobFinished[module] = $"{module}JobFinished";                PortJobFailed[module] = $"{module}JobFailed";                PortSequenceSelected[module] = $"{module}SequenceSelected";                PortSequenceSelectFailed[module] = $"{module}SequenceSelectFailed";            }        }        public void JobCreated(ControlJobInfo cj, ProcessJobInfo pj)        {            foreach(var s in pj.Stockers)            {                var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");                if(!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))                {                    ModuleName module = ModuleHelper.Converter(s.Item1);                    EV.Notify(PortSequenceSelected[module], new SerializableDictionary<string, string>()                    {                        {DVIDName.LotID,  cj.LotName},                        {DVIDName.JobID,  pj.ControlJobName},                        {DVIDName.PortID, PortId[module] },                        {DVIDName.SequenceID, pj.JobRecipe }                    });                }            }        }        public void JobCreateFailed(string module, string lotID, string jobID, string sequenceID)        {            ModuleName moduleName = ModuleHelper.Converter(module);            EV.Notify(PortSequenceSelectFailed[moduleName], new SerializableDictionary<string, string>()            {                {DVIDName.LotID,  lotID},                {DVIDName.JobID,  jobID},                {DVIDName.PortID, PortId[moduleName] },                {DVIDName.SequenceID, sequenceID }            });        }        public void JobStarted(ControlJobInfo cj, ProcessJobInfo pj)        {            foreach (var s in pj.Stockers)            {                var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");                if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))                {                    ModuleName module = ModuleHelper.Converter(s.Item1);                    EV.Notify(PortJobStarted[module], new SerializableDictionary<string, string>()                    {                        {DVIDName.LotID,  cj.LotName},                        {DVIDName.JobID,  pj.ControlJobName},                        {DVIDName.PortID, PortId[module] },                        {DVIDName.SequenceID, pj.JobRecipe }                    });                }            }        }        public void JobStopped(ControlJobInfo cj, ProcessJobInfo pj)        {            foreach (var s in pj.Stockers)            {                var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");                if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))                {                    ModuleName module = ModuleHelper.Converter(s.Item1);                    EV.Notify(PortJobStopped[module], new SerializableDictionary<string, string>()                    {                        {DVIDName.LotID,  cj.LotName},                        {DVIDName.JobID,  pj.ControlJobName},                        {DVIDName.PortID, PortId[module] },                        {DVIDName.SequenceID, pj.JobRecipe }                    });                }            }        }        public void JobPaused(ControlJobInfo cj, ProcessJobInfo pj)        {            foreach (var s in pj.Stockers)            {                var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");                if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))                {                    ModuleName module = ModuleHelper.Converter(s.Item1);                    EV.Notify(PortJobPaused[module], new SerializableDictionary<string, string>()                    {                        {DVIDName.LotID,  cj.LotName},                        {DVIDName.JobID,  pj.ControlJobName},                        {DVIDName.PortID, PortId[module] },                        {DVIDName.SequenceID, pj.JobRecipe }                    });                }            }        }        public void JobResumed(ControlJobInfo cj, ProcessJobInfo pj)        {            foreach (var s in pj.Stockers)            {                var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");                if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))                {                    ModuleName module = ModuleHelper.Converter(s.Item1);                    EV.Notify(PortJobResumed[module], new SerializableDictionary<string, string>()                    {                        {DVIDName.LotID,  cj.LotName},                        {DVIDName.JobID,  pj.ControlJobName},                        {DVIDName.PortID, PortId[module] },                        {DVIDName.SequenceID, pj.JobRecipe }                    });                }            }        }        public void JobAborted(ControlJobInfo cj, ProcessJobInfo pj)        {            foreach (var s in pj.Stockers)            {                var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");                if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))                {                    ModuleName module = ModuleHelper.Converter(s.Item1);                    EV.Notify(PortJobAborted[module], new SerializableDictionary<string, string>()                    {                        {DVIDName.LotID,  cj.LotName},                        {DVIDName.JobID,  pj.ControlJobName},                        {DVIDName.PortID, PortId[module] },                        {DVIDName.SequenceID, pj.JobRecipe }                    });                }            }        }        public void JobFinished(ControlJobInfo cj, ProcessJobInfo pj)        {            foreach (var s in pj.Stockers)            {                var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");                if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))                {                    ModuleName module = ModuleHelper.Converter(s.Item1);                    EV.Notify(PortJobFinished[module], new SerializableDictionary<string, string>()                    {                        {DVIDName.LotID,  cj.LotName},                        {DVIDName.JobID,  pj.ControlJobName},                        {DVIDName.PortID, PortId[module] },                        {DVIDName.SequenceID, pj.JobRecipe }                    });                }            }        }        public void JobFailed(ControlJobInfo cj, ProcessJobInfo pj)        {            foreach (var s in pj.Stockers)            {                var type = SC.GetStringValue($"System.Stocker.{s.Item1}WaferType");                if (!string.IsNullOrEmpty(type) && (type.Contains("P") || type.Contains("M")))                {                    ModuleName module = ModuleHelper.Converter(s.Item1);                    EV.Notify(PortJobFailed[module], new SerializableDictionary<string, string>()                    {                        {DVIDName.LotID,  cj.LotName},                        {DVIDName.JobID,  pj.ControlJobName},                        {DVIDName.PortID, PortId[module] },                        {DVIDName.SequenceID, pj.JobRecipe }                    });                }            }        }    }}
 |