Esempio n. 1
0
        ///<summary>
        ///chkInput
        ///入力データチェック
        ///</summary>
        ///
        public bool chkInput(string denNo, bool hathuFlg)
        {
            // 品名のない行は登録対象外
            if (string.IsNullOrWhiteSpace(txtHinban.Text))
            {
                return(true);
            }

            if (!string.IsNullOrWhiteSpace(txtShohin.Text))
            {
                // 大分類
                if (string.IsNullOrWhiteSpace(lsDaibun.CodeTxtText))
                {
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_EXCLAMATION);
                    basemessagebox.ShowDialog();
                    this.lsDaibun.codeTxt.Focus();
                    return(false);
                }

                // 中分類
                if (string.IsNullOrWhiteSpace(lsChubun.CodeTxtText))
                {
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_EXCLAMATION);
                    basemessagebox.ShowDialog();
                    this.lsChubun.codeTxt.Focus();
                    return(false);
                }

                // メーカー
                if (string.IsNullOrWhiteSpace(lsMaker.CodeTxtText))
                {
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_EXCLAMATION);
                    basemessagebox.ShowDialog();
                    this.lsMaker.codeTxt.Focus();
                    return(false);
                }
            }

            // 数量
            if (string.IsNullOrWhiteSpace(txtSuryo.Text))
            {
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_EXCLAMATION);
                basemessagebox.ShowDialog();
                this.txtSuryo.Focus();
                return(false);
            }

            // 単価
            if (string.IsNullOrWhiteSpace(txtTanka.Text))
            {
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_EXCLAMATION);
                basemessagebox.ShowDialog();
                this.txtTanka.Focus();
                return(false);
            }

            if (!hathuFlg)
            {
                // 出庫倉庫
                if (string.IsNullOrWhiteSpace(lsSouko.CodeTxtText))
                {
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_EXCLAMATION);
                    basemessagebox.ShowDialog();
                    this.lsSouko.codeTxt.Focus();
                    return(false);
                }
            }
            else
            {
                // 納期
                if (string.IsNullOrWhiteSpace(txtNoki.Text))
                {
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_EXCLAMATION);
                    basemessagebox.ShowDialog();
                    this.txtNoki.Focus();
                    return(false);
                }
            }

            // 在庫チェック(支給品(出庫)のみ)
            if (!hathuFlg && string.IsNullOrWhiteSpace(txtShohin.Text))
            {
                return(true);
            }
            if (!hathuFlg && !(txtShohin.Text).Equals("88888") && !(lsDaibun.CodeTxtText).Equals("28"))
            {
                A0110_KakohinTehaiInput_B bis = new A0110_KakohinTehaiInput_B();

                try
                {
                    DataTable dt = bis.getZaiko(lsSouko.CodeTxtText, txtShohin.Text);

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        decimal su = 0;
                        if (dt.Rows[0]["フリー在庫数"] != null && dt.Rows[0]["フリー在庫数"] != DBNull.Value)
                        {
                            su = decimal.Parse(dt.Rows[0]["フリー在庫数"].ToString());
                        }

                        // 更新の場合は出庫数も換算する
                        if (!string.IsNullOrWhiteSpace(denNo))
                        {
                            su = su + bis.getShukko(lsSouko.CodeTxtText, txtNo.Text);
                        }

                        if (su.CompareTo(decimal.Parse(txtSuryo.Text)) < 0)
                        {
                            BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "フリー在庫数を超えています。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_EXCLAMATION);
                            basemessagebox.ShowDialog();
                            this.txtSuryo.Focus();
                            return(false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            return(true);
        }