Ejemplo n.º 1
0
 private void FrmSPC_Load(object sender, EventArgs e)
 {
     dataGridView1.DataSource          = ProductManager.GetCurProduct().Configs;
     dataGridView1.Columns[0].ReadOnly = true;
     dataGridView1.Columns[1].ReadOnly = true;
     dataGridView1.Columns[2].DefaultCellStyle.Format = "N3";
     dataGridView1.Columns[3].DefaultCellStyle.Format = "N3";
 }
Ejemplo n.º 2
0
 private void btnProductName_Click(object sender, EventArgs e)
 {
     if (Globals.runStatus == Globals.RunStatus.Ready && UserManager.GetUserPowLevel(Globals.CurrentUser) > 1)
     {
         Globals.runStatus = Globals.RunStatus.Debug;
         new FrmProductManage().ShowDialog();
         Globals.runStatus   = Globals.RunStatus.Ready;
         btnProductName.Text = ProductManager.GetCurProduct().Name;
     }
 }
Ejemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string str = ProductManager.SavePoduct(ProductManager.GetCurProduct());

            if (str == "OK")
            {
                MsgBox.Show("保存成功!");
            }
            else
            {
                MsgBox.Show("保存失败:" + str, ico: MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
        public static SortedList <string, string> RunCam3Program(ICogImage iCogImage)
        {
            WriteBlockInput(Tb3, "Image", iCogImage);
            Tb3.Run();
            Tb3.CreateLastRunRecord();

            SortedList <string, string> rs = new SortedList <string, string>()
            {
            };

            rs["RunStatus"] = Tb3.RunStatus.Result.ToString();
            if (rs["RunStatus"] != "Accept")
            {             //检测异常
                rs["Result"]       = "4";
                rs["ResultString"] = "检测失败";
                return(rs);
            }

            //处理结果,生成结果
            rs["Result"]       = "1";
            rs["ResultString"] = "OK";
            rs["NGKeys"]       = "";
            foreach (CogToolBlockTerminal item in Tb3.Outputs)
            {
                ConfigItem cfg   = ProductManager.GetCurProduct().Configs.Find(cfi => cfi.CamIndex == 3 && cfi.Key == item.Name);
                double     value = 0;
                double.TryParse(item.Value.ToString(), out value);
                value = Math.Round(value, 3);
                rs.Add(item.Name, value.ToString());
                if (value > cfg.Usl || value < cfg.Lsl)
                {
                    rs["Result"]       = "2";
                    rs["ResultString"] = "NG";
                    rs["NGKeys"]      += item.Name + ",";
                }
            }
            return(rs);
        }
Ejemplo n.º 5
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                return;
            }
            int id = (int)dataGridView1.SelectedRows[0].Cells[0].Value;

            if (id == ProductManager.GetCurProduct().Id)
            {
                return;
            }
            string rs = ProductManager.SetProduct(id);

            if (rs == "OK")
            {
                Close();
            }
            else
            {
                MsgBox.Show("加载产品失败:" + rs, ico: MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 6
0
        private void FrmHome_Load(object sender, EventArgs e)
        {
            btnProductName.Text = ProductManager.GetCurProduct().Name;
            Globals.runStatus   = Globals.RunStatus.Ready;
            List <ConfigItem> configs = ProductManager.GetCurProduct().Configs;

            for (int i = 0; i < configs.Count; i++)
            {
                dataGridView1.Rows.Add(configs[i].CamIndex, configs[i].Key);
                switch (configs[i].CamIndex)
                {
                case 1:
                    cam1Rows.Add(i);
                    break;

                case 2:
                    cam2Rows.Add(i);
                    break;

                case 3:
                    cam3Rows.Add(i);
                    break;

                default:
                    break;
                }
            }

            Vision.Cam1ResultAvailable += new VisionResultAvailableEventHandler(Vision_Cam1ResultAvailable);
            Vision.Cam2ResultAvailable += new VisionResultAvailableEventHandler(Vision_Cam2ResultAvailable);
            Vision.Cam3ResultAvailable += new VisionResultAvailableEventHandler(Vision_Cam3ResultAvailable);

            cogRecordDisplay1.AutoFit = true;
            cogRecordDisplay2.AutoFit = true;
            cogRecordDisplay3.AutoFit = true;
            timer1.Start();
        }
Ejemplo n.º 7
0
 private void FrmVision_FormClosing(object sender, FormClosingEventArgs e)
 {
     ProductManager.RefreshConfigItems(ProductManager.GetCurProduct());
 }