Exemplo n.º 1
0
    public void create_cell_test_file(DataTable dt, string file_type, EDA_FILE_LCM_CELL _EDA_FILE_LCM_CELL)
    {
        DataTable dt_chip = new DataTable();
        DataView  dv      = new DataView();

        dv = dt.DefaultView;

        dt_chip = dv.ToTable(true, "CELL_CHIP_ID", "STEP_ID", "STARTTIME", "OPERATION_MODE");
        DataTable dt_index_chip_id = new DataTable();


        for (int i = 0; i <= dt_chip.Rows.Count - 1; i++)
        {
            //di = new DirectoryInfo(Server.MapPath(".") + "\\RUN_LOG\\" ); //DateTime.Now.ToString("yyyyMMdd")
            di = new DirectoryInfo(HttpContext.Current.Server.MapPath(".") + "//FILE//T1CELL//" + DateTime.Now.ToString("yyyyMMdd") + "//"); //DateTime.Now.ToString("yyyyMMdd")
            //fi = new FileInfo(Server.MapPath(".") + "\\RUN_LOG\\" + DateTime.Now.ToString("yyyyMMdd") + "\\" + DateTime.Now.ToString("yyyyMMdd") + ".log");
            fi = new FileInfo(HttpContext.Current.Server.MapPath(".") + "//FILE//T1CELL//" + DateTime.Now.ToString("yyyyMMdd") + "//" + dt_chip.Rows[i]["CELL_CHIP_ID"] + "_" + dt_chip.Rows[i]["STEP_ID"] + "_" + dt_chip.Rows[i]["OPERATION_MODE"] + "." + file_type);

            if (!di.Exists)
            {
                di.Create();//目錄不存在 產生目錄
            }
            if (fi.Exists == true)
            {
                //檔案存在 寫檔案
                //sw = File.AppendText(Server.MapPath(".") + "\\RUN_LOG\\" + DateTime.Now.ToString("yyyyMMdd") + ".log");
                sw = File.AppendText(HttpContext.Current.Server.MapPath(".") + "//FILE//T1CELL//" + DateTime.Now.ToString("yyyyMMdd") + "//" + dt_chip.Rows[i]["CELL_CHIP_ID"] + "_" + dt_chip.Rows[i]["STEP_ID"] + "_" + dt_chip.Rows[i]["OPERATION_MODE"] + "." + file_type);
            }
            else
            {
                sw = fi.CreateText(); //檔案不存在 產生檔案
            }



            dv.RowFilter = "CELL_CHIP_ID='" + dt_chip.Rows[i]["CELL_CHIP_ID"].ToString() + "'" + " and STEP_ID='" + dt_chip.Rows[i]["STEP_ID"].ToString() + "'";
            dv.Sort      = "STARTTIME";

            dt_index_chip_id = dv.ToTable();

            string aaa          = "";
            string DEFECT_COUNT = "";

            for (int j = 0; j <= dt_index_chip_id.Rows.Count - 1; j++)
            {
                #region initial data

                _EDA_FILE_LCM_CELL.CELL_CHIP_ID = dt_index_chip_id.Rows[j]["CELL_CHIP_ID"].ToString();

                _EDA_FILE_LCM_CELL.STEP_ID = dt_index_chip_id.Rows[j]["STEP_ID"].ToString();

                _EDA_FILE_LCM_CELL.SOURCE_CARRIER_ID = dt_index_chip_id.Rows[j]["SOURCE_CARRIER_ID"].ToString();

                _EDA_FILE_LCM_CELL.EQUIP_ID = dt_index_chip_id.Rows[j]["EQUIP_ID"].ToString();

                _EDA_FILE_LCM_CELL.SPEC_FLAG = dt_index_chip_id.Rows[j]["SPEC_FLAG"].ToString();

                _EDA_FILE_LCM_CELL.OPERATION_MODE = dt_index_chip_id.Rows[j]["OPERATION_MODE"].ToString();

                _EDA_FILE_LCM_CELL.SPEC1_FLAG = dt_index_chip_id.Rows[j]["SPEC1_FLAG"].ToString();

                _EDA_FILE_LCM_CELL.TACT_TIME = dt_index_chip_id.Rows[j]["TACT_TIME"].ToString();

                _EDA_FILE_LCM_CELL.SPEC2_FLAG = dt_index_chip_id.Rows[j]["SPEC2_FLAG"].ToString();

                _EDA_FILE_LCM_CELL.STARTTIME = dt_index_chip_id.Rows[j]["STARTTIME"].ToString();

                _EDA_FILE_LCM_CELL.ENDTIME = dt_index_chip_id.Rows[j]["ENDTIME"].ToString();

                _EDA_FILE_LCM_CELL.OPERATOR_ID = dt_index_chip_id.Rows[j]["OPERATOR_ID"].ToString();

                _EDA_FILE_LCM_CELL.SPEC3_FLAG = dt_index_chip_id.Rows[j]["SPEC3_FLAG"].ToString();

                DEFECT_COUNT = String.Format("{0:000}", dt_index_chip_id.Rows.Count); // 輸出 0001

                _EDA_FILE_LCM_CELL.DEFECT_COUNT = DEFECT_COUNT;

                _EDA_FILE_LCM_CELL.SPEC4_FLAG = dt_index_chip_id.Rows[j]["SPEC4_FLAG"].ToString();

                _EDA_FILE_LCM_CELL.BATCH_ID = dt_index_chip_id.Rows[j]["BATCH_ID"].ToString();

                _EDA_FILE_LCM_CELL.SPEC5_FLAG = dt_index_chip_id.Rows[j]["SPEC5_FLAG"].ToString();


                _EDA_FILE_LCM_CELL.SPEC6_FLAG = dt_index_chip_id.Rows[j]["SPEC6_FLAG"].ToString();

                _EDA_FILE_LCM_CELL.SPEC7_FLAG = dt_index_chip_id.Rows[j]["SPEC7_FLAG"].ToString();

                _EDA_FILE_LCM_CELL.SPEC8_FLAG = dt_index_chip_id.Rows[j]["SPEC8_FLAG"].ToString();

                _EDA_FILE_LCM_CELL.SPEC9_FLAG = dt_index_chip_id.Rows[j]["SPEC9_FLAG"].ToString();

                _EDA_FILE_LCM_CELL.SPEC10_FLAG = dt_index_chip_id.Rows[j]["SPEC10_FLAG"].ToString();

                _EDA_FILE_LCM_CELL.SPEC11_FLAG = dt_index_chip_id.Rows[j]["SPEC11_FLAG"].ToString();

                _EDA_FILE_LCM_CELL.SPEC12_FLAG = dt_index_chip_id.Rows[j]["SPEC12_FLAG"].ToString();

                //aaa = Convert.ToString(j + 1);



                aaa = String.Format("{0:000}", j + 1); // 輸出 0001

                _EDA_FILE_LCM_CELL.DEFECT_SEQ_NO = aaa;

                _EDA_FILE_LCM_CELL.DEFECT_CODE = dt_index_chip_id.Rows[j]["DEFECT_CODE"].ToString();

                _EDA_FILE_LCM_CELL.S = dt_index_chip_id.Rows[j]["S"].ToString();

                _EDA_FILE_LCM_CELL.G = dt_index_chip_id.Rows[j]["G"].ToString();

                _EDA_FILE_LCM_CELL.DEFECT_COLOR = dt_index_chip_id.Rows[j]["DEFECT_COLOR"].ToString();

                _EDA_FILE_LCM_CELL.SPEC13_FLAG = dt_index_chip_id.Rows[j]["SPEC13_FLAG"].ToString();

                _EDA_FILE_LCM_CELL.DEFECT_NAME = dt_index_chip_id.Rows[j]["DEFECT_NAME"].ToString();

                _EDA_FILE_LCM_CELL.SPEC14_FLAG = dt_index_chip_id.Rows[j]["SPEC14_FLAG"].ToString();

                _EDA_FILE_LCM_CELL.SPEC15_FLAG = dt_index_chip_id.Rows[j]["SPEC15_FLAG"].ToString();


                _EDA_FILE_LCM_CELL.SPEC16_FLAG = dt_index_chip_id.Rows[j]["SPEC16_FLAG"].ToString();



                #endregion

                if (j == 0)
                {
                    //  1 Row
                    sw.WriteLine(_EDA_FILE_LCM_CELL.CELL_CHIP_ID + " " + _EDA_FILE_LCM_CELL.STEP_ID + " " + _EDA_FILE_LCM_CELL.SOURCE_CARRIER_ID);
                    //  2 Row
                    sw.WriteLine(_EDA_FILE_LCM_CELL.EQUIP_ID + " " + _EDA_FILE_LCM_CELL.SPEC_FLAG + " " + _EDA_FILE_LCM_CELL.OPERATION_MODE + " " + _EDA_FILE_LCM_CELL.SPEC1_FLAG + " " + _EDA_FILE_LCM_CELL.TACT_TIME + " " + _EDA_FILE_LCM_CELL.SPEC2_FLAG + " " + _EDA_FILE_LCM_CELL.STARTTIME + " " + _EDA_FILE_LCM_CELL.ENDTIME + " " + _EDA_FILE_LCM_CELL.OPERATOR_ID);

                    //  3 Row
                    sw.WriteLine(" ");

                    //  4 Row
                    sw.WriteLine(" ");
                    //  5 Row
                    sw.WriteLine(_EDA_FILE_LCM_CELL.SPEC3_FLAG + " " + _EDA_FILE_LCM_CELL.DEFECT_COUNT);

                    //  6 Row
                    sw.WriteLine(" ");
                    //  7 Row
                    sw.WriteLine(_EDA_FILE_LCM_CELL.SPEC4_FLAG + " " + _EDA_FILE_LCM_CELL.BATCH_ID);


                    //  8 Row
                    sw.WriteLine(" ");
                    //  9 Row
                    sw.WriteLine(" ");

                    //  10 Row
                    sw.WriteLine(" ");
                    //  11Row
                    sw.WriteLine(" ");

                    //  12 Row
                    sw.WriteLine(" ");

                    //  13 Row
                    sw.WriteLine(_EDA_FILE_LCM_CELL.SPEC5_FLAG);

                    //  14 Row
                    sw.WriteLine(_EDA_FILE_LCM_CELL.SPEC6_FLAG);

                    //  15 Row
                    sw.WriteLine(_EDA_FILE_LCM_CELL.SPEC7_FLAG);


                    //  16 Row
                    sw.WriteLine(_EDA_FILE_LCM_CELL.SPEC8_FLAG);


                    //  17 Row
                    sw.WriteLine(_EDA_FILE_LCM_CELL.SPEC9_FLAG);


                    //  18 Row
                    sw.WriteLine(_EDA_FILE_LCM_CELL.SPEC10_FLAG);


                    //  19 Row
                    sw.WriteLine(_EDA_FILE_LCM_CELL.SPEC11_FLAG);



                    //  20 Row
                    sw.WriteLine(_EDA_FILE_LCM_CELL.SPEC12_FLAG);
                }

                // Third Row   21~N
                sw.WriteLine(_EDA_FILE_LCM_CELL.DEFECT_SEQ_NO + " " + _EDA_FILE_LCM_CELL.DEFECT_CODE + " " + _EDA_FILE_LCM_CELL.S + " " + _EDA_FILE_LCM_CELL.G + " " + _EDA_FILE_LCM_CELL.DEFECT_COLOR + " " + _EDA_FILE_LCM_CELL.SPEC13_FLAG + " " + _EDA_FILE_LCM_CELL.DEFECT_NAME + " " + _EDA_FILE_LCM_CELL.SPEC14_FLAG);


                // last Row  Add  Finished symbol  '@'
                if (j == dt_index_chip_id.Rows.Count - 1)
                {
                    sw.WriteLine(_EDA_FILE_LCM_CELL.SPEC15_FLAG);

                    sw.WriteLine(" ");

                    sw.WriteLine(" ");

                    sw.WriteLine(_EDA_FILE_LCM_CELL.SPEC16_FLAG);
                }
            }
            sw.Close();
        }
    }
Exemplo n.º 2
0
    public void create_celltest_file_ini()
    {
        string test_step = "'6615','6630','6815','6830'";


        EDA_FILE_LCM_CELL _EDA_FILE_LCM_CELL = new EDA_FILE_LCM_CELL();


        sql_temp1 = @"

select 
        'Y'||substr(ot1.CELL_CHIP_ID,7,20) as CELL_CHIP_ID ,
       ot1.step_id,
       ot1.equip_id,
      
      
       RPAD(RTRIM(ot1.SOURCE_CARRIER_ID), 8, ' ') as SOURCE_CARRIER_ID,
       '******' as spec_flag,
       case when ot1.step_id ='6615' then 'OY'
            when ot1.step_id ='6620' then 'OL'
            when ot1.step_id ='6630' then 'OY'
            when ot1.step_id ='6815' then 'OY'
            when ot1.step_id ='6820' then 'OL'
            when ot1.step_id ='6830' then 'OY'
            else '**' end as OPERATION_MODE,
            
       '********' as SPEC1_FLAG,
       LPAD(LTRIM(round((case when (ot1.ENDTIME-ot1.STARTTIME)*24*60*60 >999 then 999
              else (ot1.ENDTIME-ot1.STARTTIME)*24*60*60 end),0)), 3, '0')  as TACT_TIME,
       '***' as SPEC2_FLAG,
       to_char(ot1.STARTTIME,'yyyyMMddHH24MISS') as STARTTIME,
        to_char(ot1.ENDTIME,'yyyyMMddHH24MISS') as ENDTIME,
        LPAD(LTRIM(ot1.OPERATOR_ID), 8, '0') as OPERATOR_ID,
       '**************** ** ****' as SPEC3_FLAG,
     
       '* **** **** ****' as SPEC4_FLAG,
       
       
       RPAD(RTRIM(ot1.Batch_Id), 20, ' ') as Batch_Id,
       '&' as SPEC5_FLAG,
       '>' as SPEC6_FLAG,
       '<' as SPEC7_FLAG,
       '{' as SPEC8_FLAG,
       '}' as SPEC9_FLAG,
       '[' as SPEC10_FLAG,
       ']' as SPEC11_FLAG,
       '%No Code Data  Gate  C RK Leve   ND  R PAT Defect Pattern Name  English Defect Name  CEDC Cell Re Eng Def Name JC BD Spare      Spare' as SPEC12_FLAG,
       substr(ot1.DEFECT_CODE,2,4) as DEFECT_CODE ,
       LPAD(LTRIM(ot1.S), 5, '0') as S,
       
       LPAD(LTRIM(ot1.G), 5, '0') as G,
        case when ot1.DEFECT_COLOR is null then '*'
             else ot1.DEFECT_COLOR end as DEFECT_COLOR ,
       '** ****** *** * *** ********************' as SPEC13_FLAG,
        RPAD(RTRIM(substr(ot1.DEFECT_NAME,0,20)), 20, ' ') as DEFECT_NAME,
       '**** ******************** **    ********** **********' as SPEC14_FLAG,
       '$N Cod STime Pattern Switch Name  Spare      Spare     ' as SPEC15_FLAG,
       '@' as SPEC16_FLAG,
      
       ot1.DEFECT_JUDGE_CODE,
       
      
       ot1.CT_DEFECT_CODE
       
       
  from (
        
        select t1.step_id,
                
                t1.EQUIP_ID,
                t1.Item2 as OPERATOR_ID,
                t1.Item3 as SOURCE_CARRIER_ID,
                case
                  when t1.Date_Item1 is null then
                   t1.COMPONENT_START_TIME
                  else
                   t1.Date_Item1
                end STARTTIME,
                
                t1.COMPONENT_START_TIME as ENDTIME,
                t1.Batch_Id,
                t2.chip_id as CELL_CHIP_ID,
                t2.s as S,
                t2.g as G,
                t2.Item1 as DEFECT_CODE,
                t2.Item3 as DEFECT_JUDGE_CODE,
                t2.Item4 as DEFECT_NAME,
                t2.Item5 as DEFECT_COLOR,
                t2.Item51 as CT_DEFECT_CODE
        
          from lcdsys.cell_component_t t1, lcdsys.cell_defect_t t2
         where t1.step_id in ( {2})
              
             and t1.component_START_TIME >=to_date('{0}', 'yyyyMMddHH24') 
             and t1.component_START_TIME<to_date('{1}', 'yyyyMMddHH24')
           and t1.component_id = t2.component_id
           and t1.step_id = t2.step_id
           and t1.component_start_time = t2.component_start_time
          
        
        ) ot1
        


";
        //sql_temp1 = string.Format(sql_temp1, yesturday_shiftday, today_shiftday);


        sql_temp1 = sql_temp1.Replace("{0}", yesturday_shiftday).Replace("{1}", today_shiftday).Replace("{2}", test_step);



        //OracleCommand cmd = new OracleCommand(sql_temp1, orcn);
        //OracleDataAdapter da=new OracleDataAdapter(cmd);
        //DataSet ds=new DataSet();
        //da.Fill(ds,"test");
        create_cell_test_file(func.get_dataSet_access_oracle_client(sql_temp1, conn).Tables[0], "txt", _EDA_FILE_LCM_CELL);

        GridView2.DataSource = func.get_dataSet_access_oracle_client(sql_temp1, conn);
        GridView2.DataBind();

        System.Diagnostics.Process.Start(Server.MapPath("winrar.exe"), " a -ep " + Server.MapPath(".") + "//FILE//T1CELL//" + DateTime.Now.ToString("yyyyMMdd") + ".zip" + " " + Server.MapPath(".") + "//FILE//T1CELL//" + DateTime.Now.ToString("yyyyMMdd"));
    }