示例#1
0
        private void LoadPort_ASCM_Click(object sender, EventArgs e)
        {
            string PortName     = (sender as Button).Name.Replace("_ASCM", "");
            string AssignStatus = (sender as Button).Text;
            Node   port         = NodeManagement.Get(PortName);

            DataGridView Port_gv      = this.Controls.Find(PortName + "Assign_Gv", true).FirstOrDefault() as DataGridView;
            DataGridView DestPort_gv  = this.Controls.Find(port.DestPort + "Assign_Gv", true).FirstOrDefault() as DataGridView;
            Button       DestPort_btn = this.Controls.Find(port.DestPort + "_ASCM", true).FirstOrDefault() as Button;

            if (port != null)
            {
                if (AssignStatus.Equals("Assign Cancel"))
                {
                    port.Available = false;
                    ProcessRecord.CancelPr(port);



                    (sender as Button).Text      = "Assign Complete";
                    (sender as Button).BackColor = Color.Gainsboro;
                    (sender as Button).ForeColor = Color.Black;

                    Port_gv.Enabled      = true;
                    DestPort_gv.Enabled  = true;
                    DestPort_btn.Enabled = true;
                }
                else if (AssignStatus.Equals("Assign Complete"))
                {
                    TextBox fp = this.Controls.Find(PortName + "_FoupID", true).FirstOrDefault() as TextBox;
                    port.FoupID = fp.Text;
                    Node desport = NodeManagement.Get(port.DestPort);
                    fp             = this.Controls.Find(desport.Name + "_FoupID", true).FirstOrDefault() as TextBox;
                    desport.FoupID = fp.Text;

                    CheckBox Align = this.Controls.Find(port.Name + "_Align_ck", true).FirstOrDefault() as CheckBox;
                    CheckBox Ocr   = this.Controls.Find(port.Name + "_Align_ck", true).FirstOrDefault() as CheckBox;
                    foreach (Job j in port.JobList.Values.ToList())
                    {
                        if (j.NeedProcess)
                        {
                            j.AlignerFlag = Align.Checked;
                            j.OCRFlag     = Ocr.Checked;
                        }
                    }


                    port.Available = true;

                    ProcessRecord.CreatePr(port);

                    (sender as Button).Text      = "Assign Cancel";
                    (sender as Button).BackColor = Color.Green;
                    (sender as Button).ForeColor = Color.White;

                    Port_gv.Enabled      = false;
                    DestPort_gv.Enabled  = false;
                    DestPort_btn.Enabled = false;

                    FormMain.xfe.Start(port.Name);
                }
            }
            else
            {
                MessageBox.Show(PortName + "不存在!");
            }
        }
示例#2
0
        public static void ReverseRunning(string FinishPort)
        {
            Form form = Application.OpenForms["FormRunningScreen"];

            if (form == null)
            {
                return;
            }

            TextBox tb = form.Controls.Find("TransCount_tb", true).FirstOrDefault() as TextBox;

            if (tb == null)
            {
                return;
            }

            if (tb.InvokeRequired)
            {
                UpdatePresent ph = new UpdatePresent(ReverseRunning);
                tb.BeginInvoke(ph, FinishPort);
            }
            else
            {
                Node FinPort = NodeManagement.Get(FinishPort);
                if (FinPort != null)
                {
                    Node DestPort = NodeManagement.Get(FinPort.DestPort);
                    if (DestPort != null)
                    {
                        int        StartSlot    = 1;
                        List <Job> DestPortJobs = DestPort.JobList.Values.ToList();
                        DestPortJobs.Sort((x, y) => { return(Convert.ToInt16(x.Slot).CompareTo(Convert.ToInt16(y.Slot))); });
                        foreach (Job job in DestPortJobs)
                        {
                            if (job.MapFlag)
                            {
                                while (StartSlot <= 25)
                                {
                                    if (FinPort.GetJob(StartSlot.ToString()).MapFlag == false)
                                    {
                                        job.NeedProcess = true;
                                        job.ProcessFlag = false;
                                        job.AlignerFlag = true;
                                        job.OCRFlag     = true;
                                        job.AssignPort(FinPort.Name, StartSlot.ToString());

                                        FinPort.ReserveList.TryAdd(job.Slot, job);
                                        StartSlot++;
                                        break;
                                    }
                                    StartSlot++;
                                }
                            }
                            if (StartSlot > 25)
                            {
                                break;
                            }
                        }
                        //FinPort.DestPort = "Assign";
                        if (FinPort.Name.Equals(DestPort.Name))
                        {
                            DestPort.Mode = "LU";
                        }
                        else
                        {
                            FinPort.Mode  = "UD";
                            DestPort.Mode = "LD";
                            WaferAssignUpdate.UpdateLoadPortMode(FinPort.Name, FinPort.Mode);
                            WaferAssignUpdate.UpdateLoadPortMode(DestPort.Name, DestPort.Mode);
                        }
                        FinPort.DestPort  = "";
                        DestPort.DestPort = FinPort.Name;
                        DestPort.ReserveList.Clear();
                        tb = form.Controls.Find("TransCount_tb", true).FirstOrDefault() as TextBox;
                        if (Convert.ToInt32(tb.Text) <= 1)//次數歸零 停止DEMO
                        {
                            DestPort.Available = false;
                            //FormMain.RouteCtrl.Stop();
                        }
                        else
                        {
                            ProcessRecord.CreatePr(DestPort);
                            WaferAssignUpdate.UpdateAssignCM(DestPort.Name, FinPort.Name, false);
                            DestPort.Available = true;
                            if (DestPort.ByPass)
                            {
                                DestPort.PortUnloadAndLoadFinished = true;
                            }
                        }
                        FinPort.Used = false;
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
        }