浏览代码

Merge branch 'GSP' of http://36.129.169.60:30080/gogsadmin/OTS into GSP

cxs 4 周之前
父节点
当前提交
047cfc7c37
共有 1 个文件被更改,包括 113 次插入0 次删除
  1. 113 0
      OTSIncAReportApp/1-UI/COffLineClassifyLogic.cs

+ 113 - 0
OTSIncAReportApp/1-UI/COffLineClassifyLogic.cs

@@ -0,0 +1,113 @@
+using OTSCLRINTERFACE;
+using OTSModelSharp.ServiceCenter;
+using System.Collections.Generic;
+using static OTSDataType.otsdataconst;
+
+namespace OTSCommon
+{
+    public static class COffLineClassifyLogic
+    {
+        //we have a complicate online classify logic(considering the xray counts and using the spectrum compare and may do not quantify)
+        //when we do classification offline we cann't use that mechanism so we use a surrogate mechanism which is simpler and general .
+        private static CClassifyEngine m_classifyEngine = new CClassifyEngine();
+        public static bool ClassifyIncA(List<COTSParticleClr> parts, string stdname, int steelTech, int type)
+        {
+            bool r = true;
+            if (type == -1)
+            {
+                if (stdname != "NoSTDDB" && stdname != "NoSTDDB.db")
+                {
+                    foreach (var part in parts)
+                    {
+                        part.SetBasicClassifyId((int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED);
+                        IClassifyEngine engine = m_classifyEngine.GetExpressionClassifyEngine(stdname);
+                        r = engine.ClassifyByExpression(part);
+
+
+                        if (part.GetBasicClassifyId() == (int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED)
+                        {
+
+                            engine = m_classifyEngine.GetIncClassifyEngine();
+                            r = engine.ClassifyIncA(part, steelTech);
+
+                        }
+
+                    }
+
+                }
+                else
+                {
+                    foreach (var part in parts)
+                    {
+                        IClassifyEngine engine;
+                        engine = m_classifyEngine.GetIncClassifyEngine();
+                        r = engine.ClassifyIncA(part, steelTech);
+                    }
+                }
+            }
+            else if (type == 0)
+            {
+                foreach (var part in parts)
+                {
+                    IClassifyEngine engine;
+                    engine = m_classifyEngine.GetIncClassifyEngine();
+                    r = engine.ClassifyIncA(part, steelTech);
+                }
+            }
+            else if (type == 1 || type == 2 || type == 3 )
+            {
+                if (stdname != "NoSTDDB" && stdname != "NoSTDDB.db")
+                {
+                    foreach (var part in parts)
+                    {
+                        part.SetBasicClassifyId((int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED);
+                        IClassifyEngine engine = m_classifyEngine.GetExpressionClassifyEngine(stdname);
+                        r = engine.ClassifyByExpression(part);
+
+
+                        if (part.GetBasicClassifyId() == (int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED)
+                        {
+
+                            engine = m_classifyEngine.GetIncClassifyEngine();
+                            r = engine.ClassifyIncA(part, steelTech);
+
+                        }
+
+                    }
+
+                }
+                else
+                {
+                    foreach (var part in parts)
+                    {
+                        IClassifyEngine engine;
+                        engine = m_classifyEngine.GetIncClassifyEngine();
+                        r = engine.ClassifyIncA(part, steelTech);
+                    }
+                }
+            }
+
+            return r;
+        }
+        public static bool ClassifyCleannessA(List<COTSParticleClr> parts, string stdname)
+        {
+            bool r = true;
+            IClassifyEngine engine;
+            engine = m_classifyEngine.GetExpressionClassifyEngine(stdname);
+            if (stdname != "NoSTDDB")
+            {
+                foreach (var p in parts)
+                {
+
+                    r = engine.ClassifyByExpression(p);
+                }
+
+            }
+
+
+            return true;
+
+        }
+
+    }
+}