private void MakePositionCheckProcess() { var seq = PositionCheckProcess; #region Regist Event seq.OnStart += delegate { JobStepIndex = 0; VisionJobNamePreFix = "pos_check_"; RetryInfoPositionCheckRetry.ClearCount(); //ProductInfo.ECInfo.PACKING_MASTER_INFO.PART_ID = "MZVLV256HCHP-000H1-G12"; //ProductInfo.ECInfo.PACKING_MASTER_INFO.TRAY_ARRAY_X = 3; //ProductInfo.ECInfo.PACKING_MASTER_INFO.TRAY_ARRAY_Y = 5; //ProductInfo.VT8792ProductInfo.TrayIndex = 1; //ProductInfo.VT8792ProductInfo.TrayCount = 10; }; #endregion #region Steps seq.Steps.Add("LoadJob", new StepInfo()); seq.Steps.Add("Align", new StepInfo()); seq.Steps.Add("ChangeVisionJob", new StepInfo()); seq.Steps.Add("TimeAlignTime", new StepInfo()); seq.Steps.Add("ConfirmJobStepEnd", new StepInfo()); seq.Steps.Add("ScanStep", new StepInfo()); seq.Steps.Add("MoveRobot", new StepInfo()); seq.Steps.Add("PositionCheck", new StepInfo()); seq.Steps.Add("ConfirmPositionCheckResult", new StepInfo()); seq.Steps.Add("IncreaseJobStep", new StepInfo()); seq.Steps.Add("Terminate", new StepInfo()); seq.Steps.Add("PositionCheckRetry", new StepInfo()); #endregion seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (ProductInfo.VT8792ProductInfo.LotScanCompleted.ScanSuccess == false) actor.NextStep("Terminate"); else if (ProductInfo.VT8792ProductInfo.TrayIndex > ProductInfo.VT8792ProductInfo.TrayCount) actor.NextStep("Terminate"); else actor.NextStep(); }); seq.Steps["LoadJob"].StepIndex = seq.AddItem(LoadJob); seq.Steps["Align"].StepIndex = seq.AddItem(Aligner.Up.Sequence, Stopper.Up.Sequence); seq.Steps["ChangeVisionJob"].StepIndex = seq.AddItem(ChangeVisionJob); seq.Steps["TimeAlignTime"].StepIndex = seq.AddItem(TimeAlignTime); seq.Steps["ConfirmJobStepEnd"].StepIndex = seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (DevicePositionCheckJobInfo.Steps.Count > JobStepIndex) { actor.NextStep(); } else actor.NextStep("Terminate"); }); seq.Steps["ScanStep"].StepIndex = seq.AddItem( delegate(FASequence actor, TimeSpan time) { SSDCountInTray = ProductInfo.ECInfo.PACKING_MASTER_INFO.TRAY_ARRAY_X * ProductInfo.ECInfo.PACKING_MASTER_INFO.TRAY_ARRAY_Y; if (ProductInfo.VT8792ProductInfo.TrayIndex == ProductInfo.VT8792ProductInfo.TrayCount && ProductInfo.VT8792ProductInfo.RemainSSDCount != 0) { SSDCountInTray = ProductInfo.VT8792ProductInfo.RemainSSDCount; } var jobStep = DevicePositionCheckJobInfo.Steps[JobStepIndex] as FASSDScanJobPositionMoveStep; jobStep.Position.PositionX.CopyTo(SSDScannerTransferServoX.ScanPos); jobStep.Position.PositionY.CopyTo(SSDScannerTransferServoY.ScanPos); jobStep.Position.PositionZ.CopyTo(SSDScannerTransferServoZ.ScanPos); actor.NextStep(); }); seq.Steps["MoveRobot"].StepIndex = seq.AddItem(MoveRobot); seq.Steps["PositionCheck"].StepIndex = seq.AddItem(PositionCheck); #region ConfirmPositionCheckResult seq.Steps["ConfirmPositionCheckResult"].StepIndex = seq.AddItem( delegate(FASequence actor, TimeSpan time) { var job = DevicePositionCheckJobInfo.Steps[JobStepIndex] as FASSDScanJobPositionMoveStep; List<int> validCrossNumber, emptyPocketList; GetValidCrossNumber(job.IndexList, SSDCountInTray, out validCrossNumber); var ssdScanResults = PositionCheckResultList.Select(x => x).Where(x => validCrossNumber.Contains(x.Index)); GetInvalidCrossNumber(job.IndexList, SSDCountInTray, out emptyPocketList); ScanFailMessage = string.Empty; if (validCrossNumber.Count == ssdScanResults.Count() && TimeStamp == CognexVisionReceiver.TimeStamp) { bool positionError = false; string errorMsg = string.Empty; List<SSDPositionCheckInfo> barcodeInfoList = GetDevicePositionCheckResultList(ssdScanResults, emptyPocketList, out positionError, out errorMsg); if (positionError) { ScanFailMessage = "POSITION CHECK ERROR\n" + errorMsg; if (RetryInfoPositionCheckRetry.IncreaseCount() == false) actor.NextStep("PositionCheckRetry"); else actor.NextStep("ScanStep"); } else actor.NextStep(); } else { ScanFailMessage = string.Format("Index Count Of Job is not match with scan result. Index count of job={0}, pos check result index count={1}, JobStep={2}", validCrossNumber.Count, ssdScanResults.Count(), JobStepIndex); WriteTraceLog(ScanFailMessage); if (RetryInfoPositionCheckRetry.IncreaseCount() == false) actor.NextStep("PositionCheckRetry"); else actor.NextStep("ScanStep"); } }); #endregion seq.Steps["IncreaseJobStep"].StepIndex = seq.AddItem( delegate(object obj) { if (DevicePositionCheckJobInfo.Steps.Count > JobStepIndex) { RetryInfoPositionCheckRetry.ClearCount(); JobStepIndex++; } }); seq.AddItem("ConfirmJobStepEnd"); seq.Steps["Terminate"].StepIndex = seq.AddTerminate(); #region Retry FAFramework.GUI.QuestionMessageBoxWindow questionWindow = null; seq.Steps["PositionCheckRetry"].StepIndex = seq.AddItem( delegate(object obj) { App.Current.Dispatcher.Invoke( new Action( delegate { questionWindow = new FAFramework.GUI.QuestionMessageBoxWindow(); questionWindow.Message = Utility.UtilityClass.GetStringResource(this, "VT8792.AreYouSureYouWantToScanRetry", "Are you sure you want to scan retry?") + "\n" + ScanFailMessage; questionWindow.EquipmentInstance = Equipment; questionWindow.Show(); Equipment.StateSignalModuleReferance.EquipmentStateConfigs.WarningStateConfig.CopyTo( Equipment.StateSignalModuleReferance.CustomState); Equipment.StateSignalModuleReferance.CustomMode = true; }), null); }); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (questionWindow.Result == FAFramework.GUI.QuestionMessageBoxWindow.QuestionResult.Yes) { Equipment.StateSignalModuleReferance.CustomMode = false; actor.NextStep("ScanStep"); } else if (questionWindow.Result == FAFramework.GUI.QuestionMessageBoxWindow.QuestionResult.No) { Equipment.StateSignalModuleReferance.CustomMode = false; actor.NextStep("IncreaseJobStep"); } }); #endregion }
private void MakeBarcodeScanProcess() { FAExtendECPart.ECResult ecResult = new FAExtendECPart.ECResult(); var seq = BarcodeScanProcess; #region Regist Event seq.OnStart += delegate { JobStepIndex = 0; RetryInfoScanRetry.ClearCount(); VisionJobNamePreFix = string.Empty; }; #endregion #region Add Steps seq.Steps.Add("LoadJob", new StepInfo()); seq.Steps.Add("GetStructOfBarcodes", new StepInfo()); seq.Steps.Add("ChangeVisionJob", new StepInfo()); seq.Steps.Add("Align", new StepInfo()); seq.Steps.Add("ConfirmJobStepEnd", new StepInfo()); seq.Steps.Add("ScanStep", new StepInfo()); seq.Steps.Add("Scan", new StepInfo()); seq.Steps.Add("IncreaseJobStep", new StepInfo()); seq.Steps.Add("ConfirmScanResult", new StepInfo()); seq.Steps.Add("ScanDataClear", new StepInfo()); seq.Steps.Add("TurnOffLight", new StepInfo()); seq.Steps.Add("ScanFailRetry", new StepInfo()); seq.Steps.Add("StaticScanRetry", new StepInfo()); #endregion seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (ProductInfo.VT8792ProductInfo.LotScanCompleted.ScanSuccess == false) actor.NextStep("TurnOffLight"); else actor.NextStep(); }); seq.Steps["LoadJob"].StepIndex = seq.AddItem(LoadJob); #region Action Before Scan seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (ProductInfo.VT8792ProductInfo.TrayIndex == 1) { PassCount = 0; FailCount = 0; PEBagStartTime = DateTime.Now; if (VT8792Equipment.GlobalConfigModule.UseGEMCommunication) { GEM.GEMFuncWrapper.SetPEBagStart(Equipment.Name, ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID, ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_QTY, ProductInfo.ECInfo.PACKING_MASTER_INFO.PART_ID, DateTime.Now); } JobStepIndex = 0; Equipment.ProductOutput.TrackInLot(DateTime.Now, ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID); if (AlwaysGetStructOfBarcodes) { LastPartIDOfProduct = string.Empty; actor.NextStep("GetStructOfBarcodes"); } else if (LastPartIDOfProduct == ProductInfo.ECInfo.PACKING_MASTER_INFO.PART_ID) { WriteTraceLog(string.Format("GetStructOfBarcodes Skip. LastPartID={0}, CurrentPartID{1}", LastPartIDOfProduct, ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID)); actor.NextStep("ChangeVisionJob"); } else { WriteTraceLog(string.Format("GetStructOfBarcodes Start. LastPartID={0}, CurrentPartID{1}", LastPartIDOfProduct, ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID)); actor.NextStep("GetStructOfBarcodes"); } } else { if (CommonJobInfo.UsePositionCheck) actor.NextStep("ChangeVisionJob"); else actor.NextStep("Align"); } }); seq.Steps["GetStructOfBarcodes"].StepIndex = seq.AddItem(GetStructOfBarcodes); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (BarcodeStructScanFail) actor.NextStep("TurnOffLight"); else actor.NextStep(); }); seq.Steps["ChangeVisionJob"].StepIndex = seq.AddItem(ChangeVisionJob); seq.Steps["Align"].StepIndex = seq.AddItem(Aligner.Up.Sequence, Stopper.Up.Sequence); seq.AddItem(TimeAlignTime); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (ProductInfo.VT8792ProductInfo.TrayIndex > ProductInfo.VT8792ProductInfo.TrayCount) { Equipment.ProductOutput.TrackOutLot(DateTime.Now, ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID); actor.NextTerminate(); } else actor.NextStep(); }); seq.AddItem( delegate(object obj) { ProductInfo.SerialBarcodeInfo.SetBarcodeInfo(ProductInfo.ECInfo.LOT_CLOSE.SERIAL); ProductInfo.PPIDBarcodeInfo.SetBarcodeInfo(ProductInfo.ECInfo.LOT_CLOSE.PPID); ProductInfo.WWNBarcodeInfo.SetBarcodeInfo(ProductInfo.ECInfo.LOT_CLOSE.WWN); ProductInfo.CSerialBarcodeInfo.SetBarcodeInfo(ProductInfo.ECInfo.LOT_CLOSE.C_SERIAL); ProductInfo.PSIDBarcodeInfo.SetBarcodeInfo(ProductInfo.ECInfo.LOT_CLOSE.PSID); }); seq.AddItem(VisionLight.DoTurnOn); seq.Steps["ScanDataClear"].StepIndex = seq.AddItem( delegate(object obj) { JobStepIndex = 0; SSDScanFullResult.Clear(); SSDScanResultList.Clear(); ecResult.Clear(); }); #endregion seq.Steps["ConfirmJobStepEnd"].StepIndex = seq.AddItem(ConfirmJobStepEnd); seq.AddItem(SelectJobStepAction); #region ScanStep seq.Steps["ScanStep"].StepIndex = seq.AddItem( delegate(FASequence actor, TimeSpan time) { SSDCountInTray = ProductInfo.ECInfo.PACKING_MASTER_INFO.TRAY_ARRAY_X * ProductInfo.ECInfo.PACKING_MASTER_INFO.TRAY_ARRAY_Y; if (ProductInfo.VT8792ProductInfo.TrayIndex == ProductInfo.VT8792ProductInfo.TrayCount && ProductInfo.VT8792ProductInfo.RemainSSDCount != 0) { SSDCountInTray = ProductInfo.VT8792ProductInfo.RemainSSDCount; actor.NextStep(); } else actor.NextStep(); }); seq.AddItem(SetRobotPositionFromJob); seq.AddItem(MoveRobot); #endregion seq.Steps["Scan"].StepIndex = seq.AddItem(Scan); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.DRY_RUN || Equipment.RunMode == FAFramework.Equipment.RunModeTypes.COLD_RUN) { actor.NextStep("IncreaseJobStep"); } else actor.NextStep(); }); #region ConfirmScanResult seq.AddItem( delegate(FASequence actor, TimeSpan time) { var job = BarcodeScanJobInfo.Steps[JobStepIndex] as FASSDScanJobPositionMoveStep; List<int> validCrossNumber, emptyPocketList; GetValidCrossNumber(job.IndexList, SSDCountInTray, out validCrossNumber); GetInvalidCrossNumber(job.IndexList, SSDCountInTray, out emptyPocketList); var ssdScanResults = SSDScanResultList.Select(x => x).Where(x => validCrossNumber.Contains(x.Index)); ScanFailMessage = string.Empty; if (validCrossNumber.Count == ssdScanResults.Count()) { bool isScanFail = false; List<SSDBarcodesInfo> barcodeInfoList = GetBarcodeInfoList(ssdScanResults, emptyPocketList, out isScanFail); string emptyPocketCheckErrorMessage = string.Empty; bool emptyPocketCheckResult = CheckEmptyPocketOfTray(SSDScanResultList, emptyPocketList, out emptyPocketCheckErrorMessage); if (isScanFail || emptyPocketCheckResult == false) { if (RetryInfoScanRetry.IncreaseCount() == false) { ScanFailMessage += emptyPocketCheckErrorMessage; actor.NextStep("ScanFailRetry"); } else actor.NextStep("StaticScanRetry"); } else { foreach (var item in barcodeInfoList) { this.SSDScanFullResult.Add(item.Clone()); } actor.NextStep(); } } else { ScanFailMessage = string.Format("Index Count Of Job is not match with scan result. Index count of job={0}, scan result index count={1}, JobStep={2}", validCrossNumber.Count, ssdScanResults.Count(), JobStepIndex); WriteTraceLog(ScanFailMessage); if (RetryInfoScanRetry.IncreaseCount() == false) { actor.NextStep("ScanFailRetry"); } else actor.NextStep("StaticScanRetry"); } }); #endregion seq.AddItem("IncreaseJobStep"); seq.Steps["IncreaseJobStep"].StepIndex = seq.AddItem( delegate(object obj) { if (BarcodeScanJobInfo.Steps.Count > JobStepIndex) { JobStepIndex++; } }); seq.AddItem("ConfirmJobStepEnd"); seq.Steps["ConfirmScanResult"].StepIndex = seq.AddItem(ConfirmScanResult); #region PEBag seq.AddItem( delegate(object obj) { FAECInfo.BRAND_PEBAG_TRAY_CHECK_REQ command = new FAECInfo.BRAND_PEBAG_TRAY_CHECK_REQ(); command.LOT_ID = ProductInfo.ECInfo.LOT_CLOSE.LOT_ID; command.SSD_CNT = SSDCountInTray; foreach (var item in this.SSDScanFullResult) { Utility.FAECInfo.PEBAG_TRAY_CHECK_ITEM info = new Utility.FAECInfo.PEBAG_TRAY_CHECK_ITEM(); info.PROD_SRLNO = item.PROD_SRLNO; info.CUST_SRLNO = item.CUST_SRLNO; info.WWN_SRLNO = item.WWN_SRLNO; info.PIECE_PROD_ID = item.PIECE_PROD_ID; info.PHYS_SECRTY_ID = item.PHYS_SECRTY_ID; command.SERIAL_LIST.Add(info); } ecResult.Clear(); InterfaceUnit.ECPart.AddCommand(command, ecResult); }); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (ecResult.ReceiveOk) { if (ecResult.ParsingSuccess) { if (ecResult.ECInfo.BRAND_PEBAG_TRAY_CHECK.RESULT == FAECInfo.FAECResult.PASS) { WriteTraceLog("PACKING MASTER INFO RECEIVE OK"); ecResult.ECInfo.BRAND_PEBAG_TRAY_CHECK.CopyTo(ProductInfo.ECInfo.BRAND_PEBAG_TRAY_CHECK); actor.NextStep(); } else { ProductInfo.VT8792ProductInfo.LotScanCompleted.ScanCompleted = true; ProductInfo.VT8792ProductInfo.LotScanCompleted.ScanSuccess = false; ProductInfo.VT8792ProductInfo.LotScanCompleted.LotFailMessage = "EC PEBAG CHECK RESULT FAIL"; var msg = GetErrorMessageOfTrayPEBAGCheck(ProductInfo.VT8792ProductInfo.TrayIndex, ecResult.ECInfo.BRAND_PEBAG_TRAY_CHECK); string windowName = string.Empty; var alarm = Utility.AlarmUtility.GetAlarm(ecResult.LastAlarmNo, "[RF READER MODULE] PEBAG CHECK EC RESULT FAIL."); Manager.MessageWindowManager.Instance.Show(Equipment, "TrayScanModuleECCommFail", out windowName, alarm, "[TRAY SCAN MODULE] TRAY SCAN FAIL\n" + msg, true); actor.NextStep(); } } else { string windowName = string.Empty; var alarm = Utility.AlarmUtility.GetAlarm(ecResult.LastAlarmNo, "[RF READER MODULE] EC PEBAG CHECK RECEIVE DATA PARSING FAIL."); Manager.MessageWindowManager.Instance.Show(Equipment, "TrayScanModuleECCommFail", out windowName, alarm, string.Empty, true); ProductInfo.VT8792ProductInfo.LotScanCompleted.ScanCompleted = true; ProductInfo.VT8792ProductInfo.LotScanCompleted.ScanSuccess = false; ProductInfo.VT8792ProductInfo.LotScanCompleted.LotFailMessage = "EC PEBAG CHECK RECEIVE DATA PARSING FAIL"; actor.NextStep(); } } else if (ecResult.LastAlarmNo != 0) { string windowName = string.Empty; var alarm = Utility.AlarmUtility.GetAlarm(ecResult.LastAlarmNo, "[TRAY SCAN MODULE] EC PEBAG CHECK RECEIVE FAIL."); Manager.MessageWindowManager.Instance.Show(Equipment, "TrayScanModuleECCommFail", out windowName, alarm, string.Empty, true); ProductInfo.VT8792ProductInfo.LotScanCompleted.ScanCompleted = true; ProductInfo.VT8792ProductInfo.LotScanCompleted.ScanSuccess = false; ProductInfo.VT8792ProductInfo.LotScanCompleted.LotFailMessage = "EC PEBAG CHECK RECEIVE FAIL"; actor.NextStep(); } }); #endregion #region Action Before Terminate seq.AddItem( delegate(object obj) { PassCount += SSDCountInTray; Equipment.ProductOutput.AddProduct(DateTime.Now, ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID, SSDCountInTray); }); seq.Steps["TurnOffLight"].StepIndex = seq.AddItem( delegate(object obj) { VisionLight.DoTurnOff(obj); Aligner.Down.Execute(obj); Stopper.Down.Execute(obj); if (ProductInfo.VT8792ProductInfo.TrayIndex == ProductInfo.VT8792ProductInfo.TrayCount) { if (VT8792Equipment.GlobalConfigModule.UseGEMCommunication) { FailCount = ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_QTY - PassCount; GEM.GEMFuncWrapper.SetPEBagEnd(Equipment.Name, ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID, ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_QTY, ProductInfo.ECInfo.PACKING_MASTER_INFO.PART_ID, PassCount, FailCount, DateTime.Now - PEBagStartTime, DateTime.Now); } ProductInfo.VT8792ProductInfo.LotScanCompleted.ScanCompleted = true; } }); #endregion seq.AddTerminate(); #region ScanFailRetry FAFramework.GUI.QuestionMessageBoxWindow questionWindow = null; seq.Steps["ScanFailRetry"].StepIndex = seq.AddItem( delegate(object obj) { App.Current.Dispatcher.Invoke( new Action( delegate { questionWindow = new FAFramework.GUI.QuestionMessageBoxWindow(); questionWindow.Message = Utility.UtilityClass.GetStringResource(this, "VT8792.AreYouSureYouWantToScanRetry", "Are you sure you want to scan retry?") + "\n" + ScanFailMessage; questionWindow.EquipmentInstance = Equipment; questionWindow.Show(); Equipment.StateSignalModuleReferance.EquipmentStateConfigs.WarningStateConfig.CopyTo( Equipment.StateSignalModuleReferance.CustomState); Equipment.StateSignalModuleReferance.CustomMode = true; }), null); }); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (questionWindow.Result == FAFramework.GUI.QuestionMessageBoxWindow.QuestionResult.Yes) { Equipment.StateSignalModuleReferance.CustomMode = false; actor.NextStep(); } else if (questionWindow.Result == FAFramework.GUI.QuestionMessageBoxWindow.QuestionResult.No) { Equipment.StateSignalModuleReferance.CustomMode = false; ProductInfo.VT8792ProductInfo.LotScanCompleted.ScanCompleted = true; ProductInfo.VT8792ProductInfo.LotScanCompleted.ScanSuccess = false; actor.NextStep("TurnOffLight"); } }); seq.AddItem(ChangeVisionJob); seq.Steps["StaticScanRetry"].StepIndex = seq.AddItem("Scan"); #endregion }
private void MakeGetStructOfBarcodes() { var seq = GetStructOfBarcodes; seq.OnStart += delegate { BarcodeStructScanFail = false; RetryInfoVisionControllerJobChangeRetry.ClearCount(); }; seq.Steps.Add("Start", new StepInfo()); seq.Steps.Add("ActionOfBeforeTriggerOn", new StepInfo()); seq.Steps.Add("TurnOffLight", new StepInfo()); seq.Steps.Add("ScanFailRetry", new StepInfo()); seq.AddItem(SetRobotPositionFromJob); seq.AddItem(MoveRobot); seq.Steps["Start"].StepIndex = seq.AddItem(VisionTrigger.DoTurnOff); seq.AddItem(new FATime(FATimeType.second, 1)); seq.AddItem(ResetVisionJobName); seq.AddItem(BarcodeVisionControl.Offline); seq.AddItem((object obj) => BarcodeVisionControl.TargetJobName = "get_struct_" + VisionJobName); seq.AddItem(BarcodeVisionControl.JobChange); seq.AddItem(BarcodeVisionControl.Online); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (BarcodeVisionControl.CommandSendResult) { actor.NextStep(); } else if (TimeVisionJobChangeTimeout.Time < time) { if (RetryInfoVisionControllerJobChangeRetry.IncreaseCount() == false) { RaiseAlarm(actor, AlarmVisionSerialCommFail, "Vision Comm Online Fail"); } actor.NextStep("Start"); } }); seq.AddItem(BarcodeVisionControl.GetOnlineStatus); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (BarcodeVisionControl.CommandSendResult) actor.NextStep(); else if (TimeVisionJobChangeTimeout.Time < time) { RaiseAlarm(actor, AlarmVisionJobChangeFail); actor.NextStep("Start"); } }); seq.AddItem(VisionLight.DoTurnOn); seq.Steps["ActionOfBeforeTriggerOn"].StepIndex = seq.AddItem(VisionTrigger.DoTurnOff); seq.AddItem(new FATime(FATimeType.second, 1)); seq.AddItem((object obj) => CognexVisionReceiver.ClearResult()); seq.AddItem(VisionTrigger.DoTurnOn); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (CognexVisionReceiver.ReadOk) { actor.NextStep(); } else if (TimeGetStructTimeout.Time < time) { if (RetryInfoVisionControllerJobChangeRetry.IncreaseCount() == false) { ScanFailMessage = "Scan Data Receive Fail"; actor.NextStep("ScanFailRetry"); } else actor.NextStep("ActionOfBeforeTriggerOn"); } }); #region ConfirmScanResult seq.AddItem( delegate(FASequence actor, TimeSpan time) { ScanFailMessage = string.Empty; if (CognexVisionReceiver.SSDBarcodesList.Count() > 0) { List<SSDBarcodesInfo> barcodeInfoList = new List<SSDBarcodesInfo>(); bool emptyBarcode = false; try { var item = CognexVisionReceiver.SSDBarcodesList.First(); var barcodeInfo = GetBarcodeInfo(item.Barcodes); if (item.DirectionOk == false) { ScanFailMessage = ScanFailMessage + string.Format("Wrong Direction. Index : {0}. JobStep={1}", item.Index, JobStepIndex) + "\n"; WriteTraceLog(ScanFailMessage); emptyBarcode = true; } else if (IsSerialScanOk(barcodeInfo.PROD_SRLNO) == false || IsPPIDScanOk(barcodeInfo.PIECE_PROD_ID) == false || IsWWNScanOk(barcodeInfo.WWN_SRLNO) == false || IsCSerialScanOk(barcodeInfo.CUST_SRLNO) == false || IsPSIDScanOk(barcodeInfo.PHYS_SECRTY_ID) == false) { ScanFailMessage = ScanFailMessage + string.Format("Index : {0}. Barcodes : {1}. JobStep={2}", item.Index, item.ToString(), JobStepIndex) + "\n"; WriteTraceLog(ScanFailMessage); emptyBarcode = true; } } catch (Exception e) { WriteDebugLog("GetStructOfBarcodes Barcode Match Fail.\n" + e.ToString()); emptyBarcode = true; } if (emptyBarcode) { if (RetryInfoScanRetry.IncreaseCount() == false) { actor.NextStep("ScanFailRetry"); } else actor.NextStep("Start"); } else actor.NextStep(); } else { ScanFailMessage = "Scan result count is zero"; WriteTraceLog(ScanFailMessage); if (RetryInfoScanRetry.IncreaseCount() == false) { actor.NextStep("ScanFailRetry"); } else actor.NextStep("Start"); } }); #endregion seq.Steps["TurnOffLight"].StepIndex = seq.AddItem(VisionLight.DoTurnOff); seq.AddItem(VisionTrigger.DoTurnOff); seq.AddTerminate(); #region ScanFailRetry FAFramework.GUI.QuestionMessageBoxWindow questionWindow = null; seq.Steps["ScanFailRetry"].StepIndex = seq.AddItem( delegate(object obj) { App.Current.Dispatcher.Invoke( new Action( delegate { questionWindow = new FAFramework.GUI.QuestionMessageBoxWindow(); questionWindow.Message = Utility.UtilityClass.GetStringResource(this, "VT8792.AreYouSureYouWantToScanRetry", "Are you sure you want to scan retry?") + "\n" + ScanFailMessage; questionWindow.EquipmentInstance = Equipment; questionWindow.Show(); Equipment.StateSignalModuleReferance.EquipmentStateConfigs.WarningStateConfig.CopyTo( Equipment.StateSignalModuleReferance.CustomState); Equipment.StateSignalModuleReferance.CustomMode = true; }), null); }); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (questionWindow.Result == FAFramework.GUI.QuestionMessageBoxWindow.QuestionResult.Yes) { Equipment.StateSignalModuleReferance.CustomMode = false; actor.NextStep("Start"); } else if (questionWindow.Result == FAFramework.GUI.QuestionMessageBoxWindow.QuestionResult.No) { BarcodeStructScanFail = true; Equipment.StateSignalModuleReferance.CustomMode = false; ProductInfo.VT8792ProductInfo.LotScanCompleted.ScanCompleted = true; ProductInfo.VT8792ProductInfo.LotScanCompleted.ScanSuccess = false; actor.NextStep("TurnOffLight"); } }); #endregion }
public override void InitializeSequence() { FAFramework.GUI.QuestionMessageBoxWindow questionWindow = null; var seq = ForceStopSequence; seq.Steps.Add("LoopHead", new StepInfo()); seq.Steps["LoopHead"].StepIndex = seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (Equipment.State != Equipment.StatePreStop && Equipment.State != Equipment.StatePreWarning && Equipment.State != Equipment.StatePreAlarm && Equipment.State != Equipment.StatePreSuspend) { actor.NextStep("LoopHead"); } else if (OperationUnit.StopButtonSwitch.IsOn) { if (time > ForceStopTime.Time) { App.Current.Dispatcher.Invoke( new Action( delegate { questionWindow = new FAFramework.GUI.QuestionMessageBoxWindow(); questionWindow.Message = "Are you sure you want to force stop?"; questionWindow.EquipmentInstance = Equipment; questionWindow.Show(); }), null); actor.NextStep(); } } else actor.NextStep("LoopHead"); }); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (questionWindow.Result == FAFramework.GUI.QuestionMessageBoxWindow.QuestionResult.Yes) { Equipment.ForceSuspendSubSequence(); Equipment.RequestStop(); actor.NextStep(); } else if (questionWindow.Result == FAFramework.GUI.QuestionMessageBoxWindow.QuestionResult.No) { actor.NextStep(); } }); seq.AddItem("LoopHead"); }