예제 #1
0
        public static Panel paint(Info.TrayList.Tray trayInfo)
        {
            if (trayInfo.message != null)
            {
                Main.main.lblMessage.Text = trayInfo.message;
            }
            Color panelColor = new Color();
            Color strColor   = new Color();

            foreach (Control control in Main.main.gbDetail.Controls)
            {
                if (trayInfo.type == control.Text)
                {
                    panelColor = control.BackColor;
                    strColor   = control.ForeColor;
                    break;
                }
            }
            Panel panel = new Panel();

            panel.Dock      = DockStyle.Fill;
            panel.BackColor = panelColor;
            //panel.AutoSize = true;

            Label l1 = new Label();

            l1.Text = trayInfo.type;//l1.Text = trayInfo.result == "0" ? "PASS" : "FAIL";
            //l1.Font = new Font("微软雅黑", 12, FontStyle.Bold);
            l1.Font      = new Font("微软雅黑", l1.Font.Size, FontStyle.Bold);
            l1.ForeColor = strColor;
            Label l2 = new Label();

            //绝对位置change动态位置
            l2.Location  = new Point(0, 50);
            l2.Text      = Regedit.Trajectory[Info.TrayList.trayList.Count - 1];
            l2.ForeColor = strColor;
            Label l3 = new Label();

            l3.BringToFront();
            //l3.AutoSize = true;
            l3.Width     = (Main.TlpLayout_Width / Convert.ToInt16(System.Configuration.ConfigurationManager.AppSettings["col"])) - 10;
            l3.Height    = 24;//可以显示2行字
            l3.Location  = new Point(0, 20);
            l3.ForeColor = strColor;
            panel.Controls.Add(l3);

            l3.Text = trayInfo.value;


            panel.Controls.Add(l1);
            panel.Controls.Add(l2);

            return(panel);
        }
예제 #2
0
        public static void WriteCSV(Info.TrayList.Tray trayInfo)//(string SN,DateTime checkTime)
        {
            DateTime dt       = DateTime.Now;
            string   fileName = type + factory + building + line + process + dt.ToString("_yyyyMMddHHmmss_") + trayInfo.sn;
            string   path     = Document.pathList[1] + fileName + ".csv";

            using (StreamWriter file = new StreamWriter(path, true))
            {
                string[] csvStr = new string[]
                {
                    type, factory, building, line, process, trayInfo.sn, "", "", "", dt.ToString("yy,MM,dd,HH,mm,ss"), "1", inspect,
                    upperLimit, lowerLimit, Info.Oven.roastTime.ToString(), Info.Oven.result, trayInfo.result, "0"
                };
                string str = String.Join(",", csvStr);

                file.WriteLine(str);// 直接追加文件末尾,换行
            }
        }
예제 #3
0
        public static TrayList.Tray GetTrayInfo(string sn)
        {
            string sql = sql0.Replace("{0}", sn);

            System.Data.DataTable dt = new System.Data.DataTable();
            new DBFactory().ExecuteDataTable(sql, ref dt);
            TrayList.Tray tray = new TrayList.Tray()
            {
                sn = sn
            };
            if (dt.Rows.Count > 0)
            {
                tray.value = dt.Rows[0]["value"].ToString();
                tray.type  = dt.Rows[0]["type"].ToString();
                try { tray.message = dt.Rows[0]["message"].ToString(); } catch { }
                return(tray);
            }
            else
            {
                tray.type   = "NULL";
                tray.result = "1";
                return(tray);
            }
        }
예제 #4
0
        void Action(string sn)
        {
            lblMessage.Text   = "";
            txtDisplaySN.Text = sn;
            txtSN.Text        = "";
            txtSN.SelectAll();
            Application.DoEvents();
            //填满之后,清空
            object sender = new object { };

            if (sequence == NTRSbyDB.Layout.sum)
            {
                BtnClear_Click(sender, new EventArgs());
            }
            if (!sn.Contains("ERROR"))
            {
                sn = sn.Substring(0, 17);
            }


            #region SN检查:是否重复
            foreach (Info.TrayList.Tray var in Info.TrayList.trayList)
            {
                if (sn == var.sn && sn != "ERROR")
                {
                    txtResult.Text = "DUPLICATE";
                    return;
                }
            }
            #endregion

            #region 第一个tray检查
            Info.TrayList.Tray tray = Info.DB.GetTrayInfo(sn);
            Info.TrayList.trayList.Add(tray);
            #endregion


            #region 方块布局显示
            int[] location = Array.ConvertAll(Regedit.Trajectory[sequence].Split(','), int.Parse);

            try
            {
                TlpLayout.Controls.Add(NTRSbyDB.Layout.paint(Info.TrayList.trayList[Info.TrayList.trayList.Count - 1]),
                                       location[0] - 1, location[1] - 1);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion

            #region 数据显示
            txtResult.Text = Info.TrayList.trayList[Info.TrayList.trayList.Count - 1].type;

            //txtDetail.Text = string.Format("Oven Info:\r\n{0}sec\r\n{1}\r\n{2}",
            //    Info.Oven.roastTime, Info.Oven.start, Info.Oven.end);
            //if (Info.TrayList.trayList[Info.TrayList.trayList.Count - 1].partsserial_cd == null)
            //{
            //    txtDetail.Text += "\r\n\r\nTray Info:\r\nNo tray data in database";
            //    txtDetail.ForeColor = Color.Red;
            //    txtDetail.BackColor = txtDetail.BackColor;
            //}
            //else
            //{
            //    txtDetail.Text += string.Format("\r\n\r\nTray Info:\r\n{0}\r\n{1}\r\n{2}",
            //        Info.TrayList.trayList[Info.TrayList.trayList.Count - 1].process_at,
            //        Info.TrayList.trayList[Info.TrayList.trayList.Count - 1].datatype_id,
            //        Info.TrayList.trayList[Info.TrayList.trayList.Count - 1].partsserial_cd);
            //}
            #endregion
            //写log
            Log.WriteLog(txtDisplaySN.Text, lblMessage.Text, txtResult.Text);
            //非"MISS"写csv
            //if (txtResult.Text != "MISS")
            //{
            //    Pqm.WriteCSV(Info.TrayList.trayList[Info.TrayList.trayList.Count - 1]);
            //}
            sequence++;
        }