///<summary>
        ///setSelectItem
        ///データグリッドビューの処理
        ///</summary>
        private void setSelectItem()
        {
            //データ渡し用
            List <string> lstString = new List <string>();

            DataTable dtSelect = null;

            //グリッドにデータがない場合
            if (gridRireki.Rows.Count < 1)
            {
                return;
            }

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

            //データ渡し用
            lstString.Add(txtYMD.Text);
            lstString.Add(strSelectSyouhinCD);
            lstString.Add((string)gridRireki.CurrentRow.Cells["営業所コード"].Value);

            try
            {
                //処理部に移動
                F0140_TanaorosiInput_B tanaorosiinputB = new F0140_TanaorosiInput_B();
                //戻り値のDatatableを取り込む
                dtSelect = tanaorosiinputB.setSelectItem(lstString);

                //存在チェック
                if (dtSelect.Rows.Count > 0)
                {
                    //各ラベル,テキストボックスに記入
                    txtShouhinCD.Text = strSelectSyouhinCD;
                    labelSet_Daibunrui_Edit.CodeTxtText = dtSelect.Rows[0]["大分類コード"].ToString();
                    labelSet_Daibunrui_Edit.chkTxtDaibunrui();
                    labelSet_Chubunrui_Edit.CodeTxtText = dtSelect.Rows[0]["中分類コード"].ToString();
                    labelSet_Chubunrui_Edit.chkTxtChubunrui(labelSet_Daibunrui_Edit.CodeTxtText);
                    labelSet_Tanaban_Edit.CodeTxtText = dtSelect.Rows[0]["棚番"].ToString();
                    labelSet_Maker_Edit.CodeTxtText   = dtSelect.Rows[0]["メーカーコード"].ToString();
                    lblDspShouhin.Text = dtSelect.Rows[0]["品名型番"].ToString();
                    txtBiko.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();


                    gRowIndex = gridRireki.CurrentCell.RowIndex;



                    txtTanasuu.Focus();
                }
            }
            catch (Exception ex)
            {
                //データロギング
                new CommonException(ex);
                //例外発生メッセージ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                return;
            }
        }
        ///<summary>
        ///setViewGrid
        ///Gridを表示させる
        ///</summary>
        private void setViewGrid()
        {
            //データ渡し用
            List <string> lstString = new List <string>();

            strDaibunruiCD = null;

            strDaibunruiCD = labelSet_Daibunrui.CodeTxtText;

            DataTable dtView = new DataTable();

            gridRireki.Enabled = true;

            string strBtnJud = "0";

            if (radBase1.Checked == true)
            {
                strBtnJud = "1";
            }
            else if (radBase2.Checked == true)
            {
                strBtnJud = "2";
            }
            else if (radBase3.Checked == true)
            {
                strBtnJud = "3";
            }
            else if (radBase4.Checked == true)
            {
                strBtnJud = "4";
            }

            //データ渡し用
            lstString.Add(txtYMD.Text);
            lstString.Add(labelSet_Eigyousho.CodeTxtText);
            lstString.Add(labelSet_Daibunrui.CodeTxtText);
            lstString.Add(labelSet_Chubunrui.CodeTxtText);
            lstString.Add(labelSet_Maker.CodeTxtText);
            lstString.Add(labelSet_Tanaban.CodeTxtText);
            lstString.Add(strBtnJud);

            try
            {
                //処理部に移動
                F0140_TanaorosiInput_B tanaorosiinputB = new F0140_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();
                }

                gridRireki.DataSource = dtView;

                if (gridRireki.RowCount > 0)
                {
                    gridRireki.Focus();
                    gridRireki.CurrentCell = gridRireki[0, gRowIndex];
                }
                else
                {
                    btnViewGrid.Focus();
                }
                lblRecords.Text = "該当件数:" + gridRireki.RowCount.ToString();

                txtShouhinCD.Text = "";

                txtTanasuu.Text = "";
                labelSet_Tanaban_Edit.CodeTxtText    = "";
                labelSet_Tanaban_Edit.ValueLabelText = "";
                blnEditting = false;
            }
            catch (Exception ex)
            {
                //データロギング
                new CommonException(ex);
                //例外発生メッセージ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                return;
            }
        }
        ///<summary>
        ///TanaorosiInput_Load
        ///棚卸入力(初回読み込み)
        ///</summary>
        private void TanaorosiInput_Load(object sender, EventArgs e)
        {
            this.Show();
            this._Title = "棚卸入力";
            // フォームでもキーイベントを受け取る
            this.KeyPreview = true;

            radBase4.Checked = true;

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

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

            DataTable dtYMD = new DataTable();

            try
            {
                //処理部に移動
                F0140_TanaorosiInput_B tanaorosiinputB = new F0140_TanaorosiInput_B();
                dtYMD = tanaorosiinputB.setYMD();

                if (dtYMD.Rows.Count != 0)
                {
                    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;

                    //閲覧権限がある場合
                    if (("1").Equals(etsuranFlg))
                    {
                        this.btnF05.Text    = "F5:更新";
                        this.btnF05.Enabled = true;
                    }
                    else
                    {
                        this.btnF05.Enabled = false;
                    }

                    this.btnF12.Text = STR_FUNC_F12;
                }
                else
                {
                    //メッセージボックスの処理、項目のデータがない場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent, CommonTeisu.TEXT_VIEW, CommonTeisu.LABEL_NOTDATA, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                new CommonException(ex);
            }
        }
        ///<summary>
        ///addTanaorosi
        ///テキストボックス内のデータをDBに登録
        ///</summary>
        private void addTanaorosi()
        {
            if (blnAddDataCheck() != true)
            {
                return;
            }

            //データ渡し用
            List <string> lstString = new List <string>();

            //データ渡し用
            lstString.Add(txtYMD.Text);
            lstString.Add(labelSet_Eigyousho.CodeTxtText);
            lstString.Add(txtShouhinCD.Text);
            lstString.Add(txtTanasuu.Text);
            lstString.Add(labelSet_Tanaban_Edit.CodeTxtText);
            lstString.Add(txtBiko.Text);

            DBConnective con = null;

            KATO.Business.A0010_JuchuInput.A0010_JuchuInput_B juchuB = new KATO.Business.A0010_JuchuInput.A0010_JuchuInput_B();

            con = new DBConnective();

            try
            {
                F0140_TanaorosiInput_B tanaorosiinputB = new F0140_TanaorosiInput_B();
                tanaorosiinputB.addTanaoroshi(lstString);

                con.BeginTrans();
                juchuB.updZaiko(txtShouhinCD.Text, labelSet_Eigyousho.CodeTxtText, txtYMD.Text, Environment.UserName, con);
                con.Commit();

                //特定の値確保
                string strYMD      = txtYMD.Text;
                string strDibunCd  = labelSet_Daibunrui.CodeTxtText;
                string strChubunCd = labelSet_Chubunrui.CodeTxtText;
                string strEigyoCd  = labelSet_Eigyousho.CodeTxtText;
                string strMakerCd  = labelSet_Maker.CodeTxtText;
                string strTanaban  = labelSet_Tanaban.CodeTxtText;

                //画面内削除
                delFormClear(this, gridRireki);

                //確保した値を元に戻す
                txtYMD.Text = strYMD;
                labelSet_Daibunrui.CodeTxtText = strDibunCd;
                labelSet_Chubunrui.CodeTxtText = strChubunCd;
                labelSet_Eigyousho.CodeTxtText = strEigyoCd;
                labelSet_Maker.CodeTxtText     = strMakerCd;
                labelSet_Tanaban.CodeTxtText   = strTanaban;

                setViewGrid();

                //各ラベルセットのLeave処理
                if (labelSet_Daibunrui.chkTxtDaibunrui())
                {
                    return;
                }

                if (labelSet_Chubunrui.chkTxtChubunrui(labelSet_Daibunrui.CodeTxtText))
                {
                    return;
                }

                if (labelSet_Eigyousho.chkTxtEigyousho())
                {
                    return;
                }

                if (labelSet_Maker.chkTxtMaker())
                {
                    return;
                }

                if (labelSet_Tanaban.chkTxtTanaban())
                {
                    return;
                }

                txtTyoubosuu.Text = "0";

                //メッセージボックスの処理、登録完了のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_TOUROKU, CommonTeisu.LABEL_TOUROKU, CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                basemessagebox.ShowDialog();

                txtKensaku.Focus();
            }
            catch (Exception ex)
            {
                if (con != null)
                {
                    con.Rollback();
                }
                //データロギング
                new CommonException(ex);
                //例外発生メッセージ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                return;
            }
        }
        /// <summary>
        /// updKoshin
        /// 更新実行
        /// </summary>
        private void updKoshin()
        {
            // 空文字判定(伝票年月日)
            if (txtYMD.blIsEmpty() == false)
            {
                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "項目が空です。日付を入力してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                txtYMD.Focus();
                return;
            }

            // 日付フォーマットチェック
            string datedata = txtYMD.chkDateDataFormat(txtYMD.Text);

            if ("".Equals(datedata))
            {
                // メッセージボックスの処理
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_DATE_ALERT, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                return;
            }
            else
            {
                txtYMD.Text = datedata;
            }

            // ビジネス層のインスタンス生成
            F0140_TanaorosiInput_B tanaorosiinputB = new F0140_TanaorosiInput_B();

            try
            {
                //待機状態
                Cursor.Current = Cursors.WaitCursor;

                // 表示中の棚卸年月日の棚卸データの取得、判定
                int intJud = tanaorosiinputB.judTanaData(txtYMD.Text);

                //元に戻す
                Cursor.Current = Cursors.Default;

                //本社棚卸データがない場合
                if (intJud == 1)
                {
                    // メッセージボックスの処理、追加成功の場合のウィンドウ(OK)
                    BaseMessageBox basemessageboxHon = new BaseMessageBox(this, CommonTeisu.TEXT_TOUROKU, "本社の棚卸データがありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                    basemessageboxHon.ShowDialog();
                }
                //岐阜棚卸データがない場合
                else if (intJud == 2)
                {
                    // メッセージボックスの処理、追加成功の場合のウィンドウ(OK)
                    BaseMessageBox basemessageboxHon = new BaseMessageBox(this, CommonTeisu.TEXT_TOUROKU, "岐阜の棚卸データがありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                    basemessageboxHon.ShowDialog();
                }
                else
                {
                    // メッセージボックスの処理、の場合のウィンドウ(YES,NO)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_DEL, "指定した年月日の棚卸データを更新します。" + "\r\n" + "よろしいですか?", CommonTeisu.BTN_YESNO, CommonTeisu.DIAG_QUESTION);

                    // NOが押された場合
                    if (basemessagebox.ShowDialog() == DialogResult.No)
                    {
                        return;
                    }

                    //待機状態
                    Cursor.Current = Cursors.WaitCursor;

                    // 表示中の棚卸年月日を追加処理
                    tanaorosiinputB.updTanaData(txtYMD.Text, SystemInformation.UserName);

                    // メッセージボックスの処理、追加成功の場合のウィンドウ(OK)
                    basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_TOUROKU, CommonTeisu.LABEL_TOUROKU, CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                    basemessagebox.ShowDialog();

                    //元に戻す
                    Cursor.Current = Cursors.Default;

                    //初期化
                    delText();
                }
            }
            catch (Exception ex)
            {
                //元に戻す
                Cursor.Current = Cursors.Default;

                // エラーロギング
                new CommonException(ex);

                //例外発生メッセージ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
            }
            return;
        }
        ///<summary>
        ///updTxtKensakuLeave
        //検索ウィンドウか別テキストボックスに移動
        ///</summary>
        public void updTxtKensakuLeave(object sender, EventArgs e)
        {
            if (txtKensaku.TextLength > 0)
            {
                ShouhinList shouhinlist = new ShouhinList(this);
                try
                {
                    //検索項目に一つでも記入がある場合
                    if (labelSet_Daibunrui.codeTxt.blIsEmpty() == false &&
                        labelSet_Chubunrui.codeTxt.blIsEmpty() == false &&
                        labelSet_Maker.codeTxt.blIsEmpty() == false &&
                        txtKensaku.blIsEmpty() == false)
                    {
                        shouhinlist.blKensaku = false;
                    }
                    else
                    {
                        shouhinlist.blKensaku = true;
                    }

                    shouhinlist.intFrmKind       = CommonTeisu.FRM_TANAOROSHI;
                    shouhinlist.strYMD           = txtYMD.Text;
                    shouhinlist.strEigyoushoCode = labelSet_Eigyousho.CodeTxtText;
                    shouhinlist.lsDaibunrui      = labelSet_Daibunrui_Edit;
                    shouhinlist.lsChubunrui      = labelSet_Chubunrui_Edit;
                    shouhinlist.lsMaker          = labelSet_Maker_Edit;


                    //shouhinlist.lsDaibunrui.CodeTxtText = "";
                    //shouhinlist.lsChubunrui.CodeTxtText = "";
                    //shouhinlist.lsMaker.CodeTxtText = "";



                    shouhinlist.btxtKensaku         = txtKensaku;
                    shouhinlist.blKensaku           = true;
                    shouhinlist.lblGrayHinChuHinban = lblDspShouhin;
                    shouhinlist.btxtShohinCd        = txtShouhinCD;

                    //営業所が本社の場合
                    if (labelSet_Eigyousho.CodeTxtText == "0001")
                    {
                        shouhinlist.lsTanabanH = labelSet_Tanaban_Edit;
                    }
                    //営業所が岐阜の場合
                    else if (labelSet_Eigyousho.CodeTxtText == "0002")
                    {
                        shouhinlist.lsTanabanG = labelSet_Tanaban_Edit;
                    }

                    shouhinlist.ShowDialog();

                    //商品コードがある場合
                    if (txtShouhinCD.blIsEmpty())
                    {
                        //データ渡し用
                        List <string> lstString = new List <string>();

                        DataTable dtSelect = null;

                        //データ渡し用
                        lstString.Add(txtYMD.Text);
                        lstString.Add(txtShouhinCD.Text);
                        lstString.Add(labelSet_Eigyousho.CodeTxtText);

                        //処理部に移動
                        F0140_TanaorosiInput_B tanaorosiinputB = new F0140_TanaorosiInput_B();
                        //戻り値のDatatableを取り込む
                        dtSelect = tanaorosiinputB.setSelectItem(lstString);

                        //存在チェック
                        if (dtSelect.Rows.Count > 0)
                        {
                            //各ラベル,テキストボックスに記入
                            labelSet_Daibunrui_Edit.CodeTxtText = dtSelect.Rows[0]["大分類コード"].ToString();
                            labelSet_Daibunrui_Edit.chkTxtDaibunrui();
                            labelSet_Chubunrui_Edit.CodeTxtText = dtSelect.Rows[0]["中分類コード"].ToString();
                            labelSet_Chubunrui_Edit.chkTxtChubunrui(labelSet_Daibunrui_Edit.CodeTxtText);
                            labelSet_Tanaban_Edit.CodeTxtText = dtSelect.Rows[0]["棚番"].ToString();
                            labelSet_Maker_Edit.CodeTxtText   = dtSelect.Rows[0]["メーカーコード"].ToString();
                            lblDspShouhin.Text = dtSelect.Rows[0]["品名型番"].ToString();
                            txtBiko.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();

                            txtTanasuu.Focus();
                        }
                    }
                }
                catch (Exception ex)
                {
                    //データロギング
                    new CommonException(ex);
                    //例外発生メッセージ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();
                    return;
                }
            }
        }