// 品項載入(續2) private void Item_Load2() { string vPICK_SELECT_1 = "0"; string vPICK_SELECT_2 = "0"; if (this.chkPICK_SELECT_1.Checked == true) //正常品 vPICK_SELECT_1 = "1"; if (this.chkPICK_SELECT_2.Checked == true) //客服查補 vPICK_SELECT_2 = "1"; SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value); string SessionIDName_Pick = "PUR041_Pick" + PageTimeStamp.Value; Session[SessionIDName_Pick] = null; //第一次查詢,為了餵給BCO.InsertMaster Dt資料 ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text, "int", false)); ParameterList.Add(GetValueSetParameter(this.txtPLAN_ACCEPT_DATE.Text, "string", false)); ParameterList.Add(GetValueSetParameter(vPICK_SELECT_1, "int", false)); ParameterList.Add(GetValueSetParameter(vPICK_SELECT_2, "int", false)); ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false)); ParameterList.Add(GetValueSetParameter(DateTime.Now.ToString(), "datetime", false)); PURModel.MaintainPurchaseDeliveryGoods BCO = new PURModel.MaintainPurchaseDeliveryGoods(ConnectionDB); DataTable Dt = BCO.QuerySwitch(PURModel.MaintainPurchaseDeliveryGoods.QueryType.QueryByLOAD, ParameterList); string msg = "", msg1 = "", msg2 = ""; if (getDataType() == "1") { for (int i = 0; i < Dt.Rows.Count; i++) if (ChkDup(Dt.Rows[i]["ST_ACCEPT_DATE"].ToString(), Dt.Rows[i]["VIRTUAL_CODE"].ToString(), Dt.Rows[i]["PERIOD"].ToString(), "2")) { msg1 += "品號:" + Dt.Rows[i]["VIRTUAL_CODE"].ToString() + "、期別:" + Dt.Rows[i]["PERIOD"].ToString() + "<br \\>"; Dt.Rows.Remove(Dt.Rows[i]); } if (msg1 != "") msg1 += "已存在客服查補裏,故未載入<br \\>"; } else if (getDataType() == "2") { for (int i = 0; i < Dt.Rows.Count; i++) if (ChkDup(Dt.Rows[i]["ST_ACCEPT_DATE"].ToString(), Dt.Rows[i]["VIRTUAL_CODE"].ToString(), Dt.Rows[i]["PERIOD"].ToString(), "1")) { msg2 += "品號:" + Dt.Rows[i]["VIRTUAL_CODE"].ToString() + "、期別:" + Dt.Rows[i]["PERIOD"].ToString() + "<br \\>"; Dt.Rows.Remove(Dt.Rows[i]); } if (msg2 != "") msg2 += "已存在正常品裏,故未載入"; } msg = msg1 + msg2; if (msg != "") lblMsg.Text = msg; //2009/9/17 修改流程:「品項載入」後即可經由管制鈕的選擇而ENABLE「通路管制設定」鈕,所以要先Reset該DB的資料 //先全部刪除~再新增 ParameterList.Clear(); ParameterList.Add(this.txtPLAN_ACCEPT_DATE.Text); ParameterList.Add(this.txtPICK_BATCH.Text); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(getDataType()); // 2010/3/8 By Tony 新增資料來源條件:1:正常品 2:客服查補 3:正常品 + 客服查補 DateTime dNow = DateTime.Now; //DeleteAll、InsertMaster、QuerySwitch使用統一的時間 BCO.DeleteAll(ParameterList, null, dNow); BCO.InsertMaster(this.getMasterParameterList(), Dt, null, dNow); //第二次查詢,為了找出BCO.InsertMaster後的Update資訊 string v_PICK_CNT = "0"; string v_RESTRAIN_CNT = "0"; ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text, "int", false)); ParameterList.Add(txtPLAN_ACCEPT_DATE.Text); ParameterList.Add(txtPICK_BATCH.Text); ParameterList.Add(getDataType()); Dt = BCO.QueryPICK_CONTROL(ParameterList); GridView1.DataSource = Dt; Session[SessionIDName] = Dt; #region 將明細資料放至DetailDt中 detailTmpDt = Dt; #endregion //將空白的資料做處理 Dt = ProcessDBNull(Dt); #region 使用XML放置到前端資料 DataSet Ds = Dt.DataSet; DetailOLDData.InnerHtml = Ds.GetXml(); #endregion //設定分頁大小 GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text); GridView1.PageIndex = 0; GridView1.DataBind(); if (Dt == null || (Dt != null && Dt.Rows.Count <= 0)) { LabelQueryRecordCount.Text = ""; this.hid_PICK_CNT.Value = "0"; this.hid_RESTRAIN_CNT.Value = "0"; btnPrint.Visible = false; btnEdit.Visible = false; ErrorMsgLabel.Text = "查無資料"; btnDelItem.Visible = false; //btnImportOnDate.Visible = false; this.hid_PageStatus.Text = "VIEW"; } else { LabelQueryRecordCount.Text = "品項數:理貨品:" + Dt.Rows.Count + "筆 管制品:0筆"; this.hid_PICK_CNT.Value = Dt.Rows.Count.ToString(); this.hid_RESTRAIN_CNT.Value = "0"; btnPrint.Visible = true; btnEdit.Visible = true; this.hid_PageStatus.Text = "LOAD"; SetPageStatus(); LockControlChk();//對ControlChk鎖定編輯 btnDelItem.Visible = true; //btnImportOnDate.Visible = true; btnImportOnDate.Enabled = true; } #region ToolBar設定 if (detailTmpDt == null || (detailTmpDt != null && detailTmpDt.Rows.Count <= 0)) { GMToolbar1.GMToolbarStatus = WUI_GMToolbarV.GMToolbarStatusEnum.Other; GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Find, true, "PUR041.aspx?Code=PUR04", null, WUI_GMToolbarV.ClickAction.LinkURL); //GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.FindExport, false, "", this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.New, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, false, string.Empty, this.btnSave, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Edit, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Delete, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick); } else { GMToolbar1.GMToolbarStatus = WUI_GMToolbarV.GMToolbarStatusEnum.Other; GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Find, true, "PUR041.aspx?Code=PUR04", null, WUI_GMToolbarV.ClickAction.LinkURL); // GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.FindExport, false, "", this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.New, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, true, string.Empty, this.btnSave, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Edit, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Delete, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick); } #endregion }