From da297f042a4e46c645b3ed26db9a81012fbbb944 Mon Sep 17 00:00:00 2001
From: simon <panruising@163.com>
Date: Sat, 27 Mar 2021 06:01:39 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E6=A0=B7=E5=93=81?=
 =?UTF-8?q?=E6=8A=A5=E8=AD=A6=E7=9A=84msg=20=E6=94=BE=E5=85=A5=20FLY.Thick?=
 =?UTF-8?q?.Base.Common.ERRNOs.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../FLY.Thick.Base/Common/ERRNO.cs            |  6 +++-
 .../FLY.Thick.Base/Server/GetSample.cs        | 30 +++++++++++--------
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/Project.FLY.Thick.Base/FLY.Thick.Base/Common/ERRNO.cs b/Project.FLY.Thick.Base/FLY.Thick.Base/Common/ERRNO.cs
index cc6eaf8..bdc022e 100644
--- a/Project.FLY.Thick.Base/FLY.Thick.Base/Common/ERRNO.cs
+++ b/Project.FLY.Thick.Base/FLY.Thick.Base/Common/ERRNO.cs
@@ -30,6 +30,10 @@ namespace FLY.Thick.Base.Common
         public ERRNO BASE_ERRNO_TIMEGRIDADV = new ERRNO() { Code = 14, Descrption = "AD卡版本太低,不能启动 [高级AD数据]" };
         public ERRNO SCAN_ERRNO_FATAL = new ERRNO() { Code = 20, Descrption = "扫描异常,致命错误 必须停止扫描" };
         public ERRNO SYNC_ERRNO_FATAL = new ERRNO() { Code = 21, Descrption = "同步异常,致命错误 必须停止扫描" };
-        public ERRNO MEASURE_SYNC_ERRNO_FATAL = new ERRNO() { Code = 22, Descrption = "测量同步参数异常,致命错误 必须停止" };          
+        public ERRNO MEASURE_SYNC_ERRNO_FATAL = new ERRNO() { Code = 22, Descrption = "测量同步参数异常,致命错误 必须停止" };
+
+        public ERRNO SAMPLE_ERRNO_Failure = new ERRNO() { Code = 60, Descrption = "样品取样出错" };
+
+
     }
 }
diff --git a/Project.FLY.Thick.Base/FLY.Thick.Base/Server/GetSample.cs b/Project.FLY.Thick.Base/FLY.Thick.Base/Server/GetSample.cs
index 541c7db..85dfc39 100644
--- a/Project.FLY.Thick.Base/FLY.Thick.Base/Server/GetSample.cs
+++ b/Project.FLY.Thick.Base/FLY.Thick.Base/Server/GetSample.cs
@@ -14,6 +14,7 @@ using FLY.Thick.Base.IService;
 using PropertyChanged;
 using Newtonsoft.Json;
 using static Misc.ReverserInfo;
+using FLY.Thick.Base.Common;
 
 namespace FLY.Thick.Base.Server
 {
@@ -23,8 +24,6 @@ namespace FLY.Thick.Base.Server
         /// <summary>
         /// 报警测试
         /// </summary>
-        public static FLY.OBJComponents.Common.ERRNO SAMPLE_ERRNO_Failure = new FLY.OBJComponents.Common.ERRNO() { Code = 60, Descrption = "样品取样出错" };
-
 
         #region IGetSampleService 接口
 
@@ -197,7 +196,7 @@ namespace FLY.Thick.Base.Server
         {
             try
             {
-                string json = Newtonsoft.Json.JsonConvert.SerializeObject(this);
+                string json = Newtonsoft.Json.JsonConvert.SerializeObject(this, Formatting.Indented);
                 File.WriteAllText(param_path, json);
 
             }
@@ -360,7 +359,7 @@ namespace FLY.Thick.Base.Server
         }
 
 
-
+        bool mIsFailure = false;
         /// <summary>
         /// 样品取样,推送给thickm, 参数一定合法,不用检测
         /// </summary>
@@ -504,11 +503,13 @@ namespace FLY.Thick.Base.Server
 
             if (isFailure)//样品获取失败,下次继续!!!
             {
+                
                 this.warningSystem.Add(
-                    SAMPLE_ERRNO_Failure.Code,
-                    SAMPLE_ERRNO_Failure.Descrption,
+                    ERRNOs.Instance.SAMPLE_ERRNO_Failure.Code,
+                    ERRNOs.Instance.SAMPLE_ERRNO_Failure.Descrption,
                     OBJComponents.Common.ERR_STATE.ON);
             }
+            mIsFailure = isFailure;
         }
 
         /// <summary>
@@ -519,13 +520,16 @@ namespace FLY.Thick.Base.Server
         {
             if (Enable)
             {
-                foreach (SampleCell sample in Samples)
-                {
-                    if ((sample.Enable) && (sample.AD < 0))
-                    {
-                        return false;
-                    }
-                }
+                if (mIsFailure)
+                    return false;
+
+                //foreach (SampleCell sample in Samples)
+                //{
+                //    if ((sample.Enable) && (sample.AD < 0))
+                //    {
+                //        return false;
+                //    }
+                //}
             }
 
             return true;
-- 
2.18.1