/// <summary> /// 計算鈕 /// </summary> protected void btnCalculate_Click(object sender, EventArgs e) { ErrorMsgLabel.Text = ""; //檢核門市進貨日是否己出庫 if (SLP_StAcceptDate.Text.Trim() != "") { if (VerifyALOOutNo() == false) return; } if (SLP_SKU1.Text.Trim() == "" && txtSLP_Gift.Text.Trim() == "") { //ErrorMsgLabel.Text = "品號或虛擬品號須擇一輸入"; ErrorMsgLabel.Text = "品號或虛擬品號須擇一輸入"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD071.aspx", "alert(' 品號或虛擬品號須擇一輸入 ');", true); return; } //檢核品項是否存在門市進貨主檔 if ((SLP_SKU1.Text.Trim() != "" || txtSLP_Gift.Text.Trim() != "") && SLP_Period.Text.Trim() != "") { if (CheckAloItemS() == false) return; } if (VerifyFormData() == true) { try { ErrorMsgLabel.Text = ""; string SessionIDName = "CGD071_" + PageTimeStamp.Value; CGDModel.ProcessDeliverBatchAdj BCO = new CGDModel.ProcessDeliverBatchAdj(ConntionDB); DataTable Dt; ParameterList.Clear(); ParameterList.Add(SLP_StAcceptDate.Text.Trim()); ParameterList.Add(SLP_StoreChain1.Text.Trim()); ParameterList.Add(ddlTypeNo.SelectedValue.Trim()); ParameterList.Add(SLP_Route1.Text.Trim()); ParameterList.Add(txtStep_Start.Text.Trim()); ParameterList.Add(txtStep_End.Text.Trim()); ParameterList.Add(SLP_SKU1.Text.Trim()); ParameterList.Add(SLP_Period.Text.Trim()); ParameterList.Add(txtSLP_Gift.Text.Trim()); Dt = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.GetAloItemSumQty, ParameterList); if (Dt.Rows.Count == 0) { ErrorMsgLabel.Text = "查無資料"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD071.aspx", "alert(' 查無資料 ');", true); return; } else { txtCount.Value = Dt.Rows[0][0].ToString(); } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } } }
/// <summary> /// 檢核品項是否存在門市進貨主檔 /// </summary> private bool CheckAloItemS() { try { ErrorMsgLabel.Text = ""; string CheckErr; string SessionIDName = "CGD071_" + PageTimeStamp.Value; CGDModel.ProcessDeliverBatchAdj BCO = new CGDModel.ProcessDeliverBatchAdj(ConntionDB); DataTable Dt; ParameterList.Clear(); ParameterList.Add(SLP_StAcceptDate.Text.Trim()); ParameterList.Add(SLP_StoreChain1.Text.Trim()); ParameterList.Add(ddlTypeNo.SelectedValue.Trim()); ParameterList.Add(SLP_Route1.Text.Trim()); ParameterList.Add(txtStep_Start.Text.Trim()); ParameterList.Add(txtStep_End.Text.Trim()); ParameterList.Add(SLP_SKU1.Text.Trim()); ParameterList.Add(SLP_Period.Text.Trim()); ParameterList.Add(txtSLP_Gift.Text.Trim()); //Dt = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.CheckAloItem, ParameterList); CheckErr = BCO.CheckAloItem(ParameterList); if (CheckErr == String.Empty || CheckErr == null) //if (Dt.Rows.Count == 0) { ErrorMsgLabel.Text = "門市進貨日的通路或路線無此品號或虛擬品號的期別"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD071.aspx", "alert(' 門市進貨日的通路或路線無此品號或虛擬品號的期別 ');", true); return false; } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; return false; } return true; }
/// <summary> /// 執行鈕 /// </summary> protected void btnQuery_Click(object sender, EventArgs e) { //檢核門市進貨日是否己出庫 if (SLP_StAcceptDate.Text.Trim() != "") { if (VerifyALOOutNo() == false) return; } if (txtStore_Qty.Text.Trim() == "" || Convert.ToInt32(txtStore_Qty.Text.Trim()) < 0) { ErrorMsgLabel.Text = "單店數量不可為空值或小於0"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD071.aspx", "alert('單店數量不可為空值或小於0 ');", true); return; } //檢核品項是否存在門市進貨主檔 if ((SLP_SKU1.Text.Trim() != "" || txtSLP_Gift.Text.Trim() != "") && SLP_Period.Text.Trim() != "") { if (CheckAloItemS() == false) return; } if (VerifyFormData() == true ) { try { ErrorMsgLabel.Text = ""; string SessionIDName = "CGD071_" + PageTimeStamp.Value; int Store_Qty = 0; int rtn = 0; CGDModel.ProcessDeliverBatchAdj BCO = new CGDModel.ProcessDeliverBatchAdj(ConntionDB); ParameterList.Clear(); ParameterList.Add(SLP_StAcceptDate.Text.Trim()); ParameterList.Add(SLP_StoreChain1.Text.Trim()); ParameterList.Add(ddlTypeNo.SelectedValue.Trim()); ParameterList.Add(SLP_Route1.Text.Trim()); ParameterList.Add(txtStep_Start.Text.Trim()); ParameterList.Add(txtStep_End.Text.Trim()); ParameterList.Add(SLP_SKU1.Text.Trim()); ParameterList.Add(SLP_Period.Text.Trim()); ParameterList.Add(txtSLP_Gift.Text.Trim()); if (txtStore_Qty.Text.Trim() != "") { Store_Qty = Convert.ToInt32(txtStore_Qty.Text.Trim()); ParameterList.Add(Store_Qty); } //else //{ // ParameterList.Add(Store_Qty); //} ParameterList.Add(Session["UID"].ToString().Trim()); rtn = BCO.UpdateAloItemQty(ParameterList); ErrorMsgLabel.Text = "執行成功"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD071.aspx", "alert(' 執行成功 ');", true); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } } }