Ejemplo n.º 1
0
        public static void UpdateLoadPortMapping(string PortName, string Mapping)
        {
            try
            {
                Form         form = Application.OpenForms["FormWaferMapping"];
                DataGridView Port_gv;
                if (form == null)
                {
                    return;
                }

                Port_gv = form.Controls.Find(PortName + "Assign_Gv", true).FirstOrDefault() as DataGridView;
                if (Port_gv == null)
                {
                    return;
                }

                if (Port_gv.InvokeRequired)
                {
                    UpdatePort ph = new UpdatePort(UpdateLoadPortMapping);
                    Port_gv.BeginInvoke(ph, PortName, Mapping);
                }
                else
                {
                    Node port = NodeManagement.Get(PortName);
                    //List<Job> MappingData = new List<Job>();
                    //port.IsMapping = true;
                    if (Mapping.Equals(""))
                    {
                        foreach (Job eachJob in port.JobList.Values)
                        {
                            JobManagement.Remove(eachJob.Job_Id);
                        }
                        port.JobList.Clear();
                        port.ReserveList.Clear();
                        JobManagement.ClearAssignJobByPort(port.Name);
                    }
                    else
                    {
                        int currentIdx = 1;
                        for (int i = 0; i < Mapping.Length; i++)
                        {
                            Job wafer = RouteControl.CreateJob();
                            wafer.Slot         = (i + 1).ToString();
                            wafer.FromPort     = PortName;
                            wafer.FromPortSlot = wafer.Slot;
                            wafer.Position     = PortName;
                            wafer.AlignerFlag  = false;
                            wafer.RecipeID     = "300MM";
                            string Slot = (i + 1).ToString("00");
                            switch (Mapping[i])
                            {
                            case '0':
                                wafer.Job_Id      = "No wafer";
                                wafer.Host_Job_Id = wafer.Job_Id;
                                //MappingData.Add(wafer);
                                break;

                            case '1':
                                while (true)
                                {
                                    wafer.Job_Id      = "Wafer" + currentIdx.ToString("00");
                                    wafer.Host_Job_Id = wafer.Job_Id;
                                    wafer.MapFlag     = true;
                                    if (JobManagement.Add(wafer.Job_Id, wafer))
                                    {
                                        //MappingData.Add(wafer);
                                        break;
                                    }
                                    currentIdx++;
                                }

                                break;

                            case '2':
                                wafer.Job_Id      = "Crossed";
                                wafer.Host_Job_Id = wafer.Job_Id;
                                wafer.MapFlag     = true;
                                //MappingData.Add(wafer);
                                break;

                            case '?':
                                wafer.Job_Id      = "Undefined";
                                wafer.Host_Job_Id = wafer.Job_Id;
                                wafer.MapFlag     = true;
                                //MappingData.Add(wafer);
                                break;

                            case 'W':
                                wafer.Job_Id      = "Double";
                                wafer.Host_Job_Id = wafer.Job_Id;
                                wafer.MapFlag     = true;
                                //MappingData.Add(wafer);
                                break;
                            }
                            if (!port.AddJob(wafer.Slot, wafer))
                            {
                                Job org = port.GetJob(wafer.Slot);
                                JobManagement.Remove(org.Job_Id);
                                port.RemoveJob(wafer.Slot);
                                port.AddJob(wafer.Slot, wafer);
                            }
                        }
                    }
                    List <Job> tmp = port.JobList.Values.ToList();
                    tmp.Sort((x, y) => { return(-Convert.ToInt16(x.Slot).CompareTo(Convert.ToInt16(y.Slot))); });
                    Port_gv.DataSource                          = tmp;
                    Port_gv.Columns["Slot"].Width               = 25;
                    Port_gv.Columns["Slot"].HeaderText          = "S";
                    Port_gv.Columns["Host_Job_Id"].Width        = 75;
                    Port_gv.Columns["DisplayDestination"].Width = 55;
                    Port_gv.Columns["DestinationSlot"].Width    = 30;
                    Port_gv.Columns["Offset"].Visible           = false;
                    Port_gv.Columns["Angle"].Visible            = false;
                    Port_gv.Columns["Job_Id"].Visible           = false;
                    Port_gv.Columns["Destination"].Visible      = false;
                    Port_gv.Columns["ProcessFlag"].Visible      = false;
                    // Port_gv.Columns["Piority"].Visible = false;
                    Port_gv.Columns["AlignerFlag"].Visible     = false;
                    Port_gv.Columns["OCRFlag"].Visible         = false;
                    Port_gv.Columns["AlignerFinished"].Visible = false;
                    Port_gv.Columns["OCRFinished"].Visible     = false;
                    Port_gv.Columns["Position"].Visible        = false;
                    Port_gv.Columns["FromPort"].Visible        = false;
                    Port_gv.Columns["LastNode"].Visible        = false;
                    Port_gv.Columns["CurrentState"].Visible    = false;
                    Port_gv.Columns["WaitToDo"].Visible        = false;
                    //Port_gv.Columns["FetchRobot"].Visible = false;
                    Port_gv.Columns["ProcessNode"].Visible           = false;
                    Port_gv.Columns["MapFlag"].Visible               = false;
                    Port_gv.Columns["DisplayDestination"].HeaderText = "Dest";
                    Port_gv.Columns["DestinationSlot"].HeaderText    = "DS";
                    Port_gv.Columns["Host_Job_Id"].HeaderText        = "ID";
                    Port_gv.ColumnHeadersDefaultCellStyle.Font       = new Font("Arial", 10);
                    Port_gv.Columns["NeedProcess"].Visible           = false;
                    Port_gv.Columns["OCRImgPath"].Visible            = false;
                    Port_gv.Columns["OCRScore"].Visible              = false;
                    Port_gv.Columns["LastSlot"].Visible              = false;
                    Port_gv.Columns["FromPortSlot"].Visible          = false;
                    Port_gv.Columns["AssignTime"].Visible            = false;
                    Port_gv.Columns["DefaultOCR"].Visible            = false;
                    Port_gv.Columns["RecipeID"].Visible              = false;
                    Port_gv.Columns["ErrPosition"].Visible           = false;
                    Port_gv.Columns["InProcess"].Visible             = false;
                    Port_gv.Columns["Host_Lot_Id"].Visible           = false;

                    MonitoringUpdate.UpdateNodesJob(PortName);
                    port.IsMapping = true;
                }
            }
            catch (Exception e)
            {
                logger.Error("UpdateLoadPortMapping: Update fail:" + e.StackTrace);
            }
        }
Ejemplo n.º 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            LockUI(true);
            if (!MainProcess._Mode.Equals("Stop") && !MainProcess._Mode.Equals(""))
            {
                AlarmUpdate.UpdateMessage("目前狀態為 " + MainProcess._Mode + " 模式,請先停止動作。");
                return;
            }

            NodeManagement.InitialNodes();
            JobManagement.Initial();

            if (PortSetting1Active_ck.Checked)
            {
                if (!PortSetting1Aligner_cb.Text.Equals(""))
                {
                    Node Aligner1 = NodeManagement.Get(PortSetting1Aligner_cb.Text);
                    if (Aligner1 != null)
                    {
                        Aligner1.LockByNode = PortSetting1Name_cb.Text;
                    }
                }
                Node P1 = NodeManagement.Get(PortSetting1Name_cb.Text);

                int SlotMode = 0;
                if (PortSetting1SlotMode_ck.Checked)
                {
                    SlotMode = 1;
                }
                else
                {
                    SlotMode = 2;
                }
                for (int i = Convert.ToInt16(PortSetting1StartSlot_tb.Text); i <= Convert.ToInt16(PortSetting1EndSlot_tb.Text); i = i + SlotMode)
                {
                    Job w = new Job();
                    w.Job_Id = "Wafer" + i.ToString("000");

                    w.AlignerFlag     = true;
                    w.OCRFlag         = false;
                    w.Position        = P1.Name;
                    w.ProcessFlag     = false;
                    w.FromPort        = P1.Name;
                    w.Slot            = i.ToString();
                    w.Destination     = PortSetting1Dest_cb.Text;
                    w.DestinationSlot = i.ToString();;
                    JobManagement.Add(w.Job_Id, w);
                    P1.JobList.TryAdd(w.Slot, w);
                }
            }

            if (PortSetting2Active_ck.Checked)
            {
                if (!PortSetting2Aligner_cb.Text.Equals(""))
                {
                    Node Aligner2 = NodeManagement.Get(PortSetting2Aligner_cb.Text);
                    if (Aligner2 != null)
                    {
                        Aligner2.LockByNode = PortSetting2Name_cb.Text;
                    }
                }
                Node P2 = NodeManagement.Get(PortSetting2Name_cb.Text);

                int SlotMode = 0;
                if (PortSetting2SlotMode_ck.Checked)
                {
                    SlotMode = 1;
                }
                else
                {
                    SlotMode = 2;
                }
                if (Convert.ToInt16(PortSetting2StartSlot_tb.Text) != 0 && Convert.ToInt16(PortSetting2EndSlot_tb.Text) != 0)
                {
                    for (int i = Convert.ToInt16(PortSetting2StartSlot_tb.Text); i <= Convert.ToInt16(PortSetting2EndSlot_tb.Text); i = i + SlotMode)
                    {
                        Job w = new Job();
                        w.Job_Id = "Wafer" + (i + 25).ToString("000");

                        w.AlignerFlag     = true;
                        w.OCRFlag         = false;
                        w.Position        = P2.Name;
                        w.ProcessFlag     = false;
                        w.FromPort        = P2.Name;
                        w.Slot            = i.ToString();
                        w.Destination     = PortSetting2Dest_cb.Text;
                        w.DestinationSlot = i.ToString();;
                        JobManagement.Add(w.Job_Id, w);
                        P2.JobList.TryAdd(w.Slot, w);
                    }
                }
            }
            NodeManagement.UpdatePortToUI();
            if (AutoIni_ck.Checked)
            {
                MainProcess.SetMode("AutoInitial");//initial
            }
            else
            {
                MainProcess.SetMode("Auto");
            }
        }