示例#1
0
        public override int Write(BinaryWriter bw)
        {
            bw.Write(Convert.ToUInt16(STDFRecordType.TSR));
            bw.Write(this.HEAD_NUM);
            bw.Write(this.SITE_NUM);
            bw.Write(this.TEST_TYP);
            bw.Write(this.TEST_NUM);
            bw.Write(this.EXEC_CNT);
            bw.Write(this.FAIL_CNT);
            bw.Write(this.ALRM_CNT);
            base.WriteString(bw, this.TEST_NAM);
            base.WriteString(bw, this.SEQ_NAME);
            base.WriteString(bw, this.TEST_LBL);
            uint num = (uint)~this.OPT_FLAG;

            num &= 0xff;
            byte b = Convert.ToByte(num);

            if (b != 0)
            {
                bw.Write(this.OPT_FLAG);
                bw.Write(this.TEST_TIM);
                b = STDFManager.SetBit(b, 2, false);
                if (b == 0)
                {
                    return(0);
                }
                bw.Write(this.TEST_MIN);
                b = STDFManager.SetBit(b, 0, false);
                if (b == 0)
                {
                    return(0);
                }
                bw.Write(this.TEST_MAX);
                b = STDFManager.SetBit(b, 1, false);
                if (b == 0)
                {
                    return(0);
                }
                bw.Write(this.TST_SUMS);
                if (STDFManager.SetBit(b, 4, false) == 0)
                {
                    return(0);
                }
                bw.Write(this.TST_SQRS);
            }
            return(0);
        }
示例#2
0
 public PRRRecord() : base(STDFRecordType.PRR)
 {
     this.PART_FLG = 0;
     this.PART_FLG = STDFManager.SetBit(this.PART_FLG, 4, true);
 }
示例#3
0
        public override int Write(BinaryWriter bw)
        {
            bw.Write(Convert.ToUInt16(STDFRecordType.PTR));
            bw.Write(this.TEST_NUM);
            bw.Write(this.HEAD_NUM);
            bw.Write(this.SITE_NUM);
            bw.Write(this.TEST_FLG);
            bw.Write(this.PARM_FLG);
            bw.Write(this.RESULT);
            base.WriteString(bw, this.TEST_TXT);
            base.WriteString(bw, this.ALARM_ID);
            byte b = (byte)~this.OPT_FLAG;

            if (STDFManager.GetBit(b, 4))
            {
                b = STDFManager.SetBit(b, 6, true);
            }
            if (STDFManager.GetBit(b, 6))
            {
                b = STDFManager.SetBit(b, 4, true);
            }
            if (STDFManager.GetBit(b, 5))
            {
                b = STDFManager.SetBit(b, 7, true);
            }
            if (STDFManager.GetBit(b, 7))
            {
                b = STDFManager.SetBit(b, 5, true);
            }
            byte num2 = 0;

            if (this.UNITS.Length != 0)
            {
                num2 = STDFManager.SetBit(num2, 0, true);
            }
            if (this.C_RESFMT.Length != 0)
            {
                num2 = STDFManager.SetBit(num2, 1, true);
            }
            if (this.C_LLMFMT.Length != 0)
            {
                num2 = STDFManager.SetBit(num2, 2, true);
            }
            if (this.C_HLMFMT.Length != 0)
            {
                num2 = STDFManager.SetBit(num2, 3, true);
            }
            bw.Write(this.OPT_FLAG);
            if ((b != 0) || (num2 != 0))
            {
                bw.Write(this.RES_SCAL);
                b = STDFManager.SetBit(b, 0, false);
                if ((b == 0) && (num2 == 0))
                {
                    return(0);
                }
                bw.Write(this.LLM_SCAL);
                b = STDFManager.SetBit(b, 4, false);
                if ((b == 0) && (num2 == 0))
                {
                    return(0);
                }
                bw.Write(this.HLM_SCAL);
                b = STDFManager.SetBit(b, 5, false);
                if ((b == 0) && (num2 == 0))
                {
                    return(0);
                }
                bw.Write(this.LO_LIMIT);
                b = STDFManager.SetBit(b, 6, false);
                if ((b == 0) && (num2 == 0))
                {
                    return(0);
                }
                bw.Write(this.HI_LIMIT);
                b = STDFManager.SetBit(b, 7, false);
                if ((b == 0) && (num2 == 0))
                {
                    return(0);
                }
                base.WriteString(bw, this.UNITS);
                num2 = STDFManager.SetBit(num2, 0, false);
                if ((b == 0) && (num2 == 0))
                {
                    return(0);
                }
                base.WriteString(bw, this.C_RESFMT);
                num2 = STDFManager.SetBit(num2, 1, false);
                if ((b == 0) && (num2 == 0))
                {
                    return(0);
                }
                base.WriteString(bw, this.C_LLMFMT);
                num2 = STDFManager.SetBit(num2, 2, false);
                if ((b == 0) && (num2 == 0))
                {
                    return(0);
                }
                base.WriteString(bw, this.C_HLMFMT);
                num2 = STDFManager.SetBit(num2, 3, false);
                if ((b == 0) && (num2 == 0))
                {
                    return(0);
                }
                bw.Write(this.LO_SPEC);
                if (STDFManager.SetBit(b, 2, false) == 0)
                {
                    return(0);
                }
                bw.Write(this.HI_SPEC);
            }
            return(0);
        }
示例#4
0
        }//end of GetDataFromTxt MultiFile

        ///<summary>
        ///<para>Parse test data from LTX std test result in to datatable</para>
        ///<seealso cref="DataParse.GetDataFromTxt"/>
        ///</summary>
        /// <param name="fileName">Full patch with file name of the std file</param>
        /// <returns>DataTable</returns>
        public DataTable GetDataFromStd(string fileName)
        {
            #region *** Variable define ***
            DateTime dtStart;
            TimeSpan ts;

            DataRow dr;
            DataTable DataParseResult = new DataTable();
            StringBuilder sbData1 = new StringBuilder();
            StringBuilder sbData2 = new StringBuilder();

            StringBuilder sbColumnName = new StringBuilder("Device#,1,2,3,4");
            StringBuilder sbParameter = new StringBuilder("Test Item,Site No,Soft Bin,Hard Bin,Device ID");
            StringBuilder sbLowLimit = new StringBuilder("Low Limit,,,,");
            StringBuilder sbHighLimit = new StringBuilder("High Limit,,,,");
            StringBuilder sbUnits = new StringBuilder("Units,,,,");

            bool isLimitSet = false;
            int ParameterLength = 0;
            int intColumnLength = 0;
            int intDeviceCounter = 1;
            int i;

            string PassFail1, PassFail2;


            #endregion *** Variable define ***

            #region *** Initialize properties ***
            m_FreezeColumn = 5;
            m_ParseTime = 0;
            m_InsertTime = 0;
            m_TestedDevice = 0;
            m_PassedDevice = 0;
            m_FailedDevice = 0;
            m_Header = new DataHeader();
            m_Bin = new Bin();
            m_Bin.DeviceCount = new int[8];
            m_Bin.Name = new string[8];
            m_Bin.Number = new int[8];
            m_Bin.Percent = new double[8];

            m_Header.SessionCount = 0;

            #endregion *** Initialize properties ***

            //Timer session
            dtStart = DateTime.Now;

            STDFManager stdf = new STDFManager(STDFFileMode.Read, fileName);
            STDFRecord lineRecord = null;
            //sbData.Append(intDeviceCounter);
            while ((lineRecord = stdf.ReadRecord()) != null)
            {
                #region --- STDF File Version Check ---
                //STDF file version
                if (lineRecord.RECORD_TYPE == STDFRecordType.FAR)
                {
                    int stdf_ver = int.Parse(((FARRecord)lineRecord).STDF_VER.ToString());
                    if (stdf_ver != 4) throw new Exception("Datalog is not in STDF_V4 fromat");
                }
                #endregion --- STDF File Version Check ---

                #region --- Datalog Header Information ---
                // Lot information
                if (lineRecord.RECORD_TYPE == STDFRecordType.MIR)
                {
                    string temp = ((MIRRecord)lineRecord).JOB_NAM;
                    this.GetProgramNameRev(temp);

                    m_Header.SessionCount++;

                    m_Header.enVision_Version = ((MIRRecord)lineRecord).EXEC_VER;
                    m_Header.LotID = ((MIRRecord)lineRecord).LOT_ID;
                    m_Header.Tester = ((MIRRecord)lineRecord).NODE_NAM;
                    m_Header.DeviceName = ((MIRRecord)lineRecord).PART_TYP;
                    m_Header.SubLotID = ((MIRRecord)lineRecord).SBLOT_ID;
                    m_Header.LotStartDateTime = ((MIRRecord)lineRecord).START_T;
                    m_Header.TesterType = ((MIRRecord)lineRecord).TSTR_TYP;
                }

                if (lineRecord.RECORD_TYPE == STDFRecordType.MRR)
                {
                    m_Header.LotFinishDateTime = ((MRRRecord)lineRecord).FINISH_T;
                    m_Header.LotDesc = ((MRRRecord)lineRecord).USR_DESC;
                }
                // Device Count
                if (lineRecord.RECORD_TYPE == STDFRecordType.PCR)
                {
                    m_TestedDevice = m_Header.TestQuantity = (int)((PCRRecord)lineRecord).PART_CNT;
                    m_PassedDevice = m_Header.PassQuantity = (int)((PCRRecord)lineRecord).GOOD_CNT;
                    m_FailedDevice = m_Header.FailQuantity = m_Header.TestQuantity - m_Header.PassQuantity;
                    //Yield
                    double yield = Convert.ToDouble(m_Header.PassQuantity) / Convert.ToDouble(m_Header.TestQuantity) * 100;
                    m_Header.Yield = Math.Round(yield, 2);
                }
                #endregion Datalog header information

                try
                {
                    #region --- Device Test Result ---
                    while (lineRecord.RECORD_TYPE == STDFRecordType.PTR)
                    {
                        #region -- Parse PTR Data From STD File --
                        if (!isLimitSet)
                        {
                            if (((PTRRecord)lineRecord).UNITS.ToLower() == "s" && ((PTRRecord)lineRecord).SITE_NUM == 1)
                            {
                                sbColumnName.Append("," + ((PTRRecord)lineRecord).TEST_NUM);
                                sbParameter.Append("," + ParameterParse(((PTRRecord)lineRecord).TEST_TXT));
                                sbLowLimit.Append("," + Math.Round(((PTRRecord)lineRecord).LO_LIMIT * 1000, 3));
                                sbHighLimit.Append("," + Math.Round(((PTRRecord)lineRecord).HI_LIMIT * 1000, 3));
                                sbUnits.Append(",m" + ((PTRRecord)lineRecord).UNITS);
                            }
                            else if (((PTRRecord)lineRecord).SITE_NUM == 1)
                            {
                                sbColumnName.Append("," + ((PTRRecord)lineRecord).TEST_NUM);
                                sbParameter.Append("," + ParameterParse(((PTRRecord)lineRecord).TEST_TXT));
                                sbLowLimit.Append("," + ResultScale(((PTRRecord)lineRecord).LO_LIMIT, ((PTRRecord)lineRecord).RES_SCAL));
                                sbHighLimit.Append("," + ResultScale(((PTRRecord)lineRecord).HI_LIMIT, ((PTRRecord)lineRecord).RES_SCAL));
                                sbUnits.Append("," + UnitScale(((PTRRecord)lineRecord).UNITS, ((PTRRecord)lineRecord).RES_SCAL));
                            }
                        }

                        if (((PTRRecord)lineRecord).SITE_NUM == 1)
                        {
                            if (((PTRRecord)lineRecord).UNITS.ToLower() == "s")
                                sbData1.Append("," + Math.Round(((PTRRecord)lineRecord).RESULT * 1000, 3));
                            else
                                sbData1.Append("," + ResultScale(((PTRRecord)lineRecord).RESULT, ((PTRRecord)lineRecord).RES_SCAL));
                        }
                        else if (((PTRRecord)lineRecord).SITE_NUM == 2)
                        {
                            if (((PTRRecord)lineRecord).UNITS.ToLower() == "s")
                                sbData2.Append("," + Math.Round(((PTRRecord)lineRecord).RESULT * 1000, 3));
                            else
                                sbData2.Append("," + ResultScale(((PTRRecord)lineRecord).RESULT, ((PTRRecord)lineRecord).RES_SCAL));

                        }

                        lineRecord = stdf.ReadRecord();     //jump to PRR

                        #endregion -- Parse ptr data from std file --

                        while (lineRecord.RECORD_TYPE == STDFRecordType.PRR)
                        {
                            #region -- Parse PRR Data From STD File --
                            // Parse Site#1 PRR Data
                            if (((PRRRecord)lineRecord).SITE_NUM == 1)
                            {
                                if (((PRRRecord)lineRecord).PartPassed)
                                    PassFail1 = "Pass";
                                else
                                    PassFail1 = "Fail";
                                sbData1.Append("," + PassFail1);

                                sbData1.Insert(0, intDeviceCounter + "," + ((PRRRecord)lineRecord).SITE_NUM.ToString()
                                                                   + "," + ((PRRRecord)lineRecord).SOFT_BIN.ToString()
                                                                   + "," + ((PRRRecord)lineRecord).HARD_BIN.ToString()
                                                                   + "," + ((PRRRecord)lineRecord).PART_ID.ToString());

                            }
                            else // Parse Site#2 PRR Data
                            {
                                if (((PRRRecord)lineRecord).PartPassed)
                                    PassFail2 = "Pass";
                                else
                                    PassFail2 = "Fail";
                                sbData2.Append("," + PassFail2);

                                sbData2.Insert(0, intDeviceCounter + "," + ((PRRRecord)lineRecord).SITE_NUM.ToString()
                                                                   + "," + ((PRRRecord)lineRecord).SOFT_BIN.ToString()
                                                                   + "," + ((PRRRecord)lineRecord).HARD_BIN.ToString()
                                                                   + "," + ((PRRRecord)lineRecord).PART_ID.ToString());

                            }
                            #endregion -- Parse prrdata from std file --

                            #region -- Build Datatable and Insert limit info --
                            if (!isLimitSet)
                            {
                                ParameterLength = ((PRRRecord)lineRecord).NUM_TEST;
                                intColumnLength = ParameterLength + 6;
                                // Build Data Table
                                sbColumnName.Append(",*");
                                string[] ColumnName = sbColumnName.ToString().Split(',');
                                for (i = 0; i < ColumnName.Length; i++)
                                {
                                    DataParseResult.Columns.Add(new DataColumn(ColumnName[i], typeof(string)));
                                }
                                //Insert Parameter 
                                string[] Parameter = sbParameter.ToString().Split(',');
                                dr = DataParseResult.NewRow();
                                for (i = 0; i < intColumnLength - 1; i++)
                                {
                                    dr[i] = Parameter[i];
                                }
                                dr[i] = "Status";
                                DataParseResult.Rows.Add(dr);

                                //Insert Units  
                                string[] Units = sbUnits.ToString().Split(',');
                                dr = DataParseResult.NewRow();
                                for (i = 0; i < intColumnLength - 1; i++)
                                {
                                    dr[i] = Units[i];
                                }
                                DataParseResult.Rows.Add(dr);

                                //Insert Low Limit  
                                string[] LowLimit = sbLowLimit.ToString().Split(',');
                                dr = DataParseResult.NewRow();

                                for (i = 0; i < intColumnLength - 1; i++)
                                {
                                    dr[i] = LowLimit[i];
                                }
                                DataParseResult.Rows.Add(dr);

                                //Insert High Limit
                                string[] HighLimit = sbHighLimit.ToString().Split(',');
                                dr = DataParseResult.NewRow();

                                for (i = 0; i < intColumnLength - 1; i++)
                                {
                                    dr[i] = HighLimit[i];
                                }
                                DataParseResult.Rows.Add(dr);

                                isLimitSet = true;
                            }
                            #endregion Build Datatable

                            #region -- Insert Test Data Result --
                            string[] Data;
                            //Insert site#1 Test Data Result
                            if (((PRRRecord)lineRecord).SITE_NUM == 1)
                            {
                                Data = sbData1.ToString().Split(',');
                            }
                            else //Insert site#2 Test Data Result
                            {
                                Data = sbData2.ToString().Split(',');
                            }

                            dr = DataParseResult.NewRow();

                            int j = intColumnLength;
                            if (Data.Length < j) j = Data.Length;

                            for (i = 0; i < j; i++)
                            {
                                dr[i] = Data[i];
                            }
                            DataParseResult.Rows.Add(dr);
                            #endregion Insert Test Data Result

                            #region -- Next Device --
                            if (((PRRRecord)lineRecord).SITE_NUM == 1)
                                sbData1 = new StringBuilder();
                            else
                                sbData2 = new StringBuilder();

                            intDeviceCounter++;

                            if ((lineRecord = stdf.ReadRecord()).RECORD_TYPE == STDFRecordType.PIR)     //jump to PIR
                            {
                                lineRecord = stdf.ReadRecord();     //jump to PTR
                            }

                            #endregion -- Next Device --
                        }
                    }

                    #endregion --- Device Test Result ---
                }
                catch (Exception ex)
                {
                    throw new Exception("Parse Data Error \r\n" + ex.Message);
                }
            }

            //Timer session
            ts = DateTime.Now - dtStart;
            ParseTime = ts.TotalMilliseconds;
            dtStart = DateTime.Now;

            DataParseResult.PrimaryKey = new DataColumn[] { DataParseResult.Columns[0] };
            return DataParseResult;
            //throw new Exception("ooops");
        }