123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- using System;
- using System.Collections.Generic;
- using Aitex.Core.Common;
- using Aitex.Core.RT.Event;
- using Aitex.Core.Util;
- using Aitex.Sorter.Common;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.SubstrateTrackings;
- using Virgo_DCommon;
- using Virgo_DRT.Device;
- using Virgo_DRT.Device.YASKAWA;
- using System.Diagnostics;
- namespace Virgo_DRT.Devices
- {
- /// <summary>
- /// Base action
- /// </summary>
- abstract class EfemActionBase : ActionBase
- {
- protected readonly EfemBase _efem;
- public EfemOperation Type { get; protected set; }
- protected EfemActionBase() : this(null) { }
- protected EfemActionBase(EfemBase efem) : base(ModuleName.EFEM)
- {
- _efem = efem;
- }
- }
- class DelayAction : ActionBase
- {
- private readonly DeviceTimer _timer = new DeviceTimer();
- private readonly ushort _delayTime;
- public bool IsDone => _timer.IsTimeout();
- public DelayAction(ushort delaytime) : base(ModuleName.System)
- {
- this._delayTime = delaytime;
- }
- public override void Execute()
- {
- _timer.Start(this._delayTime * 1000);
- }
- public override void OnPostWork(string data)
- {
- EV.PostInfoLog(ModuleName.EFEM.ToString(), $"Delay time [{_delayTime}]");
- }
- }
- }
- namespace Virgo_DRT.Devices.YASKAWA
- {
- class EfemAction : EfemActionBase
- {
- public EfemAction(EfemBase device, ModuleName mod) : base(device)
- { }
- public override void Execute()
- {
- _efem.MsgHandler.Send(new EfemMessage
- {
- Operation = this.Type,
- Head = EfemMessage.MsgHead.MOV,
- Parameters = new List<string> { Constant.ModuleString[this.Module] }
- });
- base.Execute();
- _efem.Status = DeviceState.Busy;
- EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} Start");
- }
- public override void OnPostWork(string data = null)
- {
- _efem.Status = DeviceState.Idle;
- EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} End");
- }
- }
- /// <summary>
- ///
- /// </summary>
- class HomeAllAction : EfemAction
- {
- public HomeAllAction(EfemBase efem, ModuleName mod) : base(efem, mod)
- {
- Type = EfemOperation.Home;
- this.Module = mod;
- }
- }
- class HomeModuleAction : EfemAction
- {
- public HomeModuleAction(EfemBase efem, ModuleName mod) : base(efem, mod)
- {
- Type = EfemOperation.Home;
- this.Module = mod;
- }
- }
- class OrgshAction : EfemAction
- {
- public OrgshAction(EfemBase efem, ModuleName mod) : base(efem, mod)
- {
- Type = EfemOperation.Orgsh;
- this.Module = mod;
- }
- }
- class ClearErrorAction : EfemAction
- {
- public ClearErrorAction(EfemBase efem) : base(efem, ModuleName.EFEM)
- {
- Type = EfemOperation.ClearError;
- }
- public override void Execute()
- {
- _efem.MsgHandler.Send(new EfemMessage
- {
- Operation = this.Type,
- Head = EfemMessage.MsgHead.SET,
- Parameters = new List<string> { "CLEAR" }
- });
- EV.PostInfoLog(this.Module.ToString(), "清除 EFEM 所有错误");
- }
- }
- class MapAction : EfemAction
- {
- public MapAction(EfemBase efem, ModuleName mod) : base(efem, mod)
- {
- Type = EfemOperation.Map;
- this.Module = mod;
- }
- public override void OnPostWork(string data)
- {
- _efem[Module].Status = DeviceState.Idle;
- }
- }
- class PickAction : EfemAction
- {
- private MoveParam MoveParam { get; }
- public PickAction(EfemBase efem, MoveParam mp) : base(efem, ModuleName.EFEM)
- {
- Type = EfemOperation.Pick;
- MoveParam = mp;
- }
- public override void Execute()
- {
- //MOV:LOAD/P113/ARM2;
- _efem.MsgHandler.Send(new EfemMessage
- {
- Operation = this.Type,
- Head = EfemMessage.MsgHead.MOV,
- Parameters = new List<string>
- {
- MoveParam.SrcPos.ToHWString(),
- Constant.ArmString[MoveParam.Arm],
- MoveParam.WaferSize.ToString()
- }
- });
- this.Status = ActionStatus.SendCmd;
- _efem.Status = DeviceState.Busy;
- }
- public override void OnPostWork(string data)
- {
- WaferManager.Instance.WaferMoved(MoveParam.SrcModule, MoveParam.SrcSlot, MoveParam.DestModule, MoveParam.DestSlot);
- _efem.Status = DeviceState.Idle;
- //_bladeTarget = ModuleName.EfemRobot;
- }
- }
- // MOV:GOTO/P113/ARM2/DOWN;
- // MOV:UNLOAD/P225/ARM2;
- class PlaceAction : EfemAction
- {
- private MoveParam MoveParam { get; }
- public PlaceAction(EfemBase device, MoveParam mp) : base(device, ModuleName.EFEM)
- {
- Type = EfemOperation.Place;
- MoveParam = mp;
- }
- public override void Execute()
- {
- _efem.MsgHandler.Send(new EfemMessage
- {
- Operation = this.Type,
- Head = EfemMessage.MsgHead.MOV,
- Parameters = new List<string>
- {
- MoveParam.DestPos.ToHWString(),
- Constant.ArmString[MoveParam.Arm],
- MoveParam.WaferSize.ToString()
- }
- });
- this.Status = ActionStatus.SendCmd;
- _efem.Status = DeviceState.Busy;
- }
- public override void OnPostWork(string data)
- {
- WaferManager.Instance.WaferMoved(MoveParam.SrcModule, MoveParam.SrcSlot, MoveParam.DestModule, MoveParam.DestSlot);
- _efem.Status = DeviceState.Idle;
- }
- }
- class ExtendAction : EfemAction
- {
- private ExtendParam ExtParam { get; }
- public ExtendPos TargetPosition => ExtParam.Pos;
- public ExtendAction(EfemBase efem, ExtendParam ep)
- : base(efem, ModuleName.EFEM)
- {
- Type = EfemOperation.Extend;
- ExtParam = ep;
- ExtParam.Arm = Hand.Blade1;
- }
- public override void Execute()
- {
- //MOV:EXTEND/LLA03/ARM2;
- _efem.MsgHandler.Send(new EfemMessage
- {
- Operation = this.Type,
- Head = EfemMessage.MsgHead.MOV,
- Parameters = new List<string>
- {
- ExtParam.Module.ToHWString(),
- //Constant.ExtendPosString[ExtParam.Pos],
- ExtParam.Pos.ToString(),
- Constant.ArmString[ExtParam.Arm]
- }
- });
- this.Status = ActionStatus.SendCmd;
- _efem.Status = DeviceState.Busy;
- }
- public override void OnPostWork(string data)
- {
- _efem.Status = DeviceState.Idle;
- switch (TargetPosition)
- {
- case ExtendPos.PB:
- WaferManager.Instance.WaferMoved(ModuleName.EfemRobot, (int)ExtParam.Arm, ExtParam.Module, 0);
- break;
- case ExtendPos.G4:
- WaferManager.Instance.WaferMoved(ExtParam.Module, 0, ModuleName.EfemRobot, (int)ExtParam.Arm);
- break;
- default:
- Debug.WriteLine($"MNPT:{TargetPosition} 不需要更新 WaferManager 信息");
- break;
- }
- }
- }
- class LiftAction : EfemAction
- {
- // MOV:LIFT/ALIGN1;
- public LiftAction(EfemBase device, ModuleName mod) : base(device, mod)
- {
- Type = EfemOperation.Lift;
- Module = mod;
- }
- public override void OnPostWork(string data)
- { }
- }
- class AlignAction : EfemAction
- {
- private WaferSize _ws { get; }
- public AlignAction(EfemBase device, ModuleName mod, WaferSize size) : base(device, mod)
- {
- Type = EfemOperation.Align;
- this.Module = mod;
- this._ws = size;
- }
- public override void Execute()
- {
- _efem.MsgHandler.Send(new EfemMessage
- {
- Operation = this.Type,
- Head = EfemMessage.MsgHead.MOV,
- Parameters = new List<string> { Module.ToHWString(), this._ws.ToString() }
- });
- this.Status = ActionStatus.SendCmd;
- }
- public override void OnPostWork(string data) { }
- }
- class LedAction : EfemAction
- {
- private LightType Light { get; }
- private LightStatus LtStatus { get; }
- public LedAction(EfemBase device, LightType lt, LightStatus st) : base(device, ModuleName.EFEM)
- {
- Type = EfemOperation.Light;
- Light = lt;
- LtStatus = st;
- }
- public override void Execute()
- {
- _efem.MsgHandler.Send(new EfemMessage
- {
- Operation = this.Type,
- Head = EfemMessage.MsgHead.SET,
- Parameters = new List<string> { Constant.STOWER, Light.ToString(), LtStatus.ToString() }
- });
- _efem.Status = DeviceState.Busy;
- EV.PostInfoLog(this.Module.ToString(), $"Cmd {this.ID} {this.Type} Start");
- }
- public override void OnPostWork(string data)
- {
- }
- }
- class AbortAction: EfemAction
- {
- public AbortAction(EfemBase efem) : base(efem, ModuleName.EFEM)
- {
- Type = EfemOperation.Abort;
- }
- public override void Execute()
- {
- _efem.MsgHandler.Send(new EfemMessage
- {
- Operation = this.Type,
- Head = EfemMessage.MsgHead.MOV
- });
- }
- }
- }
|