Browse Source

add 1024 limit handle while doing batch process.

gsp 1 year ago
parent
commit
62d7702f2b
1 changed files with 65 additions and 2 deletions
  1. 65 2
      OTSIncAMeasureApp/ServiceCenter/EDSController.cs

+ 65 - 2
OTSIncAMeasureApp/ServiceCenter/EDSController.cs

@@ -170,10 +170,73 @@ namespace OTSModelSharp.ServiceCenter
                     }
                 }
             }
+           
+            int nSize = a_listParticles.Count;
+            if (nSize > 1024)
+            {
+                COTSParticleClr[] partsTemp = new COTSParticleClr[1024];
+                Point[] PsTemp = new Point[1024];
+
+                int nTimes = nSize / 1024;
+                for (int i = 0; i < nTimes; i++)
+                {
+                  
+                    for (int m = 0; m < 1024; m++)
+                    {
+                        partsTemp[m]=a_listParticles[i * 1024 + m];
+                        PsTemp[m] = Ps[i * 1024 + m];
+                    }
+
+                    if (!eds.GetXRayByPoints(a_nXRayAQTime, PsTemp, partsTemp, a_bElementInfo))
+                    {
+                        NLog.LogManager.GetCurrentClassLogger().Error("GetXRayByPoints: failed to get element.");
+                        return false;
+                    }
+
+                   
+                }
+
+                int nLast = nSize % 1024;
+                if (nLast != 0)
+                {
+                   
+                    COTSParticleClr[] lastParts = new COTSParticleClr[nLast];
+                    Point[] lastPs = new Point[nLast];
+                   
+                    for (int m = 0; m < nLast; m++)
+                    {
+                        
+                        lastParts[m] = a_listParticles[nTimes * 1024 + m];
+                        lastPs[m] = Ps[nTimes * 1024 + m];
+                    }
+
+                    if (!eds.GetXRayByPoints(a_nXRayAQTime, lastPs, lastParts, a_bElementInfo))
+                    {
+                        NLog.LogManager.GetCurrentClassLogger().Error("GetXRayByPoints: failed to get element.");
+                        return false;
+                    }                 
+
+                   
+
+                }
+
+
+            }
+            else 
+            {
+                COTSParticleClr[] parts = a_listParticles.ToArray();
+
+
+
+                result = eds.GetXRayByPoints(a_nXRayAQTime, Ps, parts, a_bElementInfo);
+
+
+
+            }
+           
+
 
-            COTSParticleClr[] parts = a_listParticles.ToArray();
 
-                result= eds.GetXRayByPoints(a_nXRayAQTime, Ps, parts, a_bElementInfo);
 
             if (result == true)
             {