private void MakeUnloading()
        {
            var seq = Unloading;

            seq.OnStart +=
                delegate
                {
                    RetryInfoUnloadingTray.ClearCount();
                };

            seq.OnStop += delegate { VerticalBandingMachineUnit.BandingConveyorMotor.Stop.Execute(this); };
            seq.OnSuspending += delegate { VerticalBandingMachineUnit.BandingConveyorMotor.Stop.Execute(this); };

            seq.Steps.Add("Start", new StepInfo());
            seq.Steps.Add("SendCommandToNextMachine", new StepInfo());
            seq.Steps.Add("ConfirmUnloadedTray", new StepInfo());

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

            seq.AddItem(
                delegate(object obj)
                {
                    InterfaceUnit.TransferReady.DoTurnOn(obj);
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (InterfaceUnit.NextMachineAutoRunning.IsOn &&
                        InterfaceUnit.NextMachineTransferReady.IsOn)
                    {
                        InterfaceUnit.TransferReady.DoTurnOff(actor);
                        actor.NextStep();
                    }
                });
            seq.Steps["ConfirmUnloadedTray"].StepIndex = seq.AddItem(ConfirmUnloadedTray);
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (TimeConveyorStopDelayForUnloading.Time < time)
                    {
                        VerticalBandingMachineUnit.BandingConveyorMotor.Stop.Execute(actor);
                        actor.NextStep();
                    }
                });

            seq.Steps["SendCommandToNextMachine"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    try
                    {
                        var command = new FAVT5081InterfacePart.FANextMachineDataInfo.ProductInfoRequest();
                        command.LOT_ID = ProductInfo.ECInfo.LOT_CLOSE.LOT_ID;
                        command.LOT_MOQ = ProductInfo.ECInfo.PACKING_MASTER_INFO.L_BOX_MOQ;
                        command.LOT_QTY = ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_QTY;
                        _nextMachineInterfaceResult.Clear();
                        VerticalBandingMachineUnit.VT5081Interface.AddCommand(command, _nextMachineInterfaceResult);
                        actor.NextStep();
                    }
                    catch (Exception e)
                    {
                        Manager.MessageWindowManager.Instance.Show(Equipment, "SendCommandToNextMachineError", e.ToString());
                        Equipment.RequestStop();
                        Manager.LogManager.Instance.WriteTraceLog(Equipment, e.ToString());
                    }
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (_nextMachineInterfaceResult.ReceiveOk)
                    {
                        if (_nextMachineInterfaceResult.ParsingSuccess)
                        {
                            if (_nextMachineInterfaceResult.NextMachineDataInfo.ProductInfoReplyInstance.RESULT == FAVT5081InterfacePart.FANextMachineDataInfo.FAResult.PASS)
                            {
                                actor.NextStep();
                            }
                            else
                            {
                                WriteTraceLog(string.Format("SEND DATA FAIL TO NEXT MACHINE. {0}, ALARM={1}",
                                    _nextMachineInterfaceResult.ToString(),
                                    _nextMachineInterfaceResult.LastAlarmNo));
                                actor.NextStep("SendCommandToNextMachine");
                            }
                        }
                        else if (TimeNextMachineInterfaceTimeout.Time < time)
                        {
                            WriteTraceLog(string.Format("SEND DATA FAIL TO NEXT MACHINE. TIMEOUT. {0}, ALARM={1}",
                                    _nextMachineInterfaceResult.ToString(),
                                    _nextMachineInterfaceResult.LastAlarmNo));
                            actor.NextStep("SendCommandToNextMachine");
                        }
                    }
                    else if (_nextMachineInterfaceResult.LastAlarmNo != 0)
                    {
                        WriteTraceLog(string.Format("SEND DATA FAIL TO NEXT MACHINE. {0}, ALARM={1}",
                                    _nextMachineInterfaceResult.ToString(),
                                    _nextMachineInterfaceResult.LastAlarmNo));
                        actor.NextStep("SendCommandToNextMachine");
                    }
                    else if (TimeNextMachineInterfaceTimeout.Time < time)
                    {
                        WriteTraceLog(string.Format("SEND DATA FAIL TO NEXT MACHINE. TIMEOUT. {0}, ALARM={1}",
                                _nextMachineInterfaceResult.ToString(),
                                _nextMachineInterfaceResult.LastAlarmNo));
                        actor.NextStep("SendCommandToNextMachine");
                    }
                });

            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    // 2015.06.14
                    // Stopper 아래에 Sensor가 없어서 VT5081가 Ready Off가 되는 상태를 체크하고 Stopper Down 하도록 임시 적용.
                    if (InterfaceUnit.NextMachineTransferReady.IsOff)
                    {
                        Equipment.LotManager.RemoveLot(ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_ID);
                        actor.NextStep();
                    }
                });
            seq.AddItem(VerticalBandingMachineUnit.Stopper.Down.Sequence);
        }
 public void SendTestData()
 {
     var command = new FAVT5081InterfacePart.FANextMachineDataInfo.ProductInfoRequest();
     command.LOT_ID = "TEST";
     NextMachineInterfaceResult result = new NextMachineInterfaceResult();
     AddCommand(command, result);
 }
        public override void InitializeSequence()
        {
            base.InitializeSequence();

            MakePreLoading();
            MakeLoading();
            MakeProcess();
            MakePreUnloading();
            MakeUnloading();
            MakeForceUnloading();

            SendLotInfoCommand = new CommandHandler(
                delegate(object obj)
                {
                    try
                    {
                        var command = new FAVT5081InterfacePart.FANextMachineDataInfo.ProductInfoRequest();
                        command.LOT_ID = ProductInfo.ECInfo.LOT_CLOSE.LOT_ID;
                        command.LOT_MOQ = ProductInfo.ECInfo.PACKING_MASTER_INFO.L_BOX_MOQ;
                        command.LOT_QTY = ProductInfo.ECInfo.PACKING_MASTER_INFO.LOT_QTY;
                        _nextMachineInterfaceResult.Clear();
                        VerticalBandingMachineUnit.VT5081Interface.AddCommand(command, _nextMachineInterfaceResult);
                    }
                    catch (Exception e)
                    {
                        Manager.LogManager.Instance.WriteTraceLog(Equipment, e.ToString());
                    }
                }, true);
        }