コード例 #1
0
 private void buttonSend_Click(object sender, RoutedEventArgs e)
 {
     FAExtendECPart.ECResult result = new FAExtendECPart.ECResult();
     Part.AddCommand(Command, result);
 }
コード例 #2
0
        private void MakeClearProductData()
        {
            FAExtendECPart.ECResult ecResult = new FAExtendECPart.ECResult();

            var seq = ClearProductData;

            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (UseProductDataAutoClear == false)
                        actor.NextTerminate();
                    else
                        actor.NextStep();
                });

            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    FAECInfo.DATA_CLEAR_REQ command = new FAECInfo.DATA_CLEAR_REQ();
                    command.DATA_ID = ProductInfo.ECInfo.OEM_LBOX_ISSUE.L_BOX_ID;
                    command.MODE = FAECInfo.ClearMode.LBOX;

                    if (Equipment.CurrentUser != null)
                        command.OPER_ID = Equipment.CurrentUser.Name;
                    else
                        command.OPER_ID = "1";

                    ecResult.Clear();
                    InterfaceUnit.ECPart.AddCommand(command, ecResult);
                    actor.NextStep();
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (ecResult.ReceiveOk)
                    {
                        if (ecResult.ParsingSuccess)
                        {
                            if (ecResult.ECInfo.DATA_CLEAR.RESULT == FAECInfo.FAECResult.PASS)
                            {
                                ecResult.ECInfo.DATA_CLEAR.CopyTo(ProductInfo.ECInfo.DATA_CLEAR);
                                WriteTraceLog(string.Format("AUTO DATA CLEAR LBOX_ID {0}", ProductInfo.ECInfo.OEM_LBOX_ISSUE.L_BOX_ID));
                                actor.NextStep();
                            }
                            else
                            {
                                WriteTraceLog(string.Format("AUTO DATA CLEAR FAIL. LBOX_ID : {0}. EC ALARM NO : {1}",
                                    ProductInfo.ECInfo.OEM_LBOX_ISSUE.L_BOX_ID,
                                    ecResult.LastAlarmNo.ToString()));
                                actor.NextTerminate();
                            }
                        }
                        else
                        {
                            WriteTraceLog(string.Format("AUTO DATA CLEAR FAIL. LBOX_ID : {0}. EC ALARM NO : {1}",
                                    ProductInfo.ECInfo.OEM_LBOX_ISSUE.L_BOX_ID,
                                    ecResult.LastAlarmNo.ToString()));
                            actor.NextTerminate();
                        }
                    }
                    else if (ecResult.LastAlarmNo != 0)
                    {
                        WriteTraceLog(string.Format("AUTO DATA CLEAR FAIL. LBOX_ID : {0}. EC ALARM NO : {1}",
                                    ProductInfo.ECInfo.OEM_LBOX_ISSUE.L_BOX_ID,
                                    ecResult.LastAlarmNo.ToString()));
                        actor.NextTerminate();
                    }
                });

            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    FAECInfo.DATA_CLEAR_REQ command = new FAECInfo.DATA_CLEAR_REQ();
                    command.DATA_ID = ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID;
                    command.MODE = FAECInfo.ClearMode.SBOX;

                    if (Equipment.CurrentUser != null)
                        command.OPER_ID = Equipment.CurrentUser.Name;
                    else
                        command.OPER_ID = "1";

                    ecResult.Clear();
                    InterfaceUnit.ECPart.AddCommand(command, ecResult);
                    actor.NextStep();
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (ecResult.ReceiveOk)
                    {
                        if (ecResult.ParsingSuccess)
                        {
                            if (ecResult.ECInfo.DATA_CLEAR.RESULT == FAECInfo.FAECResult.PASS)
                            {
                                ecResult.ECInfo.DATA_CLEAR.CopyTo(ProductInfo.ECInfo.DATA_CLEAR);
                                WriteTraceLog(string.Format("AUTO DATA CLEAR LOT_ID {0}", ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID));
                                actor.NextStep();
                            }
                            else
                            {
                                WriteTraceLog(string.Format("AUTO DATA CLEAR FAIL. LOT_ID : {0}. EC ALARM NO : {1}",
                                    ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID,
                                    ecResult.LastAlarmNo.ToString()));
                                actor.NextTerminate();
                            }
                        }
                        else
                        {
                            WriteTraceLog(string.Format("AUTO DATA CLEAR FAIL. LOT_ID : {0}. EC ALARM NO : {1}",
                                    ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID,
                                    ecResult.LastAlarmNo.ToString()));
                            actor.NextTerminate();
                        }
                    }
                    else if (ecResult.LastAlarmNo != 0)
                    {
                        WriteTraceLog(string.Format("AUTO DATA CLEAR FAIL. LOT_ID : {0}. EC ALARM NO : {1}",
                                    ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID,
                                    ecResult.LastAlarmNo.ToString()));
                        actor.NextTerminate();
                    }
                });

            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    FAECInfo.PK_XCLOSE_REQ command = new FAECInfo.PK_XCLOSE_REQ();
                    command.EQP_ID = Equipment.Config.SystemID;
                    command.LOT_ID = ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID;

                    if (Equipment.CurrentUser != null)
                        command.OPER_ID = Equipment.CurrentUser.Name;
                    else
                        command.OPER_ID = "1";

                    ecResult.Clear();
                    InterfaceUnit.ECPart.AddCommand(command, ecResult);
                    actor.NextStep();
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (ecResult.ReceiveOk)
                    {
                        if (ecResult.ParsingSuccess)
                        {
                            if (ecResult.ECInfo.PK_XCLOSE.RESULT == FAECInfo.FAECResult.PASS)
                            {
                                ecResult.ECInfo.DATA_CLEAR.CopyTo(ProductInfo.ECInfo.DATA_CLEAR);
                                WriteTraceLog(string.Format("PK_XCLOSE LOT_ID {0}", ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID));
                                actor.NextStep();
                            }
                            else
                            {
                                WriteTraceLog(string.Format("PK_XCLOSE FAIL. LOT_ID : {0}. EC ALARM NO : {1}",
                                    ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID,
                                    ecResult.LastAlarmNo.ToString()));
                                actor.NextTerminate();
                            }
                        }
                        else
                        {
                            WriteTraceLog(string.Format("PK_XCLOSE FAIL. LOT_ID : {0}. EC ALARM NO : {1}",
                                    ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID,
                                    ecResult.LastAlarmNo.ToString()));
                            actor.NextTerminate();
                        }
                    }
                    else if (ecResult.LastAlarmNo != 0)
                    {
                        WriteTraceLog(string.Format("PK_XCLOSE FAIL. LOT_ID : {0}. EC ALARM NO : {1}",
                                    ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID,
                                    ecResult.LastAlarmNo.ToString()));
                        actor.NextTerminate();
                    }
                });
        }
コード例 #3
0
        private void MakeLoading()
        {
            FAExtendECPart.ECResult ecResult = new FAExtendECPart.ECResult();

            var seq = Loading;

            seq.OnSuspending +=
                delegate
                {
                    RetryInfoLoading.ClearCount();
                    TrayLoadingUnit.ConveyorMotor.Stop.Execute(this);
                };
            seq.OnStop +=
                delegate
                {
                    RetryInfoLoading.ClearCount();
                    TrayLoadingUnit.ConveyorMotor.Stop.Execute(this);
                };

            seq.Steps.Add("Start", new StepInfo());
            seq.Steps.Add("ConfirmRunDown", new StepInfo());
            seq.Steps.Add("ConfirmStartSignal", new StepInfo());
            seq.Steps.Add("ReceiveData", new StepInfo());
            seq.Steps.Add("ConfirmReleaseReadyOff", new StepInfo());
            seq.Steps.Add("ConfirmArrivalTray", new StepInfo());
            seq.Steps.Add("ECComm", new StepInfo());
            seq.Steps.Add("ReadyOff", new StepInfo());

            seq.Steps["Start"].StepIndex =
                seq.AddItem(TrayLoadingUnit.Stopper.Up.Sequence);
            seq.AddItem("ConfirmStartSignal");

            seq.Steps["ConfirmRunDown"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (ForceLoading)
                    {
                        if (TrayLoadingUnit.InSensor.IsOn)
                        {
                            Equipment.RequestStart();
                            ProductInfo.ECInfo.PACKING_MASTER_INFO.L_BOX_MOQ = 1;
                            ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_QTY = 120;
                            ProductInfo.ECInfo.PACKING_MASTER_INFO.S_BOX_MOQ = 120;

                            actor.NextStep("ConfirmArrivalTray");
                        }
                    }
                    else if (InterfaceUnit.FrontMachineAutoRunning.IsOn &&
                        InterfaceUnit.FrontMachineTransferReady.IsOn)
                    {
                        Equipment.RequestStart();
                        InterfaceUnit.TransferReady.DoTurnOn(actor);
                        actor.NextStep("ConfirmReleaseReadyOff");
                    }
                    else if (TimeRunDownTime.Time < time)
                    {
                        Equipment.SetRundown();
                    }
                });
            seq.Steps["ConfirmStartSignal"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (ForceLoading)
                    {
                        if (TrayLoadingUnit.InSensor.IsOn)
                        {
                            Equipment.RequestStart();
                            ProductInfo.ECInfo.PACKING_MASTER_INFO.L_BOX_MOQ = 1;
                            ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_QTY = 120;
                            ProductInfo.ECInfo.PACKING_MASTER_INFO.S_BOX_MOQ = 120;

                            actor.NextStep("ConfirmArrivalTray");
                        }
                    }
                    else if (InterfaceUnit.FrontMachineAutoRunning.IsOn &&
                        InterfaceUnit.FrontMachineTransferReady.IsOn)
                    {
                        Equipment.RequestStart();
                        InterfaceUnit.TransferReady.DoTurnOn(actor);
                        actor.NextStep();
                    }
                    else if (Equipment.LotManager.IsEmpty)
                    {
                        actor.NextStep("ConfirmRunDown");
                    }
                });
            seq.Steps["ConfirmReleaseReadyOff"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (InterfaceUnit.FrontMachineAutoRunning.IsOn &&
                        InterfaceUnit.FrontMachineTransferReady.IsOff)
                    {
                        actor.NextStep();
                    }
                });

            seq.Steps["ConfirmArrivalTray"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (ForceLoading == false && InterfaceUnit.FrontMachineAutoRunning.IsOn == false)
                    {
                        TrayLoadingUnit.ConveyorMotor.Stop.Execute(actor);
                        actor.NextStep("ConfirmArrivalTray");
                    }
                    else if (TrayLoadingUnit.StopSensor.IsOn)
                    {
                        ProductInfo.ExistProduct = true;
                        TrayLoadingUnit.ConveyorMotor.Stop.Execute(actor);
                        actor.NextStep();
                    }
                    else if (TimeLoadingTimeout.Time < time)
                    {
                        if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.DRY_RUN)
                        {
                            TrayLoadingUnit.ConveyorMotor.Stop.Execute(actor);
                            actor.NextStep();
                        }
                        else
                        {
                            if (RetryInfoLoading.IncreaseCount() == false)
                                RaiseAlarm(actor, AlarmLoadingFail, TrayLoadingUnit.StopSensor.GetInputIOStatus());

                            actor.NextStep("ConfirmArrivalTray");
                        }
                    }
                    else
                        TrayLoadingUnit.ConveyorMotor.Run.Execute(actor);
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (ForceLoading)
                        actor.NextTerminate();
                    else
                        actor.NextStep();
                });

            seq.Steps["ReceiveData"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (InterfaceUnit.FrontMachineAutoRunning.IsOn)
                    {
                        if (ReceivedDataFromFrontMachine.Exist == true)
                        {
                            if (ReceivedDataFromFrontMachine.Error)
                            {
                                RaiseAlarm(actor, AlarmFrontMachineDataError);
                            }
                            else
                            {
                                Equipment.RequestStart();
                                ProductInfo.ECInfo.LOT_CLOSE.LOT_ID = ReceivedDataFromFrontMachine.ReceiveData.LOT_ID;
                                ReceivedDataFromFrontMachine.Exist = false;
                                actor.NextStep();
                            }
                        }
                        else if (TimeLoadingTimeout.Time < time)
                        {
                            RaiseAlarm(actor, AlarmDataReceiveFailFromFrontMachine);
                        }
                    }
                    else
                        actor.NextStep("ReceiveData");
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.HOT_RUN)
                    {
                        actor.NextStep();
                    }
                    else
                    {
                        ProductInfo.ECInfo.PACKING_MASTER_INFO.L_BOX_MOQ = ReceivedDataFromFrontMachine.ReceiveData.LOT_MOQ;
                        ProductInfo.ECInfo.PACKING_MASTER_INFO.S_BOX_MOQ = ReceivedDataFromFrontMachine.ReceiveData.LOT_MOQ;
                        ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_QTY = ReceivedDataFromFrontMachine.ReceiveData.LOT_QTY;
                        actor.NextStep("ReadyOff");
                    }
                });
            seq.Steps["ECComm"].StepIndex = seq.AddItem(
                delegate(object obj)
                {
                    FAECInfo.PACKING_MASTER_INFO_REQ command = new FAECInfo.PACKING_MASTER_INFO_REQ();
                    command.LOT_ID = ProductInfo.ECInfo.LOT_CLOSE.LOT_ID;
                    ecResult.Clear();
                    InterfaceUnit.ECPart.AddCommand(command, ecResult);
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (ecResult.ReceiveOk)
                    {
                        if (ecResult.ParsingSuccess)
                        {
                            if (ecResult.ECInfo.PACKING_MASTER_INFO.RESULT == FAECInfo.FAECResult.PASS)
                            {
                                ProductInfo.VT5081ProductInfo.ProductStatus = EProductStatus.Normal;
                                ecResult.ECInfo.PACKING_MASTER_INFO.CopyTo(ProductInfo.ECInfo.PACKING_MASTER_INFO);
                                actor.NextStep();
                            }
                            else
                            {
                                RaiseAlarm(actor, ecResult.LastAlarmNo);
                                actor.NextStep("ECComm");
                            }
                        }
                        else
                        {
                            RaiseAlarm(actor, ecResult.LastAlarmNo);
                            actor.NextStep("ECComm");
                        }
                    }
                    else if (ecResult.LastAlarmNo != 0)
                    {
                        RaiseAlarm(actor, ecResult.LastAlarmNo);
                        actor.NextStep("ECComm");
                    }
                });

            seq.Steps["ReadyOff"].StepIndex = seq.AddItem(InterfaceUnit.TransferReady.DoTurnOff);
        }
コード例 #4
0
        private void MakeSingleProcess()
        {
            FAExtendECPart.ECResult ecResult = new FAExtendECPart.ECResult();

            var seq = SingleProcess;

            seq.Steps.Add("LoadJob", new StepInfo());

            seq.Steps["LoadJob"].StepIndex =

            seq.AddItem(LoadJob);
            #region SendRecipeFileToGEM
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    var VT5081Equipment = Equipment as VT5081.SubEquipment;
                    if (VT5081Equipment.GlobalConfigModule.UseGEMCommunication == false)
                    {
                        actor.NextStep();
                        return;
                    }

                    bool raisedException = false;
                    try
                    {
                        string recipeName = ProductInfo.ECInfo.PACKING_MASTER_INFO.PRODUCT_NAME;
                        string recipeFileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), recipeName);
                        string recipe = string.Empty;
                        JobInfo.ToINIFormat(out recipe);
                        System.IO.File.WriteAllText(recipeFileName, recipe);
                        GEM.GEMFuncWrapper.SendRecipeFile(recipeName, recipeFileName);
                        raisedException = false;
                    }
                    catch
                    {
                        raisedException = true;
                    }
                    finally
                    {
                        if (raisedException == false)
                            actor.NextStep();
                    }
                });
            #endregion
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    try
                    {
                        if (JobInfo.FoamPadJobInfo.BottomFoamPadType == VT5081.JobInfo.EBottomFoamPadType.Low)
                        {
                            SelectedFoamPadModule = ESelectedFoamPadModule.BottomFoamPadModule1;
                            actor.NextStep();
                        }
                        else if (JobInfo.FoamPadJobInfo.BottomFoamPadType == VT5081.JobInfo.EBottomFoamPadType.High)
                        {
                            SelectedFoamPadModule = ESelectedFoamPadModule.BottomFoamPadModule2;
                            actor.NextStep();
                        }
                        else
                        {
                            RaiseAlarm(actor, AlarmFoamPadTypeOfJobIsNotCorrect);
                            actor.NextStep("LoadJob");
                        }
                    }
                    catch (Exception e)
                    {
                        RaiseAlarm(actor, AlarmFoamPadTypeOfJobIsNotCorrect, e.ToString());
                        actor.NextStep("LoadJob");
                    }
                });
            seq.AddItem(TransferFoamPad);
            seq.AddItem(ScanBottomFoamPadInLargeBox);
            seq.AddItem(TransferTrays);
            seq.AddItem((object obj) => SelectedFoamPadModule = ESelectedFoamPadModule.UpperFoamPadModule);
            seq.AddItem(TransferFoamPad);
            seq.AddItem(ScanUpperFoamPadInLargeBox);
            seq.AddItem((object obj) => BoxPuttingModule.TrayLoadingCompleted = true);
            seq.AddItem(AttachLabelToFoamPad);
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (PrinterControlModule.ForceOutWhenLabelIssueFail && LargeBoxLabelIssueFail)
                    {
                        BoxPuttingModule.LabelLoadingCompleted = true;
                        PrinterControlModule.LargeBoxLabelSkip = true;
                        ProductInfo.CopyTo(BoxPuttingModule.ProductInfo);
                        actor.NextTerminate();
                    }
                    else
                    {
                        PrinterControlModule.LargeBoxLabelPrintRequest = true;
                        actor.NextStep();
                    }
                });
            seq.AddItem(AttachLabelToLargeBox);
            seq.AddItem(ScanLargeBoxOnPuttingPosition);
            seq.AddItem((object obj) => BoxPuttingModule.LabelLoadingCompleted = true);
        }
コード例 #5
0
        private void MakeAttachLabelToFoamPad()
        {
            #region SubAction
            List<Func<bool>> scanLabelActionList = new List<Func<bool>>();
            TimeSpan scanTimeout = new TimeSpan(0, 0, 2);
            DateTime scanStartTime = DateTime.Now;
            TimeSpan scanResultDelayTime = new TimeSpan(0, 0, 0, 0, 300);
            DateTime scanResultDelayStartTime = DateTime.Now;

            scanLabelActionList.Add(
                delegate
                {
                    BarcodeScanSuccess = false;
                    RobotUnit.BarcodeScanCompleted.DoTurnOff(this);
                    RobotUnit.ImageSensorScanSuccess.DoTurnOff(this);
                    RobotUnit.ImageSensorScanFail.DoTurnOff(this);
                    return true;
                });
            scanLabelActionList.Add(
                delegate
                {
                    if (PrinterControlModule.SelectedPrinter == FAPrinterControlModule.PrinterPosition.FrontPrinter)
                    {
                        if (RobotUnit.MovedToScanPosOnThePrinter2.IsOn)
                        {
                            scanStartTime = DateTime.Now;
                            RobotUnit.BarcodeScanner.TriggerOn(this);
                            return true;
                        }
                    }
                    else if (PrinterControlModule.SelectedPrinter == FAPrinterControlModule.PrinterPosition.RearPrinter)
                    {
                        if (RobotUnit.MovedToScanPosOnThePrinter1.IsOn)
                        {
                            scanStartTime = DateTime.Now;
                            RobotUnit.BarcodeScanner.TriggerOn(this);
                            return true;
                        }
                    }

                    return false;
                });
            scanLabelActionList.Add(
                delegate
                {
                    if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.DRY_RUN ||
                        Equipment.RunMode == FAFramework.Equipment.RunModeTypes.COLD_RUN)
                    {
                        BarcodeScanSuccess = true;
                        RobotUnit.BarcodeScanCompleted.DoTurnOn(this);
                        return true;
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(RobotUnit.BarcodeScanner.SmallBoxBarcode.Barcode) == false)
                        {
                            scanResultDelayStartTime = DateTime.Now;
                            BarcodeScanSuccess = true;
                            SmallBoxBarcode = RobotUnit.BarcodeScanner.SmallBoxBarcode.Barcode;
                            RobotUnit.ImageSensorScanSuccess.DoTurnOn(this);
                            return true;
                        }
                        else if (DateTime.Now - scanStartTime > scanTimeout)
                        {
                            scanResultDelayStartTime = DateTime.Now;
                            BarcodeScanSuccess = false;
                            RobotUnit.ImageSensorScanFail.DoTurnOn(this);
                            return true;
                        }

                        return false;
                    }
                });
            scanLabelActionList.Add(
                delegate
                {
                    if (DateTime.Now - scanResultDelayStartTime > scanResultDelayTime)
                    {
                        RobotUnit.BarcodeScanCompleted.DoTurnOn(this);
                        return true;
                    }

                    return false;
                });
            #endregion

            #region ScanAfterAttach
            string barcodeAfterAttachOnFoamPad = string.Empty;
            List<Func<bool>> scanLabelAfterAttachActionList = new List<Func<bool>>();
            TimeSpan scanLabelAfterAttachTimeout = new TimeSpan(0, 0, 2);
            DateTime scanLabelAfterAttachStartTime = DateTime.Now;

            scanLabelAfterAttachActionList.Add(
                delegate
                {
                    BarcodeScanSuccess = false;
                    barcodeAfterAttachOnFoamPad = string.Empty;
                    return true;
                });
            scanLabelAfterAttachActionList.Add(
                delegate
                {
                    if (RobotUnit.MovedToScanPosOnThePrinter1.IsOn)
                    {
                        scanLabelAfterAttachStartTime = DateTime.Now;
                        RobotUnit.BarcodeScanner.TriggerOn(this);
                        return true;
                    }
                    else if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.DRY_RUN ||
                        Equipment.RunMode == FAFramework.Equipment.RunModeTypes.COLD_RUN)
                    {
                        return true;
                    }

                    return false;
                });
            scanLabelAfterAttachActionList.Add(
                delegate
                {
                    if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.DRY_RUN ||
                        Equipment.RunMode == FAFramework.Equipment.RunModeTypes.COLD_RUN)
                    {
                        BarcodeScanSuccess = true;
                        return true;
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(RobotUnit.BarcodeScanner.SmallBoxBarcode.Barcode) == false)
                        {
                            BarcodeScanSuccess = true;
                            barcodeAfterAttachOnFoamPad = RobotUnit.BarcodeScanner.SmallBoxBarcode.Barcode;
                            return true;
                        }
                        else if (DateTime.Now - scanLabelAfterAttachStartTime > scanLabelAfterAttachTimeout)
                        {
                            BarcodeScanSuccess = false;
                            return true;
                        }

                        return false;
                    }
                });
            #endregion

            FAExtendECPart.ECResult ecResult = new FAExtendECPart.ECResult();

            var seq = AttachLabelToFoamPad;

            seq.OnStart +=
               delegate
               {
                   RetryInfoFoamPadLabel.ClearCount();
                   RetryInfoFoamPadLabelRemove.ClearCount();
                   RetryInfoCheckLabelAlign.ClearCount();
               };

            seq.Steps.Add("Start", new StepInfo());
            seq.Steps.Add("SetBarcodeScanActionCode", new StepInfo());
            seq.Steps.Add("RequestLBoxInfo", new StepInfo());
            seq.Steps.Add("LabelUnloadingCompleted", new StepInfo());
            seq.Steps.Add("AttachLabel", new StepInfo());
            seq.Steps.Add("RemoveLabel", new StepInfo());
            seq.Steps.Add("Retry", new StepInfo());

            seq.AddItem(MoveHomeToLabelPrinterPos);

            seq.Steps["Start"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (PrinterControlModule.UnloadingStandby && PrinterControlModule.LabelStep == FAPrinterControlModule.ELabelStep.SmallBoxLabel)
                    {
                        string sensorStatus = string.Empty;
                        if (PrinterControlModule.GetLabelAlignStatus(out sensorStatus) == true)
                            actor.NextStep("SetBarcodeScanActionCode");
                        else
                        {
                            WriteTraceLog("Small Box Label Align Fail. " + sensorStatus);
                            actor.NextStep();
                        }
                    }
                    else if (PrinterControlModule.LabelIssueFail && PrinterControlModule.ForceOutWhenLabelIssueFail)
                    {
                        ProductInfo.VT5081ProductInfo.ProductStatus = EProductStatus.Fail;
                        ProductInfo.VT5081ProductInfo.FailMessage = "Small Box Label Issue Fail";
                        actor.NextTerminate();
                    }
                });
            seq.AddItem(RemoveLabel);
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (RetryInfoCheckLabelAlign.IncreaseCount() == false)
                        RaiseAlarm(actor, AlarmLabelAlignCheckFail);

                    actor.NextStep();
                });
            seq.AddItem(
                delegate(object obj)
                {
                    PrinterControlModule.LabelScanSuccess = false;
                    PrinterControlModule.UnloadingCompleted = true;
                });
            seq.AddItem("Start");

            seq.Steps["SetBarcodeScanActionCode"].StepIndex = seq.AddItem(
                (object obj) =>
                {
                    RobotUnit.ImageSensorScanSuccess.DoTurnOff(this);
                    RobotUnit.ImageSensorScanFail.DoTurnOff(this);
                    RobotUnit.BarcodeScanCompleted.DoTurnOff(this);
                    RobotModule.SubActionList = scanLabelActionList;

                    if (PrinterControlModule.SelectedPrinter == FAPrinterControlModule.PrinterPosition.FrontPrinter)
                        RobotModule.SendData.ActionCode = (byte)FAKukaRobotCommandList.LabelActionList.EAction.PickLabelOnThePrinter2;
                    else
                        RobotModule.SendData.ActionCode = (byte)FAKukaRobotCommandList.LabelActionList.EAction.PickLabelOnThePrinter1;

                    RobotModule.UseFailReturn = true;
                });
            seq.AddItem(new FASequenceAtomicInfo(RobotModule.ExecuteAction, true));
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (BarcodeScanSuccess)
                    {
                        PrinterControlModule.LabelScanSuccess = true;
                        actor.NextStep();
                    }
                    else
                    {
                        actor.NextStep("RemoveLabel");
                    }
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (RobotModule.ReceiveData.ActionSuccess)
                    {
                        WriteTraceLog(string.Format("Small Box Scan Success. {0}", SmallBoxBarcode));
                        actor.NextStep();
                    }
                    else
                    {
                        WriteTraceLog("Small Box Scan Action Fail.");
                        actor.NextStep("RemoveLabel");
                    }
                });
            seq.Steps["RequestLBoxInfo"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.HOT_RUN)
                    {
                        FAECInfo.OEM_LBOX_ISSUE_REQ command = new FAECInfo.OEM_LBOX_ISSUE_REQ();
                        command.LOT_ID = ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID;
                        command.S_BOX_CNT = 1;
                        command.GATE = ProductInfo.ECInfo.PACKING_MASTER_INFO.GATE_NO;
                        command.S_BOX_LABEL_SERIAL = SmallBoxBarcode;
                        ecResult.Clear();
                        InterfaceUnit.ECPart.AddCommand(command, ecResult);
                        actor.NextStep();
                    }
                    else
                    {
                        actor.NextStep("LabelUnloadingCompleted");
                    }
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (ecResult.ReceiveOk)
                    {
                        if (ecResult.ParsingSuccess)
                        {
                            if (ecResult.ECInfo.OEM_LBOX_ISSUE.RESULT == FAECInfo.FAECResult.PASS)
                            {
                                LargeBoxLabelIssueFail = false;
                                ecResult.ECInfo.OEM_LBOX_ISSUE.CopyTo(ProductInfo.ECInfo.OEM_LBOX_ISSUE);
                                ProductInfo.ECInfo.OEM_LBOX_ISSUE.CopyTo(PrinterControlModule.ProductInfo.ECInfo.OEM_LBOX_ISSUE);
                                actor.NextStep();
                            }
                            else
                            {
                                LargeBoxLabelIssueFail = true;

                                string msg = string.Format("MSG = {0}, Parsing Fail Message = {1}", ecResult.ECInfo.OEM_SBOX_ISSUE.MSG, ecResult.ParsingFailMessage);

                                if (PrinterControlModule.ForceOutWhenLabelIssueFail)
                                {
                                    ProductInfo.VT5081ProductInfo.ProductStatus = EProductStatus.Fail;
                                    ProductInfo.VT5081ProductInfo.FailMessage = msg;
                                    actor.NextStep();
                                }
                                else
                                {
                                    RaiseAlarm(actor, AlarmLargeBoxLabelIssueFail, msg);
                                    actor.NextStep("RequestLBoxInfo");
                                }
                            }
                        }
                        else
                        {
                            LargeBoxLabelIssueFail = true;

                            string msg = string.Format("Result Fail, Parsing Fail Message = {0}", ecResult.ParsingFailMessage);

                            if (PrinterControlModule.ForceOutWhenLabelIssueFail)
                            {
                                ProductInfo.VT5081ProductInfo.ProductStatus = EProductStatus.Fail;
                                ProductInfo.VT5081ProductInfo.FailMessage = msg;
                                actor.NextStep();
                            }
                            else
                            {
                                RaiseAlarm(actor, AlarmLargeBoxLabelIssueFail, msg);
                                actor.NextStep("RequestLBoxInfo");
                            }
                        }
                    }
                    else if (ecResult.LastAlarmNo != 0)
                    {
                        LargeBoxLabelIssueFail = true;

                        string msg = "Data Receive Fail";

                        if (PrinterControlModule.ForceOutWhenLabelIssueFail)
                        {
                            ProductInfo.VT5081ProductInfo.ProductStatus = EProductStatus.Fail;
                            ProductInfo.VT5081ProductInfo.FailMessage = msg;
                            actor.NextStep();
                        }
                        else
                        {
                            RaiseAlarm(actor, AlarmLargeBoxLabelIssueFail, "Data Receive Fail");
                            actor.NextStep("RequestLBoxInfo");
                        }
                    }
                });
            seq.Steps["LabelUnloadingCompleted"].StepIndex = seq.AddItem((object obj) => PrinterControlModule.UnloadingCompleted = true);
            seq.Steps["AttachLabel"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (BoxPuttingModule.LabelLoadingStandby)
                        actor.NextStep();
                });
            seq.AddItem(
                (object obj) =>
                {
                    BarcodeScanSuccess = false;
                    RobotModule.UseFailReturn = true;
                    RobotModule.SubActionList = scanLabelAfterAttachActionList;
                    RobotModule.SendData.Parameter = (byte)PrinterControlModule.SelectedPrinter;
                    RobotModule.SendData.ActionCode = (byte)FAKukaRobotCommandList.LabelActionList.EAction.AttachLabelToFoamPad;
                });
            seq.AddItem(new FASequenceAtomicInfo(RobotModule.ExecuteAction, true));
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (BarcodeScanSuccess)
                    {
                        if (barcodeAfterAttachOnFoamPad == SmallBoxBarcode)
                        {
                            WriteTraceLog(string.Format("Small Box Barcode On FoamPad Scan Success. {0}", barcodeAfterAttachOnFoamPad));
                            actor.NextStep();
                        }
                        else if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.HOT_RUN)
                        {
                            string msg = string.Format("Small Box Barcode Match Fail. Scan On The Label Block = {0}, Scan On The FoamPad = {1}",
                                SmallBoxBarcode, barcodeAfterAttachOnFoamPad);
                            WriteTraceLog(msg);
                            RaiseAlarm(actor, AlarmSmallBoxBarcodeMatchFail, msg);
                            actor.NextStep("AttachLabel");
                        }
                        else
                        {
                            WriteTraceLog(string.Format("Small Box Barcode On FoamPad Scan Success. {0}", barcodeAfterAttachOnFoamPad));
                            actor.NextStep();
                        }
                    }
                    else
                    {
                        RaiseAlarm(actor, AlarmScanFailSmallBoxBarcodeOnTheFoamPad);
                        actor.NextStep("AttachLabel");
                    }
                });
            seq.AddTerminate();

            seq.Steps["RemoveLabel"].StepIndex =seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (RetryInfoFoamPadLabelRemove.IncreaseCount() == false)
                    {
                        RaiseAlarm(actor, AlarmAttachLabelToFoamPad);
                        actor.NextStep();
                    }
                    else
                    {
                        actor.NextStep();
                    }
                });
            seq.AddItem(
                delegate(object obj)
                {
                    try
                    {
                        RobotUnit.BarcodeScanner.Disconnect(this);
                    }
                    catch
                    {
                    }
                });
            seq.AddItem(new FATime(FATimeType.second, 1));
            seq.AddItem(
                delegate(object obj)
                {
                    try
                    {
                        RobotUnit.BarcodeScanner.Connect(this);
                    }
                    catch
                    {
                    }
                });
            seq.AddItem(new FATime(FATimeType.second, 1));
            seq.AddItem(RemoveLabel);
            seq.AddItem((object obj) =>
            {
                PrinterControlModule.LabelScanSuccess = false;
                PrinterControlModule.UnloadingCompleted = true;
            });
            seq.AddItem("Start");
        }
コード例 #6
0
        private void MakeProcess()
        {
            string windowName = string.Empty;
            FAExtendECPart.ECResult ecResult = new FAExtendECPart.ECResult();

            var seq = Process;

            seq.Steps.Add("RequestSBoxInfo", new StepInfo());
            seq.Steps.Add("PrintLabel", new StepInfo());
            seq.Steps.Add("UnloadLabel", new StepInfo());
            seq.Steps.Add("PrintLargeBoxLabel", new StepInfo());

            seq.AddItem((object obj) => LargeBoxLabelPrintRequest = false);

            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.HOT_RUN)
                    {
                        FAECInfo.OEM_SBOX_ISSUE_REQ command = new FAECInfo.OEM_SBOX_ISSUE_REQ();
                        command.LOT_ID = ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID;
                        command.GATE = command.GATE = ProductInfo.ECInfo.PACKING_MASTER_INFO.GATE_NO;                        
                        ecResult.Clear();
                        InterfaceUnit.ECPart.AddCommand(command, ecResult);
                        actor.NextStep();
                    }
                    else
                    {
                        actor.NextStep("PrintLabel");
                    }
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (ecResult.ReceiveOk)
                    {
                        if (ecResult.ParsingSuccess)
                        {
                            if (ecResult.ECInfo.OEM_SBOX_ISSUE.RESULT == FAECInfo.FAECResult.PASS)
                            {
                                ecResult.ECInfo.OEM_SBOX_ISSUE.CopyTo(ProductInfo.ECInfo.OEM_SBOX_ISSUE);                                
                                actor.NextStep();
                            }
                            else
                            {
                                LabelIssueFail = true;

                                if (ForceOutWhenLabelIssueFail)
                                    actor.NextTerminate();
                                else
                                {
                                    RaiseAlarm(actor, AlarmSmallBoxLabelIssueFail, string.Format("MSG = {0}, Parsing Fail Message = {1}", ecResult.ECInfo.OEM_SBOX_ISSUE.MSG, ecResult.ParsingFailMessage));
                                    actor.NextStep("RequestSBoxInfo");
                                }
                            }
                        }
                        else
                        {
                            LabelIssueFail = true;

                            if (ForceOutWhenLabelIssueFail)
                                actor.NextTerminate();
                            else
                            {
                                RaiseAlarm(actor, AlarmSmallBoxLabelIssueFail, string.Format("Result Fail, Parsing Fail Message = {0}", ecResult.ParsingFailMessage));
                                actor.NextStep("RequestSBoxInfo");
                            }
                        }
                    }
                    else if (ecResult.LastAlarmNo != 0)
                    {
                        LabelIssueFail = true;

                        if (ForceOutWhenLabelIssueFail)
                            actor.NextTerminate();
                        else
                        {
                            RaiseAlarm(actor, AlarmSmallBoxLabelIssueFail, "Data Receive Fail");
                            actor.NextStep("RequestSBoxInfo");
                        }
                    }
                });

            // Foam Pad Label
            seq.AddItem((object obj) => LabelFormat = ProductInfo.ECInfo.OEM_SBOX_ISSUE.FORMAT);
            seq.Steps["PrintLabel"].StepIndex = seq.AddItem((object obj) => AllPrinterNotStandby = false);
            seq.AddItem(PrintLabel);
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (AllPrinterNotStandby)
                    {
                        var alarm = Utility.AlarmUtility.GetAlarm(AlarmAllPrinterNotStandby, "All Printer Not Standby");
                        Manager.MessageWindowManager.Instance.Show(Equipment, "AllPrinterNotStandby", out windowName, alarm, string.Empty, true);
                        actor.NextStep("PrintLabel");
                    }
                    else
                    {
                        Manager.MessageWindowManager.Instance.CloseWindow(windowName);
                        actor.NextStep();
                    }
                });
            seq.AddItem((object obj) => LabelScanSuccess = false);
            seq.AddItem((object obj) => LabelStep = ELabelStep.SmallBoxLabel);
            seq.Steps["UnloadLabel"].StepIndex = seq.AddItem(UnloadLabel);
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (LabelScanSuccess)
                        actor.NextStep();
                    else
                        actor.NextStep("PrintLabel");
                });

            // Box Label
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (LargeBoxLabelPrintRequest)
                    {
                        LabelFormat = ProductInfo.ECInfo.OEM_LBOX_ISSUE.FORMAT;
                        LargeBoxLabelPrintRequest = false;
                        actor.NextStep();
                    }
                    else if (LargeBoxLabelSkip)
                    {
                        actor.NextTerminate();
                    }
                });
            seq.Steps["PrintLargeBoxLabel"].StepIndex = seq.AddItem(PrintLabel);
            seq.AddItem((object obj) => LabelScanSuccess = false);
            seq.AddItem((object obj) => LabelStep = ELabelStep.LargeBoxLabel);
            seq.AddItem(UnloadLabel);
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (LabelScanSuccess)
                        actor.NextStep();
                    else
                        actor.NextStep("PrintLargeBoxLabel");
                });
        }