/// <summary> /// 計算數量鈕 /// </summary> protected void btnCount_Click(object sender, EventArgs e) { try { if (chkBatchIsSelect()) { string strMsg = string.Empty; string strResult = string.Empty; DataTable Dt = new DataTable(); DataTable Dt_Error = new DataTable(); PIC.VDS2G.LGT.CGR.MaintainBackWard BCO = new PIC.VDS2G.LGT.CGR.MaintainBackWard(ConntionDB); ParameterList.Clear(); string strBatchNo = GetBatchNo(); if (rdoType.SelectedIndex == 0) //Sorter結轉 { ParameterList.Add(SLP_StoreChain.Text); ParameterList.Add(strBatchNo); ParameterList.Add(Session["UID"].ToString() + PageTimeStamp.Value); Dt = BCO.GetSorterData(ParameterList, out strMsg, out strResult); if (strResult == "0") { if (strMsg == "檢核結果異常" || strMsg == "無可結轉資料") { ParameterList.Clear(); ParameterList.Add(Session["UID"].ToString() + PageTimeStamp.Value); Dt_Error = BCO.GetErrData(ParameterList); PanelError.Visible = true; btnPrint.Visible = false; gvError.Visible = false; //CheckErrorMsg.Text = "檢核結果異常!"; CheckErrorMsg.Text = strMsg; if (strMsg == "檢核結果異常") { PanelError.Visible = true; btnPrint.Visible = true; gvError.Visible = true; BindError(Dt_Error); } } else { ScriptManager.RegisterStartupScript(Page, this.GetType(), "BatchIsClosed", "alert('" + strMsg + "');", true); } } else { if (Dt.Rows.Count > 0) { ViewState["EnableAdjust"] = true; //Bind gvDetail BindDetail(Dt); } //顯示訊息,控制畫面 SetOkStatus(); } } else //通路退貨結轉 { ParameterList.Add(SLP_StoreChain.Text); ParameterList.Add(strBatchNo); Dt = BCO.GetChanRtnData(ParameterList, out strMsg, out strResult); if (strResult == "1") { if (Dt.Rows.Count > 0) { ViewState["EnableAdjust"] = true; //Bind gvDetail BindDetail(Dt); } //顯示訊息,控制畫面 SetOkStatus(); } else { ScriptManager.RegisterStartupScript(Page, this.GetType(), "BatchIsClosed", "alert('" + strMsg + "');", true); } } } else { ScriptManager.RegisterStartupScript(Page, this.GetType(), "chkBatchIsSelect", "alert(' 無批號被選擇 ');", true); } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } }