예제 #1
0
        // サブプロシージャ:上限・下限、行セット・列セット、コマンド、の設定
        private void setLimitSetAndCommand(ref DataTable dt)
        {
            dt.Clear();
            string sql = "select upper, lower, clm_set, row_set, instrument from tbl_measure_item_2 " +
                         "where model = '" + txtModel.Text + "' and " +
                         "inspect = '" + txtInspect.Text + "'";

            System.Diagnostics.Debug.Print(sql);
            TfSQL tf = new TfSQL();

            tf.sqlDataAdapterFillDatatable(sql, ref dt);

            upp         = (double)dt.Rows[0]["upper"];
            txtUsl.Text = upp.ToString();
            low         = (double)dt.Rows[0]["lower"];
            txtLsl.Text = low.ToString();
            rowSet      = (int)dt.Rows[0]["row_set"];
            clmSet      = (int)dt.Rows[0]["clm_set"];
            if (dt.Rows[0]["instrument"].ToString() == "push")
            {
                command = push;
            }
            else if (dt.Rows[0]["instrument"].ToString() == "pull")
            {
                command = pull;
            }
        }
예제 #2
0
        // サブプロシージャ:データグリットビューの更新
        public void updateDataGripViews(ref DataGridView dgv, bool load)
        {
            dtInspectItems.Clear();
            string model = cmbModel.Text;
            string sql   = "select no, model, process, inspect, description, instrument from tbl_measure_item_2 where model='"
                           + model + "' order by no, process, inspect";

            System.Diagnostics.Debug.Print(sql);
            TfSQL tf = new TfSQL();

            tf.sqlDataAdapterFillDatatable(sql, ref dtInspectItems);

            // データグリットビューへDTAATABLEを格納
            dgv.DataSource = dtInspectItems;

            // グリットビュー右端にボタンを追加
            addButtonsToDataGridView(dgv);

            // 列幅の調整
            //dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            dgv.Columns["no"].Width          = 50;
            dgv.Columns["model"].Width       = 100;
            dgv.Columns["process"].Width     = 50;
            dgv.Columns["inspect"].Width     = 100;
            dgv.Columns["description"].Width = 600;
            dgv.Columns["instrument"].Width  = 80;
        }
예제 #3
0
        // サブプロシージャ:DBからのDTHISTORYへの読み込み
        private void readDtHistory(ref DataTable dt)
        {
            dt.Clear();

            string   model   = txtModel.Text;
            string   process = txtProcess.Text;
            string   inspect = txtInspect.Text;
            DateTime lotFrom = dtpLotFrom.Value;
            DateTime lotTo   = dtpLotTo.Value;
            string   line    = txtLine.Text;

            string sql = "select inspect, lot, inspectdate, line, qc_user, " +
                         "m1, m2, m3, m4, m5, x, r FROM tbl_measure_history " +
                         "WHERE model = '" + model + "' AND " +
                         "process = '" + process + "' AND " +
                         "inspect = '" + inspect + "' AND " +
                         "lot >= '" + lotFrom.ToString() + "' AND " +
                         "lot <= '" + lotTo.ToString() + "' AND " +
                         "line = '" + line + "' " +
                         "order by lot, inspectdate";

            System.Diagnostics.Debug.Print(sql);
            TfSQL tf = new TfSQL();

            tf.sqlDataAdapterFillDatatable(sql, ref dt);
        }
예제 #4
0
        // 既存測定値の修正
        private void dgvHistory_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int curRow = int.Parse(e.RowIndex.ToString());

            if (dgvHistory.Columns[e.ColumnIndex] == Open && curRow >= 0)
            {
                // 編集モードフラグを立て、登録・修正ボタンを「修正」の表示にする
                editMode            = true;
                btnRegister.Text    = "Update";
                dtpLotInput.Enabled = false;

                // 新規登録用バッファーテーブル、バッファーグリットビューを初期化し、ボタンに対応する値を格納する
                dtBuffer.Clear();

                string sql = "select inspect, lot, inspectdate, line, qc_user, " +
                             "m1, m2, m3, m4, m5 FROM tbl_measure_history WHERE " +
                             "model = '" + txtModel.Text + "' AND " +
                             "inspect = '" + dgvHistory["inspect", curRow].Value.ToString() + "' AND " +
                             "lot = '" + (DateTime)dgvHistory["lot", curRow].Value + "' AND " +
                             "inspectdate = '" + (DateTime)dgvHistory["inspectdate", curRow].Value + "' AND " +
                             "line = '" + dgvHistory["line", curRow].Value.ToString() + "' " +
                             "order by qc_user";
                System.Diagnostics.Debug.Print(sql);
                TfSQL tf = new TfSQL();
                tf.sqlDataAdapterFillDatatable(sql, ref dtBuffer);

                // グリットビューの更新
                updateDataGripViews(dtBuffer, dtHistory, ref dgvBuffer, ref dgvHistory);

                // 新規登録用グリットビュー(バッファテーブル)へ、ボタンを追加する
                if (dgvBuffer.Columns.Count <= 12)
                {
                    addButtonsToDgvBuffer(dgvBuffer, edit1, edit2, edit3, edit4, edit5);
                }

                // 変更ターゲット行を表示する
                if (dgvHistory.Rows.Count >= 1)
                {
                    dgvHistory.FirstDisplayedScrollingRowIndex = curRow;
                }

                // サブプロシージャ:編集中の行をマーキングする
                colorViewForEdit(ref dgvHistory, curRow);
                colorViewForEdit(ref dgvBuffer, 0);
            }
        }
예제 #5
0
        // サブサブプロシージャ:グリットビュー右端にボタンを追加
        private void addButtonsToDataGridView(DataGridView dgv)
        {
            dtLine.Clear();
            string model = cmbModel.Text;
            string sql   = "select line FROM tbl_model_line where model='" + model + "' order by line";

            System.Diagnostics.Debug.Print(sql);
            TfSQL tf = new TfSQL();

            tf.sqlDataAdapterFillDatatable(sql, ref dtLine);

            if (dtLine.Rows.Count == 0)
            {
                return;
            }

            if (line1 != null)
            {
                dgv.Columns.Remove(line1);
                line1 = null;
            }

            if (line2 != null)
            {
                dgv.Columns.Remove(line2);
                line2 = null;
            }

            if (line3 != null)
            {
                dgv.Columns.Remove(line3);
                line3 = null;
            }

            if (dtLine.Rows.Count >= 1)
            {
                line1      = new DataGridViewButtonColumn();
                line1.Name = "line";
                line1.Text = dtLine.Rows[0]["line"].ToString();
                line1.UseColumnTextForButtonValue = true;
                line1.Width = 45;
                dgv.Columns.Add(line1);
            }

            if (dtLine.Rows.Count >= 2)
            {
                line2      = new DataGridViewButtonColumn();
                line2.Name = "line";
                line2.Text = dtLine.Rows[1]["line"].ToString();
                line2.UseColumnTextForButtonValue = true;
                line2.Width = 45;
                dgv.Columns.Add(line2);
            }

            if (dtLine.Rows.Count >= 3)
            {
                line3      = new DataGridViewButtonColumn();
                line3.Name = "line";
                line3.Text = dtLine.Rows[2]["line"].ToString();
                line3.UseColumnTextForButtonValue = true;
                line3.Width = 45;
                dgv.Columns.Add(line3);
            }
        }