Beispiel #1
0
        ///<summary>
        ///addTanaoroshi
        ///テキストボックス内のデータをDBに登録
        ///作成者:大河内
        ///作成日:2017/3/10
        ///更新者:大河内
        ///更新日:2017/3/22
        ///カラム論理名
        ///</summary>
        private void addTanaoroshi()
        {
            if (blnDataCheckAdd() != true)
            {
                return;
            }

            TanaorosiInput_B tanaorosiinputB = new TanaorosiInput_B();

            tanaorosiinputB.addTanaoroshi(txtYMD.Text, txtEigyousyo.Text, txtShouhinCD.Text, txtTanasuu.Text, txtTanabanEdit.Text);

            setViewGrid();

            txtTanasuu.Text        = "";
            txtTanabanEdit.Text    = "";
            lblDspTanabanEdit.Text = "";
            txtChubunruiEdit.Text  = "";
            lblDspChubunEdit.Text  = "";
            txtMakerEdit.Text      = "";
            lblDspMakerEdit.Text   = "";
            lblDspShouhin.Text     = "";

            //MessageBox.Show("正常に登録されました。", "登録", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            txtEigyousyo.Focus();
        }
Beispiel #2
0
        private void TanaorosiInput_Load(object sender, EventArgs e)
        {
            //delText();

            this.Show();
            this._Title = "棚卸入力";
            // フォームでもキーイベントを受け取る
            this.KeyPreview = true;

            radioButton4.Checked = true;

            lblDspEigyousyo.TextAlign   = ContentAlignment.MiddleLeft;
            lblDspDaibunrui.TextAlign   = ContentAlignment.MiddleLeft;
            lblDspChubunrui.TextAlign   = ContentAlignment.MiddleLeft;
            lblDspMaker.TextAlign       = ContentAlignment.MiddleLeft;
            lblDspTanaban.TextAlign     = ContentAlignment.MiddleLeft;
            lblDspShouhin.TextAlign     = ContentAlignment.MiddleLeft;
            lblDspTanabanEdit.TextAlign = ContentAlignment.MiddleLeft;
            lblDspChubunEdit.TextAlign  = ContentAlignment.MiddleLeft;
            lblDspMakerEdit.TextAlign   = ContentAlignment.MiddleLeft;
            txtTanasuu.TextAlign        = HorizontalAlignment.Right;
            txtTyoubosuu.TextAlign      = HorizontalAlignment.Right;

            //DataGridViewの初期設定
            dgvSetUp();

            //SQLのインスタンス作成
            DBConnective dbconnective = new DBConnective();

            DataTable dtYMD = new DataTable();

            //処理部に移動
            TanaorosiInput_B tanaorosiinputB = new TanaorosiInput_B();

            dtYMD = tanaorosiinputB.setYMD();

            string strYMD = dtYMD.Rows[0]["最新棚卸年月日"].ToString();

            txtYMD.Text = strYMD.Substring(0, 10);

            this.txtYMD.ReadOnly = true;
            this.txtYMD.Enabled  = false;

            this.txtTyoubosuu.Enabled = false;

            this.btnF01.Text = STR_FUNC_F1;
            this.btnF04.Text = STR_FUNC_F4;
            this.btnF12.Text = STR_FUNC_F12;
        }
Beispiel #3
0
        ///<summary>
        ///setSelectItem
        ///データグリッドビューの処理
        ///作成者:大河内
        ///作成日:2017/3/15
        ///更新者:大河内
        ///更新日:2017/4/7
        ///カラム論理名
        ///</summary>
        private void setSelectItem()
        {
            //データ渡し用
            List <string> lstString = new List <string>();

            DataTable dtSelect = null;

            //選択行の商品コード取得
            string strSelectSyouhinCD = (string)dgvRireki.CurrentRow.Cells["商品コード"].Value;

            //データ渡し用
            lstString.Add(txtYMD.Text);
            lstString.Add(strSelectSyouhinCD);

            //処理部に移動
            TanaorosiInput_B tanaorosiinputB = new TanaorosiInput_B();

            //戻り値のDatatableを取り込む
            dtSelect = tanaorosiinputB.setSelectItem(lstString);

            //各ラベル,テキストボックスに記入
            txtShouhinCD.Text     = strSelectSyouhinCD;
            txtChubunruiEdit.Text = dtSelect.Rows[0]["中分類コード"].ToString();
            txtTanabanEdit.Text   = dtSelect.Rows[0]["棚番"].ToString();
            txtMakerEdit.Text     = dtSelect.Rows[0]["メーカーコード"].ToString();
            lblDspShouhin.Text    = dtSelect.Rows[0]["品名型番"].ToString();


            //文字列をDecimal型に変換、小数点以下を削除
            decimal decElemTanasu = Math.Floor(decimal.Parse(dtSelect.Rows[0]["棚卸数量"].ToString()));
            decimal decElemShitei = Math.Floor(decimal.Parse(dtSelect.Rows[0]["指定日在庫"].ToString()));

            //各テキストボックスに記入
            txtTanasuu.Text   = decElemTanasu.ToString();
            txtTyoubosuu.Text = decElemShitei.ToString();

            txtTanabanEdit.Focus();
            txtChubunruiEdit.Focus();
            txtMakerEdit.Focus();
            txtKensaku.Focus();
            txtTanasuu.Focus();
        }
Beispiel #4
0
        ///<summary>
        ///setViewGrid
        ///Gridを表示させる
        ///作成者:大河内
        ///作成日:2017/3/10
        ///更新者:大河内
        ///更新日:2017/4/6
        ///カラム論理名
        ///</summary>
        private void setViewGrid()
        {
            //データ渡し用
            List <string> lstString = new List <string>();

            strDaibunruiCD = null;

            strDaibunruiCD = txtDaibunrui.Text;

            DataTable dtView = new DataTable();

            dgvRireki.Enabled = true;

            string strBtnJud = "0";

            if (radioButton1.Checked == true)
            {
                strBtnJud = "1";
            }
            else if (radioButton2.Checked == true)
            {
                strBtnJud = "2";
            }
            else if (radioButton3.Checked == true)
            {
                strBtnJud = "3";
            }
            else if (radioButton4.Checked == true)
            {
                strBtnJud = "4";
            }

            //データ渡し用
            lstString.Add(txtYMD.Text);
            lstString.Add(txtEigyousyo.Text);
            lstString.Add(txtDaibunrui.Text);
            lstString.Add(txtChubunrui.Text);
            lstString.Add(txtMaker.Text);
            lstString.Add(txtTanaban.Text);
            lstString.Add(strBtnJud);

            //処理部に移動
            TanaorosiInput_B tanaorosiinputB = new TanaorosiInput_B();

            //戻り値のDatatableを取り込む
            dtView = tanaorosiinputB.setViewGrid(lstString);

            //指定日在庫、棚卸数量の小数点切り下げ
            for (int cnt = 0; cnt < dtView.Rows.Count; cnt++)
            {
                decimal decTyoubosuu = Math.Floor(decimal.Parse(dtView.Rows[cnt]["棚卸数量"].ToString()));
                dtView.Rows[cnt]["棚卸数量"] = decTyoubosuu.ToString();
                decimal decTanasuu = Math.Floor(decimal.Parse(dtView.Rows[cnt]["指定日在庫"].ToString()));
                dtView.Rows[cnt]["指定日在庫"] = decTanasuu.ToString();
            }

            dgvRireki.DataSource = dtView;

            if (dgvRireki.RowCount > 0)
            {
                dgvRireki.Focus();
            }
            else
            {
                btnViewGrid.Focus();
            }
            lblRecords.Text = "該当件数:" + dgvRireki.RowCount.ToString();

            txtShouhinCD.Text = "";

            txtTanasuu.Text        = "";
            txtTanabanEdit.Text    = "";
            lblDspTanabanEdit.Text = "";

            blnEditting = false;
        }
Beispiel #5
0
        ///<summary>
        ///txtGridViewLieave
        ///code入力箇所からフォーカスが外れた時(Grid表示関係)
        ///作成者:大河内
        ///作成日:2017/3/14
        ///更新者:大河内
        ///更新日:2017/4/6
        ///カラム論理名
        ///</summary>
        private void txtGridViewLieave(object sender, EventArgs e, int intDBjud)
        {
            //データ渡し用
            List <string> lstString = new List <string>();

            //初期化
            strSQL = "";

            //SQL出力後のデータテーブル
            DataTable dtSetData = null;

            //フォーカス時に空白の場合そのままスルー
            if (txtEigyousyo.Text == "" && intDBjud == 1)
            {
                return;
            }
            else if (txtDaibunrui.Text == "" && intDBjud == 2)
            {
                return;
            }
            else if (txtChubunrui.Text == "" && intDBjud == 3)
            {
                return;
            }
            else if (txtMaker.Text == "" && intDBjud == 4)
            {
                return;
            }
            else if (txtTanaban.Text == "" && intDBjud == 5)
            {
                return;
            }
            else if (txtChubunruiEdit.Text == "" && intDBjud == 6)
            {
                return;
            }
            else if (txtMakerEdit.Text == "" && intDBjud == 7)
            {
                return;
            }
            else if (txtTanabanEdit.Text == "" && intDBjud == 8)
            {
                return;
            }

            //データ渡し用
            lstString.Add(txtEigyousyo.Text);
            lstString.Add(txtDaibunrui.Text);
            lstString.Add(txtChubunrui.Text);
            lstString.Add(txtMaker.Text);
            lstString.Add(txtTanaban.Text);
            lstString.Add(txtChubunruiEdit.Text);
            lstString.Add(txtMakerEdit.Text);
            lstString.Add(txtTanabanEdit.Text);

            //処理部に移動
            TanaorosiInput_B tanaorosiinputB = new TanaorosiInput_B();

            //戻り値のDatatableを取り込む
            dtSetData = tanaorosiinputB.txtGridViewLieave(intDBjud, lstString);

            if (dtSetData.Rows.Count != 0)
            {
                switch (intDBjud)
                {
                case 1:    //営業所
                    txtEigyousyo.Text    = dtSetData.Rows[0]["営業所コード"].ToString();
                    lblDspEigyousyo.Text = dtSetData.Rows[0]["営業所名"].ToString();
                    txtDaibunrui.Focus();
                    break;

                case 2:    //大分類
                    txtDaibunrui.Text    = dtSetData.Rows[0]["大分類コード"].ToString();
                    lblDspDaibunrui.Text = dtSetData.Rows[0]["大分類名"].ToString();
                    txtChubunrui.Focus();
                    break;

                case 3:    //中分類
                    txtChubunrui.Text    = dtSetData.Rows[0]["中分類コード"].ToString();
                    lblDspChubunrui.Text = dtSetData.Rows[0]["中分類名"].ToString();
                    txtMaker.Focus();
                    break;

                case 4:    //メーカー
                    txtMaker.Text    = dtSetData.Rows[0]["メーカーコード"].ToString();
                    lblDspMaker.Text = dtSetData.Rows[0]["メーカー名"].ToString();
                    txtTanaban.Focus();
                    break;

                case 5:    //棚番
                    txtTanaban.Text    = dtSetData.Rows[0]["棚番"].ToString();
                    lblDspTanaban.Text = dtSetData.Rows[0]["棚番名"].ToString();
                    txtKensaku.Focus();
                    break;

                case 6:    //編集中分類
                    txtChubunruiEdit.Text = dtSetData.Rows[0]["中分類コード"].ToString();
                    lblDspChubunEdit.Text = dtSetData.Rows[0]["中分類名"].ToString();
                    txtMakerEdit.Focus();
                    break;

                case 7:    //編集メーカー
                    txtMakerEdit.Text    = dtSetData.Rows[0]["メーカーコード"].ToString();
                    lblDspMakerEdit.Text = dtSetData.Rows[0]["メーカー名"].ToString();
                    btnF01.Focus();
                    break;

                case 8:    //編集棚番
                    txtTanabanEdit.Text    = dtSetData.Rows[0]["棚番"].ToString();
                    lblDspTanabanEdit.Text = dtSetData.Rows[0]["棚番名"].ToString();
                    txtChubunruiEdit.Focus();
                    break;

                default:
                    return;
                }
                //初期化
                intDBjud = 0;
                //SendKeys.Send("{TAB}");
            }
            else
            {
                switch (intDBjud)
                {
                case 1:    //営業所
                    lblDspEigyousyo.Text = "";
                    txtEigyousyo.Focus();
                    break;

                case 2:    //大分類
                    lblDspDaibunrui.Text = "";
                    txtDaibunrui.Focus();
                    break;

                case 3:    //中分類
                    lblDspChubunrui.Text = "";
                    txtChubunrui.Focus();
                    break;

                case 4:    //メーカー
                    lblDspMaker.Text = "";
                    txtMaker.Focus();
                    break;

                case 5:    //棚番
                    lblDspTanaban.Text = "";
                    return;

                case 6:    //編集中分類
                    lblDspChubunEdit.Text = "";
                    txtChubunruiEdit.Focus();
                    break;

                case 7:    //編集メーカー
                    lblDspMakerEdit.Text = "";
                    txtMakerEdit.Focus();
                    break;

                case 8:    //編集棚番
                    lblDspTanabanEdit.Text = "";
                    txtTanabanEdit.Focus();
                    break;

                default:
                    return;
                }

                MessageBox.Show("入力された文字列が正しくありません。", "入力項目", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }