private void CountDown(object obj) { while (true) { while (countDownSecs <= -1) { SpinWait.SpinUntil(() => countDownSecs > -1, 99999999); } CountDownUpdate(countDownSecs.ToString()); countDownSecs--; if (countDownSecs == -1) {//Reconnect all eqp foreach (Node each in NodeManagement.GetList()) { if (each.Enable) { each.GetController().Reconnect(); } } FormShow(false); } if (countDownSecs != -1) { SpinWait.SpinUntil(() => false, 1000); } } }
private void ChangeSpeed() { string sp = RunningSpeed_cb.Text.Replace("%", ""); if (sp.Equals("100")) { sp = "0"; } foreach (Node node in NodeManagement.GetList()) { string Message = ""; if (node.Type.Equals("ROBOT")) { Transaction txn = new Transaction(); txn.Method = Transaction.Command.RobotType.Speed; txn.Value = sp; txn.FormName = "Running"; node.SendCommand(txn, out Message); } else if (node.Type.Equals("ALIGNER")) { Transaction txn = new Transaction(); txn.Method = Transaction.Command.AlignerType.Speed; txn.Value = sp; txn.FormName = "Running"; node.SendCommand(txn, out Message); } } }
private void FormWafer_Layout(object sender, LayoutEventArgs e) { WaferList_tv.Nodes.Clear(); Position_cb.Items.Clear(); foreach (Node node in NodeManagement.GetList()) { if (!node.Type.Equals("OCR")) { TreeNode each = new TreeNode(node.Name); Position_cb.Items.Add(node.Name); List <Job> jobList = node.JobList.Values.ToList(); jobList.Sort((x, y) => { return(Convert.ToInt16(x.Slot).CompareTo(Convert.ToInt16(y.Slot))); }); foreach (Job j in jobList) { if (JobManagement.Get(j.Job_Id) != null) { each.Nodes.Add(j.Job_Id, j.Job_Id + "(Slot-" + j.Slot + ")"); } } WaferList_tv.Nodes.Add(each); } } }
private void UpdateCheckBox(object input) { FormMain.HostControl.Events.Load(); MonitoringUpdate.EventUpdate("MAPDT", FormMain.HostControl.Events.MAPDT); MonitoringUpdate.EventUpdate("PORT", FormMain.HostControl.Events.PORT); MonitoringUpdate.EventUpdate("PRS", FormMain.HostControl.Events.PRS); MonitoringUpdate.EventUpdate("SYSTEM", FormMain.HostControl.Events.SYSTEM); MonitoringUpdate.EventUpdate("TRANSREQ", FormMain.HostControl.Events.TRANSREQ); MonitoringUpdate.EventUpdate("FFU", FormMain.HostControl.Events.FFU); MonitoringUpdate.EventUpdate("BF1_BYPASS", FormMain.HostControl.Events.BF1_BYPASS); NodeManagement.Get("BF1").ByPassCheck = FormMain.HostControl.Events.BF1_BYPASS; MonitoringUpdate.EventUpdate("BF2_BYPASS", FormMain.HostControl.Events.BF2_BYPASS); NodeManagement.Get("BF2").ByPassCheck = FormMain.HostControl.Events.BF2_BYPASS; DIOUpdate.UpdateDIOStatus("RED", "False"); DIOUpdate.UpdateDIOStatus("ORANGE", "False"); DIOUpdate.UpdateDIOStatus("GREEN", "False"); DIOUpdate.UpdateDIOStatus("BLUE", "False"); DIOUpdate.UpdateDIOStatus("BUZZER1", "False"); DIOUpdate.UpdateDIOStatus("BUZZER2", "False"); foreach (Node node in NodeManagement.GetList()) { MonitoringUpdate.EventUpdate(node.Name + "_Enable", node.Enable); } }
private static void ReAssign() { try { Form form = Application.OpenForms["FormOCR"]; TabControl tabControl1; if (form == null) { return; } tabControl1 = form.Controls.Find("tabControl1", true).FirstOrDefault() as TabControl; if (tabControl1 == null) { return; } if (tabControl1.InvokeRequired) { ReAssignUI ph = new ReAssignUI(ReAssign); tabControl1.BeginInvoke(ph); } else { tabControl1.TabPages.Clear(); var ocrs = from ocr in NodeManagement.GetList() where ocr.Type.Equals("OCR") select ocr; bool IsCognexInit = false; System.Threading.Thread.Sleep(2000); foreach (Node ocr in ocrs) { switch (ocr.Brand) { case "HST": pCnt++; Process p1 = Process.Start(new ProcessStartInfo("C:/Program Files (x86)/HST Vision/e-Reader8000/VB9BReaderForm.exe", ocr.AdrNo)); //ThreadPool.QueueUserWorkItem(new WaitCallback(LoadHST), ocr); break; case "COGNEX": if (!IsCognexInit) { pCnt++; IsCognexInit = true; Process p2 = Process.Start(new ProcessStartInfo("C:/Program Files (x86)/Cognex/In-Sight/In-Sight Explorer Wafer 4.5.0/WaferID.exe")); //ThreadPool.QueueUserWorkItem(new WaitCallback(LoadCOGNEX), ocr); } //ControllerManagement.Get(ocr.Controller).Connect(); break; } } } } catch (Exception e) { logger.Error(e.StackTrace); } }
private void ResetAll_bt_Click(object sender, EventArgs e) { Transaction Txn; foreach (AlarmInfo eachA in AlarmManagement.GetAll()) { if (!eachA.NeedReset) { AlarmManagement.Remove(eachA); } } foreach (Node node in NodeManagement.GetList()) { node.HasAlarm = false; } var NodeList = AlarmManagement.GetAll().GroupBy(t => t.NodeName); foreach (var group in NodeList) { string Message = ""; Txn = new Transaction(); Txn.Method = Transaction.Command.RobotType.Reset; Txn.FormName = ""; //NodeManagement.Get(group.First().NodeName).State = "Alarm"; NodeManagement.Get(group.First().NodeName).SendCommand(Txn, out Message); AlarmManagement.Remove(group.First().NodeName); } //NodeStatusUpdate.UpdateCurrentState("Idle"); AlarmUpdate.UpdateAlarmList(AlarmManagement.GetAll()); }
private void ChangeNodeConnectionStatus(string status) { var Nodes = from each in NodeManagement.GetList() where each.Controller.Equals(this.Name) select each; foreach (Node eachNode in Nodes) { eachNode.ConnectionStatus = status; } }
public void getStatus() { StateUtil.Init(); foreach (Node each in NodeManagement.GetList()) { string Message = ""; try { IController Ctrl = ControllerManagement.Get(each.Controller); //string ctrl_status = ControllerManagement.Get(each.Controller).Status; string ctrl_status = ControllerManagement.Get(each.Controller) != null?ControllerManagement.Get(each.Controller).GetStatus() : ""; if (ctrl_status.Equals("Connected") && each.ByPass == false) { string seq = ""; Transaction txn = new Transaction(); if (each.Brand.ToUpper().Equals("KAWASAKI")) { seq = Ctrl.GetNextSeq(); } else { seq = ""; } switch (each.Type) { case "ROBOT": txn.Method = Transaction.Command.RobotType.GetStatus; break; case "ALIGNER": txn.Method = Transaction.Command.AlignerType.GetStatus; break; case "LOADPORT": txn.Method = Transaction.Command.LoadPortType.ReadStatus; break; } txn.FormName = "FormStatus"; txn.AdrNo = each.AdrNo; txn.Seq = seq; if (!txn.Method.Equals("")) { each.SendCommand(txn, out Message); } } } catch (Exception e) { logger.Error(e.StackTrace); } } }
private void ProceedInitial() { foreach (Node each in NodeManagement.GetList()) { each.InitialComplete = false; each.CheckStatus = false; string Message = ""; switch (each.Type.ToUpper()) { case "ROBOT": //each.ExcuteScript("RobotInit", "Initialize", out Message); break; //先做ROBOT //case "ALIGNER": // each.ExcuteScript("AlignerInit", "Initialize"); // break; //case "LOADPORT": // each.ExcuteScript("LoadPortInit", "Initialize"); // break; } } }
private void toolStripMenuItem4_Click(object sender, EventArgs e) { string strMsg = "This equipment performs the initialization and origin search OK?\r\n" + "This equipment will be initalized, each axis will return to home position.\r\n" + "Check the condition of the wafer."; if (MessageBox.Show(strMsg, "Initialize", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.OK) { foreach (Node each in NodeManagement.GetList()) { string Message = ""; switch (each.Type) { case "ALIGNER": each.ErrorMsg = ""; //each.ExcuteScript("AlignerStateGet", "GetStatsBeforeInit", out Message); break; case "ROBOT": each.ErrorMsg = ""; //each.ExcuteScript("RobotStateGet", "GetStatsBeforeInit", out Message); break; } } } }
public static void updateDBConfig(string recipeName) { try { Recipe recipe = Recipe.Get(recipeName); //DBUtil dBUtil = new DBUtil(); //Dictionary<string, object> keyValues = new Dictionary<string, object>(); //string strSql = " UPDATE config_node SET carrier_type = CASE node_id WHEN 'LOADPORT01' THEN @ctype1 " + // " WHEN 'LOADPORT02' THEN @ctype2 " + // " WHEN 'LOADPORT03' THEN @ctype3 " + // " WHEN 'LOADPORT04' THEN @ctype4 " + // " ELSE carrier_type END, " + // " mode = CASE node_id WHEN 'LOADPORT01' THEN @mode1 " + // " WHEN 'LOADPORT02' THEN @mode2 " + // " WHEN 'LOADPORT03' THEN @mode3 " + // " WHEN 'LOADPORT04' THEN @mode4 " + // " ELSE mode END," + // " enable_flg = CASE node_id WHEN 'LOADPORT01' THEN @enable1 " + // " WHEN 'LOADPORT02' THEN @enable2 " + // " WHEN 'LOADPORT03' THEN @enable3 " + // " WHEN 'LOADPORT04' THEN @enable4 " + // " WHEN 'ALIGNER01' THEN @bypassA1 " + // " WHEN 'ALIGNER02' THEN @bypassA2 " + // " ELSE enable_flg END," + // " double_arm = CASE node_id WHEN 'ROBOT01' THEN @double_arm_r1 " + // " ELSE double_arm END, " + // " r_arm = CASE node_id WHEN 'ROBOT01' THEN @r_arm_r1 " + // " ELSE r_arm END, " + // " l_arm = CASE node_id WHEN 'ROBOT01' THEN @l_arm_r1 " + // " ELSE l_arm END, " + // " wafer_size = @wafer_size, " + // " modify_user = @modify_user, modify_timestamp = NOW() " + // " WHERE equipment_model_id = @equipment_model_id " + // " AND node_type IN ('LOADPORT','ROBOT','Aligner') ;"; //keyValues.Add("@equipment_model_id", SystemConfig.Get().SystemMode); //keyValues.Add("@modify_user", Global.currentUser); //keyValues.Add("@ctype1", recipe.port1_carrier_type); //keyValues.Add("@ctype2", recipe.port2_carrier_type); //keyValues.Add("@ctype3", recipe.port3_carrier_type); //keyValues.Add("@ctype4", recipe.port4_carrier_type); //keyValues.Add("@mode1", getPortType(recipe.port1_type)); //keyValues.Add("@mode2", getPortType(recipe.port2_type)); //keyValues.Add("@mode3", getPortType(recipe.port3_type)); //keyValues.Add("@mode4", getPortType(recipe.port4_type)); //keyValues.Add("@enable1", getEnable(recipe.port1_type)); //keyValues.Add("@enable2", getEnable(recipe.port2_type)); //keyValues.Add("@enable3", getEnable(recipe.port3_type)); //keyValues.Add("@enable4", getEnable(recipe.port4_type)); //keyValues.Add("@bypassA1", recipe.is_use_aligner1 ? 1 : 0); //keyValues.Add("@bypassA2", recipe.is_use_aligner2 ? 1 : 0); //keyValues.Add("@double_arm_r1", recipe.is_use_double_arm ? 1 : 0); //keyValues.Add("@r_arm_r1", recipe.is_use_r_arm ? 1 : 0); //keyValues.Add("@l_arm_r1", recipe.is_use_l_arm ? 1 : 0); //keyValues.Add("@wafer_size", recipe.wafer_size); //dBUtil.ExecuteNonQuery(strSql, keyValues); try { foreach (Node node in NodeManagement.GetList()) { switch (node.Name.ToUpper()) { case "LOADPORT01": node.WaferSize = recipe.wafer_size; node.CarrierType = recipe.port1_carrier_type; node.Mode = getPortType(recipe.port1_type); node.Enable = getEnable(recipe.port1_type) == 1 ? true : false; node.OrgSearchComplete = false; break; case "LOADPORT02": node.WaferSize = recipe.wafer_size; node.CarrierType = recipe.port2_carrier_type; node.Mode = getPortType(recipe.port2_type); node.Enable = getEnable(recipe.port2_type) == 1 ? true : false; node.OrgSearchComplete = false; break; case "LOADPORT03": node.WaferSize = recipe.wafer_size; node.CarrierType = recipe.port3_carrier_type; node.Mode = getPortType(recipe.port3_type); node.Enable = getEnable(recipe.port3_type) == 1 ? true : false; node.OrgSearchComplete = false; break; case "LOADPORT04": node.WaferSize = recipe.wafer_size; node.CarrierType = recipe.port4_carrier_type; node.Mode = getPortType(recipe.port4_type); node.Enable = getEnable(recipe.port4_type) == 1 ? true : false; node.OrgSearchComplete = false; break; case "ROBOT01": node.WaferSize = recipe.wafer_size; node.RArmActive = recipe.is_use_r_arm; node.LArmActive = recipe.is_use_l_arm; node.DoubleArmActive = recipe.is_use_double_arm; break; case "ALIGNER01": node.WaferSize = recipe.wafer_size; node.Enable = recipe.is_use_aligner1; break; case "ALIGNER02": node.WaferSize = recipe.wafer_size; node.Enable = recipe.is_use_aligner2; break; } } NodeManagement.Save(); } catch (Exception ex) { logger.Error("Update load port 資訊失敗! " + ex.StackTrace); } } catch (Exception ex) { logger.Error(ex.StackTrace); } }
public void setStatus() { try { //clear old data dgvRstatus.Rows.Clear(); dgvAstatus.Rows.Clear(); dgvLstatus.Rows.Clear(); Thread.Sleep(1000);//避免查詢指令尚未回來 foreach (Node each in NodeManagement.GetList()) { string ctrl_status = ControllerManagement.Get(each.Controller) != null?ControllerManagement.Get(each.Controller).GetStatus() : ""; if (ctrl_status.Equals("Connected") && each.ByPass == false) { if (each.Brand.ToUpper().Equals("KAWASAKI")) { } else { } String state = ""; switch (each.Type) { case "ROBOT": DataGridViewRow robotRow = (DataGridViewRow)dgvRstatus.Rows[0].Clone(); robotRow.Cells[0].Value = each.Name; state = ((RobotState)StateUtil.device[each.Name]).State; for (int i = 1; i <= state.Length; i++) { string value = state.Substring(i - 1, 1); robotRow.Cells[i].Value = value; robotRow.Cells[i].Style.BackColor = getStatusColor(value); } dgvRstatus.Rows.Add(robotRow); break; case "ALIGNER": DataGridViewRow alignerRow = (DataGridViewRow)dgvAstatus.Rows[0].Clone(); alignerRow.Cells[0].Value = each.Name; state = ((AlignerState)StateUtil.device[each.Name]).State; for (int i = 1; i <= state.Length; i++) { string value = state.Substring(i - 1, 1); alignerRow.Cells[i].Value = value; alignerRow.Cells[i].Style.BackColor = getStatusColor(value); } dgvAstatus.Rows.Add(alignerRow); break; case "LOADPORT": DataGridViewRow portRow = (DataGridViewRow)dgvLstatus.Rows[0].Clone(); portRow.Cells[0].Value = each.Name; state = ((LoadPortState)StateUtil.device[each.Name]).State; for (int i = 1; i <= state.Length; i++) { string value = state.Substring(i - 1, 1); portRow.Cells[i].Value = value; portRow.Cells[i].Style.BackColor = getStatusColor(value); } dgvLstatus.Rows.Add(portRow); break; } } else { ////continue; ////do nothing 以下為假資料 //string[] states = new String[] { "0", "1", "2", "3", "A", "E", "?" }; //string state; //int idx = 0; //switch (each.Type) //{ // case "Robot": // DataGridViewRow robotRow = (DataGridViewRow)dgvRstatus.Rows[0].Clone(); // robotRow.Cells[0].Value = each.Name; // for (int i = 1; i <= 32; i++) // { // idx = new Random(i).Next() % 7; // state = states[idx]; // string value = state; // robotRow.Cells[i].Value = value; // robotRow.Cells[i].Style.BackColor = getStatusColor(value); // } // dgvRstatus.Rows.Add(robotRow); // break; // case "Aligner": // DataGridViewRow alignerRow = (DataGridViewRow)dgvAstatus.Rows[0].Clone(); // alignerRow.Cells[0].Value = each.Name; // for (int i = 1; i <= 32; i++) // { // idx = new Random(i).Next() % 7; // state = states[idx]; // string value = state; // alignerRow.Cells[i].Value = value; // alignerRow.Cells[i].Style.BackColor = getStatusColor(value); // } // dgvAstatus.Rows.Add(alignerRow); // break; // case "LoadPort": // DataGridViewRow portRow = (DataGridViewRow)dgvLstatus.Rows[0].Clone(); // portRow.Cells[0].Value = each.Name; // for (int i = 1; i <= 20; i++) // { // idx = new Random(i).Next() % 7; // state = states[idx]; // string value = state; // portRow.Cells[i].Value = state; // portRow.Cells[i].Style.BackColor = getStatusColor(value); // } // dgvLstatus.Rows.Add(portRow); // break; //} } } } catch (Exception e) { logger.Error(e.StackTrace); } }
private static void updateLoadPortConfig(Recipe recipe) { Boolean result = false; try { DBUtil dBUtil = new DBUtil(); Dictionary <string, object> keyValues = new Dictionary <string, object>(); string strSql = " UPDATE config_node SET carrier_type = CASE node_id WHEN 'LOADPORT01' THEN @ctype1 " + " WHEN 'LOADPORT02' THEN @ctype2 " + " WHEN 'LOADPORT03' THEN @ctype3 " + " WHEN 'LOADPORT04' THEN @ctype4 " + " ELSE carrier_type END, " + " mode = CASE node_id WHEN 'LOADPORT01' THEN @mode1 " + " WHEN 'LOADPORT02' THEN @mode2 " + " WHEN 'LOADPORT03' THEN @mode3 " + " WHEN 'LOADPORT04' THEN @mode4 " + " ELSE mode END," + " enable_flg = CASE node_id WHEN 'LOADPORT01' THEN @enable1 " + " WHEN 'LOADPORT02' THEN @enable2 " + " WHEN 'LOADPORT03' THEN @enable3 " + " WHEN 'LOADPORT04' THEN @enable4 " + " ELSE enable_flg END," + " bypass = CASE node_id WHEN 'ALIGNER01' THEN @bypassA1 " + " ELSE bypass END," + " double_arm = CASE node_id WHEN 'ROBOT01' THEN @double_arm_r1 " + " ELSE double_arm END, " + " r_arm = CASE node_id WHEN 'ROBOT01' THEN @r_arm_r1 " + " ELSE r_arm END, " + " l_arm = CASE node_id WHEN 'ROBOT01' THEN @l_arm_r1 " + " ELSE l_arm END, " + " modify_user = @modify_user, modify_timestamp = NOW() " + " WHERE equipment_model_id = @equipment_model_id " + " AND node_type IN ('LOADPORT','ROBOT','Aligner') ;"; keyValues.Add("@equipment_model_id", SystemConfig.Get().SystemMode); keyValues.Add("@modify_user", Global.currentUser); keyValues.Add("@ctype1", recipe.port1_carrier_type); keyValues.Add("@ctype2", recipe.port2_carrier_type); keyValues.Add("@ctype3", recipe.port3_carrier_type); keyValues.Add("@ctype4", recipe.port4_carrier_type); keyValues.Add("@mode1", getPortType(recipe.port1_type)); keyValues.Add("@mode2", getPortType(recipe.port2_type)); keyValues.Add("@mode3", getPortType(recipe.port3_type)); keyValues.Add("@mode4", getPortType(recipe.port4_type)); keyValues.Add("@enable1", getEnable(recipe.port1_type)); keyValues.Add("@enable2", getEnable(recipe.port2_type)); keyValues.Add("@enable3", getEnable(recipe.port3_type)); keyValues.Add("@enable4", getEnable(recipe.port4_type)); keyValues.Add("@bypassA1", recipe.is_use_aligner1 ? 0 : 1);//要用ALIGNER 時 bypass = 0, ELSE bypass = 1 keyValues.Add("@double_arm_r1", recipe.is_use_double_arm ? 1 : 0); keyValues.Add("@r_arm_r1", recipe.is_use_r_arm ? 1 : 0); keyValues.Add("@l_arm_r1", recipe.is_use_l_arm ? 1 : 0); dBUtil.ExecuteNonQuery(strSql, keyValues); foreach (Node node in NodeManagement.GetList()) { switch (node.Name.ToUpper()) { case "LOADPORT01": node.CarrierType = recipe.port1_carrier_type; node.Mode = getPortType(recipe.port1_type); node.Enable = getEnable(recipe.port1_type) == 1 ? true : false; node.OrgSearchComplete = false; break; case "LOADPORT02": node.CarrierType = recipe.port2_carrier_type; node.Mode = getPortType(recipe.port2_type); node.Enable = getEnable(recipe.port2_type) == 1 ? true : false; node.OrgSearchComplete = false; break; case "LOADPORT03": node.CarrierType = recipe.port3_carrier_type; node.Mode = getPortType(recipe.port3_type); node.Enable = getEnable(recipe.port3_type) == 1 ? true : false; node.OrgSearchComplete = false; break; case "LOADPORT04": node.CarrierType = recipe.port4_carrier_type; node.Mode = getPortType(recipe.port4_type); node.Enable = getEnable(recipe.port4_type) == 1 ? true : false; node.OrgSearchComplete = false; break; case "ROBOT01": node.RArmActive = recipe.is_use_r_arm; node.LArmActive = recipe.is_use_l_arm; node.DoubleArmActive = recipe.is_use_double_arm; break; case "ALIGNER01": node.ByPass = !recipe.is_use_aligner1; break; case "ALIGNER02": node.ByPass = !recipe.is_use_aligner2; break; } } } catch (Exception ex) { MessageBox.Show("Update load port 資訊失敗! " + ex.StackTrace); } }