Пример #1
0
        public void loadDGV_NG(bool s_date, string dateFrom, string dateTo)
        {
            TfSQL  tfSql     = new TfSQL();
            string sqlSearch = "select * from adruino_ng where 1=1 ";

            if (s_date)
            {
                sqlSearch += " and date_time >= '" + dateFrom + "' and date_time <= '" + dateTo + "'";
            }
            else
            {
                sqlSearch += " and date_time >= '" + dateFrom + "'";
            }
            sqlSearch += " order by date_time desc";
            DataTable dt = new DataTable();

            tfSql.sqlDataAdapterFillDatatable(sqlSearch, ref dt);

            dgv_NG.DataSource = dt;

            /*
             *          dgv.Columns["machine"].HeaderText = "Machine";
             *          dgv.Columns["ng1"].HeaderText = "NG1";
             *          dgv.Columns["ng2"].HeaderText = "NG2";
             *          dgv.Columns["ng3"].HeaderText = "NG3";
             *          dgv.Columns["ng4"].HeaderText = "NG4";
             *          dgv.Columns["ng5"].HeaderText = "NG5";
             *          dgv.Columns["ng6"].HeaderText = "NG6";
             *          dgv.Columns["ng7"].HeaderText = "NG7";
             *          dgv.Columns["ng8"].HeaderText = "NG8";
             */
            dgv_NG.Columns["date_time"].HeaderText = "Date Time";

            if (dgv_NG.RowCount > 0)
            {
                int tong = 0;
                for (int i = 0; i < dgv_NG.RowCount; i++)
                {
                    for (int j = 1; j < dgv_NG.ColumnCount; j++)
                    {
                        if (dgv_NG.Rows[i].Cells[j].Value.ToString() == "1")
                        {
                            tong++;
                        }
                    }
                }
                txt_ng.Text = (tong).ToString();
            }
            ShowChartNG();
        }
Пример #2
0
        public void loadDGV(bool s_date, string dateFrom, string dateTo)
        {
            TfSQL  tfSql     = new TfSQL();
            string sqlSearch = "select * from adruino where 1=1 ";

            if (s_date)
            {
                sqlSearch += " and date_time >= '" + dateFrom + "' and date_time <= '" + dateTo + "'";
            }
            else
            {
                sqlSearch += " and date_time >= '" + dateFrom + "'";
            }
            sqlSearch += " order by date_time desc";
            DataTable dt = new DataTable();

            tfSql.sqlDataAdapterFillDatatable(sqlSearch, ref dt);

            dgv.DataSource = dt;

            dgv.Columns["machine"].HeaderText   = "Machine";
            dgv.Columns["data_"].HeaderText     = "Data";
            dgv.Columns["date_time"].HeaderText = "Date Time";

            if (dgv.RowCount > 0)
            {
                int tong = 0;
                for (int i = 0; i < dgv.RowCount; i++)
                {
                    if (dgv.Rows[i].Cells["data_"].Value.ToString() == "1")
                    {
                        tong++;
                    }
                }
                txtQty.Text = (tong * 6).ToString();
            }
            ShowChartOutput();
        }