123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Device.Unit;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.Fsm;
- using Aitex.Core.RT.OperationCenter;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.Util;
- using Aitex.Core.Utilities;
- using Aitex.Sorter.Common;
- using FurnaceRT.Equipments.PMs;
- using FurnaceRT.Equipments.Systems;
- using MECF.Framework.Common.Alarms;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.Event;
- using MECF.Framework.Common.Schedulers;
- using MECF.Framework.Common.SubstrateTrackings;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
- namespace FurnaceRT.Equipments.Stockers
- {
- public partial class StockerModule
- {
- #region fields
- private IoSensor _diStationCassettePresent;
- private IoTrigger _foupPurge;
- private int _alarmNumber;
- #endregion
- private List<AlarmEventItem> _triggeredAlarmList = new List<AlarmEventItem>();
- public void InitDevice()
- {
- _diStationCassettePresent = DEVICE.GetDevice<IoSensor>($"PM1.Sensor{Module}");
- _foupPurge = DEVICE.GetDevice<IoTrigger>($"PM1.TrigStockerPurge{Module}");
- this.OnDeviceAlarmStateChanged += OnModuleDeviceAlarmStateChanged;
- }
- public CarrierInfo CurrentCarrier
- {
- get
- {
- return CarrierManager.Instance.GetCarrier(Module);
- }
- }
- public string WaferType { get; set; }
- public void OnModuleDeviceAlarmStateChanged(string deviceId, AlarmEventItem alarmItem)
- {
- if (alarmItem.IsTriggered)
- {
- EventLevel level = alarmItem.Level;
- _triggeredAlarmList.Add(alarmItem);
- if (level == EventLevel.Alarm)
- {
- try
- {
- EV.PostAlarmLog(Module, alarmItem);
- }
- catch (Exception ex)
- {
- EV.WriteEvent(ex.Message.ToString());
- }
- }
- else
- {
- EV.PostWarningLog(Module, alarmItem);
- }
- }
- else
- {
- }
- }
- private void SetDisplayName()
- {
- if (!SC.ContainsItem($"System.Stocker.{Module}WaferType"))
- return;
- var type = SC.GetStringValue($"System.Stocker.{Module}WaferType");
- if (type.Contains("P"))
- type = "P";
- else if (type.Contains("M"))
- type = "M";
- else if (type.Contains("SD"))
- type = "SD";
- else if (type.Contains("ED"))
- type = "ED";
- int display = 0;
- for(int i = 1; i < 30; i++)
- {
- if (!SC.ContainsItem($"System.Stocker.Stocker{i}WaferType"))
- continue;
- if (SC.GetStringValue($"System.Stocker.Stocker{i}WaferType").Contains(type))
- display++;
- if (Module == $"Stocker{i}")
- break;
- }
- SC.SetItemValue($"System.StockerDisplayName.{Module}", $"{display}");
- }
- public override void Monitor()
- {
- if(_foupPurge != null && _diStationCassettePresent != null &&
- _foupPurge.Value != _diStationCassettePresent.Value)
- {
- _foupPurge.SetTrigger(_diStationCassettePresent.Value, out _);
- }
-
-
- if (ModuleHelper.IsStocker(ModuleHelper.Converter(Module)))
- {
- var stockerFoupInfo = CarrierManager.Instance.GetCarrier(Module);
- var setValue = IsFoupPresent;
- if (IsFoupPresent && stockerFoupInfo.CarrierType == CarrierType.None)
- {
- setValue = false;
- }
- SetVisibility(stockerFoupInfo, setValue);
- var pmModule = Singleton<EquipmentManager>.Instance.Modules[ModuleName.PM1] as PMModule;
- stockerFoupInfo.UICarrierColor = pmModule.GetCarrierUIColor(stockerFoupInfo.UICarrierType, stockerFoupInfo.UICarrierStatusEnum);
- }
- }
- private string GetStockerNo()
- {
- var stockerNo = Module.Replace("Stocker", "");
- if (int.Parse(stockerNo) < 10)
- {
- return $"0{stockerNo}";
- }
- else
- {
- return stockerNo;
- }
- }
- public void SetVisibility(CarrierInfo stockerCarrierInfo, bool setValue)
- {
- stockerCarrierInfo.UICarrierStatusVisibility = true;
- stockerCarrierInfo.UICarrierTypeVisibility = true;
- stockerCarrierInfo.UICarrierWaferCountVisibility = true;
- stockerCarrierInfo.UICarrierColorVisibility = true;
- stockerCarrierInfo.UIStockerExitFoup = false;
- stockerCarrierInfo.UIExitFoup = true;
- if (!setValue)
- {
- #region 判断是否在CarrierRobot上
- bool isExistCarrierRobot = false;
- if (SC.GetValue<bool>("System.IsSimulatorMode"))
- {
- var hasFoupSensor = !CarrierManager.Instance.CheckNoCarrier(ModuleName.CarrierRobot, 0);
- var carrierRobotFoupInfo = CarrierManager.Instance.GetCarrier(ModuleName.CarrierRobot);
- if (hasFoupSensor && carrierRobotFoupInfo != null && carrierRobotFoupInfo.InternalModuleName == ModuleHelper.Converter(Module))
- {
- isExistCarrierRobot = true;
- stockerCarrierInfo.UIStockerExitFoup = false;
- stockerCarrierInfo.UICarrierType = carrierRobotFoupInfo.CarrierType.ToString();
- stockerCarrierInfo.UICarrierStatusEnum = carrierRobotFoupInfo.UICarrierStatusEnum;
- stockerCarrierInfo.UICarrierColorVisibility = false;
- }
- }
- else
- {
- var carrierRobotDevice = DEVICE.GetDevice<RobotBaseDevice>($"{ModuleName.CarrierRobot}");
- var hasFoupSensor = carrierRobotDevice.IsWaferPresenceOnBlade1 || !CarrierManager.Instance.CheckNoCarrier(ModuleName.CarrierRobot, 0);
- var carrierRobotFoupInfo = CarrierManager.Instance.GetCarrier(ModuleName.CarrierRobot);
- if (hasFoupSensor && carrierRobotFoupInfo != null && carrierRobotFoupInfo.InternalModuleName == ModuleHelper.Converter(Module))
- {
- isExistCarrierRobot = true;
- stockerCarrierInfo.UIStockerExitFoup = false;
- stockerCarrierInfo.UICarrierStatusEnum = carrierRobotFoupInfo.UICarrierStatusEnum;
- stockerCarrierInfo.UICarrierType = carrierRobotFoupInfo.CarrierType.ToString();
- stockerCarrierInfo.UICarrierColorVisibility = false;
- }
- }
- #endregion
- #region 判断是否在FIMS上
- bool isExistFIMS1 = false;
- var fims1FoupInfo = CarrierManager.Instance.GetCarrier(ModuleName.FIMS1);
- if (fims1FoupInfo != null && !fims1FoupInfo.IsEmpty && fims1FoupInfo.InternalModuleName == ModuleHelper.Converter(Module))
- {
- isExistFIMS1 = true;
- stockerCarrierInfo.UIStockerExitFoup = false;
- stockerCarrierInfo.UICarrierStatusEnum = fims1FoupInfo.UICarrierStatusEnum;
- stockerCarrierInfo.UICarrierType = fims1FoupInfo.CarrierType.ToString();
- stockerCarrierInfo.UICarrierColorVisibility = false;
- }
- bool isExistFIMS2 = false;
- var fims2FoupInfo = CarrierManager.Instance.GetCarrier(ModuleName.FIMS2);
- if (fims2FoupInfo != null && !fims2FoupInfo.IsEmpty && fims2FoupInfo.InternalModuleName == ModuleHelper.Converter(Module))
- {
- isExistFIMS1 = true;
- stockerCarrierInfo.UIStockerExitFoup = false;
- stockerCarrierInfo.UICarrierStatusEnum = fims2FoupInfo.UICarrierStatusEnum;
- stockerCarrierInfo.UICarrierType = fims2FoupInfo.UICarrierType;
- stockerCarrierInfo.UICarrierColorVisibility = false;
- }
- #endregion
- #region 判断是否在LP上
- bool isExistLP = false;
- for (int i = 1; i < 5; i++)
- {
- var lpName = $"LP{i}";
- var lpFoupInfo = CarrierManager.Instance.GetCarrier(lpName);
- if (lpFoupInfo != null && !lpFoupInfo.IsEmpty && lpFoupInfo.InternalModuleName == ModuleHelper.Converter(Module))
- {
- isExistLP = true;
- stockerCarrierInfo.UIStockerExitFoup = false;
- stockerCarrierInfo.UIExitFoup = true;
- stockerCarrierInfo.UICarrierStatusEnum = lpFoupInfo.UICarrierStatusEnum;
- stockerCarrierInfo.UICarrierType = lpFoupInfo.UICarrierType;
- stockerCarrierInfo.UICarrierColorVisibility = false;
- }
- }
- #endregion
- #region 判断属于自己的foup是否放到了别的stocker上
- var isExisStocker = false;
- var stockerCount = SC.GetValue<int>("System.Stocker.StockerCount");
- for (int i = 1; i < stockerCount; i++)
- {
- var stockerName = $"Stocker{i}";
- var checkStockerFoupInfo = CarrierManager.Instance.GetCarrier(stockerName);
- if (Module == stockerName)
- {
- continue;
- }
- if (checkStockerFoupInfo != null && !checkStockerFoupInfo.IsEmpty && checkStockerFoupInfo.InternalModuleName == ModuleHelper.Converter(Module))
- {
- isExisStocker = true;
- }
- }
- #endregion
- if (!isExistCarrierRobot && !isExistFIMS1 && !isExistFIMS2 && !isExistLP)
- {
- stockerCarrierInfo.UIStockerExitFoup = true;
- stockerCarrierInfo.UIExitFoup = false;
- stockerCarrierInfo.UICarrierWaferCount = $"{SC.GetValue<int>("System.CassetteSlotCount")}";
- var stockerSCTypePath = $"System.Stocker.{Module}WaferType";
- if (SC.ContainsItem(stockerSCTypePath))
- {
- stockerCarrierInfo.UICarrierType = SC.ContainsItem(stockerSCTypePath) ? $"{SC.GetStringValue(stockerSCTypePath)} {GetStockerNo()}" : "";
- }
- }
- }
- else
- {
- stockerCarrierInfo.UICarrierType = stockerCarrierInfo.CarrierType.ToString();
- stockerCarrierInfo.UICarrierStatusEnum = CarrierStatus.READY;
- stockerCarrierInfo.UIStockerExitFoup = false;
- Singleton<EquipmentManager>.Instance.SetUIWaferCount(stockerCarrierInfo, ModuleHelper.Converter(Module), out var wafers);
- }
- }
- }
- }
|