From f8e84c7e8cb4a38dbf0720738c00f24005c05ace Mon Sep 17 00:00:00 2001 From: "SIC1016\\caipeilun" <123456> Date: Tue, 23 Jan 2024 13:28:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9Aligner=E5=93=8D=E5=BA=94?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=EF=BC=8C=E5=A4=84=E7=90=86=E5=93=8D=E5=BA=94?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Aligners/HiWinAligner/HwAlignerGuide.cs | 62 ++++++++++++++----- .../HiWinAligner/HwAlignerGuideConnection.cs | 9 +-- .../Aligners/HPA48/HPA48Simulator.cs | 30 +++++++++ 3 files changed, 77 insertions(+), 24 deletions(-) diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Aligners/HiWinAligner/HwAlignerGuide.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Aligners/HiWinAligner/HwAlignerGuide.cs index 44c7265..10b32dd 100644 --- a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Aligners/HiWinAligner/HwAlignerGuide.cs +++ b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Aligners/HiWinAligner/HwAlignerGuide.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Data.Common; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using Aitex.Core.RT.DataCenter; using Aitex.Core.RT.Device; using Aitex.Core.RT.Event; @@ -87,6 +88,12 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.HiWinAligner public string Address { get; set; } + public string Vacuum { get; set; } ="-Kpa" ; + + public string PError { get; set; } = "-"; + + public string Response { get; set; } = "-"; + public bool IsConnected => _connection is { IsConnected: true }; public bool AlarmStatus { get; set; } @@ -114,7 +121,9 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.HiWinAligner private void InitData() { DATA.Subscribe($"{Module}.{Name}.HaveWafer", () => HaveWafer); - DATA.Subscribe($"{Module}.{Name}.Result", () => _connection.Result,SubscriptionAttribute.FLAG.IgnoreSaveDB); + DATA.Subscribe($"{Module}.{Name}.Response", () => Response, SubscriptionAttribute.FLAG.IgnoreSaveDB); + DATA.Subscribe($"{Module}.{Name}.Vacuum", () => Vacuum, SubscriptionAttribute.FLAG.IgnoreSaveDB); + DATA.Subscribe($"{Module}.{Name}.PError", () => PError, SubscriptionAttribute.FLAG.IgnoreSaveDB); } private void InitOp() @@ -577,28 +586,48 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.HiWinAligner internal bool ParseData(string name, byte[] buffer, out bool bResult) { bResult = true; - var sAnswer = Encoding.ASCII.GetString(buffer); - if (sAnswer.Contains("END")) + var sAnswer = Encoding.ASCII.GetString(buffer).TrimEnd('\r', '\n'); + Response = sAnswer; + string[] units = Regex.Split(sAnswer,"\r\n"); + + foreach (string unit in units) { - _iCurrentOper = CommandEnum.NULL; - return true; - } - - if (sAnswer.Contains("ERR")) - { - lock (_locker) + if (unit.Contains("END")) { - _lstHandler.Clear(); + _iCurrentOper = CommandEnum.NULL; + return true; } + else if (unit.Contains("ERR") && _lastHandlerName != "PER") + { + lock (_locker) + { + _lstHandler.Clear(); + } - _iCurrentOper = CommandEnum.NULL; - bResult = false; + _iCurrentOper = CommandEnum.NULL; + bResult = false; - EV.PostAlarmLog(Module, $"Aligner, Execute {_lastHandlerName} error, {sAnswer.TrimEnd('\r', '\n')}"); + EV.PostAlarmLog(Module, $"Aligner, Execute {_lastHandlerName} error, {unit.TrimEnd('\r', '\n')}"); - return true; //Handled + return true; //Handled + } + else if (_lastHandlerName == "CVD") + { + try + { + double x = Convert.ToInt32(unit); + Vacuum = unit + "Kpa"; + } + catch + { + Vacuum = "Convert(" + unit + ") Failed."; + } + } + else if (_lastHandlerName == "PER") + { + PError = unit; + } } - return false; } @@ -606,6 +635,7 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.HiWinAligner { bResult = true; var sAnswer = Encoding.ASCII.GetString(buffer.ToArray()); + Response = sAnswer; if (sAnswer.Contains("END")) { HaveWafer = sAnswer.Contains("1\r\nEND"); diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Aligners/HiWinAligner/HwAlignerGuideConnection.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Aligners/HiWinAligner/HwAlignerGuideConnection.cs index 311fb94..0ada33f 100644 --- a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Aligners/HiWinAligner/HwAlignerGuideConnection.cs +++ b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Aligners/HiWinAligner/HwAlignerGuideConnection.cs @@ -8,11 +8,7 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.HiWinAligner { private readonly List _lstCacheBuffer = new(); private object _lockerActiveHandler = new object(); - private string _result = ""; - public string Result - { - get { return _result; } - } + public HwAlignerGuideConnection(string portName) : base(portName, 115200, 8, System.IO.Ports.Parity.None, System.IO.Ports.StopBits.One, "\r", false) { @@ -20,7 +16,6 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.HiWinAligner public override bool SendMessage(byte[] message) { _lstCacheBuffer.Clear(); - _result = ""; return base.SendMessage(message); } protected override MessageBase ParseResponse(byte[] rawMessage) @@ -29,8 +24,6 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.HiWinAligner _lstCacheBuffer.AddRange(rawMessage); var temps = _lstCacheBuffer.ToArray(); - _result += System.Text.Encoding.ASCII.GetString(temps); - HwAlignerGuideMessage msg = new HwAlignerGuideMessage(); msg.IsResponse = false; msg.IsAck = false; diff --git a/SimulatorCore/Aligners/HPA48/HPA48Simulator.cs b/SimulatorCore/Aligners/HPA48/HPA48Simulator.cs index dc43f8a..e3cf338 100644 --- a/SimulatorCore/Aligners/HPA48/HPA48Simulator.cs +++ b/SimulatorCore/Aligners/HPA48/HPA48Simulator.cs @@ -50,12 +50,16 @@ namespace MECF.Framework.Simulator.Core.Aligners.HPA48 CVN(message); else if (message.StartsWith("CVF")) CVF(message); + else if (message.StartsWith("CVD")) + CVD(message); else if (message.StartsWith("MTM")) MTM(message); else if (message.StartsWith("DOC")) DOC(message); else if (message.StartsWith("STP")) STP(message); + else if (message.StartsWith("PER")) + PER(message); } @@ -136,6 +140,19 @@ namespace MECF.Framework.Simulator.Core.Aligners.HPA48 }); } + /// + /// 读取真空值 + /// + /// + private void CVD(string cmd) + { + SendResponse(cmd, s => + { + Thread.Sleep(500); + OnWriteMessage("-65"); + }); + } + /// /// 打开真空。 /// @@ -175,6 +192,19 @@ namespace MECF.Framework.Simulator.Core.Aligners.HPA48 }); } + /// + /// 读取上一次报警 + /// + /// + private void PER(string cmd) + { + SendResponse(cmd, s => + { + Thread.Sleep(500); + OnWriteMessage("ERR 444"); + }); + } + /// /// 移动至测量中心点。 ///