// 品項載入 protected void btnLoad_Click(object sender, EventArgs e) { #region 欄位檢核 if (txtPLAN_ACCEPT_DATE.Text == "") { ErrorMsgLabel.Text = "門市進貨日不可空白"; return; } if (txtPICK_BATCH.Text == "") { ErrorMsgLabel.Text = "理貨批次不可空白"; return; } string nowDate = DateTime.Now.ToString("yyy/MM/dd"); int v = nowDate.CompareTo(this.txtPLAN_ACCEPT_DATE.Text); if (v > 0) { ErrorMsgLabel.Text = "門市進貨日小於系統日,不可進行品項轉入"; return; } if (this.chkPICK_SELECT_1.Checked == false && this.chkPICK_SELECT_2.Checked == false) { ErrorMsgLabel.Text = "正常品、客服查補 須至少勾選一項"; return; } //判斷 PURModel.MaintainPurchaseDeliveryGoods PUR = new PURModel.MaintainPurchaseDeliveryGoods(ConntionDB); ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(this.txtPLAN_ACCEPT_DATE.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.txtPICK_BATCH.Text, "string", false)); if (PUR.CheckStAcceptData(ParameterList) == "0") { ErrorMsgLabel.Text = "門市進貨日及批次已存在轉門市進貨單檔,不可修改每日預定出貨明細資料 !!"; return; } #endregion DataTable dt = getControlChk(); if (dt.Rows.Count > 0) { ViewState["ControlChk"] = dt; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "if (confirm('該進貨日期、理貨批次目前仍由(" + dt.Rows[0]["UPDATEUID"].ToString() + ")於" + dt.Rows[0]["UPDATEDATE"].ToString() + "編輯中\\n\\n如繼續,將會重新鎖定該日期、批號\\n\\n於編輯期間由(" + dt.Rows[0]["UPDATEUID"].ToString() + ")編輯中的資料將無法存檔\\n\\n是否確定仍要繼續載入品項?')){__doPostBack('','Item_Load1');}", true); return; } ParameterList.Clear(); ParameterList.Add(txtPLAN_ACCEPT_DATE.Text); ParameterList.Add(txtPICK_BATCH.Text); ParameterList.Add(""); ParameterList.Add(""); ParameterList.Add(""); PURModel.MaintainPurchaseDeliveryGoods BCO = new PURModel.MaintainPurchaseDeliveryGoods(ConnectionDB); DataTable Dtt = BCO.QueryChanPickControl(ParameterList); if (Dtt.Rows.Count > 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "if (confirm('將會正式「清除通路管制設定的資料」,再重新載入\\n\\n是否確定仍要載入品項?')){__doPostBack('','Item_Load2');}", true); return; } Item_Load2(); }
private void btnEdit_Continue() { PURModel.MaintainPurchaseDeliveryGoods PUR = new PURModel.MaintainPurchaseDeliveryGoods(ConntionDB); //判斷 ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(this.txtPLAN_ACCEPT_DATE.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.txtPICK_BATCH.Text, "string", false)); if (PUR.CheckStAcceptData(ParameterList) == "0") { ErrorMsgLabel.Text = "門市進貨日及批次已轉門市進貨單,不可修改出貨品項明細資料 !!"; return; } //由檢視模式切換至編輯模式 this.hid_PageStatus.Text = "EDIT"; SetPageStatus(); LockControlChk(); //對ControlChk鎖定編輯 btnDelItem.Visible = true; //btnImportOnDate.Visible = true; btnImportOnDate.Enabled = true; 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); }
// 新增明細 protected void Btn_InsertItem_Click(object sender, EventArgs e) { bool isAddDetail = false; //在檢視模式下直接按「新增明細」鈕 if (hid_PageStatus.Text == "VIEW") { #region 欄位檢核 if (txtPLAN_ACCEPT_DATE.Text == "") { ErrorMsgLabel.Text = "門市進貨日不可空白"; return; } if (txtPICK_BATCH.Text == "") { ErrorMsgLabel.Text = "理貨批次不可空白"; return; } string nowDate = DateTime.Now.ToString("yyy/MM/dd"); int v = nowDate.CompareTo(this.txtPLAN_ACCEPT_DATE.Text); if (v > 0) { ErrorMsgLabel.Text = "門市進貨日不可小於系統日"; return; } //判斷 PURModel.MaintainPurchaseDeliveryGoods PUR = new PURModel.MaintainPurchaseDeliveryGoods(ConntionDB); ParameterList.Clear(); ParameterList.Add(GetValueSetParameter(this.txtPLAN_ACCEPT_DATE.Text, "string", false)); ParameterList.Add(GetValueSetParameter(this.txtPICK_BATCH.Text, "string", false)); if (PUR.CheckStAcceptData(ParameterList) == "0") { ErrorMsgLabel.Text = "門市進貨日及批次已存在轉門市進貨單檔,不可修改每日預定出貨明細資料 !!"; return; } DataTable dt = getControlChk(); if (dt.Rows.Count > 0) { ViewState["ControlChk"] = dt; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "if (confirm('該進貨日期、理貨批次目前仍由(" + dt.Rows[0]["UPDATEUID"].ToString() + ")於" + dt.Rows[0]["UPDATEDATE"].ToString() + "編輯中\\n\\n如繼續,將會重新鎖定該日期、批號\\n\\n於編輯期間由(" + dt.Rows[0]["UPDATEUID"].ToString() + ")編輯中的資料將無法存檔\\n\\n是否確定仍要繼續編輯?')){__doPostBack('','btn_InsertItem_Contnue');}", true); return; } #endregion //進入頁面程式後,直接按下「新增明細」鈕,定義為「ADD_DETAIL」 hid_PageStatus.Text = "ADD_DETAIL"; //多一個物件,因hid_PageStatus無法於新增明細儲存後(狀態變為EDIT)再處理ADD_DETAIL的資料 hid_AddDetail.Value = "ADD_DETAIL"; isAddDetail = true; SetPageStatus(); LockControlChk();//對ControlChk鎖定編輯 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); } TextBox txt_DATE = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)txtPLAN_ACCEPT_DATE).FindControl("TextBoxCode")); TextBox txt_VIRTUAL_CODE = SLP_VIRTUAL_CODE.TextBox_Code; Session["PageStatus" + PageTimeStamp.Value] = hid_PageStatus.Text; btn_GV_Set.Attributes.Add("OnClick", "document.all['" + progress.ClientID + "'].style.top = document.documentElement.scrollTop;document.all['" + progress.ClientID + "'].left = document.documentElement.scrollLeft;document.all['" + progress.ClientID + "'].style.display = 'block';Set_Open('" + txt_DATE.ClientID + "','" + txtPICK_BATCH.ClientID + "','" + txt_VIRTUAL_CODE.ClientID + "','" + txtPERIOD.ClientID + "','" + hid_PageStatus.ClientID + "','3','" + PageTimeStamp.Value + "');"); btn_GV_Find.Attributes.Add("OnClick", "Set_Open('" + txt_DATE.ClientID + "','" + txtPICK_BATCH.ClientID + "','" + txt_VIRTUAL_CODE.ClientID + "','" + txtPERIOD.ClientID + "','" + hid_PageStatus.ClientID + "','2','" + PageTimeStamp.Value + "');"); SLP_VIRTUAL_CODE.TextBox_Code.Attributes["onblur"] = "if($get('" + SLP_VIRTUAL_CODE.TextBox_Code.ClientID + "').value!=''){__doPostBack('" + UpdatePanel1.UniqueID + "','ItemBlur');} else {$get('" + lblONWAY_QTY.ClientID + "').innerHTML='';$get('" + lblONHD_QTY.ClientID + "').innerHTML='';$get('" + lblDIS_QTY.ClientID + "').innerHTML='';$get('" + lblDIFF_QTY.ClientID + "').innerHTML='';}"; txtPERIOD.Attributes["onblur"] = "if($get('" + txtPERIOD.ClientID + "').value!=''){__doPostBack('" + UpdatePanel1.UniqueID + "','PeriodBlur');} else {$get('" + lblONWAY_QTY.ClientID + "').innerHTML='';$get('" + lblONHD_QTY.ClientID + "').innerHTML='';$get('" + lblDIS_QTY.ClientID + "').innerHTML='';$get('" + lblDIFF_QTY.ClientID + "').innerHTML='';}"; ErrorMsgLabel.Text = ""; panAdd.Visible = true; ViewState["Insert"] = "1";//新增狀態 SLP_VIRTUAL_CODE.Text = ""; txtPERIOD.Text = ""; lblONWAY_QTY.Text = ""; lblONHD_QTY.Text = ""; lblDIS_QTY.Text = ""; lblDIFF_QTY.Text = ""; Btn_InsertItem.Enabled = false; //新增 btnSave.Enabled = false; //存檔 btnCancel.Enabled = false; //取消 btnDelItem.Enabled = false; //刪除品號 btnImportOnDate.Enabled = false; //指定日期匯入 radPICK_SELECT1.Checked = false; radPICK_SELECT2.Checked = true; Focus(((TextBox)SLP_VIRTUAL_CODE.FindControl("TextBoxCode")).ClientID); //進入頁面程式後,直接按下「新增明細」鈕 if (isAddDetail) { txtPLAN_ACCEPT_DATE.ReadOnly = true; txtPICK_BATCH.ReadOnly = true; txtPICK_BATCH.CssClass = "readtxtbox"; chkPICK_SELECT_1.Enabled = false; chkPICK_SELECT_2.Enabled = false; ButtonQuery.Visible = false; //查詢鈕 btnLoad.Visible = false; //品項載入鈕 btnSave.Visible = true; //編輯鈕 btnCancel.Visible = true; //取消鈕 } Session["isFirst" + PageTimeStamp.Value] = "0"; //設定為第一次執行通路管制設定(進入PopUp視窗後預設為理貨) Session["Control" + PageTimeStamp.Value] = "0"; //理貨(PopUp視窗判斷用) ViewState["NoPeriod"] = "1"; //預設會存在該期別 radPICK_SELECT1.Enabled = false; radPICK_SELECT2.Enabled = false; GridView_ReadOnly(); GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, false, string.Empty, this.btnSave, WUI_GMToolbarV.ClickAction.ButtonClick); }