From e69865a1a3739740201bac8782b721da35d49923 Mon Sep 17 00:00:00 2001
From: patrick.xu <patrick.xu@broconcentric.com>
Date: 星期一, 25 一月 2021 18:45:28 +0800
Subject: [PATCH] 1. gocator添加重试和清理缓存操作 2. gts板卡调整监听频率 3. 记录产品数据使用filsstream避免程序崩溃影响

---
 src/Bro.M071.Process/M071Process_MotionCard.cs |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/Bro.M071.Process/M071Process_MotionCard.cs b/src/Bro.M071.Process/M071Process_MotionCard.cs
index c85443d..8806106 100644
--- a/src/Bro.M071.Process/M071Process_MotionCard.cs
+++ b/src/Bro.M071.Process/M071Process_MotionCard.cs
@@ -17,7 +17,6 @@
     public partial class M071Process
     {
         public Timer ResetTimer = null;
-        const int FULLRESETTIME = 5;
 
         object machineStateLock = new object();
         //MachineState _machineStatePre = MachineState.Unknown;
@@ -30,6 +29,7 @@
                 if (machineState == value)
                     return;
 
+                LogAsync(DateTime.Now, $"璁惧鐘舵�佸垏鎹�:{machineState.ToString()}->{value.ToString()}", "");
                 machineState = value;
 
                 Task.Run(() =>
@@ -233,7 +233,7 @@
             if (opConfig?.InputPara != null && opConfig.InputPara.Count > 0)
             {
                 //澶у浣嶄俊鍙�
-                ResetTimer.Change(opConfig.InputPara[0] == 1 ? FULLRESETTIME * 1000 : -1, -1);
+                ResetTimer.Change(opConfig.InputPara[0] == 1 ? Config.FullResetRequiredDuration * 1000 : -1, -1);
 
                 if (opConfig.InputPara[0] == 0)
                     return new ProcessResponse(true);
@@ -250,15 +250,15 @@
 
             RaisedAlarm("");
 
-            if (MachineState != MachineState.Pause)
-            {
-                MachineState = MachineState.Ready;
-            }
-            else
-            {
-                LogAsync(DateTime.Now, "璁惧鏆傚仠涓紝鏃犳硶澶嶄綅", "");
-                return new ProcessResponse(true);
-            }
+            //if (MachineState != MachineState.Pause)
+            //{
+            MachineState = MachineState.Ready;
+            //}
+            //else
+            //{
+            //    LogAsync(DateTime.Now, "璁惧鏆傚仠涓紝鏃犳硶澶嶄綅", "");
+            //    return new ProcessResponse(true);
+            //}
 
             if (IsEmergencyStopped)
             {
@@ -302,8 +302,11 @@
             MachineState = MachineState.Resetting;
             MotionCardDefaultRun("FullReset", ref opConfig, ref invokeDevice);
 
-            productionList.ForEach(u => u.Dispose());
-            productionList.Clear();
+            lock (productionLock)
+            {
+                productionList.ForEach(u => u.Dispose());
+                productionList.Clear();
+            }
 
             OnFullResetDone?.Invoke();
 

--
Gitblit v1.8.0