示例#1
0
        public bool ToModeSetInicialization()
        {
            FEmployer.Refresh();    //Обновим данные сотрудника
            Const.Refresh();        //Обновим константы

            PreviousAction = "";
            DocsSet        = new List <string>();

            if (!MBGoToSetSelfControl())
            {
                return(false);
            }

            string TextQuery =
                "SELECT " +
                "journ.iddoc as IDDOC " +
                "FROM " +
                "_1sjourn as journ (nolock) " +
                "INNER JOIN DH$КонтрольНабора as DocCC (nolock) " +
                "ON DocCC.iddoc = journ.iddoc " +
                "WHERE " +
                "DocCC.$КонтрольНабора.Наборщик = :Employer " +
                "and journ.iddocdef = $КонтрольНабора " +
                "and DocCC.$КонтрольНабора.Дата2 = :EmptyDate " +
                "and not DocCC.$КонтрольНабора.Дата1 = :EmptyDate " +
                "and journ.ismark = 0 ";

            QuerySetParam(ref TextQuery, "Employer", Employer.ID);
            QuerySetParam(ref TextQuery, "EmptyDate", GetVoidDate());
            DataTable DT;

            if (!ExecuteWithRead(TextQuery, out DT))
            {
                return(false);
            }

            if (DT.Rows.Count > 0)
            {
                DataRow[] DR = DT.Select();
                foreach (DataRow dr in DR)
                {
                    DocsSet.Add(dr["IDDOC"].ToString());
                }
                return(ToModeSet(null, null));
            }

            BoxForSet    = null;
            FCurrentMode = Mode.SetInicialization;
            return(true);
        } // ToModeSetInicialization
示例#2
0
        } // ToModeChoiseWork

        public bool ChoiseWork(Mode DesireMode)
        {
            FExcStr = null;
            if (!(FCurrentMode == Mode.ChoiseWork || FCurrentMode == Mode.ChoiseWorkShipping || FCurrentMode == Mode.ChoiseWorkSupply || FCurrentMode == Mode.ChoiseWorkSample || FCurrentMode == Mode.ChoiseWorkAcceptance))
            {
                FExcStr = "Недопустимая команда в текущем режиме!";
                return(false);
            }

            bool result = false;

            switch (DesireMode)
            {
            case Mode.Acceptance:
                if (FConsignment != null)
                {
                    FConsignment.Rows.Clear();
                }
                result = ToModeAcceptance();
                break;

            case Mode.TransferInicialize:
                result = ToModeTransferInicialize();
                break;

            case Mode.ChoiseInventory:
                result = ToModeChoiseInventory();
                break;

            case Mode.SampleInventory:
                result = ToModeSampleInventory();
                break;

            case Mode.SamplePut:
                SampleDoc = null;
                result    = ToModeSamplePut();
                break;

            case Mode.NewChoiseInventory:
                result = ToModeNewChoiseInventory();
                break;

            case Mode.SampleSet:
                result = ToModeSampleSet();
                break;

            case Mode.HarmonizationInicialize:
                result = ToModeHarmonizationInicialize();
                break;

            case Mode.LoadingInicialization:
                result = ToModeLoadingInicialization();
                break;

            case Mode.SetInicialization:
                FEmployer.Refresh();
                result = ToModeSetInicialization();
                break;

            case Mode.ChoiseDown:
                result = ToModeChoiseDown();
                break;

            case Mode.FreeDownComplete:
                result = ToModeFreeDownComplete();
                break;

            case Mode.AcceptanceCross:
                if (FConsignment != null)
                {
                    FConsignment.Rows.Clear();
                }
                result = ToModeAcceptanceCross();
                break;

            default:
                FExcStr = "Не возможно перейти в указанный режим!";
                return(false);
            }
            if (result)
            {
                OnChangeMode(new ChangeModeEventArgs(FCurrentMode));
            }
            return(result);
        } // ChoiseWork
示例#3
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);
            }
        }
示例#4
0
        } // CheckOrder

        internal override ABaseMode Init()
        {
            if (!NewEmployer.Selected)
            {
                return(Negative("Чудовищная ошибка программы! СРОЧНО ЗВОНИТЕ ПУТИНУ!"));
            }
            if (NewEmployer.IsMark)
            {
                return(Negative("Вы, вероятно, уволены!"));
            }
            Mode ToMode = CheckOrder(Mode.ChoiseWork, NewEmployer);

            //Пишем команду login!
            if (Employer == null || NewEmployer.ID != Employer.ID)
            {
                //Это перелогин или первый логин
                if (Employer != null && NewEmployer.ID != Employer.ID)
                {
                    //Перелогин, нужно сделать логаут предыдущему челу
                    if (!Logout())
                    {
                        return(Negative(SS.ExcStr));
                    }
                }
                RefEmployer OldEmployer = FEmployer;
                FEmployer = NewEmployer;
                if (!Login())
                {
                    FEmployer = OldEmployer;
                    if (OldEmployer != null)
                    {
                        FEmployer.Refresh();
                    }
                    return(Negative(SS.ExcStr));
                }
            }

            SS.Employer = FEmployer;    //ВРЕМЕННО, Чтобы работала обратная совместимость

            Const.Refresh();

            if (ToMode == Mode.Down)
            {
                if (!SS.ToModeDown())
                {
                    return(Negative(SS.ExcStr));
                }
                return(Positive());
            }
            else if (ToMode == Mode.FreeDownComplete)
            {
                if (!SS.ToModeFreeDownComplete())
                {
                    return(Negative(SS.ExcStr));
                }
                return(Positive());
            }
            else if (ToMode == Mode.NewComplectation)
            {
                if (!SS.ToModeNewComplectation())
                {
                    return(Negative(SS.ExcStr));
                }
                return(Positive());
            }
            else
            {
                return(Positive());
            }
        } // Init