Example #1
0
        private void SimpleMode_Form_Load(object sender, EventArgs e)
        {
            Int32 n_majorOSVersion = Environment.OSVersion.Version.Major;

            if (n_majorOSVersion == 5)
            {
                this.ConfigPath = @"C:\Documents and Settings\All Users\Application Data\SSManualReportGenerator\";
            }
            else if (n_majorOSVersion == 6)
            {
                this.ConfigPath = @"C:\Users\Public\SSManualReportGenerator\";
            }
            else
            {
                MessageBox.Show("Neznama verzia operacneho systemu. Zavolajte prosim testovacieho inziniera");
                this.Dispose();
                return;
            }

            this.ProductsConfig = new ProductsConfigurationFile(this.ConfigPath);
            try
            {
                ComboBox cb_TestTypesParentForm = (ComboBox)Application.OpenForms[0].Controls["gb_Product"].Controls["cb_TestType"];
                foreach (String actTest in cb_TestTypesParentForm.Items)
                {
                    this.cb_TestTypes.Items.Add(actTest);
                }

                Label lbl_operatorNr = (Label)Application.OpenForms[0].Controls["groupBox2"].Controls["lbl_OperatorNr"];
                str_OperatorNr = lbl_operatorNr.Text.Trim();

                if (this.cb_TestTypes.Items.Count == 1)
                {
                    this.cb_TestTypes.SelectedIndex = 0;
                    this.lbl_Info.Text = "Oskenujte SerialNumber z produktu";
                }
                else
                {
                    this.lbl_Info.Text = "Vyberte typ testu";
                    this.cb_TestTypes.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            this.Text = String.Concat("Simple Tracing - Operator: ", this.objBelMes.Emp.strEmployeeName, @"/", this.objBelMes.Emp.strEmployeeNumber);

            foreach (StationConfig.SerialNumberIP actSN in myStationConfig.GetSerialNumbersInProcess())
            {
                String PassBtnText = "PASS";
                Array  actCTIs     = ProductsConfig.GetChildTestsInfos(actSN.ProductID, actSN.TestType);
                if (actCTIs.Length > 0)
                {
                    PassBtnText = "START";
                }
                this.dgv_SNsIP.Rows.Add(actSN.SerialNumber, actSN.ProductID, actSN.TestType, actSN.Operator, actSN.StartTime, PassBtnText, "FAIL", "TERMINATE");
            }

            for (int i = 1; i < 5000; i++)
            {
                this.cb_FromSN.Items.Add(i);
                this.cb_ToSN.Items.Add(i);
            }

            if (myStationConfig.SimpleModeBatchAvailable())
            {
                this.BatchModeAvailable = true;
                this.label3.Enabled     = true;
                this.label4.Enabled     = true;
                this.label5.Enabled     = true;
                this.tb_JobID.Enabled   = true;
            }

            this.chb_ChecklistImmediatelyStart.Checked = myStationConfig.GetChecklistImmediatelyStart();

            this.chb_JobIDChecking.Checked = this.myStationConfig.GetSimpleModeJobIDCheckingState();

            int HeightOfScreen = Screen.PrimaryScreen.Bounds.Height - 30;

            this.Height = HeightOfScreen;

            this.lbl_Info.ForeColor = System.Drawing.Color.Green;
            this.Activate();
        }
Example #2
0
        private void frm_Instructions_Load(object sender, EventArgs e)
        {
            Screen    current = Screen.FromControl(this);
            Rectangle area    = current.WorkingArea;

            this.Size = new Size(area.Width, area.Height);

            int nBtnsWidth = (area.Width - 48) / 3;

            this.btnPASS.Location      = new Point(12, 50);
            this.btnFAIL.Location      = new Point(12 + nBtnsWidth + 12, 50);
            this.btnTERMINATE.Location = new Point(12 + nBtnsWidth + 12 + nBtnsWidth + 12, 50);

            this.btnPASS.Size      = new Size(nBtnsWidth, 63);
            this.btnFAIL.Size      = new Size(nBtnsWidth, 63);
            this.btnTERMINATE.Size = new Size(nBtnsWidth, 63);

            Int32 n_majorOSVersion = Environment.OSVersion.Version.Major;

            if (n_majorOSVersion == 5)
            {
                this.ConfigPath = @"C:\Documents and Settings\All Users\Application Data\SSManualReportGenerator\";
            }
            else if (n_majorOSVersion == 6)
            {
                this.ConfigPath = @"C:\Users\Public\SSManualReportGenerator\";
            }
            else
            {
                MessageBox.Show("Neznama verzia operacneho systemu. Zavolajte prosim testovacieho inziniera");
                this.Dispose();
                return;
            }

            this.ProductsConfig = new ProductsConfigurationFile(this.ConfigPath);

            this.dgv_Instructions = new DGV_Instructions(this.ProductsConfig.GetChildTestsInfos(this.ProductName, this.TestKind));
            this.dgv_Instructions.DefaultCellStyle.Font = new Font("Arial", 20.0F);
            this.dgv_Instructions.Location          = new Point(12, 120);
            this.dgv_Instructions.RowHeadersVisible = false;
            this.dgv_Instructions.Size             = new Size((area.Width - 12) / 2, area.Height - 140);
            this.dgv_Instructions.Columns[1].Width = this.dgv_Instructions.Width / 2;
            //this.dgv_Instructions.Columns[5].Width = this.dgv_Instructions.Width - (this.dgv_Instructions.Columns[0].Width + this.dgv_Instructions.Columns[1].Width + this.dgv_Instructions.Columns[2].Width + this.dgv_Instructions.Columns[3].Width + this.dgv_Instructions.Columns[4].Width);



            for (int i = 0; i < this.Instructions.Length; i++)
            {
                ProductsConfigurationFile.ChildTestInfo actCTI = (ProductsConfigurationFile.ChildTestInfo) this.Instructions.GetValue(i);
                if (actCTI.ScanBarcode == "")
                {
                    this.dgv_Instructions.Rows.Add(actCTI.Name, actCTI.Instruction, "", "PASS", "FAIL", "");
                }
                else
                {
                    this.dgv_Instructions.Rows.Add(actCTI.Name, actCTI.Instruction, "", "SCAN", "FAIL", "");
                }
            }

            this.Controls.Add(this.dgv_Instructions);

            this.dgv_Instructions.Columns[5].Width = this.dgv_Instructions.Width - (this.dgv_Instructions.Columns[0].Width + this.dgv_Instructions.Columns[1].Width + this.dgv_Instructions.Columns[2].Width + this.dgv_Instructions.Columns[3].Width + this.dgv_Instructions.Columns[4].Width);
        }
        private void tb_Order_KeyUp(object sender, KeyEventArgs e)
        {
            if (!btn_Pass.Enabled)
            {
                return;
            }
            if (e.KeyCode != Keys.Enter)
            {
                return;
            }
            String actOrder = this.tb_Order.Text.Trim();
            String buffer   = Regex.Match(actOrder, @"\d+").Value;

            if (buffer.Length > 12)
            {
                if (buffer.Substring(0, 13) == actSN.SerialNumber)
                {
                    actOrder = "$StepPass#";
                }
            }


            ProductsConfigurationFile.ChildTestInfo actCI = (ProductsConfigurationFile.ChildTestInfo)Instructions.GetValue(actInstruction);
            SimpleMode_Form.StepInfo actSI = new SimpleMode_Form.StepInfo();
            if (actCI.CameraInspection == "1")
            {
                actSI = this.TcpConnect();
                if (actSI.Grade == "")
                {
                    this.ErrorMessageBoxShow(String.Concat("Nemozem nadviazat spojenie s kamerovym systemom. Skontrolujte ci je spusteny program pre obsluhu kamery - Ikona je na ploche PC. Ak sa chyba aj napriek tomu opakuje, zavolajte prosim technika."), true);
                    return;
                }
                if (actSI.Grade == "FAIL")
                {
                    return;
                }
            }

            if (actCI.ScanBarcode != "")
            {
                if (!ProductsConfigurationFile.CheckValueToMask(actOrder, actCI.ScanBarcode))
                {
                    this.lbl_Instruction.Text      = String.Concat("Nespravne zoskenovany udaj\n\n", actCI.Instruction);
                    this.lbl_Instruction.ForeColor = Color.Red;
                    this.tb_Order.Text             = "";
                    this.tb_Order.Focus();
                    return;
                }
                else
                {
                    actSI.Name        = actCI.Name;
                    actSI.Description = actCI.Instruction;
                    actSI.Grade       = "PASS";
                    actSI.ResultValue = actOrder;
                }
            }
            else
            {
                if (actOrder == "$StepFail#")
                {
                    actSI.Name = actCI.Name;
                    if (actCI.CameraInspection != "1")
                    {
                        actSI.Description = actCI.Instruction;
                    }
                    actSI.Grade = "FAIL";
                    this.Close();
                }
                else if (actOrder == "$StepPass#")
                {
                    actSI.Name = actCI.Name;
                    if (actCI.CameraInspection != "1")
                    {
                        actSI.Description = actCI.Instruction;
                    }
                    actSI.Grade = "PASS";
                }
                else
                {
                    this.lbl_Instruction.Text      = String.Concat("Nespravne zoskenovany/zadany udaj\n\n", actCI.Instruction);
                    this.lbl_Instruction.ForeColor = Color.Red;
                    this.tb_Order.Text             = "";
                    this.tb_Order.Focus();
                    return;
                }
            }
            if (actSI.ResultValue.Trim() == "")
            {
                actSI.ResultValue = "Checked";
            }
            Array.Resize(ref actSN.Steps, actSN.Steps.Length + 1);
            actSN.Steps.SetValue(actSI, actSN.Steps.Length - 1);

            this.actInstruction++;
            if (actInstruction == this.Instructions.Length)
            {
                this.Close();
            }
            else
            {
                this.lbl_InsCounter.Text = String.Format("Instruction   {0}/{1}", actInstruction + 1, this.Instructions.Length);
                actCI                          = (ProductsConfigurationFile.ChildTestInfo)Instructions.GetValue(actInstruction);
                this.actTimeout                = Convert.ToInt32(actCI.Timeout);
                this.lbl_Instruction.Text      = actCI.Instruction;
                this.lbl_Instruction.ForeColor = Color.Black;
                if (actCI.CameraInspection == "1")
                {
                    this.btn_Pass.Text = "START";
                }
                else
                {
                    this.btn_Pass.Text = "PASS";
                }
                if (actCI.PicturePath != "")
                {
                    String str_actPicturesPath = String.Concat(str_PicturesPath, actCI.PicturePath);
                    if (actCI.CameraInspection == "1")
                    {
                        Int32  foldIndex   = actCI.PicturePath.IndexOf('\\');
                        String instrfolder = actCI.PicturePath.Substring(0, foldIndex + 1);
                        str_actPicturesPath = String.Concat(str_PicturesPath, instrfolder, this.Item, "_CAM.jpg");
                        if (!File.Exists(str_actPicturesPath))
                        {
                            str_actPicturesPath = String.Concat(str_PicturesPath, instrfolder, "Default_CAM.jpg");
                        }
                    }
                    if (Directory.Exists(Path.GetDirectoryName(str_actPicturesPath)))
                    {
                        if (!File.Exists(str_actPicturesPath))
                        {
                            this.Cursor = Cursors.Default;
                            if (Path.GetFileName(str_actPicturesPath) == "")
                            {
                                return;
                            }
                            else
                            {
                                this.ErrorMessageBoxShow(String.Concat("Neexistuje subor \"", str_actPicturesPath, "\". Zavolajte prosim testovacieho technika."), true);
                            }
                            return;
                        }
                        Image img_PictureToShow = Image.FromFile(str_actPicturesPath);
                        this.pictureBox1.Visible  = true;
                        this.pictureBox1.Image    = img_PictureToShow;
                        this.pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
                    }
                }
                else
                {
                    this.pictureBox1.Visible = false;
                }
                this.btn_Pass.BackColor = this.BackColor;
                this.btn_Pass.Enabled   = false;
                this.btn_Fail.BackColor = this.BackColor;
                this.btn_Fail.Enabled   = false;
                this.tb_Order.Text      = "";
                this.timeoutStart       = DateTime.Now;
                this.t_Main.Start();
            }
        }