Ejemplo n.º 1
0
        /// <summary>
        /// 老化结束数量
        /// </summary>
        private void refreshEndBIStatus()
        {
            try
            {
                string er = string.Empty;

                CDBCOM db = new CDBCOM(EDBType.Access, "", CGlobalPara.SysDB);

                DataSet ds = null;

                string sqlCmd = string.Empty;

                if (cmbModel.Text == CLanguage.Lan("所有老化机种"))
                {
                    sqlCmd = "select * from RUN_PARA where doRun=" + (int)EDoRun.老化结束 + " order by UUTNO";
                }
                else
                {
                    sqlCmd = "select * from RUN_PARA where doRun=" + (int)EDoRun.老化结束 + " and ModelName='" + cmbModel.Text + "' order by UUTNO";
                }

                if (!db.QuerySQL(sqlCmd, out ds, out er))
                {
                    MessageBox.Show(er);
                    return;
                }

                labOutNum.Text = ds.Tables[0].Rows.Count.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 加载中英文字典
 /// </summary>
 private void LoadLanguge()
 {
     try
     {
         CLanguage.LoadLanType();
         string lanDB = Application.StartupPath + "\\LAN.accdb";
         if (!File.Exists(lanDB))
         {
             return;
         }
         CDBCOM  db     = new CDBCOM(EDBType.Access, ".", lanDB);
         string  er     = string.Empty;
         DataSet ds     = null;
         string  sqlCmd = "select * from LanList order by idNo";
         if (!db.QuerySQL(sqlCmd, out ds, out er))
         {
             return;
         }
         Dictionary <string, string> lan = new Dictionary <string, string>();
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             string LAN_CH = ds.Tables[0].Rows[i]["LAN_CH"].ToString();
             string LAN_EN = ds.Tables[0].Rows[i]["LAN_EN"].ToString();
             if (!lan.ContainsKey(LAN_CH))
             {
                 lan.Add(LAN_CH, LAN_EN);
             }
         }
         CLanguage.Load(lan, out er);
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 产能统计
        /// </summary>
        private void refreshYieldRecord()
        {
            try
            {
                string er = string.Empty;

                YieldView.Rows.Clear();

                CDBCOM db = new CDBCOM(EDBType.Access, "", CGlobalPara.SysDB);

                string sqlCmd = "select * from YieldRecord order by idNo";

                DataSet ds = null;

                if (!db.QuerySQL(sqlCmd, out ds, out er))
                {
                    MessageBox.Show(er);
                    return;
                }
                int    dayTTNum    = 0;
                int    dayPassNum  = 0;
                double dayFailRate = 0;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    string idNo       = (i + 1).ToString();
                    string yieldTimes = ds.Tables[0].Rows[i]["YieldTimes"].ToString();
                    int    ttNum      = System.Convert.ToInt32(ds.Tables[0].Rows[i]["ttNum"].ToString());
                    int    passNum    = System.Convert.ToInt32(ds.Tables[0].Rows[i]["passNum"].ToString());
                    double failRate   = 0;
                    if (ttNum != 0)
                    {
                        failRate = (double)(ttNum - passNum) / (double)ttNum;
                    }
                    YieldView.Rows.Add(idNo, yieldTimes, ttNum, passNum, failRate.ToString("P2"));
                    dayTTNum   += ttNum;
                    dayPassNum += passNum;
                }
                if (dayTTNum != 0)
                {
                    dayFailRate = (double)(dayTTNum - dayPassNum) / (double)dayTTNum;
                }
                YieldView.Rows.Add("*", "00:00--24:00", dayTTNum, dayPassNum, dayFailRate.ToString("P2"));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 4
0
        private bool LoadPLCAccessDB(string accessFile)
        {
            try
            {
                if (!File.Exists(accessFile))
                {
                    //MessageBox.Show("【" + accessFile + "】不存在", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }

                PLCView.Rows.Clear();

                string er = string.Empty;

                CDBCOM db = new CDBCOM(EDBType.Access, "", accessFile);

                DataSet ds = null;

                string sqlCmd = string.Format("select * from AlamList order by idNo");

                if (!db.QuerySQL(sqlCmd, out ds, out er))
                {
                    MessageBox.Show(er, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    PLCView.Rows.Add(ds.Tables[0].Rows[i]["RegFun"].ToString(),
                                     ds.Tables[0].Rows[i]["RegDesc"].ToString(),
                                     "");
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Tip", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
        }
Ejemplo n.º 5
0
        private void refreshModelList()
        {
            try
            {
                string er = string.Empty;

                CDBCOM db = new CDBCOM(EDBType.Access, "", CGlobalPara.SysDB);

                DataSet ds = null;

                string sqlCmd = "select distinct ModelName from RUN_PARA where doRun=" + (int)EDoRun.正在老化 + " or doRun=" + (int)EDoRun.老化结束;

                if (!db.QuerySQL(sqlCmd, out ds, out er))
                {
                    MessageBox.Show(er);
                    return;
                }

                labModelNum.Text = ds.Tables[0].Rows.Count.ToString();

                cmbModel.Items.Clear();

                cmbModel.Items.Add(CLanguage.Lan("所有老化机种"));

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    cmbModel.Items.Add(ds.Tables[0].Rows[i]["ModelName"].ToString());
                }

                cmbModel.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 6
0
        private void btnQueryFailSn_Click(object sender, EventArgs e)
        {
            try
            {
                btnQueryFailSn.Enabled = false;

                snFailView.Rows.Clear();

                string er = string.Empty;

                string startDate = dpStartDate.Value.ToString("yyyy/MM/dd") + " 00:00:00";

                string endDate = dpEndDate.Value.ToString("yyyy/MM/dd") + " 23:59:59";

                CDBCOM db = new CDBCOM(EDBType.Access, "", CGlobalPara.SysDB);

                DataSet ds = null;

                string sqlCmd = string.Empty;

                if (txtFailSn.Text == string.Empty)
                {
                    sqlCmd = string.Format("select * from FailRecord where StartTime >= '{0}' and StartTime <='{1}'" +
                                           " order by StartTime desc,IdCard,SlotNo", startDate, endDate);
                }
                else
                {
                    sqlCmd = string.Format("select * from FailRecord where  StartTime >= '{0}' and StartTime <='{1}' and SerialNo='{2}'",
                                           startDate, endDate, txtFailSn.Text);
                }

                if (!db.QuerySQL(sqlCmd, out ds, out er))
                {
                    labFailStatus.Text      = er;
                    labFailStatus.ForeColor = Color.Red;
                    return;
                }

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    string serialNo = ds.Tables[0].Rows[i]["SerialNo"].ToString();

                    string fixName = ds.Tables[0].Rows[i]["IdCard"].ToString() + "-" +
                                     System.Convert.ToInt16(ds.Tables[0].Rows[i]["SlotNo"].ToString()).ToString("D2");

                    string localName = ds.Tables[0].Rows[i]["LocalName"].ToString();

                    string startTime = ds.Tables[0].Rows[i]["StartTime"].ToString();

                    string endTime = ds.Tables[0].Rows[i]["EndTime"].ToString();

                    string failInfo = ds.Tables[0].Rows[i]["FailInfo"].ToString();

                    string failTime = ds.Tables[0].Rows[i]["FailTime"].ToString();

                    string filePath = ds.Tables[0].Rows[i]["ReportPath"].ToString();

                    snFailView.Rows.Add(serialNo, fixName, localName, startTime, endTime, failInfo, failTime, filePath);
                }

                labFailStatus.Text = CLanguage.Lan("查询不良数量") + ":" + "【" + ds.Tables[0].Rows.Count.ToString() + "】";

                labFailStatus.ForeColor = Color.Blue;
            }
            catch (Exception ex)
            {
                labFailStatus.Text      = ex.ToString();
                labFailStatus.ForeColor = Color.Red;
            }
            finally
            {
                btnQueryFailSn.Enabled = true;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 即将老化结束
        /// </summary>
        private void refreshChmrStatus()
        {
            try
            {
                string er = string.Empty;

                CDBCOM db = new CDBCOM(EDBType.Access, "", CGlobalPara.SysDB);

                DataSet ds = null;

                int leftTimes = System.Convert.ToInt32(txtEndTimes.Text) * 60;

                string sqlCmd = string.Empty;

                if (cmbModel.Text == CLanguage.Lan("所有老化机种"))
                {
                    sqlCmd = "select RUN_BASE.LocalName," +
                             "RUN_PARA.ModelName," +
                             "RUN_PARA.IDCard," +
                             "RUN_PARA.StartTime," +
                             "RUN_PARA.EndTime," +
                             "UUT_PARA.RunTime," +
                             "RUN_PARA.doRun," +
                             "RUN_PARA.BurnTime," +
                             "RUN_PARA.UUTNO" +
                             " from RUN_PARA,RUN_BASE,UUT_PARA" +
                             " where RUN_PARA.UUTNO = RUN_BASE.UUTNO" +
                             " and RUN_PARA.UUTNO = UUT_PARA.UUTNO" +
                             " and RUN_PARA.IDCard<>''" +
                             " and (RUN_PARA.doRun=" + (int)EDoRun.老化结束 +
                             " or (RUN_PARA.doRun=" + (int)EDoRun.正在老化 +
                             " and (RUN_PARA.BurnTime - UUT_PARA.RunTime)<" +
                             leftTimes.ToString() + "))" +
                             "  order by RUN_PARA.ModelName,RUN_PARA.StartTime";
                }
                else
                {
                    sqlCmd = "select RUN_BASE.LocalName," +
                             "RUN_PARA.ModelName," +
                             "RUN_PARA.IDCard," +
                             "RUN_PARA.StartTime," +
                             "RUN_PARA.EndTime," +
                             "UUT_PARA.RunTime," +
                             "RUN_PARA.doRun," +
                             "RUN_PARA.BurnTime," +
                             "RUN_PARA.UUTNO" +
                             " from RUN_PARA,RUN_BASE,UUT_PARA" +
                             " where RUN_PARA.UUTNO=RUN_BASE.UUTNO" +
                             " and RUN_PARA.UUTNO = UUT_PARA.UUTNO" +
                             " and RUN_PARA.IDCard<>''" +
                             " and (RUN_PARA.doRun=" + (int)EDoRun.老化结束 +
                             " or (RUN_PARA.doRun=" + (int)EDoRun.正在老化 +
                             " and (RUN_PARA.BurnTime-UUT_PARA.RunTime)<" +
                             leftTimes.ToString() + "))" +
                             " and ModelName='" + cmbModel.Text + "'" +
                             " order by RUN_PARA.ModelName,RUN_PARA.StartTime";
                }

                if (!db.QuerySQL(sqlCmd, out ds, out er))
                {
                    MessageBox.Show(er);
                    return;
                }

                int preNum = ds.Tables[0].Rows.Count;

                uutView.Rows.Clear();

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    int idNo = i + 1;

                    string modelName = ds.Tables[0].Rows[i]["ModelName"].ToString();

                    string localName = ds.Tables[0].Rows[i]["LocalName"].ToString();

                    string idCard = ds.Tables[0].Rows[i]["IDCard"].ToString();

                    string startTime = ds.Tables[0].Rows[i]["StartTime"].ToString();

                    int runTime = System.Convert.ToInt32(ds.Tables[0].Rows[i]["RunTime"].ToString());

                    TimeSpan ts = new TimeSpan(0, 0, runTime);

                    string runTimes = ts.Days.ToString("D2") + ":" + ts.Hours.ToString("D2") + ":" +
                                      ts.Minutes.ToString("D2") + ":" + ts.Seconds.ToString("D2");

                    int doRun = System.Convert.ToInt32(ds.Tables[0].Rows[i]["doRun"].ToString());

                    string status = string.Empty;

                    if (doRun == (int)EDoRun.正在老化)
                    {
                        status = "老化中";
                    }
                    else
                    {
                        status = "老化结束";
                    }

                    uutView.Rows.Add(idNo, modelName, localName, idCard, startTime, runTimes, status);
                }

                labPreNum.Text = preNum.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }