示例#1
0
        public bool ReactionCancel()
        {
            //Заглушка временнаяы
            if (NewStructModes.Contains(FCurrentMode))
            {
                ABaseMode tmpMM = MM;
                MM        = MM.Cancel();
                FEmployer = MM.Employer;    //Временно
                Const     = MM.Const;       //Временно, рефрешим константы
                if (tmpMM.CurrentMode != MM.CurrentMode)
                {
                    OnChangeMode(new ChangeModeEventArgs(MM.CurrentMode));
                }
                else
                {
                    OnReport(new ReportEventArgs(MM.ExcStr));
                }
                return(MM.Result == MMResult.Positive ? true : false);
            }
            FExcStr = null;
            //Обновим параметры сотрудника, если он задан
            if (FEmployer != null)
            {
                FEmployer.Refresh();
            }
            switch (FCurrentMode)
            {
            case Mode.LoaderChoise:
                return(ToModeChoiseWork());

            case Mode.FreeDownComplete:
                if (DocDown.ID == null)
                {
                    return(ToModeChoiseWork());
                }
                else
                {
                    return(ToModeWaiting());
                };

            case Mode.SetCorrect:
                return(ToModeSet(null, null));

            case Mode.ChoiseWork:
                return(ToModeWaiting());

            case Mode.Set:
                QuitModesSet();
                if (Const.BoxSetOn)
                {
                    return(ToModeSetInicializationRequest());
                }
                else
                {
                    return(ToModeChoiseWork());
                }

            case Mode.SetSelfContorl:
                QuitModesSet();
                return(ToModeChoiseWork());

            case Mode.SetInicialization:
                return(ToModeChoiseWork());

            case Mode.SetComplete:
                QuitModesSet();
                return(ToModeChoiseWork());

            case Mode.Acceptance:
                QuitModeAcceptance();
                return(ToModeChoiseWork());

            case Mode.Inventory:
                return(ToModeChoiseWork());

            case Mode.NewInventory:
                QuitModeTransfer();
                return(ToModeChoiseWork());

            case Mode.ChoiseInventory:
                return(ToModeChoiseWork());

            case Mode.NewChoiseInventory:
                return(ToModeChoiseWork());

            case Mode.TransferInicialize:
                return(ToModeChoiseWork());

            case Mode.SampleInventory:
                return(ToModeChoiseWork());

            case Mode.Transfer:
                QuitModeTransfer();
                return(ToModeChoiseWork());

            case Mode.AcceptedItem:
                QuitModeAcceptedItem();     //Тут не важно смог снять или нет блокировку, выходить то как-то надо
                if (AcceptedItem.ToMode == Mode.Acceptance)
                {
                    if (!ToModeAcceptance())
                    {
                        //Если не получилось обновить, то вылетаем в главное меню!
                        FCurrentMode = Mode.Acceptance;
                        return(ReactionCancel());
                    }
                }
                else if (AcceptedItem.ToMode == Mode.AcceptanceCross)
                {
                    if (!ToModeAcceptanceCross())
                    {
                        //Если не получилось обновить, то вылетаем в главное меню!
                        FCurrentMode = Mode.AcceptanceCross;
                        return(ReactionCancel());
                    }
                }
                else
                {
                    FCurrentMode = AcceptedItem.ToMode;
                }
                return(true);

            case Mode.SamplePut:
                QuitModeSamplePut();
                return(ToModeChoiseWork());

            case Mode.SampleSet:
                return(ToModeChoiseWork());

            case Mode.SampleSetCorrect:
                return(ToModeSampleSet());

            case Mode.HarmonizationInicialize:
                return(ToModeChoiseWork());

            case Mode.Harmonization:
                return(ToModeChoiseWork());

            case Mode.HarmonizationPut:
                return(ToModeChoiseWork());

            case Mode.Loading:
                QuitModeLoading();
                return(ToModeChoiseWork());

            case Mode.LoadingInicialization:
                return(ToModeChoiseWork());

            case Mode.ChoiseDown:
                return(ToModeChoiseWork());

            case Mode.Down:
                return(ToModeWaiting());

            case Mode.DownComplete:
                return(ToModeWaiting());

            case Mode.NewComplectation:
                return(ToModeWaiting());

            case Mode.NewComplectationComplete:
                return(ToModeWaiting());

            case Mode.AcceptanceCross:
                QuitModeAcceptanceCross();
                return(ToModeChoiseWork());

            default:
                FExcStr = "Недопустимая команда в текущем режиме!";
                return(false);
            }
        }