using System; using System.Data; using System.Diagnostics; using System.IO; using Microsoft.VisualBasic.CompilerServices; using static iMESCore.DataBase.iMESSql; namespace AutoLoaderLib_Base { //調整行業包基底AutoLoaderLib_Base將原有EPIParseTemplate, ParseNEL, ParsePL, ParsePR, ParseQEL等類別進行下架處理 '//^_^ADD BY H-14278 2023-11-29 FOR //public class ParseNEL : EPIParseTemplate //{ // // 呼叫父類別的建構子 // public ParseNEL(string paramSourcePath, string paramDestinationPath, string paramQueuePath, string paramFailPath) : base(paramSourcePath, paramDestinationPath, paramQueuePath, paramFailPath) // { // } // /// // /// 設定暫存資料表的欄位 // /// // /// // /// // /// // internal override bool AddColumns(DataTable dt) // { // bool blnResult = false; // try // { // dt.Columns.Add("WaferID", Type.GetType("System.String")); // dt.Columns.Add("POS", Type.GetType("System.Decimal")); // dt.Columns.Add("LOP1", Type.GetType("System.Decimal")); // dt.Columns.Add("WLD1", Type.GetType("System.Decimal")); // dt.Columns.Add("VF1", Type.GetType("System.Decimal")); // blnResult = true; // } // catch (Exception ex) // { // throw; // } // return blnResult; // } // /// // /// 將暫存資料表寫入資料庫 // /// // /// // /// // /// // internal override bool InsertTable(DataTable dt) // { // bool blnResult = false; // string strSQL_Raw; // string strSQL_Avg; // string WaferID = ""; // decimal LOP1 = 0m; // decimal WLD1 = 0m; // decimal VF1 = 0m; // strSQL_Raw = " INSERT INTO TBL_LEDLD_EL_N_RAW " + " (WaferID, CreateDate, POS, LOP1, WLD1, VF1) " + " VALUES ('{0}', SYSDATE, {1}, {2}, {3}, {4}) "; // strSQL_Avg = " INSERT INTO TBL_LEDLD_EL_N " + " (WaferID, CreateDate, LOP1, WLD1, VF1) " + " VALUES ('{0}', SYSDATE, {1}, {2}, {3}) "; // try // { // using (var oTran = objConnection.BeginTransaction()) // { // try // { // using (var cmd = CreateCommand()) // { // cmd.Connection = objConnection; // cmd.Transaction = oTran; // if (dt.Rows.Count > 0) // { // for (int i = 0, loopTo = dt.Rows.Count - 1; i <= loopTo; i++) // { // cmd.CommandText = string.Format(strSQL_Raw, dt.Rows[i]["WaferID"], dt.Rows[i]["POS"], dt.Rows[i]["LOP1"], dt.Rows[i]["WLD1"], dt.Rows[i]["VF1"]); // cmd.ExecuteNonQuery(); // WaferID = Conversions.ToString(dt.Rows[i]["WaferID"]); // LOP1 = LOP1 + Convert.ToDecimal(dt.Rows[i]["LOP1"]); // WLD1 = WLD1 + Convert.ToDecimal(dt.Rows[i]["WLD1"]); // VF1 = VF1 + Convert.ToDecimal(dt.Rows[i]["VF1"]); // } // cmd.CommandText = string.Format(strSQL_Avg, WaferID, LOP1 / dt.Rows.Count, WLD1 / dt.Rows.Count, VF1 / dt.Rows.Count); // cmd.ExecuteNonQuery(); // } // } // oTran.Commit(); // blnResult = true; // } // catch (Exception ex) // { // oTran.Rollback(); // throw; // } // } // } // catch (Exception ex) // { // throw; // } // return blnResult; // } // /// // /// 解析資料, 並寫入暫存資料表 // /// // /// // /// // /// // /// // internal override bool ParsingFile(DataTable dt, string file) // { // bool blnResult = false; // DataRow dr = null; // string line; // string[] tmpData; // bool startParsing = false; // string WaferID; // try // { // // 檔名即為 WaferID // var fi = new FileInfo(file); // WaferID = fi.Name.Replace(fi.Extension, ""); // fi = null; // using (var sr = new StreamReader(file)) // { // do // { // line = sr.ReadLine(); // if (!string.IsNullOrEmpty(line)) // { // if (startParsing) // { // tmpData = line.Split(','); // dr = dt.NewRow(); // dr["WaferID"] = WaferID; // dr["POS"] = Convert.ToDecimal(tmpData[0].Trim()); // dr["LOP1"] = Convert.ToDecimal(tmpData[4].Trim()); // dr["WLD1"] = Convert.ToDecimal(tmpData[5].Trim()); // dr["VF1"] = Convert.ToDecimal(tmpData[3].Trim()); // dt.Rows.Add(dr); // } // else // { // Debug.Print(line); // if (line.IndexOf("PosX") >= 0 && line.IndexOf("PosY") >= 0) // { // startParsing = true; // } // } // } // } // while (!(line == null)); // blnResult = true; // } // } // catch (Exception ex) // { // throw; // } // finally // { // if (dr != null) // { // dr = null; // } // } // return blnResult; // } //} }