| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617 | 
							- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using Aitex.Core.RT.Event;
 
- using Aitex.Core.Util;
 
- using MECF.Framework.Common.Equipment;
 
- using MECF.Framework.Common.Jobs;
 
- using FurnaceRT.FAs;
 
- using Aitex.Core.RT.SCCore;
 
- using static MECF.Framework.Common.FAServices.Gem300Events;
 
- using MECF.Framework.Common.FAServices;
 
- using Aitex.Core.Common;
 
- using MECF.Framework.Common.SubstrateTrackings;
 
- using FabConnect.SecsGemInterface.Common;
 
- using Aitex.Core.RT.DataCenter;
 
- using MECF.Framework.FA.Core.FAControl;
 
- using FurnaceRT.Equipments.Systems;
 
- using Aitex.Core.RT.Log;
 
- 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 < 45; 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"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.EquipmentOFFLINE, $"EquipmentOFFLINE"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.HOSTOFFLINE, $"HOSTOFFLINE"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.ControlStateLOCAL, $"ControlStateLOCAL"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.ControlStateREMOTE, $"ControlStateREMOTE"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.ProcessingStarted, $"ProcessingStarted"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.ProcessingCompleted, $"ProcessingCompleted"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.ProcessingStopped, $"ProcessingStopped"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.ProcessingStateChanged, $"ProcessingStateChanged"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.EquipmentConstantChanged, $"EquipmentConstantChanged"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.ProcessProgramChanged, $"ProcessProgramChanged"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.ProcessProgramSelected, $"ProcessProgramSelected"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.ProcessProgramCreated, $"ProcessProgramCreated"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.SpoolingActivated, $"SpoolingActivated"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.SpoolingDeactivated, $"SpoolingDeactivated"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.SpoolingFailed, $"SpoolingFailed"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.SpoolingFailed, $"SpoolingFailed"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.ChargeStart, $"ChargeStart"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.ChargeEnd, $"ChargeEnd"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.DischargeStart, $"DischargeStart"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.DischargeEnd, $"DischargeEnd"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.BatchLocOccupied, $"BatchLocOccupied"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.BatchLocUnOccupied, $"BatchLocUnOccupied"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.CarrierInEnd, $"CarrierInEnd"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.CarrierInStart, $"CarrierInStart"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.CarrierOutStart, $"CarrierOutStart"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.CarrierOutEnd, $"CarrierOutEnd"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.SideDummyStateAlarm, $"SideDummyStateAlarm"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.ExtraDummyStateAlarm, $"ExtraDummyStateAlarm"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.SideDummyStateWarning, $"SideDummyStateWarning"));
 
-                 EV.Subscribe(new EventItem("Event", UniversalEvents.ExtraDummyStateWarning, $"ExtraDummyStateWarning"));
 
-                 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)
 
-         {
 
-             if (cj != null)
 
-             {
 
-                 EV.Notify(Gem300Events.CJ_CREATED, new SerializableDictionary<string, object>()
 
-                 {
 
-                     {DataVariables.CJID,  cj.Name},
 
-                 });
 
-             }
 
-         }
 
-         public void JobCreated(ProcessJobInfo pj)
 
-         {
 
-             if (pj != null)
 
-             {
 
-                 EV.Notify(Gem300Events.PJ_CREATED, new SerializableDictionary<string, object>()
 
-                 {
 
-                     {DataVariables.PRJobID,  pj.Name},
 
-                 });
 
-             }
 
-         }
 
-         public void JobCreateFailed(string module, string lotID, string jobID, string sequenceID)
 
-         {
 
-             ModuleName moduleName = ModuleHelper.Converter(module);
 
-             EV.Notify(PortSequenceSelectFailed[moduleName], new SerializableDictionary<string, object>()
 
-             {
 
-                 {DVIDName.LotID,  lotID},
 
-                 {DVIDName.JobID,  jobID},
 
-                 {DVIDName.PortID, PortId[moduleName] },
 
-                 {DVIDName.SequenceID, sequenceID }
 
-             });
 
-         }
 
-         public void JobStarted(ControlJobInfo cj, ProcessJobInfo pj)
 
-         {
 
-             if (cj != null && pj != null)
 
-             {
 
-                 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, object>()
 
-                     {
 
-                         {DVIDName.LotID,  cj.LotName},
 
-                         {DVIDName.JobID,  pj.ControlJobName},
 
-                         {DVIDName.PortID, PortId[module] },
 
-                         {DVIDName.SequenceID, pj.JobRecipe }
 
-                     });
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         public void JobStopped(ControlJobInfo cj, ProcessJobInfo pj)
 
-         {
 
-             if (cj != null && pj != null)
 
-             {
 
-                 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, object>()
 
-                     {
 
-                         {DVIDName.LotID,  cj.LotName},
 
-                         {DVIDName.JobID,  pj.ControlJobName},
 
-                         {DVIDName.PortID, PortId[module] },
 
-                         {DVIDName.SequenceID, pj.JobRecipe }
 
-                     });
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         public void JobPaused(ControlJobInfo cj, ProcessJobInfo pj)
 
-         {
 
-             if (cj != null && pj != null)
 
-             {
 
-                 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, object>()
 
-                     {
 
-                         {DVIDName.LotID,  cj.LotName},
 
-                         {DVIDName.JobID,  pj.ControlJobName},
 
-                         {DVIDName.PortID, PortId[module] },
 
-                         {DVIDName.SequenceID, pj.JobRecipe }
 
-                     });
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         public void JobResumed(ControlJobInfo cj, ProcessJobInfo pj)
 
-         {
 
-             if (cj != null && pj != null)
 
-             {
 
-                 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, object>()
 
-                     {
 
-                         {DVIDName.LotID,  cj.LotName},
 
-                         {DVIDName.JobID,  pj.ControlJobName},
 
-                         {DVIDName.PortID, PortId[module] },
 
-                         {DVIDName.SequenceID, pj.JobRecipe }
 
-                     });
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         public void JobAborted(ControlJobInfo cj, ProcessJobInfo pj)
 
-         {
 
-             if (cj != null && pj != null)
 
-             {
 
-                 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, object>()
 
-                     {
 
-                         {DVIDName.LotID,  cj.LotName},
 
-                         {DVIDName.JobID,  pj.ControlJobName},
 
-                         {DVIDName.PortID, PortId[module] },
 
-                         {DVIDName.SequenceID, pj.JobRecipe }
 
-                     });
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         public void JobFinished(ControlJobInfo cj, ProcessJobInfo pj)
 
-         {
 
-             if (cj != null && pj != null)
 
-             {
 
-                 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, object>()
 
-                     {
 
-                         {DVIDName.LotID,  cj.LotName},
 
-                         {DVIDName.JobID,  pj.ControlJobName},
 
-                         {DVIDName.PortID, PortId[module] },
 
-                         {DVIDName.SequenceID, pj.JobRecipe }
 
-                     });
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         public void JobFailed(ControlJobInfo cj, ProcessJobInfo pj)
 
-         {
 
-             if (cj != null && pj != null)
 
-             {
 
-                 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, object>()
 
-                     {
 
-                         {DVIDName.LotID,  cj.LotName},
 
-                         {DVIDName.JobID,  pj.ControlJobName},
 
-                         {DVIDName.PortID, PortId[module] },
 
-                         {DVIDName.SequenceID, pj.JobRecipe }
 
-                     });
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         public void StartCharge(ProcessJobInfo pj)
 
-         {
 
-             List<string> crids = CarrierManager.Instance.GetStokerCarrierID();
 
-             SECsDataItem data = new SECsDataItem(SECsFormat.List);
 
-             foreach (var _id in crids)
 
-             {
 
-                 data.Add("CarrierID", _id);
 
-             }
 
-             if (pj != null)
 
-             {
 
-                 EV.Notify(UniversalEvents.ChargeStart, new SerializableDictionary<string, object>()
 
-                 {
 
-                     {DataVariables.PRJobID,  pj.Name},
 
-                     {DataVariables.BatchLocID,  "BatchBuild1"},
 
-                     {DataVariables.BoatID,  "Boat1"},
 
-                     {DataVariables.CarrierIDList,  data},
 
-                 });
 
-             }
 
-         }
 
-         public void EndCharge(ProcessJobInfo pj, List<string> _slotmap)
 
-         {
 
-             List<string> crids = CarrierManager.Instance.GetStokerCarrierID();
 
-             SECsDataItem data = new SECsDataItem(SECsFormat.List);
 
-             foreach (var _id in crids)
 
-             {
 
-                 data.Add("CarrierID", _id);
 
-             }
 
-             if (pj != null)
 
-             {
 
-                 EV.Notify(UniversalEvents.ChargeEnd, new SerializableDictionary<string, object>()
 
-                 {
 
-                     {DataVariables.PRJobID,  pj.Name},
 
-                     {DataVariables.BoatSlotMapList,  _slotmap},
 
-                     {DataVariables.WaferIDList,  _slotmap},
 
-                     {DataVariables.BatchLocID,  "BatchBuild1"},
 
-                     {DataVariables.BoatID,  "Boat1"},
 
-                     {DataVariables.CarrierIDList,  data},
 
-                 });
 
-             }
 
-         }
 
-         public void StartDischarge(ProcessJobInfo pj, List<string> _slotmap)
 
-         {
 
-             List<string> crids = CarrierManager.Instance.GetStokerCarrierID();
 
-             SECsDataItem data = new SECsDataItem(SECsFormat.List);
 
-             foreach (var _id in crids)
 
-             {
 
-                 data.Add("CarrierID", _id);
 
-             }
 
-             if (pj != null)
 
-             {
 
-                 EV.Notify(UniversalEvents.DischargeStart, new SerializableDictionary<string, object>()
 
-                 {
 
-                     {DataVariables.PRJobID,  pj.Name},
 
-                     {DataVariables.BoatSlotMapList,  _slotmap},
 
-                     {DataVariables.WaferIDList,  _slotmap},
 
-                     {DataVariables.BatchLocID,  "BatchBuild1"},
 
-                     {DataVariables.BoatID,  "Boat1"},
 
-                     {DataVariables.CarrierIDList,  data},
 
-                 });
 
-             }
 
-         }
 
-         public void EndDischarge(ProcessJobInfo pj)
 
-         {
 
-             if (pj != null)
 
-             {
 
-                 EV.Notify(UniversalEvents.DischargeEnd, new SerializableDictionary<string, object>()
 
-                 {
 
-                     {DataVariables.PRJobID,  pj.Name},
 
-                 });
 
-             }
 
-         }
 
-         public void CarrierInEnd(CarrierInfo carrier)
 
-         {
 
-             List<string> crids = CarrierManager.Instance.GetBufferMaterialInfo();
 
-             SECsDataItem BufferMaterialInfos = new SECsDataItem(SECsFormat.List);
 
-             SECsDataItem BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
 
-             foreach (var _id in crids)
 
-             {
 
-                 BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
 
-                 BufferMaterialInfo.Add("StockerName", _id.Split(';')[0], SECsFormat.Ascii);
 
-                 BufferMaterialInfo.Add("StockerCarrierID", _id.Split(';')[1].Replace("emptyid", ""), SECsFormat.Ascii);
 
-                 BufferMaterialInfos.Add(BufferMaterialInfo);
 
-             }
 
-             if (carrier != null)
 
-             {
 
-                 EV.Notify(UniversalEvents.CarrierInEnd, new SerializableDictionary<string, object>()
 
-                 {
 
-                     {DataVariables.Usage,  carrier.CarrierType.ToString()},
 
-                     {DataVariables.BufferCapacitiyList,  GetBufferCapacitiyList()},
 
-                     {DataVariables.BufferMaterialInfo,  BufferMaterialInfos},
 
-                     {DataVariables.CarrierID,  carrier.CarrierId},
 
-                 });
 
-             }
 
-         }
 
-         public void CarrierOutEnd(CarrierInfo carrier)
 
-         {
 
-             List<string> crids = CarrierManager.Instance.GetBufferMaterialInfo();
 
-             SECsDataItem BufferMaterialInfos = new SECsDataItem(SECsFormat.List);
 
-             SECsDataItem BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
 
-             foreach (var _id in crids)
 
-             {
 
-                 BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
 
-                 BufferMaterialInfo.Add("StockerName", _id.Split(';')[0], SECsFormat.Ascii);
 
-                 BufferMaterialInfo.Add("StockerCarrierID", _id.Split(';')[1].Replace("emptyid", ""), SECsFormat.Ascii);
 
-                 BufferMaterialInfos.Add(BufferMaterialInfo);
 
-             }
 
-             if (carrier != null)
 
-             {
 
-                 EV.Notify(UniversalEvents.CarrierOutEnd, new SerializableDictionary<string, object>()
 
-                 {
 
-                     {DataVariables.Usage,  carrier.CarrierType.ToString()},
 
-                     {DataVariables.BufferCapacitiyList,  GetBufferCapacitiyList()},
 
-                     {DataVariables.BufferMaterialInfo,  BufferMaterialInfos},
 
-                     {DataVariables.CarrierID,  carrier.CarrierId},
 
-                 });
 
-             }
 
-         }
 
-         public void CarrierInStart(CarrierType carrierType, string _carrierid)
 
-         {
 
-             List<string> crids = CarrierManager.Instance.GetBufferMaterialInfo();
 
-             SECsDataItem BufferMaterialInfos = new SECsDataItem(SECsFormat.List);
 
-             SECsDataItem BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
 
-             foreach (var _id in crids)
 
-             {
 
-                 BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
 
-                 BufferMaterialInfo.Add("StockerName", _id.Split(';')[0], SECsFormat.Ascii);
 
-                 BufferMaterialInfo.Add("StockerCarrierID", _id.Split(';')[1].Replace("emptyid", ""), SECsFormat.Ascii);
 
-                 BufferMaterialInfos.Add(BufferMaterialInfo);
 
-             }
 
-             EV.Notify(UniversalEvents.CarrierInStart, new SerializableDictionary<string, object>()
 
-             {
 
-                 {DataVariables.Usage,  carrierType.ToString()},
 
-                 {DataVariables.CarrierID,  _carrierid},
 
-                 {DataVariables.BufferCapacitiyList,  GetBufferCapacitiyList()},
 
-                 {DataVariables.BufferMaterialInfo,  BufferMaterialInfos},
 
-             });
 
-         }
 
-         public void CarrierOutStart(CarrierInfo carrier)
 
-         {
 
-             List<string> crids = CarrierManager.Instance.GetBufferMaterialInfo();
 
-             SECsDataItem BufferMaterialInfos = new SECsDataItem(SECsFormat.List);
 
-             SECsDataItem BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
 
-             foreach (var _id in crids)
 
-             {
 
-                 BufferMaterialInfo = new SECsDataItem(SECsFormat.List);
 
-                 BufferMaterialInfo.Add("StockerName", _id.Split(';')[0], SECsFormat.Ascii);
 
-                 BufferMaterialInfo.Add("StockerCarrierID", _id.Split(';')[1].Replace("emptyid", ""), SECsFormat.Ascii);
 
-                 BufferMaterialInfos.Add(BufferMaterialInfo);
 
-             }
 
-             if (carrier != null)
 
-             {
 
-                 EV.Notify(UniversalEvents.CarrierOutStart, new SerializableDictionary<string, object>()
 
-                 {
 
-                     {DataVariables.Usage,  carrier.CarrierType.ToString()},
 
-                     {DataVariables.CarrierID,  carrier.CarrierId},
 
-                     {DataVariables.BufferCapacitiyList,  GetBufferCapacitiyList()},
 
-                     {DataVariables.BufferMaterialInfo,  BufferMaterialInfos},
 
-                 });
 
-             }
 
-         }
 
-         public void JobCreated(ControlJobInfo cj, ProcessJobInfo pj)
 
-         {
 
-         }
 
-         public void SideDummyStateAlarm(CarrierInfo carrier)
 
-         {
 
-             EV.Notify(UniversalEvents.SideDummyStateAlarm, new SerializableDictionary<string, object>()
 
-             {
 
-                 {DataVariables.CarrierID,  carrier.CarrierId},
 
-             });
 
-         }
 
-         public void ExtraDummyStateAlarm(CarrierInfo carrier)
 
-         {
 
-             EV.Notify(UniversalEvents.ExtraDummyStateAlarm, new SerializableDictionary<string, object>()
 
-             {
 
-                 {DataVariables.CarrierID,  carrier.CarrierId},
 
-             });
 
-         }
 
-         public void SideDummyStateWarning(CarrierInfo carrier)
 
-         {
 
-             EV.Notify(UniversalEvents.SideDummyStateWarning, new SerializableDictionary<string, object>()
 
-             {
 
-                 {DataVariables.CarrierID,  carrier.CarrierId},
 
-             });
 
-         }
 
-         public void ExtraDummyStateWarning(CarrierInfo carrier)
 
-         {
 
-             EV.Notify(UniversalEvents.ExtraDummyStateWarning, new SerializableDictionary<string, object>()
 
-             {
 
-                 {DataVariables.CarrierID,  carrier.CarrierId},
 
-             });
 
-         }
 
-         public void CarrierInEnd(ModuleName module)
 
-         {
 
-             var carrier = CarrierManager.Instance.GetCarrier(module, 0);
 
-             if (carrier == null || carrier.IsEmpty)
 
-                 return;
 
-             List<int> slotMapList = new List<int>();
 
-             var wafers = WaferManager.Instance.GetWafers(module);
 
-             if (wafers != null)
 
-             {
 
-                 foreach (var wafer in wafers)
 
-                 {
 
-                     switch (wafer.Status)
 
-                     {
 
-                         case WaferStatus.Normal:
 
-                             slotMapList.Add(3);
 
-                             break;
 
-                         case WaferStatus.Empty:
 
-                             slotMapList.Add(1);
 
-                             break;
 
-                         case WaferStatus.Double:
 
-                             slotMapList.Add(2);
 
-                             break;
 
-                         case WaferStatus.Crossed:
 
-                             slotMapList.Add(4);
 
-                             break;
 
-                         case WaferStatus.Unknown:
 
-                             slotMapList.Add(5);
 
-                             break;
 
-                     }
 
-                 }
 
-             }
 
-             SerializableDictionary<string, object> dvid = new SerializableDictionary<string, object>();
 
-             string slotMap = "";
 
-             foreach (var item in slotMapList)
 
-             {
 
-                 slotMap += item;
 
-             }
 
-             dvid["SlotMap"] = slotMap;
 
-             dvid["SlotMapList"] = slotMapList;
 
-             dvid["CarrierType"] = carrier.CarrierType;
 
-             dvid["CarrierID"] = carrier.CarrierId;
 
-             EV.Notify("SLOT_MAP_AVAILABLE", dvid);
 
-             try
 
-             {
 
-                 Singleton<FAJobController>.Instance.Eqp_NoteCarrierSlotMapRead(carrier.PortID, slotMap, carrier.CarrierId);
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 LOG.Info($"Eqp_NoteCarrierSlotMapRead:{ex}");
 
-             }
 
-             CarrierInEnd(carrier);
 
-         }
 
-         public SECsDataItem GetBufferCapacitiyList()
 
-         {
 
-             SECsDataItem bufinfo = new SECsDataItem(SECsFormat.List);
 
-             bufinfo.Add("BUFPara", "Partition1");
 
-             bufinfo.Add("BUFPara", "General");
 
-             int emptyStocker = 0;
 
-             int totalStocker = 0;
 
-             foreach (var key in Singleton<EquipmentManager>.Instance.Modules.Keys)
 
-             {
 
-                 if (ModuleHelper.IsStocker(key))
 
-                     totalStocker++;
 
-                 if (ModuleHelper.IsStocker(key) && CarrierManager.Instance.CheckNoCarrier(key, 0))
 
-                 {
 
-                     var has = false;
 
-                     foreach (var key1 in Singleton<EquipmentManager>.Instance.Modules.Keys)
 
-                     {
 
-                         if (CarrierManager.Instance.CheckHasCarrier(key1, 0) && CarrierManager.Instance.GetCarrier(key1, 0).InternalModuleName == key)
 
-                         {
 
-                             has = true;
 
-                             break;
 
-                         }
 
-                     }
 
-                     if (has)
 
-                         continue;
 
-                     emptyStocker++;
 
-                 }
 
-             }
 
-             bufinfo.Add("BUFPara", emptyStocker, SECsFormat.U1);
 
-             bufinfo.Add("BUFPara", totalStocker, SECsFormat.U1);
 
-             int unallocatedPartitionCapacity = 0;
 
-             List<ModuleName> checkList = new List<ModuleName>()
 
-                 {
 
-                     ModuleName.LP1,
 
-                     ModuleName.LP2,
 
-                     ModuleName.FIMS1,
 
-                     ModuleName.FIMS2,
 
-                 };
 
-             foreach (var module in checkList)
 
-             {
 
-                 if (CarrierManager.Instance.CheckHasCarrier(module, 0))
 
-                     unallocatedPartitionCapacity++;
 
-             }
 
-             bufinfo.Add("BUFPara", unallocatedPartitionCapacity, SECsFormat.U1);
 
-             return bufinfo;
 
-         }
 
-     }
 
- }
 
 
  |