Exemplo n.º 1
0
        internal string[] FindAllImageByBarcode(string barcode)
        {
            SearchFiles   search = new SearchFiles();
            List <string> pics   = search.FindImage(barcode);

            return(pics.ToArray());
        }
Exemplo n.º 2
0
        internal string[] searchImageByBarcode(string barcode)
        {
            string[]      paths  = new string[] { "", "", "" };
            List <string> pic_S1 = new List <string>();
            List <string> pic_S2 = new List <string>();
            List <string> pic_S3 = new List <string>();
            SearchFiles   search = new SearchFiles();

            pic_S1.AddRange(search.FindImage("主站" + barcode));
            pic_S2.AddRange(search.FindImage("从站" + barcode));
            foreach (string path in pic_S2)
            {
                if (path.Contains(GlobalVar.gl_key_Machine1_S3_TestResult) || path.Contains(GlobalVar.gl_key_Machine2_S3_TestResult) || path.Contains(GlobalVar.gl_key_Machine3_S3_TestResult))
                {
                    pic_S3.Add(path);
                }
            }
            foreach (string path in pic_S3)
            {
                if (pic_S2.Contains(path))
                {
                    pic_S2.Remove(path);
                }
            }
            if (pic_S1.Count > 1)
            {
                for (int j = 0; j < pic_S1.Count - 1; j++)
                {
                    if (pic_S1[j + 1] != "" && pic_S1[j] != "")
                    {
                        string   temp;
                        FileInfo file   = new FileInfo(pic_S1[j]);
                        FileInfo file_1 = new FileInfo(pic_S1[j + 1]);
                        if ((file.CreationTime - file_1.CreationTime).TotalDays > 0)
                        {
                            temp          = pic_S1[j];
                            pic_S1[j]     = pic_S1[j + 1];
                            pic_S1[j + 1] = temp;
                        }
                    }
                }
                if (pic_S1[pic_S1.Count - 1].Contains(DateTime.Now.ToString("yyyyMMdd")))//只查当天
                {
                    paths[0] = pic_S1[pic_S1.Count - 1];
                }
            }
            else if (pic_S1.Count == 1)
            {
                if (pic_S1[0].Contains(DateTime.Now.ToString("yyyyMMdd")))
                {
                    paths[0] = pic_S1[0];
                }
            }
            if (pic_S2.Count > 1)
            {
                for (int j = 0; j < pic_S2.Count - 1; j++)
                {
                    if (pic_S2[j + 1] != "" && pic_S2[j] != "")
                    {
                        string   temp;
                        FileInfo file   = new FileInfo(pic_S2[j]);
                        FileInfo file_1 = new FileInfo(pic_S2[j + 1]);
                        if ((file.CreationTime - file_1.CreationTime).TotalDays > 0)
                        {
                            temp          = pic_S2[j];
                            pic_S2[j]     = pic_S2[j + 1];
                            pic_S2[j + 1] = temp;
                        }
                    }
                }
                if (pic_S2[pic_S2.Count - 1].Contains(DateTime.Now.ToString("yyyyMMdd")))//只查当天
                {
                    paths[1] = pic_S2[pic_S2.Count - 1];
                }
            }
            else if (pic_S2.Count == 1)
            {
                if (pic_S2[0].Contains(DateTime.Now.ToString("yyyyMMdd")))
                {
                    paths[1] = pic_S2[0];
                }
            }
            if (pic_S3.Count > 1)
            {
                for (int j = 0; j < pic_S3.Count - 1; j++)
                {
                    if (pic_S3[j + 1] != "" && pic_S3[j] != "")
                    {
                        string   temp;
                        FileInfo file   = new FileInfo(pic_S3[j]);
                        FileInfo file_1 = new FileInfo(pic_S3[j + 1]);
                        if ((file.CreationTime - file_1.CreationTime).TotalDays > 0)
                        {
                            temp          = pic_S3[j];
                            pic_S3[j]     = pic_S3[j + 1];
                            pic_S3[j + 1] = temp;
                        }
                    }
                }
                if (pic_S3[pic_S3.Count - 1].Contains(DateTime.Now.ToString("yyyyMMdd")))//只查当天
                {
                    paths[2] = pic_S3[pic_S3.Count - 1];
                }
            }
            else if (pic_S3.Count == 1)
            {
                if (pic_S3[0].Contains(DateTime.Now.ToString("yyyyMMdd")))
                {
                    paths[2] = pic_S3[0];
                }
            }
            return(paths);
        }