Exemplo n.º 1
0
        private ErrorButton CreateErrorButton(UITextField textField)
        {
            var btn = new ErrorButton(this, textField);

            btn.SetBackgroundImage(ErrorImage, UIControlState.Normal);
            return(btn);
        }
        void ReleaseDesignerOutlets()
        {
            if (ApiLabel != null)
            {
                ApiLabel.Dispose();
                ApiLabel = null;
            }

            if (CalServiceLabel != null)
            {
                CalServiceLabel.Dispose();
                CalServiceLabel = null;
            }

            if (ConnectedToLabel != null)
            {
                ConnectedToLabel.Dispose();
                ConnectedToLabel = null;
            }

            if (ContentView != null)
            {
                ContentView.Dispose();
                ContentView = null;
            }

            if (CrmLabel != null)
            {
                CrmLabel.Dispose();
                CrmLabel = null;
            }

            if (ErrorButton != null)
            {
                ErrorButton.Dispose();
                ErrorButton = null;
            }

            if (NavigationBar != null)
            {
                NavigationBar.Dispose();
                NavigationBar = null;
            }

            if (ReloadButton != null)
            {
                ReloadButton.Dispose();
                ReloadButton = null;
            }

            if (VersonLabel != null)
            {
                VersonLabel.Dispose();
                VersonLabel = null;
            }
        }
Exemplo n.º 3
0
        private QState StatePublishSigProbeDone(IQEvent qEvent)
        {
            LogStateInfo(_processName, System.Reflection.MethodBase.GetCurrentMethod().Name, qEvent);

            if (qEvent.IsSignal(SigRecover))
            {
                if (errorMessage != null)
                {
                    ErrorButton response = (ErrorButton)(((QEvent)qEvent).EventObject);
                    switch (response)
                    {
                    case ErrorButton.Continue:
                    {
                        PublishSignal(new QEvent(HSTWorkcell.SigProbeDone));
                        TransitionTo(stateCheckProbeFunctionalTest);
                    }
                    break;

                    default:
                        errorMessage = null;
                        System.Windows.Forms.MessageBox.Show(string.Format("Unhandled Button: {0}", response.ToString()), response.ToString());
                        return(null);
                    }
                    return(null);
                }
            }

            if (qEvent.IsSignal(SigStateJob))
            {
                try
                {
                    TestProbeHandlerMovesUpAfterMeasurementCompleteProcessCycleTimeStopWatch.Stop();
                    if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                    {
                        CommonFunctions.Instance.LogProcessCycleTime("Test Probe Handler Moves Up After Measurement Complete Process Cycle Time.csv", TestProbeHandlerMovesUpAfterMeasurementCompleteProcessCycleTimeStopWatch.ElapsedTime);
                    }

                    if (_workcell.IsAllMeasurementFailed)
                    {
                        throw new Exception("All measurement results failed, Please verify the communications with test electronics work properly");
                    }
                    else
                    {
                        PublishSignal(new QEvent(HSTWorkcell.SigProbeDone));
                        TransitionTo(stateCheckProbeFunctionalTest);
                    }
                }
                catch (Exception ex)
                {
                    ButtonList btnlst = new ButtonList(ErrorButton.Continue, ErrorButton.NoButton, ErrorButton.Stop);
                    TransitionToErrorState(btnlst, ex);
                }
            }
            return(stateRun);
        }
Exemplo n.º 4
0
        private QState StateRunInitCompleteMoveToParkPosition(IQEvent qEvent)
        {
            LogStateInfo(_processName, System.Reflection.MethodBase.GetCurrentMethod().Name, qEvent);

            if (qEvent.IsSignal(SigRecover))
            {
                if (errorMessage != null)
                {
                    ErrorButton response = (ErrorButton)(((QEvent)qEvent).EventObject);
                    switch (response)
                    {
                    case ErrorButton.Stop:
                    {
                        _retryCount = 0;
                    }
                    break;

                    default:
                        errorMessage = null;
                        System.Windows.Forms.MessageBox.Show(string.Format("Unhandled Button: {0}", response.ToString()), response.ToString());
                        return(null);
                    }
                    return(null);
                }
            }

            if (qEvent.IsSignal(SigStateJob))
            {
                try
                {
                    if (!_workcell.IsIgnoreHomeAxisForByPass)
                    {
                        _controller.GoToParkPosition(false);
                    }

                    if (HSTWorkcell.disableBoundaryCheck)
                    {
                        PublishSignal(new QEvent(HSTWorkcell.SigTestProbeBoundaryCheckComplete));
                    }
                    TransitionTo(stateCheckProbeFunctionalTest);
                }
                catch (Exception ex)
                {
                    ButtonList btnlst = new ButtonList(ErrorButton.OK, ErrorButton.NoButton, ErrorButton.NoButton);
                    TransitionToErrorState(btnlst, ex);
                }
                return(null);
            }
            return(stateRunInit);
        }
        private QState StateReportGetputError(IQEvent qEvent)
        {
            LogStateInfo(_processName, System.Reflection.MethodBase.GetCurrentMethod().Name, qEvent);

            if (qEvent.IsSignal(SigRecover))
            {
                if (errorMessage != null)
                {
                    ErrorButton response = (ErrorButton)(((QEvent)qEvent).EventObject);
                    switch (response)
                    {
                    case ErrorButton.OK:     // Reject, treat as bad carrier
                    {
                        PublishSignal(new QEvent(HSTWorkcell.SigEndRunProcess));
                    }
                    break;

                    default:
                        errorMessage = null;
                        System.Windows.Forms.MessageBox.Show(string.Format("Unhandled Button: {0}", response.ToString()), response.ToString());
                        return(null);
                    }
                    return(null);
                }
            }

            if (qEvent.IsSignal(SigStateJob))
            {
                try
                {
                    CommonFunctions.Instance.ActivePopupGetputErrorMessage = true;
                    if (FISManager.Instance.IsFISConnected)
                    {
                        HSTException.Throw(HSTErrors.TestElectronecsGetputErrorDetection2, new Exception(CommonFunctions.Instance.GetputErrorMessage));
                    }
                    else
                    {
                        HSTException.Throw(HSTErrors.TestElectronecsGetputErrorDetection, new Exception(CommonFunctions.Instance.GetputErrorMessage));
                    }
                }
                catch (Exception ex)
                {
                    ButtonList btnlst = new ButtonList(ErrorButton.OK, ErrorButton.NoButton, ErrorButton.NoButton);
                    TransitionToErrorState(btnlst, ex);
                    return(null);
                }
            }
            return(stateRun);
        }
        private QState StateReportWriterBrigeError(IQEvent qEvent)
        {
            LogStateInfo(_processName, System.Reflection.MethodBase.GetCurrentMethod().Name, qEvent);

            if (qEvent.IsSignal(SigRecover))
            {
                if (errorMessage != null)
                {
                    ErrorButton response = (ErrorButton)(((QEvent)qEvent).EventObject);
                    switch (response)
                    {
                    case ErrorButton.OK:     // Reject, treat as bad carrier
                    {
                        HSTMachine.Workcell.IsUnderWriterBridgeFailureAlert = false;
                        PublishSignal(new QEvent(HSTWorkcell.SigEndRunProcess));
                        HSTMachine.Instance.MainForm.getPanelCommand().stopSystemProcess();
                    }
                    break;

                    default:
                        errorMessage = null;
                        System.Windows.Forms.MessageBox.Show(string.Format("Unhandled Button: {0}", response.ToString()), response.ToString());
                        return(null);
                    }
                    return(null);
                }
            }

            if (qEvent.IsSignal(SigStateJob))
            {
                try
                {
                    HSTException.Throw(HSTErrors.TestElectronicsWriterBridgeDetection,
                                       new Exception(string.Format("{0},{1}Carrier ID={2}", "High percentage of writer bridging was detected, please confirm UTIC machine!",
                                                                   Environment.NewLine, HSTMachine.Workcell.WRBridgeFailueCarrierId)));
                }
                catch (Exception ex)
                {
                    ButtonList btnlst = new ButtonList(ErrorButton.OK, ErrorButton.NoButton, ErrorButton.NoButton);
                    TransitionToErrorState(btnlst, ex);
                    return(null);
                }
            }
            return(stateRun);
        }
Exemplo n.º 7
0
        public GeneralErrorUIDispatchEventListener([NotNull] IGeneralErrorEncounteredEventSubscribable subscriptionService,
                                                   [KeyFilter(UnityUIRegisterationKey.ErrorTitle)][NotNull] IUIText errorTitle,
                                                   [KeyFilter(UnityUIRegisterationKey.ErrorMessage)][NotNull] IUIText errorMessage,
                                                   [KeyFilter(UnityUIRegisterationKey.ErrorOkButton)][NotNull] IUIButton errorButton,
                                                   [KeyFilter(UnityUIRegisterationKey.ErrorBox)][NotNull] IUIElement errorDialogBox)
            : base(subscriptionService)
        {
            if (subscriptionService == null)
            {
                throw new ArgumentNullException(nameof(subscriptionService));
            }
            ErrorTitle     = errorTitle ?? throw new ArgumentNullException(nameof(errorTitle));
            ErrorMessage   = errorMessage ?? throw new ArgumentNullException(nameof(errorMessage));
            ErrorButton    = errorButton ?? throw new ArgumentNullException(nameof(errorButton));
            ErrorDialogBox = errorDialogBox ?? throw new ArgumentNullException(nameof(errorDialogBox));

            ErrorArgsQueue = new Queue <GeneralErrorEncounteredEventArgs>(2);
            //Register callback into this dispatcher.
            ErrorButton.AddOnClickListener(OnErrorOkButtonClicked);
        }
Exemplo n.º 8
0
        private QState StatePerformCleaningWithDycem(IQEvent qEvent)
        {
            LogStateInfo(_processName, System.Reflection.MethodBase.GetCurrentMethod().Name, qEvent);

            if (qEvent.IsSignal(SigRecover))
            {
                if (errorMessage != null)
                {
                    ErrorButton response = (ErrorButton)(((QEvent)qEvent).EventObject);
                    switch (response)
                    {
                    case ErrorButton.Reject:     // Reject, treat as bad carrier
                    {
                        Log.Info(this, "{0}, ProcessName:{1}, StatePerformCleaningWithDycem, Carrier rejected by user", LoggerCategory.StateTransition, _processName);
                        PublishSignal(new QEvent(HSTWorkcell.SigOutputEEDycemCleaningComplete));
                        TransitionTo(stateWaitForPrecisorReadyForPick);
                    }
                    break;

                    default:
                        errorMessage = null;
                        System.Windows.Forms.MessageBox.Show(string.Format("Unhandled Button: {0}", response.ToString()), response.ToString());
                        return(null);
                    }
                    return(null);
                }
            }

            if (qEvent.IsSignal(SigStateJob))
            {
                try
                {
                    for (int i = 0; i < HSTMachine.Workcell.HSTSettings.Install.TotalNumberOfOutputEETouchingOnDycem; i++)
                    {
                        Log.Info(this, "{0}, ProcessName:{1}, StateName:StatePerformCleaningWithDycem, Move Output EE to touch on Dycem. Cycle {2}", LoggerCategory.StateTransition, _processName, qEvent.QSignal.ToString(), i + 1);
                        // move to touch on dycem
                        _controller.DoJobMoveZToDycem(false);
                        Thread.Sleep(HSTMachine.Workcell.HSTSettings.Install.OutputEETouchingOnDycemDuration * 1000);
                        // move to EE pick height
                        Log.Info(this, "{0}, ProcessName:{1}, StateName:StatePerformCleaningWithDycem, Move Output EE up to pick height. Cycle {2}", LoggerCategory.StateTransition, _processName, qEvent.QSignal.ToString(), i + 1);
                        _controller.DoJobMoveZToPick(true, false);
                        HSTMachine.Workcell.DycemCleaningCounter.OutputEEDycemCleaningCount += 1;
                    }
                    _controller.DoJobMoveZToPark(false, false);

                    if (HSTMachine.Workcell != null)
                    {
                        if (HSTMachine.Workcell.getPanelOperation() != null)
                        {
                            if (HSTMachine.Workcell.getPanelOperation().getOperationModuleStatePanel() != null)
                            {
                                UIUtility.Invoke(HSTMachine.Workcell.getPanelOperation().getOperationModuleStatePanel(), () =>
                                {
                                    HSTMachine.Workcell.getPanelOperation().getOperationModuleStatePanel().getDycemCleaningCounterUserControl().txtOutputEECleanCount.Text = HSTMachine.Workcell.DycemCleaningCounter.OutputEEDycemCleaningCountString;
                                    HSTMachine.Workcell.DycemCleaningCounter.Save();
                                });
                            }
                        }
                    }

                    PublishSignal(new QEvent(HSTWorkcell.SigOutputEEDycemCleaningComplete));
                    TransitionTo(stateWaitForPrecisorReadyForPick);
                }
                catch (Exception ex)
                {
                    ButtonList btnlst = new ButtonList(ErrorButton.Retry, ErrorButton.Reject, ErrorButton.NoButton);
                    TransitionToErrorState(btnlst, ex);
                }

                return(null);
            }
            return(stateRun);
        }
 private ErrorButton CreateErrorButton(UITextField textField)
 {
     var btn = new ErrorButton(this, textField);
     btn.SetBackgroundImage(ErrorImage, UIControlState.Normal);
     return btn;
 }
Exemplo n.º 10
0
 public InputEventArgs(ErrorButton btn)
 {
     this.button = btn;
 }
Exemplo n.º 11
0
        private QState StateMoveTestProbeToProbePosition(IQEvent qEvent)
        {
            LogStateInfo(_processName, System.Reflection.MethodBase.GetCurrentMethod().Name, qEvent);

            if (qEvent.IsSignal(SigRecover))
            {
                if (errorMessage != null)
                {
                    ErrorButton response = (ErrorButton)(((QEvent)qEvent).EventObject);
                    switch (response)
                    {
                    case ErrorButton.Stop:
                    {
                        _retryCount = 0;
                    }
                    break;

                    default:
                        errorMessage = null;
                        System.Windows.Forms.MessageBox.Show(string.Format("Unhandled Button: {0}", response.ToString()), response.ToString());
                        return(null);
                    }
                    return(null);
                }
            }

            if (qEvent.IsSignal(SigStateJob) /* || qEvent.IsSignal(_sigTimeout)*/)
            {
                try
                {
                    if (_controller.IsSafeToMoveDown())
                    {
                        if ((HSTMachine.Workcell.HSTSettings.Install.OperationMode == OperationMode.Bypass && HSTMachine.Workcell.HSTSettings.Install.BypassMeasurementTestAtTestProbe == true))
                        {
                            // Do nothing
                        }
                        else
                        {
                            bool foundMatchingProductType = false;
                            if (String.Compare(CalibrationSettings.Instance.MeasurementTest.CurrentInstalledTestProbeType, CommonFunctions.Instance.MeasurementTestRecipe.RecipeProbeType, true) == 0)
                            {
                                foundMatchingProductType = true;
                                if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                                {
                                    Log.Info(this, "In TestProbeProcess' StateMoveTestProbeToProbePosition , found a match in the HGA Product Type database in which the Product ID = {0} and Product Name = {1}.",
                                             CalibrationSettings.Instance.MeasurementTest.CurrentInstalledTestProbeType, CommonFunctions.Instance.MeasurementTestRecipe.RecipeProbeType);
                                }
                            }

                            if (foundMatchingProductType == false)
                            {
                                try
                                {
                                    try
                                    {
                                        throw new Exception(String.Format("Unrecognized Product Name of '{0}'.", _currentInputCarrier.WorkOrderData.ProductName));
                                    }
                                    catch (Exception ex)
                                    {
                                        HSTException.Throw(HSTErrors.TestElectronicsOutdatedMeasurementTestConfiguration, new Exception(String.Format("Unrecognized Product Name of '{0}'.", _currentInputCarrier.WorkOrderData.ProductName)));
                                    }
                                }
                                catch (Exception ex)
                                {
                                    ButtonList btnlst = new ButtonList(ErrorButton.OK, ErrorButton.NoButton, ErrorButton.NoButton);
                                    TransitionToErrorState(btnlst, ex);
                                }
                            }
                        }

                        TestProbeMovesDownToPrecisorNestProbePositionProcessCycleTimeStopWatch.Start();

                        TestProbeDownToTestPositionTravellingTimeStopWatch.Start();
                        bool isUp = (_currentInputCarrier.HGATabType == HGAProductTabType.Up);
                        _controller.GoToProbePosition(isUp, false);

                        TestProbeDownToTestPositionTravellingTimeStopWatch.Stop();

                        if (HSTMachine.Workcell.HSTSettings.Install.OperationMode != OperationMode.Simulation)
                        {
                            _currentInputCarrier.setPrecisorNestPositionZ(_controller.GetTestProbePositionZ());
                        }

                        if (HSTMachine.Workcell != null)
                        {
                            if (HSTMachine.Workcell.getPanelOperation() != null)
                            {
                                if (HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel() != null)
                                {
                                    UIUtility.Invoke(HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel(), () =>
                                    {
                                        HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel().labelDownToTestPositionTravellingTime.Text = TestProbeDownToTestPositionTravellingTimeStopWatch.ElapsedTime.ToString();
                                    });
                                }
                            }
                        }

                        TestProbeStabilityProcessCycleTimeStopWatch.Start();
                        HGAMeasurementTestAtTestProbeProcessCycleTimeStopWatch.Start();

                        if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                        {
                            if (CommonFunctions.Instance.TestProbeHandlerMovesDownToPrecisorNestProcessCycleTimeStopWatch.Count > 0)
                            {
                                ProcessStopWatch PSW = CommonFunctions.Instance.TestProbeHandlerMovesDownToPrecisorNestProcessCycleTimeStopWatch.First();
                                PSW.Stop();
                                CommonFunctions.Instance.LogProcessCycleTime("Test Probe Handler Moves Down To Precisor Nest Process Cycle Time.csv.csv", PSW.GetElapsedTime(), PSW.CarrierID, PSW.GetStartTime(), PSW.GetStopTime());
                                CommonFunctions.Instance.TestProbeHandlerMovesDownToPrecisorNestProcessCycleTimeStopWatch.Dequeue();
                            }
                        }

                        TransitionTo(statePublishSigRequestForHGATesting);
                    }
                    else
                    {
                        _qTimer.FireIn(new TimeSpan(0, 0, 0, 0, 200), new QEvent(_sigTimeout));
                        return(null);
                    }
                }
                catch (Exception ex)
                {
                    ButtonList btnlst = new ButtonList(ErrorButton.OK, ErrorButton.NoButton, ErrorButton.NoButton);
                    TransitionToErrorState(btnlst, ex);
                }
                return(null);
            }
            return(stateRun);
        }
        private QState StateVisionInspectCarrierAfterLoad(IQEvent qEvent)
        {
            bool carrierLoadedInWrongDirection = false;

            LogStateInfo(_processName, System.Reflection.MethodBase.GetCurrentMethod().Name, qEvent);

            InputCameraHGADetectionAtInputTurnStationProcessCycleTimeStopWatch.Start();

            if (qEvent.IsSignal(SigRecover))
            {
                if (errorMessage != null)
                {
                    ErrorButton response = (ErrorButton)(((QEvent)qEvent).EventObject);
                    switch (response)
                    {
                    case ErrorButton.Reject:
                    {
                        BoatLeavesInputTurnStationProcessCycleTimeStopWatch.Start();
                        _currentInputCarrier.IsRejectedCarrier = true;
                        Log.Info(this, "{0}, ProcessName:{1}, StateVisionInspectCarrierAfterLoad, Carrier rejected by user", LoggerCategory.StateTransition, _processName);
                        CommonFunctions.Instance.InputCarriers.Enqueue(_currentInputCarrier);
                        TransitionTo(stateWaitForSigInputStationReady);
                    }
                    break;

                    case ErrorButton.OK:
                    {
                        _retryCount = 0;
                    }
                    break;

                    default:
                        errorMessage = null;
                        System.Windows.Forms.MessageBox.Show(string.Format("Unhandled Button: {0}", response.ToString()), response.ToString());
                        return(null);
                    }
                    return(null);
                }
            }

            if (qEvent.IsSignal(SigStateJob))
            {
                try
                {
                    if (HSTMachine.Workcell.HSTSettings.Install.OperationMode == OperationMode.Simulation || HSTMachine.Workcell.HSTSettings.Install.OperationMode == OperationMode.DryRun)
                    {
                        CarrierSettings carrierSettings = SimulatedInputCarriersSettingsQueue.Dequeue();
                        Mapper.CreateMap <CarrierSettings, Carrier>();
                        _currentInputCarrier         = Mapper.Map <Carrier>(carrierSettings);
                        _currentInputCarrierSettings = carrierSettings;


                        if (_currentInputCarrier == null)
                        {
                            throw new Exception("Failed to find valid input carrier object to be assigned with the read RFID data.");
                        }
                    }
                    else if (HSTMachine.Workcell.HSTSettings.Install.OperationMode == OperationMode.Bypass && HSTMachine.Workcell.HSTSettings.Install.BypassVisionAtInputTurnStation == true)
                    {
                        _currentInputCarrier = new Carrier();
                        _currentInputCarrier.Hga1.Hga_Status  = HGAStatus.HGAPresent;
                        _currentInputCarrier.Hga2.Hga_Status  = HGAStatus.HGAPresent;
                        _currentInputCarrier.Hga3.Hga_Status  = HGAStatus.HGAPresent;
                        _currentInputCarrier.Hga4.Hga_Status  = HGAStatus.HGAPresent;
                        _currentInputCarrier.Hga5.Hga_Status  = HGAStatus.HGAPresent;
                        _currentInputCarrier.Hga6.Hga_Status  = HGAStatus.HGAPresent;
                        _currentInputCarrier.Hga7.Hga_Status  = HGAStatus.HGAPresent;
                        _currentInputCarrier.Hga8.Hga_Status  = HGAStatus.HGAPresent;
                        _currentInputCarrier.Hga9.Hga_Status  = HGAStatus.HGAPresent;
                        _currentInputCarrier.Hga10.Hga_Status = HGAStatus.HGAPresent;
                    }
                    else
                    {
                        Thread.Sleep(HSTMachine.Workcell.SetupSettings.Delay.InputTurnTableFullyStopDelay);
                        _currentInputCarrier = _workcell.Process.InputEEProcess.Controller.VisionInspect();

                        if (CommonFunctions.Instance.visionError != "NoError")
                        {
                            HSTException.Throw(HSTErrors.InputDetectionCameraError, new Exception("Failed to run tool block: " + CommonFunctions.Instance.visionError));
                        }

                        if (_currentInputCarrier.IsLoadedInWrongDirection)
                        {
                            carrierLoadedInWrongDirection = true;
                            Log.Info(this, "{0}, ProcessName:{1}, StateVisionInspectCarrierAfterLoad, Input HGADetection camera detected carrier loaded in wrong direction. Reject this carrier.");

                            HSTException.Throw(HSTErrors.InputDetectionCameraCarrierLoadedInWrongDirection, new Exception("Input Camera detected current carrier was loaded in wrong direction."));
                        }

                        if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                        {
                            Log.Info(this, "{0}, ProcessName:{1}, StateVisionInspectCarrierAfterLoad, Input HGADetection camera result Carrier ID:{2}, " +
                                     "HGA1:{3}, HGA2:{4}, HGA3:{5}, HGA4:{6}, HGA5:{7}, " +
                                     "HGA6:{8},  HGA7:{9}, HGA8:{10}, HGA9:{11}, HGA10:{12}", LoggerCategory.StateTransition, _processName, "Unknown",
                                     _currentInputCarrier.Hga1.Hga_Status, _currentInputCarrier.Hga2.Hga_Status, _currentInputCarrier.Hga3.Hga_Status, _currentInputCarrier.Hga4.Hga_Status, _currentInputCarrier.Hga5.Hga_Status,
                                     _currentInputCarrier.Hga6.Hga_Status, _currentInputCarrier.Hga7.Hga_Status, _currentInputCarrier.Hga8.Hga_Status, _currentInputCarrier.Hga9.Hga_Status, _currentInputCarrier.Hga10.Hga_Status);
                        }
                    }
                    _currentInputCarrier.CarrierCurrentLocation = CarrierLocation.InputTurnStation;

                    lock (CommonFunctions.Instance.InputCarriersLock)
                    {
                        CommonFunctions.Instance.InputCarriers.Enqueue(_currentInputCarrier);
                    }

                    _currentInputCarrier.IsCarrierEmpty = IsCarrierEmpty.Empty;

                    if (_currentInputCarrier.Hga1.Hga_Status >= HGAStatus.HGAPresent ||
                        _currentInputCarrier.Hga2.Hga_Status >= HGAStatus.HGAPresent ||
                        _currentInputCarrier.Hga3.Hga_Status >= HGAStatus.HGAPresent ||
                        _currentInputCarrier.Hga4.Hga_Status >= HGAStatus.HGAPresent ||
                        _currentInputCarrier.Hga5.Hga_Status >= HGAStatus.HGAPresent ||
                        _currentInputCarrier.Hga6.Hga_Status >= HGAStatus.HGAPresent ||
                        _currentInputCarrier.Hga7.Hga_Status >= HGAStatus.HGAPresent ||
                        _currentInputCarrier.Hga8.Hga_Status >= HGAStatus.HGAPresent ||
                        _currentInputCarrier.Hga9.Hga_Status >= HGAStatus.HGAPresent ||
                        _currentInputCarrier.Hga10.Hga_Status >= HGAStatus.HGAPresent)
                    {
                        _currentInputCarrier.IsCarrierEmpty = IsCarrierEmpty.NotEmpty;
                    }

                    InputCameraHGADetectionAtInputTurnStationProcessCycleTimeStopWatch.Stop();
                    if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                    {
                        CommonFunctions.Instance.LogProcessCycleTime("Input Camera HGA Detection At Input Turn Station Process Cycle Time.csv", InputCameraHGADetectionAtInputTurnStationProcessCycleTimeStopWatch.ElapsedTime);
                    }

                    BoatLeavesInputTurnStationProcessCycleTimeStopWatch.Start();
                    TransitionTo(stateWaitForSigInputStationReady);
                }
                catch (Exception ex)
                {
                    bool skipRetry = carrierLoadedInWrongDirection ? true : false;

                    if (_retryCount < 3 && !skipRetry)
                    {
                        Log.Error(this, "Failed to perform vision inspection. Retry count: {0}, Exception: {1}, StateName: {2}", _retryCount, ex.Message, this.CurrentStateName);
                        TransitionTo(this.targetState);
                    }
                    else
                    {
                        ButtonList btnlst;
                        if (carrierLoadedInWrongDirection)
                        {
                            btnlst = new ButtonList(ErrorButton.Reject, ErrorButton.Stop, ErrorButton.NoButton);
                        }
                        else
                        {
                            btnlst = new ButtonList(ErrorButton.Retry, ErrorButton.Reject, ErrorButton.Stop);
                        }

                        TransitionToErrorState(btnlst, ex);
                    }
                    _retryCount++;
                }
                return(null);
            }
            return(stateRun);
        }
Exemplo n.º 13
0
 public EventParam(string sigConsumer, ErrorButton errorResponse)
 {
     _errorResponse = errorResponse;
     _sigConsumer   = sigConsumer;
 }
Exemplo n.º 14
0
 public EventParam(ErrorButton errorResponse)
 {
     _errorResponse = errorResponse;
 }
Exemplo n.º 15
0
 public void ClickError()
 {
     ErrorButton.Click();
 }
Exemplo n.º 16
0
 public ButtonList(ErrorButton left, ErrorButton middle, ErrorButton right)
 {
     this.Left   = left;
     this.Middle = middle;
     this.Right  = right;
 }
Exemplo n.º 17
0
        private QState StateMoveTestProbeToParkPosition(IQEvent qEvent)
        {
            LogStateInfo(_processName, System.Reflection.MethodBase.GetCurrentMethod().Name, qEvent);

            if (qEvent.IsSignal(SigRecover))
            {
                if (errorMessage != null)
                {
                    ErrorButton response = (ErrorButton)(((QEvent)qEvent).EventObject);
                    switch (response)
                    {
                    case ErrorButton.Stop:
                    {
                        _retryCount = 0;
                    }
                    break;

                    default:
                        errorMessage = null;
                        System.Windows.Forms.MessageBox.Show(string.Format("Unhandled Button: {0}", response.ToString()), response.ToString());
                        return(null);
                    }
                    return(null);
                }
            }

            if (qEvent.IsSignal(SigStateJob))
            {
                TestProbeUpFromTestPositionTravellingTimeStopWatch.Start();

                //Delay probe before moved up
                Thread.Sleep(HSTMachine.Workcell.SetupSettings.Delay.ProbeMoveUpDelay);

                _controller.GoToParkPosition(false);
                TestProbeUpFromTestPositionTravellingTimeStopWatch.Stop();

                if (HSTMachine.Workcell != null)
                {
                    if (HSTMachine.Workcell.getPanelOperation() != null)
                    {
                        if (HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel() != null)
                        {
                            UIUtility.Invoke(HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel(), () =>
                            {
                                HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel().labelUpFromTestPositionTravellingTime.Text = TestProbeUpFromTestPositionTravellingTimeStopWatch.ElapsedTime.ToString();
                            });
                        }
                    }
                }

                if (HSTMachine.Workcell.HSTSettings.Install.OperationMode == OperationMode.Simulation ||
                    HSTMachine.Workcell.HSTSettings.Install.OperationMode == OperationMode.DryRun ||
                    (HSTMachine.Workcell.HSTSettings.Install.OperationMode == OperationMode.Bypass && HSTMachine.Workcell.HSTSettings.Install.BypassMeasurementTestAtTestProbe == true))
                {
                    simulation = true;
                }
                else
                {
                    TestTimeStopWatch.Stop();

                    if (HSTMachine.Workcell != null)
                    {
                        if (HSTMachine.Workcell.getPanelOperation() != null)
                        {
                            if (HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel() != null)
                            {
                                UIUtility.Invoke(HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel(), () =>
                                {
                                    HSTMachine.Workcell.getPanelOperation().getOperationStatusPanel().labelTestTime.Text = TestTimeStopWatch.ElapsedTime.ToString();
                                });
                            }
                        }
                    }

                    _retryCount = 0;
                }

                try
                {
                    if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                    {
                        Log.Info(this, "{0}, ProcessName:{1}, StateName:StateWaitForSigHGATestingDone, Received QSignal:{2} and transition to new State:StatePublishSigProbeDone", LoggerCategory.StateTransition, _processName, qEvent.QSignal.ToString());
                    }

                    HGAMeasurementTestAtTestProbeProcessCycleTimeStopWatch.Stop();
                    if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                    {
                        CommonFunctions.Instance.LogProcessCycleTime("HGA Measurement Test At Test Probe Process Cycle Time.csv", HGAMeasurementTestAtTestProbeProcessCycleTimeStopWatch.ElapsedTime);
                    }

                    TestProbeHandlerMovesUpAfterMeasurementCompleteProcessCycleTimeStopWatch.Start();

                    ProcessStopWatch PSW = new ProcessStopWatch(_currentInputCarrier.CarrierID, new Stopwatch());
                    if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                    {
                        CommonFunctions.Instance.CollisionAvoidanceBetweenTestProbeHandlerAndPrecisorNestProcessCycleTimeStopWatch.Enqueue(PSW);
                    }


                    TransitionTo(stateCheckDoubleTestPeriod);
                }
                catch (Exception ex)
                {
                    ButtonList btnlst = new ButtonList(ErrorButton.OK, ErrorButton.NoButton, ErrorButton.NoButton);
                    TransitionToErrorState(btnlst, ex);
                }
                return(null);
            }
            return(stateRun);
        }
Exemplo n.º 18
0
        private QState StateWaitForSigHGATestingDone(IQEvent qEvent)
        {
            LogStateInfo(_processName, System.Reflection.MethodBase.GetCurrentMethod().Name, qEvent);

            if (qEvent.IsSignal(SigRecover))
            {
                if (errorMessage != null)
                {
                    ErrorButton response = (ErrorButton)(((QEvent)qEvent).EventObject);
                    switch (response)
                    {
                    case ErrorButton.Yes:     // Retry testing
                    {
                        TransitionTo(statePublishSigRequestForHGATesting);
                    }
                    break;

                    case ErrorButton.No:     // Skip testing
                    {
                        Log.Info(this, "{0}, ProcessName:{1}, StateWaitForSigHGATestingDone, Carrier rejected by user", LoggerCategory.StateTransition, _processName);
                        if (_currentInputCarrier.Hga1.Hga_Status == HGAStatus.HGAPresent)
                        {
                            _currentInputCarrier.Hga1.Hga_Status = HGAStatus.Untested;
                        }
                        if (_currentInputCarrier.Hga2.Hga_Status == HGAStatus.HGAPresent)
                        {
                            _currentInputCarrier.Hga2.Hga_Status = HGAStatus.Untested;
                        }
                        if (_currentInputCarrier.Hga3.Hga_Status == HGAStatus.HGAPresent)
                        {
                            _currentInputCarrier.Hga3.Hga_Status = HGAStatus.Untested;
                        }
                        if (_currentInputCarrier.Hga4.Hga_Status == HGAStatus.HGAPresent)
                        {
                            _currentInputCarrier.Hga4.Hga_Status = HGAStatus.Untested;
                        }
                        if (_currentInputCarrier.Hga5.Hga_Status == HGAStatus.HGAPresent)
                        {
                            _currentInputCarrier.Hga5.Hga_Status = HGAStatus.Untested;
                        }
                        if (_currentInputCarrier.Hga6.Hga_Status == HGAStatus.HGAPresent)
                        {
                            _currentInputCarrier.Hga6.Hga_Status = HGAStatus.Untested;
                        }
                        if (_currentInputCarrier.Hga7.Hga_Status == HGAStatus.HGAPresent)
                        {
                            _currentInputCarrier.Hga7.Hga_Status = HGAStatus.Untested;
                        }
                        if (_currentInputCarrier.Hga8.Hga_Status == HGAStatus.HGAPresent)
                        {
                            _currentInputCarrier.Hga8.Hga_Status = HGAStatus.Untested;
                        }
                        if (_currentInputCarrier.Hga9.Hga_Status == HGAStatus.HGAPresent)
                        {
                            _currentInputCarrier.Hga9.Hga_Status = HGAStatus.Untested;
                        }
                        if (_currentInputCarrier.Hga10.Hga_Status == HGAStatus.HGAPresent)
                        {
                            _currentInputCarrier.Hga10.Hga_Status = HGAStatus.Untested;
                        }
                        TransitionTo(stateMoveTestProbeToParkPosition);
                    }
                    break;

                    default:
                        errorMessage = null;
                        System.Windows.Forms.MessageBox.Show(string.Format("Unhandled Button: {0}", response.ToString()), response.ToString());
                        return(null);
                    }
                    return(null);
                }
            }

            if (qEvent.IsSignal(SigStateJob))
            {
                _qTimer.FireIn(new TimeSpan(0, 0, 0, 0, 1000), new QEvent(_sigTimeout));

                if (RecallDeferredSignal(HSTWorkcell.SigHGATestingDone))
                {
                    UpdateSignalRecipient(HSTWorkcell.SigHGATestingDone);
                    return(null);
                }
                return(null);
            }

            if (qEvent.IsSignal(HSTWorkcell.SigHGATestingDone))
            {
                HSTMachine.Workcell.TestTimePerCarrier.Stop();
                HSTMachine.Workcell.TestTimePerHead = HSTMachine.Workcell.TestTimePerCarrier.ElapsedTime_sec / 10;
                if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                {
                    AfterProbeTimeStamp = DateTime.Now;
                    TimeSpan ProbeTimeSpan = AfterProbeTimeStamp.Subtract(BeforeProbeTimeStamp);
                    if (HSTMachine.Workcell.HSTSettings.Install.EnableDebugLog)
                    {
                        Log.Info(this, "Received SigHGATestingDone in TestProbeProcess, AfterProbeTimeStamp : {0}, ProbeTimeSpan : {1}", AfterProbeTimeStamp, (ProbeTimeSpan.Seconds + ProbeTimeSpan.Milliseconds / 1000.0));
                    }
                }

                TransitionTo(stateMoveTestProbeToParkPosition);
                return(null);
            }

            if (qEvent.IsSignal(_sigTimeout))
            {
                DateTime currentTime  = DateTime.Now;
                TimeSpan diffTime     = currentTime.Subtract(_lastRequestTestTime);
                int      totalTimeout = 0;
                if (!Controller.IsDoubleTestActive)
                {
                    totalTimeout = HSTMachine.Workcell.HSTSettings.Install.MeasurementTestTimeOutLimit;
                }
                else
                {
                    totalTimeout = HSTMachine.Workcell.HSTSettings.Install.MeasurementTestTimeOutLimit * 2;
                }

                if (HSTMachine.Workcell.HSTSettings.Install.MeasurementTestTimeOutLimit > 0)
                {
                    if ((int)diffTime.TotalSeconds >= totalTimeout)
                    {
                        try
                        {
                            HSTException.Throw(HSTErrors.TestElectronicsMeasurementTimeout, new Exception(String.Format("Test duration exceed {0}s timeout Limit. \nPress 'Yes' to retry HGA testing, and 'No'to skip the testing.", HSTMachine.Workcell.HSTSettings.Install.MeasurementTestTimeOutLimit)));
                        }
                        catch (Exception ex)
                        {
                            ButtonList btnlst = new ButtonList(ErrorButton.Yes, ErrorButton.No, ErrorButton.NoButton);
                            TransitionToErrorState(btnlst, ex);
                            return(null);
                        }
                    }
                }

                _qTimer.FireIn(new TimeSpan(0, 0, 0, 0, 1000), new QEvent(_sigTimeout));
                return(null);
            }

            return(stateRun);
        }