private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { string ErrorMessage = ""; if (e.KeyChar == 13) { ///將機台TRID輸入,創建一個物件 NowProductInfo = new QisdaTool.ProductInfo(textBox1.Text); ///資料庫連線檢查 if (Accsess.DataBaseConnectCheck(out ErrorMessage) == false) { MessageBox.Show(ErrorMessage, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ///抓取機台產品訊息(將剛刷入的TRID進資料庫抓取相對應的機台資訊(包含ModelName,料號,工廠流線ID號碼)) if (Accsess.CheckTRID(textBox1.Text, ref NowProductInfo, out ErrorMessage) == true) { lab_Model.Text = NowProductInfo.ModelName; ///Model Name lab_PN.Text = NowProductInfo.PartNo; ///料號 lab_ID.Text = NowProductInfo.ID; ///工廠流線ID號碼 lab_TRID.Text = textBox1.Text.ToUpper().Trim(); ///TRID號碼 } else { MessageBox.Show(ErrorMessage, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ///資料上傳範例如下 /// //if (Accsess.InsertTestResultRecord(NowProductInfo, "ASMDL", "FX3DL", "PASS", "PASS", "0.0.1", "0.1.0", "1.003", "20160122", "191030", out ErrorMessage) != true) //{ // ///上傳資料失敗 // MessageBox.Show(ErrorMessage, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} ///取PCBA ID範例如下 /// if (Accsess.GetPCBAIDandSN(textBox1.Text, ref ApolloPCBAInfo, Application.StartupPath + "\\QisdaToolPara.ini", out ErrorMessage) == false) { MessageBox.Show(ErrorMessage, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } ///上傳過站資訊 當站全部測項都完成後 判斷此站別是PASS or Fail /// ///NG==>QisdaTool.StationTestResult.NG if (Accsess.InsertStationShopfloorData(textBox1.Text, "ASML", QisdaTool.StationTestResult.NG, Application.StartupPath + "\\QisdaToolPara.ini", out ErrorMessage) == false) { MessageBox.Show(ErrorMessage, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } ///上傳過站資訊 當站全部測項都完成後 判斷此站別是PASS or Fail /// ///PASS ==>QisdaTool.StationTestResult.GOOD if (Accsess.InsertStationShopfloorData(textBox1.Text, "ASML", QisdaTool.StationTestResult.GOOD, Application.StartupPath + "\\QisdaToolPara.ini", out ErrorMessage) == false) { MessageBox.Show(ErrorMessage, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
protected void Button4_Click(object sender, EventArgs e) { string CurrDir = System.IO.Directory.GetCurrentDirectory(); string DBDLLFilePath = CurrDir + "\\QisdaDLL\\QisdaToolPara.ini"; if (File.Exists(DBDLLFilePath) == false) { // textBox1.BackColor = Color.Pink; Label3.Text = "ERROR: DB DLL isn't exist."; } string stmp = "N19892460704112815"; string ErrorMessage = ""; ///將機台TRID輸入,創建一個物件 NowProductInfo = new QisdaTool.ProductInfo(stmp); ///資料庫連線檢查 if (Accsess.DataBaseConnectCheck(out ErrorMessage) == false) { string stmp1 = "error"; //MessageBox.Show(ErrorMessage, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ///取PCBA ID範例如下 /// if (Accsess.GetPCBAIDandSN(stmp, ref ApolloPCBAInfo, DBDLLFilePath, out ErrorMessage) == false) { string stmp2 = "error"; //MessageBox.Show(ErrorMessage, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } // string CurrDir = System.IO.Directory.GetCurrentDirectory(); //string DBDLLFilePath = CurrDir + "\\QisdaDLL\\QisdaTool.dll"; if (File.Exists(DBDLLFilePath) == false) { // textBox1.BackColor = Color.Pink; Label3.Text = "ERROR: DB DLL isn't exist."; } string m_str_DB_Server; string m_str_DB_Account; string m_str_DB_Password; bool isOk = true; string Msg = ""; string sText = ""; sText += ""; IntPtr pDll = NativeMethods.LoadLibrary(@DBDLLFilePath); //oh dear, error handling here //if (pDll == IntPtr.Zero) IntPtr pAddressOfFunctionToCall1 = NativeMethods.GetProcAddress(pDll, "ProductInfoAccess"); IntPtr pAddressOfFunctionToCall = NativeMethods.GetProcAddress(pDll, "PCBAInfo"); //public bool GetPCBAIDandSN(string ApolloTRID, ref List<PCBAInfo> PCBAInfoList, string ApplicationPath, out string ErrorMessage) //Accsess = new QisdaTool.ProductInfoAccess(m_str_DB_Server, m_str_DB_Account, m_str_DB_Password); //isOk = Accsess.DataBaseConnectCheck(out Msg); //break; //string sTmp = DecodeAndDecrypt(LKEY0.Text); // LKEY1.Text = DecodeAndDecrypt(LKEY.Text); // DllImport("msvcrt.dll"); }