Exemplo n.º 1
0
        public static void UpdateStatus(string device)
        {
            Form manual = Application.OpenForms["FormManual"];

            if (manual == null)
            {
                return;
            }

            if (manual.InvokeRequired)
            {
                UpdateStatus_D ph = new UpdateStatus_D(UpdateStatus);
                manual.BeginInvoke(ph, device);
            }
            else
            {
                StateUtil.Init();
                AlignerState aligner = StateUtil.GetDeviceState(device) != null ? (AlignerState)StateUtil.GetDeviceState(device) : null;
                if (aligner == null)
                {
                    return;
                }

                Control       tbStatus      = null;
                Control       tbServo       = null;
                Control       tbWaferSensor = null;
                Control       tbVacSolenoid = null;
                NumericUpDown nudSpeed      = null;
                Control       tbError       = null;
                ComboBox      cbMode        = null;

                if (device.Equals("ALIGNER01"))
                {
                    tbStatus      = manual.Controls.Find("tbA1Status", true).FirstOrDefault() as Control;
                    tbServo       = manual.Controls.Find("tbA1Servo", true).FirstOrDefault() as Control;
                    tbWaferSensor = manual.Controls.Find("tbA1WaferSensor", true).FirstOrDefault() as Control;
                    tbVacSolenoid = manual.Controls.Find("tbA1VacSolenoid", true).FirstOrDefault() as Control;
                    nudSpeed      = manual.Controls.Find("nudA1Speed", true).FirstOrDefault() as NumericUpDown;
                    tbError       = manual.Controls.Find("tbA1Error", true).FirstOrDefault() as Control;
                    cbMode        = manual.Controls.Find("cbA1Mode", true).FirstOrDefault() as ComboBox;
                }
                else if (device.Equals("ALIGNER02"))
                {
                    tbStatus      = manual.Controls.Find("tbA2Status", true).FirstOrDefault() as Control;
                    tbServo       = manual.Controls.Find("tbA2Servo", true).FirstOrDefault() as Control;
                    tbWaferSensor = manual.Controls.Find("tbA2WaferSensor", true).FirstOrDefault() as Control;
                    tbVacSolenoid = manual.Controls.Find("tbA2VacSolenoid", true).FirstOrDefault() as Control;
                    nudSpeed      = manual.Controls.Find("nudA2Speed", true).FirstOrDefault() as NumericUpDown;
                    tbError       = manual.Controls.Find("tbA2Error", true).FirstOrDefault() as Control;
                    cbMode        = manual.Controls.Find("cbA2Mode", true).FirstOrDefault() as ComboBox;
                }


                if (tbServo != null)
                {
                    tbServo.Text = aligner.Servo;
                    Color color = new Color();
                    switch (tbServo.Text)
                    {
                    case "OFF":
                        color = Color.MintCream;
                        break;

                    case "ON":
                        color = Color.LightGreen;
                        break;

                    default:
                        color = Color.White;
                        break;
                    }
                    tbServo.BackColor = color;
                }
                if (tbWaferSensor != null)
                {
                    tbWaferSensor.Text = aligner.Present.Equals("1") ? "ON" : "OFF";
                    Color color = new Color();
                    switch (tbWaferSensor.Text)
                    {
                    case "OFF":
                        color = Color.MintCream;
                        break;

                    case "ON":
                        color = Color.LightGreen;
                        break;

                    default:
                        color = Color.White;
                        break;
                    }
                    tbWaferSensor.BackColor = color;
                }
                if (tbVacSolenoid != null)
                {
                    tbVacSolenoid.Text = aligner.Vacuum.Equals("1") ? "ON" : "OFF";
                    Color color = new Color();
                    switch (tbVacSolenoid.Text)
                    {
                    case "OFF":
                        color = Color.MintCream;
                        break;

                    case "ON":
                        color = Color.LightGreen;
                        break;

                    default:
                        color = Color.White;
                        break;
                    }
                    tbVacSolenoid.BackColor = color;
                }
                if (nudSpeed != null)
                {
                    try
                    {
                        nudSpeed.Text = aligner.Speed.Equals("00") ? "100" : Int32.Parse(aligner.Speed).ToString();
                    }
                    catch (Exception)
                    {
                        nudSpeed.Text = aligner.Speed;
                    }
                }
                if (tbError != null)
                {
                    tbError.Text = aligner.Error;
                }
                if (cbMode != null)
                {
                    switch (aligner.Mode.ToUpper())
                    {
                    case "REAL":
                        cbMode.SelectedIndex = 0;    //kawasaki
                        break;

                    case "SIMU":
                        cbMode.SelectedIndex = 1;    //kawasaki
                        break;

                    case "":
                        cbMode.SelectedIndex = -1;
                        break;

                    default:
                        cbMode.SelectedIndex = Int32.Parse(aligner.Mode);
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static void UpdateStatus(string device)
        {
            Form manual = Application.OpenForms["FormManual"];

            if (manual == null)
            {
                return;
            }

            if (manual.InvokeRequired)
            {
                UpdateStatus_D ph = new UpdateStatus_D(UpdateStatus);
                manual.BeginInvoke(ph, device);
            }
            else
            {
                StateUtil.Init();
                RobotState robot = StateUtil.GetDeviceState(device) != null ? (RobotState)StateUtil.GetDeviceState(device) : null;
                if (robot == null)
                {
                    return;
                }

                Control nudRSpeed = manual.Controls.Find("nudRSpeed", true).FirstOrDefault() as Control;
                if (nudRSpeed != null)
                {
                    try
                    {
                        nudRSpeed.Text = robot.Speed.Equals("00") ? "100" : Int32.Parse(robot.Speed).ToString();
                    }
                    catch (Exception)
                    {
                        nudRSpeed.Text = robot.Speed;
                    }
                }
                Control tbRRwaferSensor = manual.Controls.Find("tbRRwaferSensor", true).FirstOrDefault() as Control;
                if (tbRRwaferSensor != null)
                {
                    tbRRwaferSensor.Text = robot.Present_R.Equals("1") ? "ON" : "OFF";
                    Color color = new Color();
                    switch (tbRRwaferSensor.Text)
                    {
                    case "OFF":
                        color = Color.MintCream;
                        break;

                    case "ON":
                        color = Color.LightGreen;
                        break;

                    default:
                        color = Color.White;
                        break;
                    }
                    tbRRwaferSensor.BackColor = color;
                }
                Control tbRRVacuSolenoid = manual.Controls.Find("tbRRVacuSolenoid", true).FirstOrDefault() as Control;
                if (tbRRVacuSolenoid != null)
                {
                    tbRRVacuSolenoid.Text = robot.Vacuum_R.Equals("1") ? "ON" : "OFF"; Color color = new Color();
                    switch (tbRRVacuSolenoid.Text)
                    {
                    case "OFF":
                        color = Color.MintCream;
                        break;

                    case "ON":
                        color = Color.LightGreen;
                        break;

                    default:
                        color = Color.White;
                        break;
                    }
                    tbRRVacuSolenoid.BackColor = color;
                }
                Control tbRLwaferSensor = manual.Controls.Find("tbRLwaferSensor", true).FirstOrDefault() as Control;
                if (tbRLwaferSensor != null)
                {
                    tbRLwaferSensor.Text = robot.Present_L.Equals("1") ? "ON" : "OFF"; Color color = new Color();
                    switch (tbRLwaferSensor.Text)
                    {
                    case "OFF":
                        color = Color.MintCream;
                        break;

                    case "ON":
                        color = Color.LightGreen;
                        break;

                    default:
                        color = Color.White;
                        break;
                    }
                    tbRLwaferSensor.BackColor = color;
                }
                Control tbRLVacuSolenoid = manual.Controls.Find("tbRLVacuSolenoid", true).FirstOrDefault() as Control;
                if (tbRLVacuSolenoid != null)
                {
                    tbRLVacuSolenoid.Text = robot.Vacuum_L.Equals("1") ? "ON" : "OFF"; Color color = new Color();
                    switch (tbRLVacuSolenoid.Text)
                    {
                    case "OFF":
                        color = Color.MintCream;
                        break;

                    case "ON":
                        color = Color.LightGreen;
                        break;

                    default:
                        color = Color.White;
                        break;
                    }
                    tbRLVacuSolenoid.BackColor = color;
                }
                string state = robot.State != null?robot.State.Trim() : "";

                Control tbRServo = manual.Controls.Find("tbRServo", true).FirstOrDefault() as Control;
                if (tbRServo != null)
                {
                    tbRServo.Text = robot.Servo;
                    Color color = new Color();
                    switch (tbRServo.Text)
                    {
                    case "OFF":
                        color = Color.MintCream;
                        break;

                    case "ON":
                        color = Color.LightGreen;
                        break;

                    default:
                        color = Color.White;
                        break;
                    }
                    tbRServo.BackColor = color;
                }
                Control tbRError = manual.Controls.Find("tbRError", true).FirstOrDefault() as Control;
                if (tbRError != null)
                {
                    tbRError.Text = robot.Error;
                }
                Control tbRErrorMsg = manual.Controls.Find("tbRErrorMsg", true).FirstOrDefault() as Control;
                if (tbRErrorMsg != null)
                {
                    //AlarmMessage Detail = AlmMappin.Get("ROBOT01", robot.Error);
                    //tbRErrorMsg.Text = Detail.Code_Cause_English;
                }
                ComboBox cbRMode = manual.Controls.Find("cbRMode", true).FirstOrDefault() as ComboBox;
                if (cbRMode != null)
                {
                    switch (robot.Mode.ToUpper())
                    {
                    case "REAL":
                        cbRMode.SelectedIndex = 0;    //kawasaki
                        break;

                    case "SIMU":
                        cbRMode.SelectedIndex = 1;    //kawasaki
                        break;

                    case "":
                        cbRMode.SelectedIndex = -1;
                        break;

                    default:
                        cbRMode.SelectedIndex = Int32.Parse(robot.Mode);
                        break;
                    }
                }
            }
        }