Beispiel #1
0
        // 登録済みのシリアルおよびその付帯情報を、UPDATE文で置き換える
        private void btnReplace_Click(object sender, EventArgs e)
        {
            if (dtModule.Rows.Count <= 0)
            {
                return;                           //if (testerNg || dtModule.Rows.Count <= 0)
            }
            if (!txtRow.Text.Equals("1"))
            {
                MessageBox.Show("Please check module-id status.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                return;
            }

            string mdlBefore = txtBefore.Text;
            string mdlAfter  = dtModule.Rows[0]["module_id"].ToString();

            // 重複確認処理を行う
            TfSQL  tf          = new TfSQL();
            string dbDuplicate = tf.sqlModuleDuplicateCheck(dtModule);

            if (dbDuplicate != string.Empty)
            {
                for (int i = 0; i < dgvModule.Rows.Count; ++i)
                {
                    if (dgvModule["module_id", i].Value.ToString() == dbDuplicate)
                    {
                        dgvModule["module_id", i].Style.BackColor = Color.Red;
                    }
                }
                // soundAlarm();
                btnReplace.Enabled = false;
                return;
            }

            // 更新処理
            string sql = "update t_module set " +
                         "module_id ='" + (string)dtModule.Rows[0]["module_id"].ToString() + "', " +
                         "lot ='" + dtModule.Rows[0]["lot"].ToString() + "', " +
                         "tester_id ='" + dtModule.Rows[0]["tester_id"].ToString() + "', " +
                         "test_result ='" + dtModule.Rows[0]["test_result"].ToString() + "', " +
                         "test_date ='" + dtModule.Rows[0]["test_date"].ToString() + "', " +
                         "r_mode ='" + dtModule.Rows[0]["r_mode"].ToString() + "' " +
                         "where module_id = '" + mdlBefore + "' and tray_id ='" + trayId + "'";

            System.Diagnostics.Debug.Print(sql);
            bool res = tf.sqlExecuteNonQuery(sql, false);

            if (res)
            {
                //親フォームfrmTrayのデータグリットビューを更新するため、デレゲートイベントを発生させる
                this.RefreshEvent(this, new EventArgs());
                btnReplace.Enabled = false;
                txtAfter.Enabled   = false;
                txtRow.Text        = string.Empty;
                this.Focus();
                MessageBox.Show("The replacement was successful.", "Process Result", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
            }
        }
Beispiel #2
0
        // 登録ボタン押下時、各種確認、ボックスIDの発行、シリアルの登録、バーコードラベルのプリントを行う
        private void btnRegisterTray_Click(object sender, EventArgs e)
        {
            if (cmbBinShift.Text == string.Empty)
            {
                MessageBox.Show("Please select Shift.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                return;
            }
            if (getOkCount(dtModule) != dtModule.Rows.Count)
            {
                MessageBox.Show("Module is not 24.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            // 登録処理中は、閉じるボタンを除き、すべてのコントロールを無効にする
            cmbBinShift.Enabled        = false;
            txtModuleId.Enabled        = false;
            btnRegisterTray.Enabled    = false;
            btnDeleteSelection.Enabled = false;
            btnChangeCapacity.Enabled  = false;

            if (formRefillMode && countBeforeRefill >= dtModule.Rows.Count)
            {
                MessageBox.Show("Refill is not correct.  Please close this window.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                return;
            }

            //一時テーブルのシリアル全てについて、DBテーブルに既に登録がないか、確認する
            //(REFILLモードの場合は、追加分のモジュールのみ確認する)
            DataTable dtTarget = new DataTable();

            if (formRefillMode)
            {
                dtTarget = subtractTable(dtModule, dtModuleBeforeRefill);
            }
            else
            {
                dtTarget = dtModule;
            }

            TfSQL  tf          = new TfSQL();
            string dbDuplicate = tf.sqlModuleDuplicateCheck(dtTarget);

            if (dbDuplicate != string.Empty)
            {
                for (int i = 0; i < dgvModule.Rows.Count; ++i)
                {
                    if (dgvModule["module_id", i].Value.ToString() == dbDuplicate)
                    {
                        dgvModule["module_id", i].Style.BackColor = Color.Red;
                    }
                }
                soundAlarm();

                // REFILLモードの場合は、閉じる以外の選択肢を与えない
                if (!formRefillMode)
                {
                    btnDeleteSelection.Enabled = true;
                }
                return;
            }

            // 充填モードか否かで、呼び出すプロシージャを選択して実行する
            if (!formRefillMode)
            {
                registerModuleNormalMode();
            }
            else
            {
                registerModuleRefillMode();
            }
        }