|
@@ -1,9 +1,14 @@
|
|
|
-using Aitex.Core.RT.Log;
|
|
|
+using Aitex.Core.RT.DataCenter;
|
|
|
+using Aitex.Core.RT.Log;
|
|
|
using Aitex.Core.RT.SCCore;
|
|
|
using MECF.Framework.Common.Communications;
|
|
|
using MECF.Framework.Common.Equipment;
|
|
|
+using MECF.Framework.RT.ModuleLibrary.Commons;
|
|
|
using SecsGem.Core;
|
|
|
+using SecsGemSerial.Application;
|
|
|
using SecsGemSerial.Core;
|
|
|
+using SecsGemSerial.Core.EnumData;
|
|
|
+using SecsGemSerial.Core.Model;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data;
|
|
@@ -14,7 +19,7 @@ using System.Threading.Tasks;
|
|
|
|
|
|
namespace Venus_RT.Devices.SMIF
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Fortrend PLUS 500
|
|
|
/// Loader/Unloader
|
|
@@ -22,122 +27,25 @@ namespace Venus_RT.Devices.SMIF
|
|
|
/// </summary>
|
|
|
public class FortrendPLUS500
|
|
|
{
|
|
|
- //private readonly Dictionary<FunctionType, StreamType> SFPair = new Dictionary<FunctionType, StreamType>()
|
|
|
- //{
|
|
|
- // //s1
|
|
|
- // { FunctionType.Abort,StreamType.SMIFState},
|
|
|
- // { FunctionType.Online,StreamType.SMIFState},
|
|
|
- // { FunctionType.OnlineData,StreamType.SMIFState},
|
|
|
- // { FunctionType.Map,StreamType.SMIFState},
|
|
|
- // { FunctionType.MapData,StreamType.SMIFState},
|
|
|
- // { FunctionType.Status,StreamType.SMIFState},
|
|
|
- // { FunctionType.StatusData,StreamType.SMIFState},
|
|
|
-
|
|
|
- // //s2
|
|
|
- // { FunctionType.SetReport,StreamType.SMIFControl},
|
|
|
- // { FunctionType.SetReportACK,StreamType.SMIFControl},
|
|
|
- // { FunctionType.ResetORInit,StreamType.SMIFControl},
|
|
|
- // { FunctionType.ResetORInitACK,StreamType.SMIFControl},
|
|
|
- // { FunctionType.RemoteCommand,StreamType.SMIFControl},
|
|
|
- // { FunctionType.RemoteCommandData,StreamType.SMIFControl},
|
|
|
- // { FunctionType.CheckProto,StreamType.SMIFControl},
|
|
|
- // { FunctionType.CheckProtoData,StreamType.SMIFControl},
|
|
|
-
|
|
|
- // //s3
|
|
|
- // { FunctionType.AccessMode,StreamType.LP},
|
|
|
- // { FunctionType.AccessModeACK,StreamType.LP},
|
|
|
-
|
|
|
- // //s4
|
|
|
- // {FunctionType.ReadTag,StreamType.TAG},
|
|
|
- // {FunctionType.ReadTagData,StreamType.TAG},
|
|
|
- // {FunctionType.WriteTag,StreamType.TAG},
|
|
|
- // {FunctionType.WriteTagData,StreamType.TAG},
|
|
|
-
|
|
|
- // //s5
|
|
|
- // {FunctionType.AlarmData,StreamType.ALARM },
|
|
|
- // {FunctionType.AlarmACK,StreamType.ALARM },
|
|
|
- // {FunctionType.SetAlarm,StreamType.ALARM },
|
|
|
- // {FunctionType.SetAlarmACK,StreamType.ALARM },
|
|
|
-
|
|
|
- // //s6
|
|
|
- // {FunctionType.DataSend,StreamType.DVDATA},
|
|
|
- // {FunctionType.DataSendACK,StreamType.DVDATA},
|
|
|
-
|
|
|
- // //s9
|
|
|
- // {FunctionType.UnrecognizedDeviceID,StreamType.COMMANDERROR},
|
|
|
- // {FunctionType.UnrecognizedStream,StreamType.COMMANDERROR},
|
|
|
- // {FunctionType.UnrecognizedFunction,StreamType.COMMANDERROR},
|
|
|
- // {FunctionType.IllegalData,StreamType.COMMANDERROR},
|
|
|
-
|
|
|
- //};
|
|
|
-
|
|
|
- //public enum FunctionType
|
|
|
- //{
|
|
|
- // Abort = 0,
|
|
|
-
|
|
|
- // Online = 1,
|
|
|
- // OnlineData = 2,
|
|
|
-
|
|
|
- // Map = 3,
|
|
|
- // MapData = 4,
|
|
|
-
|
|
|
- // Status = 5,
|
|
|
- // StatusData = 6,
|
|
|
-
|
|
|
- // SetReport = 15,
|
|
|
- // SetReportACK = 16,
|
|
|
-
|
|
|
- // ResetORInit = 19,
|
|
|
- // ResetORInitACK = 20,
|
|
|
-
|
|
|
- // RemoteCommand = 21,
|
|
|
- // RemoteCommandData = 22,
|
|
|
-
|
|
|
- // CheckProto = 25,
|
|
|
- // CheckProtoData = 26,
|
|
|
-
|
|
|
- // AccessMode = 27,
|
|
|
- // AccessModeACK = 27,
|
|
|
-
|
|
|
- // ReadTag = 101,
|
|
|
- // ReadTagData = 102,
|
|
|
-
|
|
|
- // WriteTag = 103,
|
|
|
- // WriteTagData = 104,
|
|
|
-
|
|
|
- // AlarmData = 1,
|
|
|
- // AlarmACK = 2,
|
|
|
-
|
|
|
- // SetAlarm = 3,
|
|
|
- // SetAlarmACK = 4,
|
|
|
-
|
|
|
- // DataSend = 3,
|
|
|
- // DataSendACK = 4,
|
|
|
-
|
|
|
- // UnrecognizedDeviceID = 1,
|
|
|
- // UnrecognizedStream = 3,
|
|
|
- // UnrecognizedFunction = 5,
|
|
|
- // IllegalData = 7,
|
|
|
- //}
|
|
|
|
|
|
public enum StreamType
|
|
|
{
|
|
|
- SMIFState = 1,
|
|
|
- SMIFControl = 2,
|
|
|
- LP = 3,
|
|
|
- TAG = 4,
|
|
|
- ALARM = 5,
|
|
|
- DVDATA = 6,
|
|
|
- COMMANDERROR = 9,
|
|
|
- RFIDCOMMAND= 18,
|
|
|
- SMARTTAG8400COMMAND = 100,
|
|
|
+ SMIFState = 1,
|
|
|
+ SMIFControl = 2,
|
|
|
+ LP = 3,
|
|
|
+ TAG = 4,
|
|
|
+ ALARM = 5,
|
|
|
+ DVDATA = 6,
|
|
|
+ COMMANDERROR = 9,
|
|
|
+ RFIDCOMMAND = 18,
|
|
|
+ SMARTTAG8400COMMAND = 100,
|
|
|
}
|
|
|
|
|
|
|
|
|
private AsyncSerialPort _serialport;
|
|
|
private string _portname;
|
|
|
//connect status
|
|
|
- public bool IsConnected;
|
|
|
+ public bool IsConnected;
|
|
|
//online status
|
|
|
public bool IsOnline;
|
|
|
//Load
|
|
@@ -147,92 +55,110 @@ namespace Venus_RT.Devices.SMIF
|
|
|
//Error
|
|
|
public bool IsError;
|
|
|
|
|
|
- private SecsGemSerial.Application.SecsGemSerialApplication _serial = null;
|
|
|
+ private SecsGemSerialApplication _serial = null;
|
|
|
+
|
|
|
+ private ModuleName _smifbelong;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 构造函数
|
|
|
/// </summary>
|
|
|
- /// <param name="DEVICEBelong">从属的设备 如VCE1 LP1</param>
|
|
|
- public FortrendPLUS500(ModuleName DEVICEBelong)
|
|
|
+ /// <param name="VCEName">从属的设备 如VCE1 LP1</param>
|
|
|
+ public FortrendPLUS500(ModuleName VCEName)
|
|
|
{
|
|
|
- _portname = SC.GetStringValue($"{DEVICEBelong}.SMIF.PortNumber");
|
|
|
- //_serialport = new AsyncSerialPort(_portname, 9600, 8,Parity.None,StopBits.One);
|
|
|
- //_serialport.Open();
|
|
|
- //_serialport.OnDataChanged += OnSMIFDataChanged;
|
|
|
+ _smifbelong = VCEName;
|
|
|
+ _portname = SC.GetStringValue($"{VCEName}.SMIF.Port");
|
|
|
SerialOptions serialOptions = new SerialOptions()
|
|
|
{
|
|
|
- Port=_portname==null? "COM81":_portname,
|
|
|
- BaudRate=9600,
|
|
|
- DataBits=8,
|
|
|
- Parity=Parity.None,
|
|
|
- StopBits=StopBits.One,
|
|
|
+ Port = _portname ?? "COM81",
|
|
|
+ BaudRate = 9600,
|
|
|
+ DataBits = 8,
|
|
|
+ Parity = Parity.None,
|
|
|
+ StopBits = StopBits.One,
|
|
|
};
|
|
|
GlobalData.DeviceId = 0;
|
|
|
- SecsGemSerial.Core.SecsGemSerialOptions secsGemSerialOptions = new SecsGemSerial.Core.SecsGemSerialOptions()
|
|
|
+ SecsGemSerialOptions secsGemSerialOptions = new SecsGemSerialOptions()
|
|
|
{
|
|
|
- DeviceId=GlobalData.DeviceId
|
|
|
+ DeviceId = GlobalData.DeviceId
|
|
|
};
|
|
|
- _serial = new SecsGemSerial.Application.SecsGemSerialApplication(DEVICEBelong.ToString(), serialOptions, secsGemSerialOptions);
|
|
|
+
|
|
|
+ _serial = new SecsGemSerialApplication(VCEName.ToString(), serialOptions, secsGemSerialOptions);
|
|
|
_serial.OnAlarm += _serial_OnAlarm;
|
|
|
}
|
|
|
|
|
|
private void _serial_OnAlarm(string alarm)
|
|
|
{
|
|
|
- Console.WriteLine(alarm);
|
|
|
+ //Console.WriteLine(alarm);
|
|
|
+ LOG.Write(eEvent.ERR_VCE_COMMON_Failed, _smifbelong, $"SMIF({_smifbelong}) received Alarm:{alarm}");
|
|
|
}
|
|
|
|
|
|
public void Initialize()
|
|
|
{
|
|
|
_serial.Initialize();
|
|
|
+ _serial.RemoteControl(out string reason);
|
|
|
}
|
|
|
|
|
|
- //检查传入SxFy是否定义在字典中
|
|
|
- //private bool CheckStreamFunctionPair(string sfstring)
|
|
|
- //{
|
|
|
- // string[] sfcodes = sfstring.Split('S','F');
|
|
|
- // if (sfcodes.Length == 2
|
|
|
- // && Enum.TryParse(Convert.ToInt32(sfcodes[0]).ToString(), out StreamType snum)
|
|
|
- // && Enum.IsDefined(typeof(StreamType),snum)
|
|
|
- // && Enum.TryParse(Convert.ToInt32(sfcodes[1]).ToString(), out FunctionType fnum)
|
|
|
- // && Enum.IsDefined(typeof(FunctionType), fnum)
|
|
|
- // && SFPair.TryGetValue(fnum,out StreamType _snum)
|
|
|
- // && _snum == snum)
|
|
|
- // {
|
|
|
- // return true;
|
|
|
- // }
|
|
|
- // return false;
|
|
|
- //}
|
|
|
|
|
|
private void OnSMIFDataChanged(string oneLineMessage)
|
|
|
{
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
+ public void Query()
|
|
|
+ {
|
|
|
+ SmifData smifdata = _serial.QueryAllSvids(out string reason);
|
|
|
+ List<EnumSlot> mapdata = smifdata?.WaferMap;
|
|
|
+ int? wafercount = smifdata?.WaferCount;
|
|
|
+ E84Signals SmifIO = smifdata?.E84Signals;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void Home()
|
|
|
+ {
|
|
|
+ if (!_serial.RemoteCommand(EnumRemoteCmd.HomeSmif, out string reason))
|
|
|
+ LOG.Write(eEvent.ERR_VCE_COMMON_Failed, _smifbelong, $"Send Home Command Failed for {reason}!Please Check SMIF({_smifbelong})");
|
|
|
+ else
|
|
|
+ LOG.Write(eEvent.EV_VCE_COMMON_INFO, _smifbelong, $"Send Home Command to SMIF({_smifbelong})");
|
|
|
}
|
|
|
|
|
|
public void Load()
|
|
|
{
|
|
|
-
|
|
|
+ if (!_serial.RemoteCommand(EnumRemoteCmd.StartLoadOpenCycle, out string reason))
|
|
|
+ LOG.Write(eEvent.ERR_VCE_COMMON_Failed, _smifbelong, $"Send Load Command Failed for {reason}!Please Check SMIF({_smifbelong})");
|
|
|
+ else
|
|
|
+ LOG.Write(eEvent.EV_VCE_COMMON_INFO, _smifbelong, $"Send Load Command to SMIF({_smifbelong})");
|
|
|
}
|
|
|
|
|
|
public void Unload()
|
|
|
{
|
|
|
-
|
|
|
+ if (!_serial.RemoteCommand(EnumRemoteCmd.StartUnloadCloseCycle, out string reason))
|
|
|
+ LOG.Write(eEvent.ERR_VCE_COMMON_Failed, _smifbelong, $"Send Unload Command Failed for {reason}!Please Check SMIF({_smifbelong})");
|
|
|
+ else
|
|
|
+ LOG.Write(eEvent.EV_VCE_COMMON_INFO, _smifbelong, $"Send UnLoad Command to SMIF({_smifbelong})");
|
|
|
}
|
|
|
|
|
|
public void Lock()
|
|
|
{
|
|
|
-
|
|
|
+ if (!_serial.RemoteCommand(EnumRemoteCmd.KeepPrtLocked, out string reason))
|
|
|
+ LOG.Write(eEvent.ERR_VCE_COMMON_Failed, _smifbelong, $"Send Lock Command Failed for {reason}!Please Check SMIF({_smifbelong})");
|
|
|
+ else
|
|
|
+ LOG.Write(eEvent.EV_VCE_COMMON_INFO, _smifbelong, $"Send Lock Command to SMIF({_smifbelong})");
|
|
|
}
|
|
|
|
|
|
public void Unlock()
|
|
|
{
|
|
|
-
|
|
|
+ if (!_serial.RemoteCommand(EnumRemoteCmd.UnlockPort, out string reason))
|
|
|
+ LOG.Write(eEvent.ERR_VCE_COMMON_Failed, _smifbelong, $"Send Unlock Command Failed for {reason}!Please Check SMIF({_smifbelong})");
|
|
|
+ else
|
|
|
+ LOG.Write(eEvent.EV_VCE_COMMON_INFO, _smifbelong, $"Send UnLock Command to SMIF({_smifbelong})");
|
|
|
}
|
|
|
|
|
|
- public void ReadMap()
|
|
|
- {
|
|
|
-
|
|
|
+ public void Reset()
|
|
|
+ {
|
|
|
+ if (!_serial.RemoteCommand(EnumRemoteCmd.HomeSmif, out string reason))
|
|
|
+ LOG.Write(eEvent.ERR_VCE_COMMON_Failed, _smifbelong, $"Send Unlock Command Failed for {reason}!Please Check SMIF({_smifbelong})");
|
|
|
+ else
|
|
|
+ LOG.Write(eEvent.EV_VCE_COMMON_INFO, _smifbelong, $"Send UnLock Command to SMIF({_smifbelong})");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 中断SMIF正在执行的操作
|
|
|
/// </summary>
|