//顯示GridView1 private void ShowGrid(string chain_no, string store, string boxcorde, out string msg) { string pick_no = "";//理貨單號 CGDModel.ProcessPickQualityCheck BCO = new CGDModel.ProcessPickQualityCheck(ConntionDB); DataTable Dt = null; ParameterList.Clear(); ParameterList.Add(SLP_StAcceptDate.Text.Trim());//門市進貨日 ParameterList.Add(txtPickBatch.Text.Trim());//理貨批次 ParameterList.Add(chain_no);//通路 ParameterList.Add(store);//門市 ParameterList.Add(boxcorde);//箱號 string errMsg = "", checkBatch = ""; msg = ""; Dt = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.GetStoreInfo, ParameterList, out errMsg); if (errMsg.Length == 0) { if (Dt.Rows.Count == 0) { ErrorMsgLabel.Text = "查無該箱條碼相關資料"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD231.aspx", "alert(' 查無該箱條碼相關資料 ');", true); msg = "查無該箱條碼相關資料"; txtItemBarcode.CssClass = "readtxtbox"; txtItemBarcode.Enabled = false; clearTxtBox1(); if (txtBoxBarcode.Text.Length > 0) { SetClinetFocus(txtBoxBarcode.ClientID); } else { SetClinetFocus(txtBoxNumber.ClientID); } return; } else //依理貨單號擷取單號的所以品項 { SLP_ChanNo.Text = Dt.Rows[0]["CHAN_NO"].ToString(); SLP_Store.Text = Dt.Rows[0]["STORE"].ToString(); txtRoute.Text = Dt.Rows[0]["ROUTE"].ToString(); txtStep.Text = Dt.Rows[0]["STEP"].ToString(); pick_no = Dt.Rows[0]["PICK_NO"].ToString();//理貨單號 txtGoodsWeigth.Text = Dt.Rows[0]["GOODS_WEIGTH"].ToString(); ViewState["PICK_NO"] = Dt.Rows[0]["PICK_NO"].ToString(); //txtPickNo.Text = Dt.Rows[0]["PICK_NO"].ToString(); //先取得檢核批次 ParameterList.Clear(); ParameterList.Add(SLP_StAcceptDate.Text.Trim());//門市進貨日 ParameterList.Add(txtPickBatch.Text.Trim());//理貨批次 ParameterList.Add(txtBoxNumber.Text.Trim());//箱號 checkBatch = BCO.StQuerySwitch(CGDModel.CGDCommon.QueryType.GetCheckBatch, ParameterList, out errMsg); //取得其餘GRID上所需資料 Dt = null; ParameterList.Clear(); ParameterList.Add(pick_no);//門市進貨日 ParameterList.Add(checkBatch);//檢核批次,直接帶給SQL值 Dt = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.GetStoreBoxItem, ParameterList, out errMsg); if (errMsg.Length != 0) { ErrorMsgLabel.Text = "查無該理貨單貨單號的品項資料"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD231.aspx", "alert(' 查無該理貨單貨單號的品項資料 ');", true); msg = "查無該理貨單貨單號的品項資料"; DataTable DtNull = null; GridView1.DataSource = DtNull; GridView1.DataBind(); if (txtBoxBarcode.Text.Length > 0) { SetClinetFocus(txtBoxBarcode.ClientID); } else { SetClinetFocus(txtBoxNumber.ClientID); } return; } else { string SessionIDName = "CGD231_" + PageTimeStamp.Value; Session[SessionIDName] = Dt; GridView1.Visible = true; GridView1.DataSource = Dt; //設定分頁大小 GridView1.PageIndex = 0; GridView1.DataBind(); btnEndBox.Enabled = true; btnEndCheck.Enabled = false; //使用XML放置到前端資料 //xmlVDS_CGD_PICK_ITEM.InnerHtml = Dt.DataSet.GetXml(); } txtItemBarcode.CssClass = ""; txtItemBarcode.Enabled = true; SetClinetFocus(txtItemBarcode.ClientID); } } else { ErrorMsgLabel.Text = "查無該箱條碼相關資料"; //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD231.aspx", "alert(' 查無該箱條碼相關資料 ');", true); msg = "查無該箱條碼相關資料"; txtItemBarcode.CssClass = "readtxtbox"; txtItemBarcode.Enabled = false; clearTxtBox1(); if (txtBoxBarcode.Text.Length > 0) { SetClinetFocus(txtBoxBarcode.ClientID); } else { SetClinetFocus(txtBoxNumber.ClientID); } return; } }