123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.SCCore;
- using athosRT.FSM;
- using athosRT.tool;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.OcrReaders;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace athosRT.Modules.LPs
- {
- public class ReadWaferIDRoutine : ModuleRoutineBase, FSM.IRoutine
- {
- private SCConfigItem _screaderTimeout => SC.GetConfigItem("OcrReader.TimeLimitForWID");
- private int _timeoutReadID = 0;
- private OcrReader widreader = null;
- public string JobName { get; set; }
- public ReadWaferIDRoutine(ModuleName module) : base(module) {
- }
- public string _reason = string.Empty;
- public RState Start(params object[] objs)
- {
- _timeoutReadID = _screaderTimeout.IntValue;
- widreader = DEVICE.GetDevice<OcrReader>("WIDReader");
- Reset();
- //EV.PostMessage<EventEnum>(ModuleName.Robot.ToString(), EventEnum.AlignBegins, (object)string.Format("{0:D}", (object)this.Notch));
- return Runner.Start(Module, "ReadWaferID");
- }
- public RState Monitor()
- {
- Runner.
- Run(ReadWaferIDStep.ReadWaferID, ReadWaferID, ReaderBusy, _timeoutReadID).
- Run(ReadWaferIDStep.Offline, Offline, ReaderBusy, _timeoutReadID).
- Run(ReadWaferIDStep.LoadJob, LoadJob, ReaderBusy, _timeoutReadID).
- Run(ReadWaferIDStep.Online, Online, ReaderBusy, _timeoutReadID).
- End(ReadWaferIDStep.ReadWaferID, ReadWaferID, ReaderBusy, _timeoutReadID)
- ;
- return Runner.Status;
- }
- public bool ReadWaferID() {
- if (widreader.Read(out _reason))
- {
- return true;
- }
- else
- {
- LogObject.Error("WIDReader", $"无法执行Read reason:{_reason}");
- return false;
- }
- return true;
- }
- public bool ReaderBusy()
- {
- if (widreader.Busy)
- {
- return false;
- }
- else
- {
- LogObject.Info("WIDReader", "not busy");
- return true;
- }
- }
- public bool LoadJob(){
- if (widreader.LoadJob(JobName, out _reason))
- {
- return true;
- }
- else
- {
- LogObject.Error("WIDReader", $"无法执行LoadJob reason:{_reason}");
- return false;
- }
- }
- public bool Offline(){
- if (widreader.Online(false, out _reason))
- {
- return true;
- }
- else
- {
- LogObject.Error("WIDReader", $"无法执行Offline reason:{_reason}");
- return false;
- }
- }
- public bool Online(){
- if (widreader.Online(true, out _reason))
- {
- return true;
- }
- else
- {
- LogObject.Error("WIDReader", $"无法执行Online reason:{_reason}");
- return false;
- }
- }
- public void Abort()
- {
-
- }
- public enum ReadWaferIDStep {
- ReadWaferID,
- LoadJob,
- Offline,
- Online,
- ReaderBusy
- }
- }
- }
|