private static TestResultHistory SelectUseAllPcbaSN(string querySN, int pageIndex, int pageSize)
        {
            //List<string> pcbaList = new List<string>();
            DataSet           ds = new DataSet();
            TestResultHistory testResultHistory = new TestResultHistory();
            var selectSQL = $"select {DbTable.F_Test_Result.SN},{DbTable.F_Test_Result.PROCESS_NAME} " +
                            $"from {DbTable.F_TEST_RESULT_NAME} " +
                            $"order by {DbTable.F_Test_Result.STATION_IN_DATE} desc";
            int count   = 1;
            var pcbaLen = ReadPCBACodeLength();

            if (pcbaLen == 0)
            {
                pcbaLen = 16;
            }
            var shellLen = ReadShellCodeLength();

            if (querySN != "" && querySN != null)
            {
                TestResultHistory testResult = new TestResultHistory();
                testResult.PcbaSN        = querySN.Trim();
                testResult.ProductTypeNo = GetProductTypeNo(querySN);
                testResult.ShellCodeLen  = shellLen;
                testResult.PcbaCodeLen   = pcbaLen;
                SelectTestResultDetail1(testResult, count);

                testResultHistory.TestResultNumber = 1;
                ds.Tables.Add(testResultDataSource);
                testResultHistory.TestResultDataSet = ds;
                return(testResultHistory);
            }
            else
            {
                var dbReader = SQLServer.ExecuteDataReader(selectSQL);
                if (dbReader.HasRows)
                {
                    pcbaCacheList.Clear();
                    int i          = 0;
                    int startIndex = (pageIndex - 1) * pageSize;
                    while (dbReader.Read())
                    {
                        var pcbaSN = dbReader[0].ToString();
                        if (pcbaSN.Length == pcbaLen)
                        {
                            //是PCBA
                            var productTypeNo = dbReader[1].ToString();
                            TestResultHistory queryTestObj = new TestResultHistory();

                            queryTestObj.PcbaSN        = pcbaSN;
                            queryTestObj.ProductTypeNo = productTypeNo;
                            queryTestObj.ShellCodeLen  = shellLen;
                            queryTestObj.PcbaCodeLen   = pcbaLen;
                            var pcbaObj = pcbaCacheList.Find(m => m.PcbaSN == pcbaSN);
                            if (pcbaObj == null)
                            {
                                pcbaCacheList.Add(queryTestObj);
                                i++;
                            }
                        }
                    }
                    LogHelper.Log.Info("开始查询明细...");
                    //开始查询明细
                    int j = 0;
                    foreach (var pcbaItem in pcbaCacheList)
                    {
                        if (j >= startIndex && j < pageIndex * pageSize)
                        {
                            TestResultHistory testResult = new TestResultHistory();
                            testResult.PcbaSN        = pcbaItem.PcbaSN;
                            testResult.ProductTypeNo = pcbaItem.ProductTypeNo;
                            testResult.ShellCodeLen  = shellLen;
                            testResult.PcbaCodeLen   = pcbaLen;
                            SelectTestResultDetail1(testResult, count);
                            count++;
                        }
                        j++;
                    }
                    LogHelper.Log.Info("查询明细结束...");
                    ds.Tables.Add(testResultDataSource);
                    testResultHistory.TestResultNumber  = j;
                    testResultHistory.TestResultDataSet = ds;
                }
            }
            LogHelper.Log.Info("查询结束...");
            return(testResultHistory);
        }