Ejemplo n.º 1
0
        private void buttonSaveToDb_Click(object sender, EventArgs e)
        {
            if (AllDataCorrect())
            {
                using (TakePhotoForm photoForm = new TakePhotoForm(deviceMonikerString, textBoxPcbQr.Text))
                {
                    if (photoForm.ShowDialog() == DialogResult.OK)
                    {
                        ProductionHistory.AddModuleToHostory(currentLotInfo.Model, textBoxPcbQr.Text, comboBoxOperator.Text, ref historyTable);
                        foreach (DataGridViewColumn col in dataGridViewHistory.Columns)
                        {
                            col.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                        }
                        List <SaveRecord> listToSave = new List <SaveRecord>();

                        string overallResult = "OK";
                        foreach (ListViewItem item in listViewOperations.Items)
                        {
                            string oper           = comboBoxOperator.Text;
                            string model          = currentLotInfo.Model;
                            string serialNo       = textBoxPcbQr.Text;
                            string jobDescription = item.SubItems[2].Text;
                            string compRef        = item.SubItems[0].Text;
                            string result         = "OK";

                            if (jobDescription.Contains("SCRAP"))
                            {
                                result        = "NG";
                                overallResult = "NG";
                            }
                            SaveRecord saveLine = new SaveRecord(oper, model, serialNo, jobDescription, compRef, result);

                            listToSave.Add(saveLine);
                        }

                        LockListView(false);
                        SqlOperations.SaveRecordToDb(listToSave);
                        if (SqlOperations.CheckNgTableForSerial(textBoxPcbQr.Text))
                        {
                            SqlOperations.UpdateReworkResultToNgTable(textBoxPcbQr.Text, overallResult, DateTime.Now);
                        }
                        comboBoxOperator.Items.Clear();
                        comboBoxOperator.Items.AddRange(SqlOperations.GetListOfOperators());
                        CleanUpForm();
                        textBoxPcbQr.Focus();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            dataGridViewHistory.DataSource = historyTable;
            comboBoxOperator.Items.Clear();
            comboBoxOperator.Items.AddRange(SqlOperations.GetListOfOperators());
            var screen = Screen.FromControl(this).Bounds;

            this.Height    = screen.Height;
            this.Width     = screen.Width / 2;
            currentLotInfo = new LotInfo("", "", 0, "", "", "", "", "", "");

            FinalFrame          = new VideoCaptureDevice();
            deviceMonikerString = CameraTools.CheckDeviceMonikerString(CaptureDevice);
            ProductionHistory.LoadHistoryFromTextFile(ref historyTable);
#if DEBUG
            buttonDebug.Visible = true;
#endif
        }