Esempio n. 1
0
 void GetLoggin() //Настройка форма ввода пароля
 {
     GB_UserData.Visible  = true;
     GB_UserData.Location = new Point(12, 12);
     GB_UserData.Size     = new Size(429, 177);
     TB_RFIDIn.Select();
 }
Esempio n. 2
0
        public WorkForm(BaseClass BC)
        {
            InitializeComponent();
            BaseC     = BC;
            this.Text = BaseC.GetType().Name;
            GetLoggin();                                                                    //Настройка форма ввода пароля

            Times.Enabled     = true; LBPrintSN.Text = DateTime.Now.ToString("dd.MM.yyyy"); //Настройка времени
            Controllabel.Text = "";

            CloseApp.Click += (a, e) =>
            {
                var Result = MessageBox.Show("Уверены, что хотите выйти?", "Предупреждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (Result == DialogResult.Yes)
                {
                    Application.Exit();
                }
            };

            TB_RFIDIn.KeyDown += (a, e) => //Событие при вводе логина
            {
                if (e.KeyCode == Keys.Enter)
                {
                    if (GetLoginData()) //Метод, которы проверяет логин и добавляет в ArrayList данные о пользователе
                    {
                        TB_RFIDIn.Clear(); TB_RFIDIn.Select();
                    }
                }
            };
        }
Esempio n. 3
0
        public WorkForm(BaseClass BC, int LOTID)
        {
            InitializeComponent();

            BaseC       = BC;                                                               //Приведение к типу
            BaseC.LOTID = LOTID;
            this.Text   = BaseC.GetType().Name;                                             //Заголовок формы называется именем модулем
            GetLoggin();                                                                    //Настройка форма ввода пароля
            Times.Enabled     = true; LBPrintSN.Text = DateTime.Now.ToString("dd.MM.yyyy"); //Настройка времени
            Controllabel.Text = "";
            TestGrid.Rows.Add(12);
            //Реализация загрузки определенного класса

            CloseApp.Click += (a, e) =>
            {
                var Result = MessageBox.Show("Уверены, что хотите выйти?", "Предупреждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (Result == DialogResult.Yes)
                {
                    Application.Exit();
                }
            };

            BackButton.Click += (a, e) =>
            {
                var Result = MessageBox.Show("Уверены, что хотите вернуться в меню настройки?", "Предупреждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (Result == DialogResult.Yes)
                {
                    Close();
                }
            };

            GETSNCH.Click += (a, e) =>
            {
                if (GETSNCH.Checked)
                {
                    BaseC.CheckGetSN = true;
                }
                if (!GETSNCH.Checked)
                {
                    BaseC.CheckGetSN = false;
                }
            };

            BTPrint.Click += (a, e) =>
            {
                if (ListPrinter.SelectedIndex == -1)
                {
                    MessageBox.Show("Принтер не выбран"); return;
                }

                BaseC.printName  = ListPrinter.SelectedItem.ToString();
                PrintLBName.Text = "Текущий принтер \n" + BaseC.printName;
                ListPrinter.ClearSelected();
            };


            ClearBT.Click += (a, e) =>
            {
                //BaseC.cts.Cancel();
                SerialTextBox.Enabled = true;
                SerialTextBox.Clear();
                SerialTextBox.Select();
            };

            TB_RFIDIn.KeyDown += (a, e) => //Событие при вводе логина
            {
                if (e.KeyCode == Keys.Enter)
                {
                    if (GetLoginData()) //Метод, которы проверяет логин и добавляет в ArrayList данные о пользователе
                    {
                        TB_RFIDIn.Clear(); TB_RFIDIn.Select();
                    }
                }
            };

            SerialTextBox.KeyDown += (a, e) => //Событие скнирование номера
            {
                if (e.KeyCode == Keys.Enter)
                {
                    TestGrid.Rows.Clear();
                    TestGrid.RowCount = 12;
                    BaseC.KeyDownMethod();

                    if (BaseC.GetType() == typeof(UploadStation))
                    {
                        return;
                    }

                    if (BaseC.GetType() == typeof(Desassembly_STB))
                    {
                        return;
                    }

                    SerialTextBox.Clear(); SerialTextBox.Select();
                }
            };

            //Сохранение координат
            BT_SevePrintSettings.Click += (a, e) =>
            {
                //var list = new List<string>() { IDX.Value.ToString(), SNX.Value.ToString(), IDY.Value.ToString(), SNY.Value.ToString()};

                //foreach (var item in pathlist)
                //{
                //    var line = item.Substring(0, 22) + list[pathlist.IndexOf(item)] + ".txt";
                //    File.Move(item,line) ;
                //}

                if (BaseC.CheckPathPrinterSettings())
                {
                    BaseC.CreatePathPrinter();
                }

                if (SNPRINT.Visible == true)
                {
                    SaveSettingPrint(SNPRINT);
                }
                if (IDPrint.Visible == true)
                {
                    SaveSettingPrint(IDPrint);
                }
            };

            BT_PrinterSettings.Click += (a, e) =>
            {
                GB_PrinterSettings.Visible = true; SettingDelay.Visible = true;
                foreach (Control item in SettingDelay.Controls)
                {
                    if (item.Name.Contains("Delay"))
                    {
                        item.Enabled = true;
                    }
                }
            };

            BT_ClosePrintSet.Click += (a, e) =>
            {
                GB_PrinterSettings.Visible = false; SettingDelay.Visible = false; SaveSettingBT.Text = ""; SerialTextBox.Select();
                foreach (Control item in SettingDelay.Controls)
                {
                    if (item.Name.Contains("Delay"))
                    {
                        item.Enabled = false;
                    }
                }
            };

            CB_ErrorCode.TextChanged += (a, e) =>
            {
                CB_ErrorCode.MaxLength = 2;
                if (CB_ErrorCode.Text.Length == 2)
                {
                    BT_Disassebly.Select();
                }
            };

            BT_Disassebly.Click += (a, e) =>
            {
                if (string.IsNullOrEmpty(CB_ErrorCode.Text))
                {
                    MessageBox.Show("Укажите код ошибки"); CB_ErrorCode.Select();  return;
                }

                if (CheckErrocode(CB_ErrorCode.Text))
                {
                    MessageBox.Show("Не корректный код ошибки"); CB_ErrorCode.Select();  return;
                }

                var Dis         = new Desassembly_STB();
                var ErrorCodeID = Dis.GetErrorCodeID(CB_ErrorCode.Text);
                var serial      = int.Parse(SerialTextBox.Text.Substring(15));
                var smID        = GetSmartCardID(serial);
                var fullStbsn   = GetFullSTBSN(serial);
                var casid       = GetCASID(serial);
                BaseC.WriteToDBDesis(serial, SerialTextBox.Text, ErrorCodeID);
                BaseC.UpdateToDBDesis(serial);
                BaseC.DeleteToDBWeight(serial);
                BaseC.DeleteToDBDesis(serial);
                BaseC.DeleteToUpload(serial);
                BaseC.AddLogDesis(serial, Dis.IDApp, smID, fullStbsn, casid);
                BaseC.LabelStatus(Controllabel, $"Серийный номер { SerialTextBox.Text } \n ОТКРЕПЛЁН УСПЕШНО", Color.Green);
                BaseC.ShiftCounter += 1;
                BaseC.LotCounter   += 1;
                BaseC.ShiftCounterUpdate();
                BaseC.LotCounterUpdate();
                Label_ShiftCounter.Text = BaseC.ShiftCounter.ToString();
                LB_LOTCounter.Text      = BaseC.LotCounter.ToString();
                SerialTextBox.Enabled   = true;
                DG_UpLog.Rows.Add(int.Parse(Label_ShiftCounter.Text), SerialTextBox.Text, CB_ErrorCode.Text, DateTime.UtcNow.AddHours(2));
                DG_UpLog.Sort(DG_UpLog.Columns[0], System.ComponentModel.ListSortDirection.Descending);
                SerialTextBox.Clear();
                CB_ErrorCode.Text     = "";
                BT_Disassebly.Enabled = false;
                SerialTextBox.Select();
            };
        }