protected void btnToIVM043_Click(object sender, EventArgs e) { //儲區、儲格起、儲格迄 string strLOCATE_NO = this.SLP_CodeFile1.Text.Trim(); string strLOCATE_SECTION_S = this.ddlS.Text.Trim(); string strLOCATE_SECTION_E = this.ddlE.Text.Trim(); //V_LOCATE_SECTION_S //V_LOCATE_SECTION_E //V_STOCK_DATE //V_TAKEUSER_ID //V_CREATEUID //D_CREATEDATE BCO.IVM043_BCO bco = new BCO.IVM043_BCO(ConntionDB); ParameterList.Clear(); ParameterList.Add(strLOCATE_NO + strLOCATE_SECTION_S); ParameterList.Add(strLOCATE_NO + strLOCATE_SECTION_E); ParameterList.Add(DateTime.Now.ToString("yyyy/MM/dd")); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(DateTime.Now); string strSTOCKTAKE_NO; string N_ID; bco.CreateStockTake(ParameterList, out strSTOCKTAKE_NO, out N_ID); Response.Redirect("IVM043.aspx?Code=IVM04&ID=" + N_ID); }
protected void btnIVM043_Click(object sender, EventArgs e) { ViewState["ddlS"] = this.ddlS.SelectedIndex > 0 ? this.ddlS.SelectedIndex : 0; ViewState["ddlE"] = this.ddlE.SelectedIndex > 0 ? this.ddlE.SelectedIndex : 0; //儲區、儲格起、儲格迄 string strLOCATE_NO = this.SLP_CodeFile1.Text.Trim(); string strLOCATE_SECTION_S = this.ddlS.Text.Trim(); string strLOCATE_SECTION_E = this.ddlE.Text.Trim(); if (strLOCATE_NO == "") { ErrorMsgLabel.Text = "儲區欄位必填"; return; } if ((strLOCATE_SECTION_S == "") || (strLOCATE_SECTION_E == "")) { ErrorMsgLabel.Text = "儲格起迄欄位必填"; return; } BCO.IVM043_BCO bco = new BCO.IVM043_BCO(ConntionDB); ParameterList.Clear(); ParameterList.Add(strLOCATE_NO + strLOCATE_SECTION_S); ParameterList.Add(strLOCATE_NO + strLOCATE_SECTION_E); string strMsg; string strResult; bco.CheckStockTakeItem(ParameterList, out strMsg, out strResult); if (strMsg != "") ScriptManager.RegisterStartupScript(Page, this.GetType(), "IVM041.aspx", "alert('" + strMsg + "');", true); else ScriptManager.RegisterStartupScript(Page, this.GetType(), "IVM041.aspx", "ConfirmToIVM043();", true); }
public static string SetItemPeriodOnBlur(string strItem, string strPeriod, string strLOCATE_NO, string strLOCATE_SECTION, string strSTOCKTAKE_NO, string strItemName_CID, string strONHD_QTY_CID, string strErrMsg1_CID, string strErrMsg2_CID) { string rtnValue = string.Empty; string strErrMsg1 = string.Empty; string strErrMsg2 = string.Empty; string strONHD_QTY = "0"; string strItemName = string.Empty; IVMModel.IVM043_BCO BCO = new IVMModel.IVM043_BCO(ConntionDB); if (strItem != "") { DataTable dtItem = BCO.CheckItem(strItem); if (dtItem.Rows.Count > 0) { strItemName = dtItem.Rows[0]["ITEM_NAME"].ToString(); if (strPeriod != "") { DataTable dtPeriod = BCO.CheckPeriod(strItem, strPeriod); if (dtPeriod.Rows.Count > 0) { ParameterList.Clear(); ParameterList.Add(strSTOCKTAKE_NO); ParameterList.Add(strLOCATE_NO); ParameterList.Add(strLOCATE_SECTION); ParameterList.Add(strItem); ParameterList.Add(strPeriod); DataTable dt = BCO.CheckDETL(ParameterList); if (dt.Rows.Count > 0) { strONHD_QTY = dt.Rows[0]["onhd_qty"].ToString(); } } else { strErrMsg2 = "期別不存在"; } } } else { strErrMsg1 = "品號不存在"; } } rtnValue = strErrMsg1_CID + ";" + strErrMsg1 + ";" + strErrMsg2_CID + ";" + strErrMsg2 + ";" + strItemName_CID + ";" + strItemName + ";" + strONHD_QTY_CID + ";" + strONHD_QTY; return rtnValue; }
public static string SetLOCATE_SECTIONOnBlur(string strItem, string strPeriod, string strLOCATE_NO, string strLOCATE_SECTION, string strSTOCKTAKE_NO, string strONHD_QTY_CID) { string rtnValue = string.Empty; string strONHD_QTY = "0"; IVMModel.IVM043_BCO BCO = new IVMModel.IVM043_BCO(ConntionDB); if ((strItem != "") && (strPeriod != "") && (strSTOCKTAKE_NO != "") && (strLOCATE_SECTION != "")) { ParameterList.Clear(); ParameterList.Add(strSTOCKTAKE_NO); ParameterList.Add(strLOCATE_NO); ParameterList.Add(strLOCATE_SECTION); ParameterList.Add(strItem); ParameterList.Add(strPeriod); DataTable dt = BCO.CheckDETL(ParameterList); if (dt.Rows.Count > 0) { strONHD_QTY = dt.Rows[0]["onhd_qty"].ToString(); } } rtnValue = strONHD_QTY_CID + ";" + strONHD_QTY; return rtnValue; }
private void SaveData() { try { SaveDT(); IVMModel.IVM043_BCO BCO = new IVMModel.IVM043_BCO(ConntionDB); DataTable dt = (DataTable)Session["IVM043_DTL_" + PageTimeStamp.Value]; int iRow = 1; string strErrMsg = string.Empty; foreach (DataRow dr in dt.Rows) { if (!( ( (dr["LOCATE_SECTION"].ToString().Trim() == "") && (dr["ITEM"].ToString().Trim() == "") && (dr["PERIOD"].ToString().Trim() == "") && ((dr["STOCKTAKE_QTY"].ToString().Trim() == "") || (dr["STOCKTAKE_QTY"].ToString().Trim() == "0")) ) || ( (dr["LOCATE_SECTION"].ToString().Trim() != "") && (dr["ITEM"].ToString().Trim() != "") && (dr["PERIOD"].ToString().Trim() != "") && (dr["STOCKTAKE_QTY"].ToString().Trim() != "") ) )) { if (strErrMsg != "") strErrMsg += "<br />"; strErrMsg += "第 " + iRow.ToString() + " 列資料輸入不完整"; } else { if (dr["ITEM"].ToString().Trim() != "") { DataTable dtItem = BCO.CheckItem(dr["ITEM"].ToString().Trim()); if (dtItem.Rows.Count > 0) { if (dr["PERIOD"].ToString().Trim() != "") { DataTable dtPeriod = BCO.CheckPeriod(dr["ITEM"].ToString().Trim(), dr["PERIOD"].ToString().Trim()); if (dtPeriod.Rows.Count == 0) { if (strErrMsg != "") strErrMsg += "<br />"; strErrMsg += "第 " + iRow.ToString() + " 列 期別不存在"; } } } else { if (strErrMsg != "") strErrMsg += "<br />"; strErrMsg += "第 " + iRow.ToString() + " 列 品號不存在"; } } if ((dr["LOCATE_SECTION"].ToString().Trim() != "") && (dr["ITEM"].ToString().Trim() != "") && (dr["PERIOD"].ToString().Trim() != "")) { //檢查實盤數請輸入大於零 if (int.Parse(dr["STOCKTAKE_QTY"].ToString().Trim()) <= 0) { if (strErrMsg != "") strErrMsg += "<br />"; strErrMsg += "第 " + iRow.ToString() + " 列 實盤數請輸入大於零的整數"; } for (int i = 0; i < dt.Rows.Count; i++) { if (i != iRow - 1) { if ((dr["LOCATE_SECTION"].ToString().Trim() == dt.Rows[i]["LOCATE_SECTION"].ToString().Trim()) && (dr["ITEM"].ToString().Trim() == dt.Rows[i]["ITEM"].ToString().Trim()) && (dr["PERIOD"].ToString().Trim() == dt.Rows[i]["PERIOD"].ToString().Trim())) { if (strErrMsg != "") strErrMsg += "<br />"; strErrMsg += "第 " + iRow.ToString() + " 列與第 " + (i + 1) + " 列 資料重複"; break; } } } } } iRow++; //dr["ITEM_NAME"].ToString() //1.檢查品號是否存 //2.期別是否存在 //3.實盤數只能輸入數字,最多6碼 } if (strErrMsg != "") { ErrorMsgLabel.Text = strErrMsg; GridView1.DataSource = dt; GridView1.DataBind(); return; } DataView dv = dt.DefaultView; dv.RowFilter = "ITEM<>''"; DataTable dtData = dv.ToTable(); if (dtData.Rows.Count > 0) { ParameterList.Clear(); ParameterList.Add(lblStockTakeNo.Text); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(hdfPID.Value); BCO.SaveData(dtData, ParameterList); } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), Guid.NewGuid().ToString(), "setTimeout(function(){alert('儲存完成');location.href='IVM041.aspx?Code=IVM04';},1);", true); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } }