示例#1
0
        private void AssignPort(object sender, EventArgs e)
        {
            string PortName = (sender as MenuItem).Text.Split('-')[0];
            string LDPort   = (CurrentSelected as DataGridView).Name.Replace("Assign_Gv", "");
            Node   UD       = NodeManagement.Get(PortName);
            Node   LD       = NodeManagement.Get(LDPort);

            UD.Mode     = "UD";
            LD.Mode     = "LD";
            LD.DestPort = UD.Name;
            WaferAssignUpdate.UpdateLoadPortMode(UD.Name, UD.Mode);
            WaferAssignUpdate.UpdateLoadPortMode(LD.Name, LD.Mode);
            string Slot = (sender as MenuItem).Text.Split('-')[1];

            if ((CurrentSelected as DataGridView).SelectedRows.Count == 0)
            {
                MessageBox.Show("請選擇來源Slot");
            }
            else if ((CurrentSelected as DataGridView).SelectedRows.Count == 1)
            {
                string waferId     = (CurrentSelected as DataGridView).SelectedRows[0].Cells["Job_Id"].Value.ToString();
                string OrgDest     = (CurrentSelected as DataGridView).SelectedRows[0].Cells["Destination"].Value.ToString();
                string OrgDestSlot = (CurrentSelected as DataGridView).SelectedRows[0].Cells["DestinationSlot"].Value.ToString();

                Job UDSlot = UD.GetJob(Slot);
                if (UDSlot == null)
                {
                    MessageBox.Show(PortName + "沒有FOUP或是尚未進行Mapping");
                    return;
                }
                if (UDSlot.MapFlag == false || LD.Name.Equals(UD.Name))
                {
                    Job wafer = JobManagement.Get(waferId);
                    if (wafer != null)
                    {
                        wafer.AssignPort(PortName, Slot);

                        wafer.NeedProcess = true;
                        wafer.ProcessFlag = false;
                        //wafer.Position = PortName;
                        if (!OrgDest.Equals(""))
                        {
                            NodeManagement.Get(OrgDest).RemoveReserve(OrgDestSlot);
                        }
                        NodeManagement.Get(PortName).AddReserve(Slot, wafer);
                        (CurrentSelected as DataGridView).Refresh();
                        MonitoringUpdate.UpdateNodesJob((CurrentSelected as DataGridView).Name.Replace("Assign_Gv", ""));
                    }
                    else
                    {
                        MessageBox.Show("找不到此Wafer資料");
                    }
                }
            }
            else if ((CurrentSelected as DataGridView).SelectedRows.Count > 1)
            {
                int StartSlot = Convert.ToInt32(Slot);
                List <DataGridViewRow> tmp = new List <DataGridViewRow>();
                foreach (DataGridViewRow each in (CurrentSelected as DataGridView).SelectedRows)
                {
                    tmp.Add(each);
                }
                tmp.Sort((x, y) => { return(-x.Index.CompareTo(y.Index)); });
                foreach (DataGridViewRow each in tmp)
                {
                    string waferId     = each.Cells["Job_Id"].Value.ToString();
                    string OrgDest     = each.Cells["Destination"].Value.ToString();
                    string OrgDestSlot = each.Cells["DestinationSlot"].Value.ToString();
                    Job    wafer       = JobManagement.Get(waferId);
                    if (wafer != null)
                    {
                        while (true)
                        {
                            if (NodeManagement.Get(PortName).GetJob(StartSlot.ToString()).MapFlag == false || LD.Name.Equals(UD.Name))
                            {
                                wafer.AssignPort(PortName, StartSlot.ToString());

                                //wafer.Position = PortName;
                                wafer.NeedProcess = true;
                                wafer.ProcessFlag = false;
                                if (!OrgDest.Equals(""))
                                {
                                    NodeManagement.Get(OrgDest).RemoveReserve(OrgDestSlot);
                                }
                                NodeManagement.Get(PortName).AddReserve(StartSlot.ToString(), wafer);

                                break;
                            }
                            else
                            {
                                StartSlot++;
                                if (StartSlot > 25)
                                {
                                    break;
                                }
                            }
                        }
                        StartSlot++;
                        if (StartSlot > 25)
                        {
                            break;
                        }
                    }
                }
                (CurrentSelected as DataGridView).Refresh();
                MonitoringUpdate.UpdateNodesJob((CurrentSelected as DataGridView).Name.Replace("Assign_Gv", ""));
            }
        }
示例#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;
                }
            }
        }