private void MakeScanBarcode()
        {
            FAExtendECPart.ECResult ecResult = new FAExtendECPart.ECResult();

            var seq = ScanBarcode;

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

            seq.Steps.Add("Start", new StepInfo());
            seq.Steps.Add("AddLoadingCount", new StepInfo());
            seq.Steps.Add("RequestPackingMasterInfo", new StepInfo());
            seq.Steps.Add("RequestSmallBoxInfo", new StepInfo());

            seq.Steps["Start"].StepIndex = seq.AddItem(SmallBoxLoadingUnit.Scanner.TriggerOn);
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.DRY_RUN ||
                        Equipment.RunMode == FAFramework.Equipment.RunModeTypes.COLD_RUN)
                    {
                        ProductInfo.ECInfo.PackingMasterInfo.LOT_ID = "TEST LOT";
                        ProductInfo.ECInfo.PackingMasterInfo.PART_ID = "BRAND_BOX";
                        ProductInfo.ECInfo.PackingMasterInfo.S_BOX_MOQ = 10;
                        ProductInfo.ECInfo.PackingMasterInfo.L_BOX_MOQ = MAX_SMALLBOX_COUNT;
                        ProductInfo.ECInfo.PackingMasterInfo.LOT_QTY = 30;
                        ProductInfo.VT5080ProductInfo.Gate = Gate;

                        InputCount++;

                        if (GlobalConfigModule.RobotWorkType == ERobotWorkType.StartAtScanedFirstSmallBox)
                        {
                            if (InputCount == 1)
                            {
                                RobotControlModule.AddWork(ProductInfo);
                            }
                        }
                        else if (GlobalConfigModule.RobotWorkType == ERobotWorkType.StartAtScanedLastSmallBox)
                        {
                            if (InputCount == MAX_SMALLBOX_COUNT)
                            {
                                RobotControlModule.AddWork(ProductInfo);
                            }
                        }

                        if (InputCount == MAX_SMALLBOX_COUNT)
                            InputCount = 0;

                        actor.NextTerminate();
                    }
                    else
                    {
                        if (IsEmptyBox(LoadingCount))
                        {
                            if (TimeScanTimeout.Time < time)
                            {
                                CurrentLotInfo.CopyTo(ProductInfo.ECInfo.PackingMasterInfo);
                                WriteTraceLog("Scan Success Empty Box");
                                actor.NextStep("AddLoadingCount");
                            }
                            else if (string.IsNullOrEmpty(SmallBoxLoadingUnit.Scanner.Barcode.Barcode) == false)
                            {
                                if (RetryInfoBarcodeScan.IncreaseCount() == false)
                                    RaiseAlarm(actor, AlarmBarcodeDetectedOnAEmptyBox);

                                actor.NextStep("Start");
                            }
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(SmallBoxLoadingUnit.Scanner.Barcode.Barcode) == false)
                            {
                                LotID = SmallBoxLoadingUnit.Scanner.Barcode.Barcode;
                                ProductInfo.VT5080ProductInfo.SmallBoxID = LotID;
                                WriteTraceLog("Barcode Scan Success : " + LotID);
                                actor.NextStep();
                            }
                            else if (TimeScanTimeout.Time < time)
                            {
                                if (RetryInfoBarcodeScan.IncreaseCount() == false)
                                    RaiseAlarm(actor, AlarmBarcodeScanFail);

                                actor.NextStep("Start");
                            }
                        }
                    }
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.DRY_RUN ||
                        Equipment.RunMode == FAFramework.Equipment.RunModeTypes.COLD_RUN)
                        actor.NextTerminate();
                    else if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.HOT_RUN)
                    {
                        actor.NextStep();
                    }
                });
            seq.Steps["RequestPackingMasterInfo"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    bool exception = false;

                    if (string.IsNullOrEmpty(LotID) == false &&
                        LotID.Length >= 10)
                    {
                        try
                        {
                            FAECInfo.PACKING_MASTER_INFO_REQ command = new FAECInfo.PACKING_MASTER_INFO_REQ();
                            command.LOT_ID = LotID.Substring(0, 10);
                            ecResult.Clear();
                            InterfaceUnit.ECPart.AddCommand(command, ecResult);
                        }
                        catch (Exception e)
                        {
                            exception = true;
                            RaiseAlarm(actor, AlarmLotIDParsingFail, e.ToString());
                        }

                        if (exception == false)
                            actor.NextStep();
                    }
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (ecResult.ReceiveOk)
                    {
                        if (ecResult.ParsingSuccess)
                        {
                            if (ecResult.ECInfo.PackingMasterInfo.RESULT == FAECInfo.FAECResult.PASS)
                            {
                                ecResult.ECInfo.PackingMasterInfo.CopyTo(ProductInfo.ECInfo.PackingMasterInfo);
                                actor.NextStep();
                            }
                            else
                            {
                                RaiseAlarm(actor, ecResult.LastAlarmNo);
                                actor.NextStep("RequestPackingMasterInfo");
                            }
                        }
                        else
                        {
                            RaiseAlarm(actor, ecResult.LastAlarmNo);
                            actor.NextStep("RequestPackingMasterInfo");
                        }
                    }
                    else if (ecResult.LastAlarmNo != 0)
                    {
                        RaiseAlarm(actor, ecResult.LastAlarmNo);
                        actor.NextStep("RequestPackingMasterInfo");
                    }
                });
            seq.Steps["RequestSmallBoxInfo"].StepIndex = seq.AddItem(
                delegate(object obj)
                {
                    string temp = LotID;
                    FAECInfo.SBOX_INFO_REQ command = new FAECInfo.SBOX_INFO_REQ();
                    command.SBOX_ID = temp;
                    command.EQP_ID = Equipment.Config.SystemID;
                    command.GATE = ProductInfo.ECInfo.PackingMasterInfo.GATE;
                    ecResult.Clear();
                    InterfaceUnit.ECPart.AddCommand(command, ecResult);
                });
            seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    if (ecResult.ReceiveOk)
                    {
                        if (ecResult.ParsingSuccess)
                        {
                            if (ecResult.ECInfo.SBoxInfo.RESULT == FAECInfo.FAECResult.PASS)
                            {
                                ecResult.ECInfo.SBoxInfo.CopyTo(ProductInfo.ECInfo.SBoxInfo);
                                actor.NextStep();
                            }
                            else
                            {
                                RaiseAlarm(actor, ecResult.LastAlarmNo);
                                actor.NextStep("RequestSmallBoxInfo");
                            }
                        }
                        else
                        {
                            RaiseAlarm(actor, ecResult.LastAlarmNo);
                            actor.NextStep("RequestSmallBoxInfo");
                        }
                    }
                    else if (ecResult.LastAlarmNo != 0)
                    {
                        RaiseAlarm(actor, ecResult.LastAlarmNo);
                        actor.NextStep("RequestSmallBoxInfo");
                    }
                });
            seq.Steps["AddLoadingCount"].StepIndex = seq.AddItem(
                delegate(FASequence actor, TimeSpan time)
                {
                    bool changedLot = false;

                    if (AddLoadingCount(ProductInfo.ECInfo.PackingMasterInfo, out changedLot) == true)
                    {
                        if (changedLot)
                        {
                            FARobotControlModule.RobotWork work = new FARobotControlModule.RobotWork();
                            ProductInfo.VT5080ProductInfo.ProductStatus = new VT5080ProductInfo.ProductStatusInfo();
                            ProductInfo.VT5080ProductInfo.Gate = Gate;
                            RobotControlModule.AddWork(ProductInfo);
                        }

                        actor.NextStep();
                    }
                    else
                    {
                        RaiseAlarm(actor, AlarmNotSameLotIDProductInput);
                        actor.NextStep("Start");
                    }
                });
            seq.AddItem(
                delegate(object obj)
                {
                    var smallBoxCount = CurrentLotLargeBoxCount() * CurrentLotInfo.L_BOX_MOQ;

                    ProductInfo.VT5080ProductInfo.SmallBoxIndex = LoadingCount - 1;

                    if (smallBoxCount == LoadingCount)
                    {
                        CurrentLotInfo.Clear();
                        LoadingCount = 0;
                    }
                });
            seq.AddTerminate();
        }
        public SBoxInfoControl()
        {
            Command = new FAECInfo.SBOX_INFO_REQ();

            InitializeComponent();
        }