Пример #1
0
        // 登録済みのパレットに対し、選択されたカートンを削除する
        private void btnDeleteCarton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtBefore.Text))
            {
                return;
            }

            string mdlBefore = txtBefore.Text;
            string sql       = "update t_carton set pallet_id = null where carton_id = '" + mdlBefore + "'";

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

            if (res)
            {
                //親フォームfrmTrayのデータグリットビューを更新するため、デレゲートイベントを発生させる
                this.RefreshEvent(this, new EventArgs());
                btnReplaceCarton.Enabled = false;
                btnDeleteCarton.Enabled  = false;
                btnAddCarton.Enabled     = false;
                txtAfter.Enabled         = false;
                // txtRow.Text = string.Empty;
                this.Focus();
                MessageBox.Show("The deletion was successful." + Environment.NewLine +
                                "Please re-print the pallet label.", "Process Result", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
            }
        }
Пример #2
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);
            }
        }
Пример #3
0
        // サブプロシージャ:トレー情報の更新
        private bool updateTrayId(string trayId, string udept, string uname)
        {
            // モジュール数量、複数ロット区分、更新日、更新部署、更新ユーザーについて更新する
            int    qty      = (int)dtLot.Rows[0]["total"];
            string multiLot = dtLot.Columns.Count >= 3 ? "T" : "F";
            string sql      = "update t_tray set " +
                              "qty ='" + qty + "', " +
                              "update_date ='" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "', " +
                              "up_dept ='" + udept + "', " +
                              "up_user ='******', " +
                              "multi_lot ='" + multiLot + "' " +
                              "where tray_id ='" + trayId + "'";

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

            return(res);
        }
Пример #4
0
        // サブプロシージャ:パレット情報の更新
        private bool updatePalletId(string PalletId, string uname)
        {
            // ロット数量、更新日、更新ユーザーについて更新する
            string lot   = dtLot.Columns[0].ColumnName;
            int    count = dtLot.Columns.Count - 1;
            int    m_qty = (int)dtLot.Rows[0]["total"];
            string sql   = "update t_pallet set " +
                           "lot ='" + lot + "', " +
                           "l_cnt = " + count + ", " +
                           "m_qty = " + m_qty + ", " +
                           "batch = '" + txtBatch.Text + "', " +
                           "register_date ='" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "', " +
                           "rg_user ='******' " +
                           "where pallet_id ='" + PalletId + "'";

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

            return(res);
        }
Пример #5
0
        // 一時テーブルの選択された複数レコードを、一括消去させる
        private void btnDeleteSelection_Click(object sender, EventArgs e)
        {
            if (dtModule.Rows.Count <= 0)
            {
                return;
            }

            // セルの選択範囲が2列以上の場合は、メッセージの表示のみでプロシージャを抜ける
            if (dgvModule.Columns.GetColumnCount(DataGridViewElementStates.Selected) >= 2)
            {
                MessageBox.Show("Please select range with only one column.", "Notice",  MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                return;
            }

            // 部分キャンセルモードでない時は、通常処理(モジュールデータテーブルの選択行削除)
            if (!formPartialCancelMode)
            {
                DialogResult result = MessageBox.Show("Do you really want to delete the selected rows?", "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.No)
                {
                    return;
                }

                foreach (DataGridViewCell cell in dgvModule.SelectedCells)
                {
                    dtModule.Rows[cell.RowIndex].Delete();
                }
                dtModule.AcceptChanges();
                updateDataGridViews(dtModule, ref dgvModule);
                txtModuleId.Focus();
                txtModuleId.SelectAll();
            }

            // 部分キャンセルモードの時は、DBモジュールテーブルの行削除
            else if (formPartialCancelMode)
            {
                if (dgvModule.SelectedCells.Count == dtModule.Rows.Count)
                {
                    MessageBox.Show("If you wish to delete all modules, please cancel the tray.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                    return;
                }

                DialogResult result = MessageBox.Show("Do you really want to delete the selected rows?", "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.No)
                {
                    return;
                }

                btnDeleteSelection.Enabled = false;
                string sql1 = "delete from t_module where module_id in ('";
                string sql2 = string.Empty;
                foreach (DataGridViewCell cell in dgvModule.SelectedCells)
                {
                    sql2 += dtModule.Rows[cell.RowIndex]["module_id"].ToString() + "','";
                    dtModule.Rows[cell.RowIndex].Delete();
                }
                string sql3 = sql1 + VBS.Left(sql2, sql2.Length - 2) + ")";
                TfSQL  tf   = new TfSQL();
                bool   res  = tf.sqlExecuteNonQuery(sql3, false);

                if (res)
                {
                    dtModule.AcceptChanges();
                    updateDataGridViews(dtModule, ref dgvModule);

                    string updateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                    string sql4       = "update t_tray set update_date = '" + updateTime + "', up_dept = '" + txtLoginDept.Text + "', " +
                                        "up_user = '******', lot = '" + dtLot.Columns[0].ColumnName + "', " +
                                        "qty = '" + dtLot.Rows[0]["total"].ToString() + "', multi_lot = '" + (dtLot.Columns.Count >= 3 ? "T" : "F") + "' " +
                                        "where tray_id = '" + txtTrayId.Text + "'";
                    System.Diagnostics.Debug.Print(sql4);
                    tf.sqlExecuteNonQuery(sql4, false);

                    //親フォームfrmTrayのデータグリットビューを更新するため、デレゲートイベントを発生させる
                    this.RefreshEvent(this, new EventArgs());
                    this.Focus();
                    MessageBox.Show("Partial cancel was successful.", "Result", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                }
                else
                {
                    MessageBox.Show("Partial cancel failed.", "Result", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                }
            }
        }