private AfterLotEndResult SetQualityState(int stateNo, string lotNo) { AfterLotEndResult afterLotEndResult = new AfterLotEndResult(); afterLotEndResult.HasError = false; try { using (SqlCommand cmd = new SqlCommand()) { //cmd.Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DBxConnectionString"].ToString()); //cmd.CommandType = CommandType.StoredProcedure; //cmd.CommandText = "[atom].[sp_set_quality_state]"; //cmd.Parameters.Add("@lot_no", SqlDbType.VarChar).Value = lotNo; //cmd.Parameters.Add("@quality_state", SqlDbType.Int).Value = stateNo; //cmd.Connection.Open(); //cmd.ExecuteNonQuery(); //cmd.Connection.Close(); //SaveLogFile("", lotNo, "SetQualityState", "Pass", ""); } } catch (Exception ex) { afterLotEndResult.HasError = true; afterLotEndResult.ErrorMessage = ex.Message; SaveLogFile("", lotNo, "SetQualityState", "Fail", ex.Message); } return(afterLotEndResult); }
private void Button2_Click(object sender, EventArgs e) { ServiceReference1.ServiceControlCenterClient serviceClient = new ServiceControlCenterClient(); AfterLotEndEventArgs endEventArgs = new AfterLotEndEventArgs(); endEventArgs.LotNo = "1940A4125V"; endEventArgs.McNo = "FT-RAS-001"; endEventArgs.LotJudge = "FT_BIN19_AUTO3"; AfterLotEndResult result = serviceClient.AfterLotEnd(endEventArgs); }
/// <summary> /// /// </summary> /// <param name="e"></param> /// <returns></returns> public AfterLotEndResult AfterLotEnd(AfterLotEndEventArgs e) { AfterLotEndResult afterLotEndResult = new AfterLotEndResult(); afterLotEndResult.HasError = false; afterLotEndResult.WarningMessage = ""; SaveLogFile(e.McNo, e.LotNo, "AfterLotEnd", "NULL", "NULL"); if (e != null) { switch (e.LotJudge) { case "FT_BIN19_AUTO3": if (!string.IsNullOrEmpty(e.LotNo) && !string.IsNullOrEmpty(e.McNo)) { int? lotId = null; int? currentFlowId = null; string currentFlowName = ""; string currentAssyDevice = ""; DataTable currentDataTable = GetCurrentTranLot(e.LotNo, out lotId, out currentFlowName, out currentFlowId, out currentAssyDevice); if (IsGDICDevice(currentAssyDevice)) { //3:Hold //afterLotEndResult = SetQualityState(3, e.LotNo); // Flow pattern = 1500 DataRow row = currentDataTable.Rows[0]; int currentStepNo = (int)row["StepNo"]; afterLotEndResult = AddFtInspSpecialFlow(e.McNo, e.LotNo, e.LotJudge, currentFlowId, lotId, currentStepNo); } else { SaveLogFile(e.McNo, e.LotNo, e.LotJudge, "Fail", "Device : " + currentAssyDevice + " not GDIC"); } } break; case "LOW YIELD": //1501 case "IC BURN": //1502 if (!string.IsNullOrEmpty(e.LotNo) && !string.IsNullOrEmpty(e.McNo)) { int? lotId = null; int? currentFlowId = null; string currentFlowName = ""; string currentAssyDevice = ""; DataTable currentDataTable = GetCurrentTranLot(e.LotNo, out lotId, out currentFlowName, out currentFlowId, out currentAssyDevice); //3:Hold //afterLotEndResult = SetQualityState(3, e.LotNo); // Flow pattern = 1500 DataRow row = currentDataTable.Rows[0]; int currentStepNo = (int)row["StepNo"]; afterLotEndResult = AddFtInspSpecialFlow(e.McNo, e.LotNo, e.LotJudge, currentFlowId, lotId, currentStepNo); } break; case "ASIMode": //1666 if (!string.IsNullOrEmpty(e.LotNo) && !string.IsNullOrEmpty(e.McNo)) { int? lotId = null; int? currentFlowId = null; string currentFlowName = ""; string currentAssyDevice = ""; DataTable currentDataTable = GetCurrentTranLot(e.LotNo, out lotId, out currentFlowName, out currentFlowId, out currentAssyDevice); //3:Hold //afterLotEndResult = SetQualityState(3, e.LotNo); // Flow pattern = 1500 DataRow row = currentDataTable.Rows[0]; if (currentFlowName.Trim() == "AUTO(2)ASISAMPLE") { SaveLogFile(e.McNo, e.LotNo, "AfterLotEnd", "Fail", "This lot already in job[" + currentFlowId.ToString() + "] : " + currentFlowName); } else { int currentStepNo = (int)row["StepNo"]; afterLotEndResult = AddFtInspSpecialFlow(e.McNo, e.LotNo, e.LotJudge, currentFlowId, lotId, currentStepNo); } } break; case "INSP_ICBURN": case "INSP_LowYield": if (!string.IsNullOrEmpty(e.LotNo) && !string.IsNullOrEmpty(e.McNo)) { int? lotId = null; int? currentFlowId = null; string currentFlowName = ""; string currentAssyDevice = ""; DataTable currentDataTable = GetCurrentTranLot(e.LotNo, out lotId, out currentFlowName, out currentFlowId, out currentAssyDevice); DataRow row = currentDataTable.Rows[0]; int currentStepNo = (int)row["StepNo"]; afterLotEndResult = AddFtInspSpecialFlow(e.McNo, e.LotNo, e.LotJudge, currentFlowId, lotId, currentStepNo); } break; default: if (e.JobSpecialFlowId != null && !string.IsNullOrEmpty(e.LotNo) && !string.IsNullOrEmpty(e.McNo)) { if (e.McNo.Substring(0, 2) == "FT") { int? lotId = null; int? currentFlowId = null; string currentFlowName = ""; string currentAssyDevice = ""; DataTable currentDataTable = GetCurrentTranLot(e.LotNo, out lotId, out currentFlowName, out currentFlowId, out currentAssyDevice); if (currentFlowId != null) { if (IsGDICDevice(currentAssyDevice)) { if (currentFlowId != 142 && currentFlowId != 11 && currentFlowId != 266) { afterLotEndResult = AddFtInspSpecialFlow(e.McNo, e.LotNo, e.LotJudge, currentFlowId, lotId); } else { SaveLogFile(e.McNo, e.LotNo, "AfterLotEnd", "Fail", "This lot already in job[" + currentFlowId.ToString() + "] : " + currentFlowName); } } else { SaveLogFile(e.McNo, e.LotNo, "IsGDICDevice", "Fail", "Device : " + currentAssyDevice + " not GDIC"); } } else { SaveLogFile(e.McNo, e.LotNo, "AfterLotEnd", "Fail", "Notfound current flow"); } } } break; } } return(afterLotEndResult); }
private AfterLotEndResult AddFtInspSpecialFlow(string mcNo, string lotNo, string lotJudgement, int?currentFlowId, int?lotId, int nextStepNo = 0) { AfterLotEndResult afterLotEndResult = new AfterLotEndResult(); afterLotEndResult.HasError = false; int flowPattern = 0; switch (lotJudgement) { case "INSPECTION": try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DBxConnectionString"].ToString()); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "[atom].[sp_set_trans_special_flow_temp]"; cmd.Parameters.Add("@lot_no", System.Data.SqlDbType.VarChar).Value = lotNo; cmd.Connection.Open(); using (SqlDataReader rd = cmd.ExecuteReader()) { if (rd.HasRows) { DataTable dt = new DataTable(); dt.Load(rd); foreach (DataRow row in dt.Rows) { SaveLogFile(mcNo, lotNo, "Add SpecialFlow : 142", "PASS", "is_special_flow = " + row[0].ToString()); } } } cmd.Connection.Close(); SaveLogFile(mcNo, lotNo, "AddFtInspSpecialFlow", "PASS", "STORE >> [atom].[sp_set_trans_special_flow_temp]"); } } catch (Exception ex) { SaveLogFile(mcNo, lotNo, "AddFtInspSpecialFlow(INSPECTION)", "FAIL", ex.Message); afterLotEndResult.HasError = true; afterLotEndResult.ErrorMessage = ex.Message; //throw; } return(afterLotEndResult); case "INSPECTION_ICMiss": flowPattern = 1267; break; case "FT_BIN19_AUTO3": flowPattern = 1500; break; case "LOW YIELD": flowPattern = 1501; break; case "IC BURN": flowPattern = 1502; break; case "ASIMode": flowPattern = 1666; break; case "INSP_LowYield": if (currentFlowId == 142 || currentFlowId == 11 || currentFlowId == 266) { flowPattern = 1501; } else { flowPattern = 1677; } break; case "INSP_ICBURN": if (currentFlowId == 142 || currentFlowId == 11 || currentFlowId == 266) { flowPattern = 1502; } else { flowPattern = 1676; } break; } if (currentFlowId == null || lotId == null) { SaveLogFile(mcNo, lotNo, "AddFtInspSpecialFlow(" + lotJudgement + ")", "NOTHING", "FlowId and LotId == null"); return(afterLotEndResult); } if (flowPattern == 0) { SaveLogFile(mcNo, lotNo, "AddFtInspSpecialFlow(" + lotJudgement + ")", "NOTHING", "FlowPattern == null"); return(afterLotEndResult); } int currentStepNo = 0; bool isNow = true; if (flowPattern == 1267) { try { DataTable dtTransLot = GetTransLotFlow(lotId); if (dtTransLot.Rows.Count > 0) { string lastFtAuto = "AUTO(4)"; //Get last AUTO foreach (DataRow row1 in dtTransLot.Rows) { if (row1["job_name"].ToString() == "AUTO(5)") { lastFtAuto = "AUTO(5)"; } } for (int i = 0; i < dtTransLot.Rows.Count - 1; i++) { DataRow row = dtTransLot.Rows[i]; if (row["job_name"].ToString() == lastFtAuto && Convert.ToInt32(row["is_skipped"]) == 0 && currentStepNo == 0) { currentStepNo = Convert.ToInt32(row["step_no"]); continue; } if (currentStepNo != 0 && Convert.ToInt32(row["is_skipped"]) == 0) { nextStepNo = Convert.ToInt32(row["step_no"]); break; } } if (currentStepNo == 0 || nextStepNo == 0) { SaveLogFile(mcNo, lotNo, "AddFtInspSpecialFlow(" + lotJudgement + ")", "FAIL", "CANNOT GET STEP_NO"); return(afterLotEndResult); } if (flowPattern == 1267) { DataTable dtCurrentLot = GetCurrentTranLot(lotNo); DataRow row2 = dtCurrentLot.Rows[0]; if (row2["ProcessName"].ToString() != "QA") { isNow = false; } } } } catch (Exception ex) { SaveLogFile(mcNo, lotNo, "AddFtInspSpecialFlow(" + lotJudgement + ")", "FAIL", ex.Message); afterLotEndResult.HasError = true; afterLotEndResult.ErrorMessage = ex.Message; } } else if (flowPattern == 1501) { if (currentFlowId == 142 || currentFlowId == 11 || currentFlowId == 266) { } else { DataTable dtTransLot = GetTransLotFlow(lotId); if (dtTransLot.Rows.Count > 0) { for (int i = 0; i < dtTransLot.Rows.Count - 1; i++) { DataRow row = dtTransLot.Rows[i]; if (Convert.ToInt32(row["step_no"]) == nextStepNo) { break; } else if (Convert.ToInt32(row["is_skipped"]) == 0) { currentStepNo = Convert.ToInt32(row["step_no"]); } //if (row["job_name"].ToString() == lastFtAuto && Convert.ToInt32(row["is_skipped"]) == 0 && currentStepNo == 0) //{ // currentStepNo = Convert.ToInt32(row["step_no"]); // continue; //} //if (currentStepNo != 0 && Convert.ToInt32(row["is_skipped"]) == 0) //{ // nextStepNo = Convert.ToInt32(row["step_no"]); // break; //} } } } } else if (flowPattern == 1502) { if (currentFlowId == 142 || currentFlowId == 11 || currentFlowId == 266) { } else { } } else { DataTable dtTransLot = GetTransLotFlow(lotId); if (dtTransLot.Rows.Count > 0) { for (int i = 0; i < dtTransLot.Rows.Count - 1; i++) { DataRow row = dtTransLot.Rows[i]; if (Convert.ToInt32(row["step_no"]) == nextStepNo) { break; } else if (Convert.ToInt32(row["is_skipped"]) == 0) { currentStepNo = Convert.ToInt32(row["step_no"]); } //if (row["job_name"].ToString() == lastFtAuto && Convert.ToInt32(row["is_skipped"]) == 0 && currentStepNo == 0) //{ // currentStepNo = Convert.ToInt32(row["step_no"]); // continue; //} //if (currentStepNo != 0 && Convert.ToInt32(row["is_skipped"]) == 0) //{ // nextStepNo = Convert.ToInt32(row["step_no"]); // break; //} } } } AddSpecialFlow_By_FlowPattern(mcNo, lotNo, lotId, currentStepNo, nextStepNo, flowPattern, isNow); return(afterLotEndResult); }