Browse Source

1.rf turn on fail时,打印出日志
2.lp load时增加 door state判断

JET-YDB\JET-YANGDB 3 months ago
parent
commit
5889dd5707

+ 35 - 3
FrameworkLocal/Common/Communications/AsyncSerialPort.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Collections.Concurrent;
 using System.ComponentModel;
 using System.IO.Ports;
 using System.Reflection;
@@ -8,6 +9,7 @@ using System.Security.Permissions;
 using System.Text;
 using Aitex.Core.RT.Event;
 using Aitex.Core.RT.Log;
+using Aitex.Core.RT.SCCore;
 using MECF.Framework.Common.Utilities;
 using Microsoft.Win32.SafeHandles;
 
@@ -40,6 +42,8 @@ namespace MECF.Framework.Common.Communications
         private string _buff = "";
 
         public bool EnableLog { get; set; }
+        public ConcurrentQueue<string> SendOrReceiveLog = new ConcurrentQueue<string>();
+        private string _COMLogConfig;
 
         private bool _isAsciiMode;
         public bool IsAsciiMode
@@ -51,6 +55,7 @@ namespace MECF.Framework.Common.Communications
 
         public AsyncSerialPort(string name, int baudRate, int dataBits, Parity parity = Parity.None, StopBits stopBits = StopBits.One, string newline = "\r", bool isAsciiMode = true)
         {
+            _COMLogConfig = SC.GetStringValue("System.COMLogFlag");
             _isAsciiMode = isAsciiMode;
             _isLineBased = !string.IsNullOrEmpty(newline);
 
@@ -145,7 +150,7 @@ namespace MECF.Framework.Common.Communications
                             LOG.Info(string.Format("Communication {0} Send {1} succeeded.", _port.PortName, string.Join(" ", Array.ConvertAll(Encoding.ASCII.GetBytes(msg), x => x.ToString("X2")))));
 
                         }
-
+                        AppendSendOrReceiveLog("Write", string.Join(" ", Array.ConvertAll(Encoding.ASCII.GetBytes(msg), x => x.ToString("X2"))));
                     }
                 }
                 return true;
@@ -175,6 +180,7 @@ namespace MECF.Framework.Common.Communications
                             LOG.Info(string.Format("Communication {0} Send {1} succeeded.", _port.PortName, string.Join(" ", Array.ConvertAll(msg, x => x.ToString("X2")))));
                             LOG.Info(string.Format("Communication {0} Send {1} succeeded.", _port.PortName, Encoding.ASCII.GetString(msg)));
                         }
+                        AppendSendOrReceiveLog("Write", string.Join(" ", Array.ConvertAll(msg, x => x.ToString("X2"))));
                     }
                 }
                 return true;
@@ -234,6 +240,8 @@ namespace MECF.Framework.Common.Communications
 
                     if (OnDataChanged != null)
                         OnDataChanged(msg);
+
+                    AppendSendOrReceiveLog("Read", string.Join(" ", Array.ConvertAll(Encoding.ASCII.GetBytes(msg), x => x.ToString("X2"))));
                 }
             }
             else
@@ -245,9 +253,10 @@ namespace MECF.Framework.Common.Communications
                     LOG.Info(string.Format("Communication {0} Receive {1}.", _port.PortName, string.Join(" ", Array.ConvertAll(Encoding.ASCII.GetBytes(msg), x => x.ToString("X2")))));
 
                 }
-
                 if (OnDataChanged != null)
                     OnDataChanged(msg);
+
+                AppendSendOrReceiveLog("Read", string.Join(" ", Array.ConvertAll(Encoding.ASCII.GetBytes(msg), x => x.ToString("X2"))));
             }
 
         }
@@ -274,9 +283,10 @@ namespace MECF.Framework.Common.Communications
                 LOG.Info(string.Format("Communication {0} Receive {1}.", _port.PortName, Encoding.ASCII.GetString(buffer)));
 
             }
-
             if (OnBinaryDataChanged != null)
                 OnBinaryDataChanged(buffer);
+
+            AppendSendOrReceiveLog("Read", string.Join(" ", Array.ConvertAll(buffer, x => x.ToString("X2"))));
         }
 
         void ErrorReceived(object sender, SerialErrorReceivedEventArgs e)
@@ -342,6 +352,28 @@ namespace MECF.Framework.Common.Communications
             }
             return true;
         }
+        private void AppendSendOrReceiveLog(string title, string content)
+        {
+            if (string.IsNullOrWhiteSpace(_COMLogConfig) || !_COMLogConfig.Contains(_port.PortName)) return;
+
+            var count = SendOrReceiveLog.Count;
+            for (var i = count; i > 400; i--)
+            {
+                SendOrReceiveLog.TryDequeue(out string _);
+            }
+            SendOrReceiveLog.Enqueue($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")} {_port?.PortName} {title ?? string.Empty} [{content ?? string.Empty}]");
+        }
+        public void ClearSendOrReceiveLog()
+        {
+            if (!SendOrReceiveLog.IsEmpty)
+            {
+                var count = SendOrReceiveLog.Count;
+                for (var i = 0; i < count; i++)
+                {
+                    SendOrReceiveLog.TryDequeue(out string _);
+                }
+            }
+        }
     }
 
     internal static class SerialPortExtensions

+ 4 - 0
JetVirgoPM/Devices/AdTecRF.cs

@@ -440,6 +440,10 @@ namespace JetVirgoPM.Devices
                 {
                     if (!IsPowerOn)
                     {
+                        string sendOrReceivelog = string.Join("\r", _serial.SendOrReceiveLog.ToArray());
+                        _serial.ClearSendOrReceiveLog();
+                        EV.PostInfoLog(Module, $"{Module} {Name} RF Turn On Failed logs: {sendOrReceivelog}");
+
                         EV.PostAlarmLog($"{Module}", $"{Name} Turn On Failed");
                         _timerRFTurnOn.Stop();
                     }

+ 1 - 1
JetVirgoPM/Devices/JetDualPM.cs

@@ -176,7 +176,7 @@ namespace JetVirgoPM.Devices
         {
             get
             {
-                if (_smallWafer == 0)
+                if (_midWafer == 0)
                     return MovementPosition.Down;
                 MovementPosition res = MovementPosition.Unknown;
                 if (_GuidePin1.ONFeedback && !_GuidePin1.OFFFeedback)

+ 1 - 0
Mars/EfemDualRT/Config/System.sccfg

@@ -40,6 +40,7 @@
     <config default="0" name="PLCSendTimeout" description="PLC send timeout" max="99999" min="0" paramter="" tag="" unit="ms" type="Integer" visible="false" />
     <config default="0" name="PLCReceiveTimeout" description="PLC receive timeout" max="99999" min="0" paramter="" tag="" unit="ms" type="Integer" visible="false" />
     <config default="0"  name="CheckResourceInterval" nameView="CheckResourceInterval" description="进程资源监视间隔,单位为秒,0为不监视" max="65535" min="0" paramter="" tag="" unit="min" type="Integer" visible="false"/>
+    <config default="" name="COMLogFlag" description="send or receive log(eg:COM13,COM14)" max="" min="" paramter="" tag=""  unit="" type="String" />
     <configs name="Scheduler">
       <config default="15" name="WaitLoadTimeOut" description="Wait Load TimeOut" max="1000" min="1" paramter="" tag="" unit="s" type="Double" visible="false"/>
       <config default="2" name="WaferCountBelowWhichStartNewProcessJob" description="Wafer Count Below Which Start New Process Job" max="25" min="1" paramter="" tag="" unit="" type="Integer"  visible="false"/>

+ 2 - 2
Mars/EfemDualRT/Properties/AssemblyInfo.cs

@@ -51,5 +51,5 @@ using System.Windows;
 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
 //通过使用 "*",如下所示:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.8")]
-[assembly: AssemblyFileVersion("1.0.0.8")]
+[assembly: AssemblyVersion("1.0.0.9")]
+[assembly: AssemblyFileVersion("1.0.0.9")]

+ 2 - 2
Mars/EfemDualUI/Properties/AssemblyInfo.cs

@@ -51,5 +51,5 @@ using System.Windows;
 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
 //通过使用 "*",如下所示:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.8")]
-[assembly: AssemblyFileVersion("1.0.0.8")]
+[assembly: AssemblyVersion("1.0.0.9")]
+[assembly: AssemblyFileVersion("1.0.0.9")]

+ 2 - 1
Mars/JetEfem/LPs/LoadPortLoadRoutine.cs

@@ -5,6 +5,7 @@ using Aitex.Core.RT.Event;
 using Aitex.Core.RT.Log;
 using Aitex.Core.RT.Routine;
 using Aitex.Core.RT.SCCore;
+using Aitex.Sorter.Common;
 using JetEfemLib.Efems;
 using MECF.Framework.Common.Equipment;
 using MECF.Framework.Common.SubstrateTrackings;
@@ -100,7 +101,7 @@ namespace JetEfemLib.LPs
 
         bool CheckDevice()
         {
-            return !(_lpModule.LPDevice.Error || _lpModule.LPDevice.IsBusy);
+            return !(_lpModule.LPDevice.Error || _lpModule.LPDevice.IsBusy || _lpModule.LPDevice.DoorState != FoupDoorState.Open);
         }
 
         bool OpenDoor()