///<summary> ///削除 ///</summary> private void delInput() { if (string.IsNullOrWhiteSpace(txtDenNo.Text)) { return; } BaseMessageBox bb = new BaseMessageBox(this, CommonTeisu.TEXT_TOUROKU, "表示中の伝票を削除します。\r\nよろしいですか?", CommonTeisu.BTN_YESNO, CommonTeisu.DIAG_QUESTION); if (bb.ShowDialog() != DialogResult.Yes) { return; } try { A0110_KakohinTehaiInput_B bis = new A0110_KakohinTehaiInput_B(); bis.delData(txtDenNo.Text, Environment.UserName); //メッセージボックスの処理、登録完了のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_TOUROKU, CommonTeisu.LABEL_DEL_AFTER, CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION); basemessagebox.ShowDialog(); clearInput(); } catch (Exception ex) { // エラーロギング new CommonException(ex); // メッセージボックスの処理、削除失敗の場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); } }
///<summary> ///初期値の設定 ///</summary> private void setDefalut() { txtYMD.Text = DateTime.Today.ToString("yyyy/MM/dd"); txtDenNo.Text = ""; lsTorihikisaki.CodeTxtText = ""; lsTorihikisaki.ValueLabelText = ""; txtEigyo.Text = ""; DataTable dtTantoshaCd = new DataTable(); A0110_KakohinTehaiInput_B bis = new A0110_KakohinTehaiInput_B(); try { //ログインIDから担当者コードを取り出す dtTantoshaCd = bis.getTantoshaCd(SystemInformation.UserName); //担当者データがある場合 if (dtTantoshaCd.Rows.Count > 0) { //一行目にデータがない場合 if (dtTantoshaCd.Rows[0][0].ToString() == "") { return; } } lsTantosha.CodeTxtText = dtTantoshaCd.Rows[0]["担当者コード"].ToString(); lsTantosha.chkTxtTantosha(); txtEigyo.Text = dtTantoshaCd.Rows[0]["営業所コード"].ToString(); lsTorihikikbn.CodeTxtText = "41"; lsTorihikikbn.chkTxtTorihikikbn(); arr.Clear(); } catch (Exception ex) { // エラーロギング new CommonException(ex); // メッセージボックスの処理、削除失敗の場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "失敗しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); } txtYMD.Focus(); }
private void searchList() { if (string.IsNullOrWhiteSpace(lsShiire.CodeTxtText) && string.IsNullOrWhiteSpace(lsTanto.CodeTxtText) && string.IsNullOrWhiteSpace(txtHinmei.Text)) { BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "担当者か仕入先か型番を指定してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_EXCLAMATION); basemessagebox.ShowDialog(); return; } A0110_KakohinTehaiInput_B bis = new A0110_KakohinTehaiInput_B(); try { DataTable dt = bis.searchList(lsShiire.CodeTxtText, lsTanto.CodeTxtText, txtHinmei.Text); if (dt != null && dt.Rows.Count > 0) { gridShukko.DataSource = dt; lblKensu.Text = "該当件数(" + (dt.Rows.Count).ToString() + "件)"; gridShukko.Focus(); } else { gridShukko.DataSource = ""; lblKensu.Text = "該当件数(0件)"; } } catch (Exception ex) { // エラーロギング new CommonException(ex); // メッセージボックスの処理、削除失敗の場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); } }
///<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); }
///<summary> ///検索 ///</summary> private void search() { lineNo = -1; if (string.IsNullOrWhiteSpace(txtDenNo.Text)) { return; } A0110_KakohinTehaiInput_B bis = new A0110_KakohinTehaiInput_B(); try { string dn = txtDenNo.Text; // 出庫情報取得 DataTable dtH = bis.getDenpyoData(dn); if (dtH == null || dtH.Rows.Count == 0) { BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "入力した伝票番号は見つかりません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_EXCLAMATION); basemessagebox.ShowDialog(); txtDenNo.Focus(); return; } DataTable dtM = bis.getDenpyoMeisai(dn); if (dtM == null || dtM.Rows.Count == 0) { BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "入力した伝票番号は見つかりません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_EXCLAMATION); basemessagebox.ShowDialog(); txtDenNo.Focus(); return; } clearInput(); txtDenNo.Text = dn; txtYMD.Text = getValue(dtH.Rows[0]["伝票年月日"]); lsTorihikisaki.CodeTxtText = getValue(dtH.Rows[0]["仕入先コード"]); lsTorihikisaki.chkTxtTorihikisaki(); lsTorihikikbn.CodeTxtText = getValue(dtH.Rows[0]["取引区分"]); lsTorihikikbn.chkTxtTorihikikbn(); lsTantosha.CodeTxtText = getValue(dtH.Rows[0]["担当者コード"]); lsTantosha.chkTxtTantosha(); txtEigyo.Text = getValue(dtH.Rows[0]["営業所コード"]); int max = MAX_ROW_S; if (dtM.Rows.Count < MAX_ROW_S) { max = dtM.Rows.Count; } for (int i = 0; i < max; i++) { int ln = int.Parse(getValue(dtM.Rows[i]["行番号"])); if (ln > 0) { ln = ln - 1; } InputLineSs[ln].lsDaibun.CodeTxtText = getValue(dtM.Rows[i]["大分類コード"]); InputLineSs[ln].lsDaibun.chkTxtDaibunrui(); InputLineSs[ln].lsChubun.CodeTxtText = getValue(dtM.Rows[i]["中分類コード"]); InputLineSs[ln].lsChubun.chkTxtChubunrui(InputLineSs[i].lsDaibun.CodeTxtText); InputLineSs[ln].lsMaker.CodeTxtText = getValue(dtM.Rows[i]["メーカーコード"]); InputLineSs[ln].lsMaker.chkTxtMaker(); InputLineSs[ln].txtShohin.Text = getValue(dtM.Rows[i]["商品コード"]); InputLineSs[ln].txtC1.Text = getValue(dtM.Rows[i]["C1"]); InputLineSs[ln].txtC2.Text = getValue(dtM.Rows[i]["C2"]); InputLineSs[ln].txtC3.Text = getValue(dtM.Rows[i]["C3"]); InputLineSs[ln].txtC4.Text = getValue(dtM.Rows[i]["C4"]); InputLineSs[ln].txtC5.Text = getValue(dtM.Rows[i]["C5"]); InputLineSs[ln].txtC6.Text = getValue(dtM.Rows[i]["C6"]); string h = InputLineSs[ln].lsChubun.ValueLabelText + " " + InputLineSs[ln].txtC1.Text + " " + InputLineSs[ln].txtC2.Text + " " + InputLineSs[ln].txtC3.Text + " " + InputLineSs[ln].txtC4.Text + " " + InputLineSs[ln].txtC5.Text + " " + InputLineSs[ln].txtC6.Text; InputLineSs[ln].txtHinban.Text = h; InputLineSs[ln].txtSuryo.Text = decimal.Parse(getValue(dtM.Rows[i]["数量"])).ToString("#,0"); InputLineSs[ln].txtTanka.Text = decimal.Parse(getValue(dtM.Rows[i]["単価"])).ToString("#,0.00"); InputLineSs[ln].txtBiko.Text = getValue(dtM.Rows[i]["備考"]); InputLineSs[ln].lsSouko.CodeTxtText = getValue(dtM.Rows[i]["出庫倉庫"]); InputLineSs[ln].lsSouko.chkTxtEigyousho(); } // 発注情報取得 DataTable dtHt = bis.getHatchuData(dn); if (dtHt == null || dtHt.Rows.Count == 0) { InputLineSs[0].lsDaibun.codeTxt.Focus(); return; } max = MAX_ROW_K; if (dtHt.Rows.Count < MAX_ROW_K) { max = dtHt.Rows.Count; } for (int i = 0; i < max; i++) { //int ln = int.Parse(getValue(dtM.Rows[i]["行番号"])) - 1; //if (ln > 0) //{ // ln = ln - 1; //} InputLineKs[i].lsDaibun.CodeTxtText = getValue(dtHt.Rows[i]["大分類コード"]); InputLineKs[i].lsDaibun.chkTxtDaibunrui(); InputLineKs[i].lsChubun.CodeTxtText = getValue(dtHt.Rows[i]["中分類コード"]); InputLineKs[i].lsChubun.chkTxtChubunrui(InputLineKs[i].lsDaibun.CodeTxtText); InputLineKs[i].lsMaker.CodeTxtText = getValue(dtHt.Rows[i]["メーカーコード"]); InputLineKs[i].lsMaker.chkTxtMaker(); InputLineKs[i].txtShohin.Text = getValue(dtHt.Rows[i]["商品コード"]); InputLineKs[i].txtC1.Text = getValue(dtHt.Rows[i]["C1"]); InputLineKs[i].txtC2.Text = getValue(dtHt.Rows[i]["C2"]); InputLineKs[i].txtC3.Text = getValue(dtHt.Rows[i]["C3"]); InputLineKs[i].txtC4.Text = getValue(dtHt.Rows[i]["C4"]); InputLineKs[i].txtC5.Text = getValue(dtHt.Rows[i]["C5"]); InputLineKs[i].txtC6.Text = getValue(dtHt.Rows[i]["C6"]); string h = InputLineKs[i].lsChubun.ValueLabelText + " " + InputLineKs[i].txtC1.Text + " " + InputLineKs[i].txtC2.Text + " " + InputLineKs[i].txtC3.Text + " " + InputLineKs[i].txtC4.Text + " " + InputLineKs[i].txtC5.Text + " " + InputLineKs[i].txtC6.Text; InputLineKs[i].txtHinban.Text = h; InputLineKs[i].txtSuryo.Text = decimal.Parse(getValue(dtHt.Rows[i]["発注数量"])).ToString("#,0"); InputLineKs[i].txtTanka.Text = decimal.Parse(getValue(dtHt.Rows[i]["発注単価"])).ToString("#,0.00"); InputLineKs[i].txtBiko.Text = getValue(dtHt.Rows[i]["注番"]); InputLineKs[i].lsSouko.chkTxtEigyousho(); InputLineKs[i].txtHNo.Text = getValue(dtHt.Rows[i]["発注番号"]); InputLineKs[i].txtNoki.Text = getValue(dtHt.Rows[i]["納期"]); InputLineKs[i].txtShiireMei.Text = getValue(dtHt.Rows[i]["仕入先名称"]); } InputLineSs[0].lsDaibun.codeTxt.Focus(); } catch (Exception ex) { // エラーロギング new CommonException(ex); // メッセージボックスの処理、削除失敗の場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); } }
///<summary> ///登録 ///</summary> private void addInput() { // 入力チェック if (!this.chkInput()) { return; } DBConnective con = new DBConnective(); A0110_KakohinTehaiInput_B bis = new A0110_KakohinTehaiInput_B(); try { bool bShukko = false; int lineCnt = 1; for (int i = 0; i < MAX_ROW_S; i++) { if (!string.IsNullOrWhiteSpace(InputLineSs[i].txtHinban.Text)) { bShukko = true; break; } } string stDenNo = txtDenNo.Text; if (bShukko && string.IsNullOrWhiteSpace(stDenNo)) { stDenNo = bis.getDenpyoNo("出庫伝票"); } con.BeginTrans(); // 出庫登録 #region if (bShukko) { string[] stHead = new string[] { stDenNo, txtYMD.Text, lsTorihikisaki.CodeTxtText, lsTorihikikbn.CodeTxtText, lsTantosha.CodeTxtText, txtEigyo.Text, Environment.UserName, lsTorihikisaki.ValueLabelText }; bis.addShukkoHead(con, stHead); bis.delShukkoMeisai(con, stDenNo); for (int i = 0; i < MAX_ROW_S; i++) { if (!string.IsNullOrWhiteSpace(InputLineSs[i].txtHinban.Text)) { string stDai = InputLineSs[i].lsDaibun.CodeTxtText; string stChu = InputLineSs[i].lsChubun.CodeTxtText; string stMak = InputLineSs[i].lsMaker.CodeTxtText; string stSho = InputLineSs[i].txtShohin.Text; string stC1 = InputLineSs[i].txtC1.Text; // 商品コードが無い場合、雑費扱い if (string.IsNullOrWhiteSpace(stSho)) { stDai = "00"; stChu = "00"; stMak = "0000"; stSho = "88888"; stC1 = InputLineSs[i].txtHinban.Text; } string[] stMeisai = new string[] { stDenNo, //0 num lineCnt.ToString(), //1 num stSho, //2 stMak, //3 stDai, //4 stChu, //5 stC1, //6 InputLineSs[i].txtC2.Text, //7 InputLineSs[i].txtC3.Text, //8 InputLineSs[i].txtC4.Text, //9 InputLineSs[i].txtC5.Text, //10 InputLineSs[i].txtC6.Text, //11 decimal.Parse(InputLineSs[i].txtSuryo.Text).ToString(), //12 num decimal.Parse(InputLineSs[i].txtTanka.Text).ToString(), //13 num InputLineSs[i].txtBiko.Text, //14 InputLineSs[i].lsSouko.CodeTxtText, //15 "0", //16 num txtYMD.Text, //17 Environment.UserName //18 }; bis.addShukkoMeisai(con, stMeisai); lineCnt++; } } } #endregion // 発注登録 #region string stHatchuNo = ""; if (string.IsNullOrWhiteSpace(stDenNo)) { stDenNo = "0"; } for (int i = 0; i < arr.Count; i++) { bis.delHaychu(con, arr[i], Environment.UserName); } lineCnt = 1; for (int i = 0; i < MAX_ROW_K; i++) { stHatchuNo = InputLineKs[i].txtHNo.Text; if (string.IsNullOrWhiteSpace(stHatchuNo)) { stHatchuNo = bis.getDenpyoNo("発注番号"); } if (!string.IsNullOrWhiteSpace(InputLineKs[i].txtHinban.Text)) { string stDai = InputLineKs[i].lsDaibun.CodeTxtText; string stChu = InputLineKs[i].lsChubun.CodeTxtText; string stMak = InputLineKs[i].lsMaker.CodeTxtText; string stSho = InputLineKs[i].txtShohin.Text; string stC1 = InputLineKs[i].txtC1.Text; // 商品コードが無い場合、雑費扱い if (string.IsNullOrWhiteSpace(stSho)) { stDai = "00"; stChu = "00"; stMak = "0000"; stSho = "88888"; stC1 = InputLineKs[i].txtHinban.Text; } string[] stHatchu = new string[] { lsTorihikisaki.CodeTxtText, //0 txtYMD.Text, //1 stHatchuNo, //2 num lsTantosha.CodeTxtText, //3 txtEigyo.Text, //4 lsTantosha.CodeTxtText, //5 "0", //6 num stDenNo, //7 num lineCnt.ToString(), //8 num stSho, //9 stMak, //10 stDai, //11 stChu, //12 stC1, //13 InputLineKs[i].txtC2.Text, //14 InputLineKs[i].txtC3.Text, //15 InputLineKs[i].txtC4.Text, //16 InputLineKs[i].txtC5.Text, //17 InputLineKs[i].txtC6.Text, //18 decimal.Parse(InputLineKs[i].txtSuryo.Text).ToString(), //19 num decimal.Parse(InputLineKs[i].txtTanka.Text).ToString(), //20 num "0", //21 num InputLineKs[i].txtNoki.Text, //22 "0", //23 num InputLineKs[i].txtBiko.Text, //24 "1", //25 num lsTorihikisaki.ValueLabelText, //26 Environment.UserName //27 }; bis.addHatchu(con, stHatchu); lineCnt++; } } #endregion con.Commit(); //メッセージボックスの処理、登録完了のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_TOUROKU, CommonTeisu.LABEL_TOUROKU, CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION); basemessagebox.ShowDialog(); clearInput(); } catch (Exception ex) { con.Rollback(); // エラーロギング new CommonException(ex); // メッセージボックスの処理、削除失敗の場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); } finally { con.DB_Disconnect(); } }