Exemplo n.º 1
0
 // 品項載入(續1)
 private void Item_Load1()
 {
     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是否確定仍要載入品項?')){window.setTimeout(function do_postback(){__doPostBack('','Item_Load2');} , 800);}", true);//發生錯誤,所以先做延遲的動作
         return;
     }
     Item_Load2();
 }
Exemplo n.º 2
0
    // 品項載入
    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();
    }
Exemplo n.º 3
0
    //新增明細區 -- 管制/理貨鈕
    protected void radPICK_SELECT_CheckedChanged(object sender, EventArgs e)
    {
        string Item_Name = ((TextBox)((PIC.VDS2G.WebUI.SLP.MKT_SLP_GiftItem)SLP_VIRTUAL_CODE).FindControl("TextBoxName")).Text;

        //顯示錯誤訊息並還原前管制/理貨鈕
        if (Item_Name == "" || Item_Name == "查無資料" || txtPERIOD.Text == "")
        {
            if (radPICK_SELECT1.Checked)
            {
                radPICK_SELECT1.Checked = false;
                radPICK_SELECT2.Checked = true;
            }
            else
            {
                radPICK_SELECT1.Checked = true;
                radPICK_SELECT2.Checked = false;
            }
            ErrorMsgLabel.Text = "請先輸入正確之品號、期別";
            Focus(((TextBox)((PIC.VDS2G.WebUI.SLP.MKT_SLP_GiftItem)SLP_VIRTUAL_CODE).FindControl("TextBoxCode")).ClientID);
            return;
        }
        ParameterList.Clear();
        ParameterList.Add(txtPLAN_ACCEPT_DATE.Text);
        ParameterList.Add(txtPICK_BATCH.Text);
        ParameterList.Add(SLP_VIRTUAL_CODE.Text);
        ParameterList.Add(txtPERIOD.Text);
        ParameterList.Add(Session["UID"].ToString());
        PURModel.MaintainPurchaseDeliveryGoods BCO = new PURModel.MaintainPurchaseDeliveryGoods(ConnectionDB);
        DataTable Dt = BCO.QueryChanPickControl(ParameterList);

        string SessionIDName_Pick = "PUR041_Pick" + PageTimeStamp.Value;
        DataTable dt = (DataTable)Session[SessionIDName_Pick];
        if (dt != null)
            if (dt.Rows.Count > 0)
            {
                DataRow[] drs = dt.Select("VIRTUAL_CODE='" + SLP_VIRTUAL_CODE.Text + "' and PERIOD='" + txtPERIOD.Text + "'");
                if (drs.Length != 0)
                    foreach (DataRow dr in drs)
                        dr["PICK_SELECT"] = radPICK_SELECT1.Checked ? "2" : "1";
                else
                {
                    foreach (DataRow dr in Dt.Rows)
                        dr["PICK_SELECT"] = radPICK_SELECT1.Checked ? "2" : "1";
                    dt.Merge(Dt);
                }
                Session[SessionIDName_Pick] = dt;
            }
            else
            {
                foreach (DataRow dr in Dt.Rows)
                    dr["PICK_SELECT"] = radPICK_SELECT1.Checked ? "2" : "1";
                Session[SessionIDName_Pick] = Dt;
            }
        else
        {
            foreach (DataRow dr in Dt.Rows)
                dr["PICK_SELECT"] = radPICK_SELECT1.Checked ? "2" : "1";
            Session[SessionIDName_Pick] = Dt;
        }

        if (radPICK_SELECT1.Checked)
        {
            btn_GV_Set.Enabled = true;
            Session["Control" + PageTimeStamp.Value] = "1"; //管制
        }
        else if (radPICK_SELECT2.Checked)
        {
            btn_GV_Set.Enabled = false;
            Session["Control" + PageTimeStamp.Value] = "0"; //理貨
        }
    }
Exemplo n.º 4
0
    //GridView管制/理貨鈕
    protected void rdoPICK_SELECT_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton btn = sender as RadioButton;
        GridViewRow gr = (btn.BindingContainer as GridViewRow);
        int i = gr.RowIndex;
        SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

        string Item_Name=((TextBox)((PIC.VDS2G.WebUI.SLP.MKT_SLP_GiftItem)GridView1.Rows[i].FindControl("VIRTUAL_CODE")).FindControl("TextBoxName")).Text;
        if (ViewState["Insert"] != null)
            if (ViewState["Insert"].ToString() == "1")
                if (Item_Name == "" || Item_Name == "查無資料" || ((TextBox)((PIC.VDS2G.WebUI.SLP.SLP_ItemPeriod)GridView1.Rows[i].FindControl("PERIOD")).FindControl("TextBoxCode")).Text == "")
                {
                    if (((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked)
                    {
                        ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked = false;
                        ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT2")).Checked = true;
                    }
                    else
                    {
                        ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked = true;
                        ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT2")).Checked = false;
                    }
                    ErrorMsgLabel.Text = "請先輸入品號、期別";
                    return;
                }

        ParameterList.Clear();
        ParameterList.Add(txtPLAN_ACCEPT_DATE.Text);
        ParameterList.Add(txtPICK_BATCH.Text);
        ParameterList.Add(((TextBox)((PIC.VDS2G.WebUI.SLP.MKT_SLP_GiftItem)GridView1.Rows[i].FindControl("VIRTUAL_CODE")).FindControl("TextBoxCode")).Text);
        ParameterList.Add(((TextBox)((PIC.VDS2G.WebUI.SLP.SLP_ItemPeriod)GridView1.Rows[i].FindControl("PERIOD")).FindControl("TextBoxCode")).Text);
        ParameterList.Add(Session["UID"].ToString());
        PURModel.MaintainPurchaseDeliveryGoods BCO = new PURModel.MaintainPurchaseDeliveryGoods(ConnectionDB);
        DataTable Dt = BCO.QueryChanPickControl(ParameterList);

        string SessionIDName_Pick = "PUR041_Pick" + PageTimeStamp.Value;
        DataTable dt = (DataTable)Session[SessionIDName_Pick];
        if (dt != null)
            if (dt.Rows.Count > 0)
            {
                DataRow[] drs = dt.Select("VIRTUAL_CODE='" + ((TextBox)((PIC.VDS2G.WebUI.SLP.MKT_SLP_GiftItem)GridView1.Rows[i].FindControl("VIRTUAL_CODE")).FindControl("TextBoxCode")).Text + "' and PERIOD='" + ((TextBox)((PIC.VDS2G.WebUI.SLP.SLP_ItemPeriod)GridView1.Rows[i].FindControl("PERIOD")).FindControl("TextBoxCode")).Text + "'");
                if (drs.Length != 0)
                    foreach (DataRow dr in drs)
                        dr["PICK_SELECT"] = ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked ? "2" : "1";
                else
                {
                    foreach (DataRow dr in Dt.Rows)
                        dr["PICK_SELECT"] = ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked ? "2" : "1";
                    dt.Merge(Dt);
                }
                Session[SessionIDName_Pick] = dt;
            }
            else
            {
                foreach (DataRow dr in Dt.Rows)
                    dr["PICK_SELECT"] = ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked ? "2" : "1";
                Session[SessionIDName_Pick] = Dt;
            }
        else
        {
            foreach (DataRow dr in Dt.Rows)
                dr["PICK_SELECT"] = ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked ? "2" : "1";
            Session[SessionIDName_Pick] = Dt;
        }

        if (((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked)
        {
            ((Button)GridView1.Rows[i].FindControl("btn_GV_Set")).Enabled = true;
            ((Label)GridView1.Rows[i].FindControl("PICK_SELECT")).Text = "2";
        }
        else if (((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT2")).Checked)
        {
            ((Button)GridView1.Rows[i].FindControl("btn_GV_Set")).Enabled = false;
            ((Label)GridView1.Rows[i].FindControl("PICK_SELECT")).Text = "1";
        }
        DataTable DetailDt = (DataTable)Session[SessionIDName];
        DataRow[] Drs;
        if(ViewState["Insert"]!=null)
            if (ViewState["Insert"].ToString() == "1")
                Drs = DetailDt.Select("VIRTUAL_CODE=''");
            else
                Drs = DetailDt.Select("VIRTUAL_CODE='" + ((TextBox)((PIC.VDS2G.WebUI.SLP.MKT_SLP_GiftItem)GridView1.Rows[i].FindControl("VIRTUAL_CODE")).FindControl("TextBoxCode")).Text + "' and PERIOD='" + ((TextBox)((PIC.VDS2G.WebUI.SLP.SLP_ItemPeriod)GridView1.Rows[i].FindControl("PERIOD")).FindControl("TextBoxCode")).Text + "'");
        else
            Drs = DetailDt.Select("VIRTUAL_CODE='" + ((TextBox)((PIC.VDS2G.WebUI.SLP.MKT_SLP_GiftItem)GridView1.Rows[i].FindControl("VIRTUAL_CODE")).FindControl("TextBoxCode")).Text + "' and PERIOD='" + ((TextBox)((PIC.VDS2G.WebUI.SLP.SLP_ItemPeriod)GridView1.Rows[i].FindControl("PERIOD")).FindControl("TextBoxCode")).Text + "'");
        Drs[0]["PICK_SELECT"] = ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked ? "2" : "1";
        Session[SessionIDName] = DetailDt;

        string outPick = "", outRestrain = "";
        getGridPickCnt(out outPick, out outRestrain);
        LabelQueryRecordCount.Text = "品項數:理貨品:" + outPick + " 筆 管制品:" + outRestrain + " 筆    ";
    }
Exemplo n.º 5
0
    //新增明細區 -- 更新
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        #region 欄位檢核
        if (SLP_VIRTUAL_CODE.Text == "" || txtPERIOD.Text == "")
        {
            ErrorMsgLabel.Text = "請輸入品號、期別";
            Focus(((TextBox)SLP_VIRTUAL_CODE.FindControl("TextBoxCode")).ClientID);
            return;
        }
        if (ChkPUR04Dup())
        {
            ErrorMsgLabel.Text = "品號" + SLP_VIRTUAL_CODE.Text + "、期別" + txtPERIOD.Text + "、門市進貨日" + txtPLAN_ACCEPT_DATE.Text + "已有相同品號存在,請確認";
            return;
        }

        SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
        DataTable DetailDt = new DataTable();

        if (Session[SessionIDName] != "" && Session[SessionIDName] != null)
        {
            DetailDt = (DataTable)Session[SessionIDName];

            //檢核重複
            DataRow[] ddrs = DetailDt.Select("VIRTUAL_CODE = '" + SLP_VIRTUAL_CODE.Text + "' and PERIOD = '" + txtPERIOD.Text + "'");
            if (ddrs.Length > 0)
            {
                ErrorMsgLabel.Text = "品號、期別資料已存在,請重新輸入";
                Focus(((TextBox)SLP_VIRTUAL_CODE.FindControl("TextBoxCode")).ClientID);
                return;
            }

            if (ViewState["NoPeriod"].ToString() != "1")
            {
                ErrorMsgLabel.Text = "期別不存在於該品號";
                return;
            }
        }
        else
        {
            DetailDt.Columns.Add("ID");
            DetailDt.Columns.Add("ITEM");
            DetailDt.Columns.Add("VIRTUAL_CODE");
            DetailDt.Columns.Add("VIRTUAL_NAME");
            DetailDt.Columns.Add("PERIOD");
            DetailDt.Columns.Add("PICK_SELECT");
            DetailDt.Columns.Add("ONWAY_QTY");
            DetailDt.Columns.Add("ONHD_QTY");
            DetailDt.Columns.Add("DIS_QTY");
            DetailDt.Columns.Add("DIFF_QTY");
            DetailDt.Columns.Add("CREATEUID");
            DetailDt.Columns.Add("CREATEDATE");
            DetailDt.Columns.Add("UPDATEUID");
            DetailDt.Columns.Add("UPDATEDATE");
            DetailDt.Columns.Add("ISDEL");
            DetailDt.Columns.Add("DATATYPE");
        }
        #endregion

        string vPICK_SELECT = "";
        string SessionIDName_Pick = "PUR041_Pick" + PageTimeStamp.Value;
        DataTable Dt_Set = (DataTable)Session[SessionIDName_Pick]; //通路管制設定
        DataTable dtTmp_Set = new DataTable();//通路管制設定(PUR432傳回的DataTable)
        if (Session[string.Format("POP_PUR0432_dtSelectDisChain_{0}", PageTimeStamp.Value)] != "")
            dtTmp_Set = (DataTable)Session[string.Format("POP_PUR0432_dtSelectDisChain_{0}", PageTimeStamp.Value)];

        if (Dt_Set == null || (Dt_Set != null && Dt_Set.Rows.Count <= 0))
        {
            if (dtTmp_Set == null || dtTmp_Set != null && dtTmp_Set.Rows.Count == 0)
            {
                string pick = "";
                ParameterList.Clear();
                ParameterList.Add(txtPLAN_ACCEPT_DATE.Text);
                ParameterList.Add(txtPICK_BATCH.Text);
                ParameterList.Add(SLP_VIRTUAL_CODE.Text);
                ParameterList.Add(txtPERIOD.Text);
                ParameterList.Add(Session["UID"].ToString());
                PURModel.MaintainPurchaseDeliveryGoods BCO = new PURModel.MaintainPurchaseDeliveryGoods(ConnectionDB);
                Dt_Set = BCO.QueryChanPickControl(ParameterList);
                if (radPICK_SELECT1.Checked) pick = "2"; else pick = "1";
                foreach (DataRow dr1 in Dt_Set.Rows)
                    dr1["PICK_SELECT"] = pick;
                Session[SessionIDName_Pick] = Dt_Set;
            }
            else
            {
                Session[SessionIDName_Pick] = dtTmp_Set.Copy();
                DataView dv_Pick = new DataView(dtTmp_Set);
                dv_Pick.RowFilter = "PICK_SELECT = '2'";
                if (dv_Pick.Count != 0)
                    vPICK_SELECT = "2";   //有一筆以上管制
                else
                    vPICK_SELECT = "1";   //無管制
            }
        }
        else
        {
            if (Dt_Set.PrimaryKey.Length <= 0)
            {
                DataColumn[] keys_pick = new DataColumn[6];

                keys_pick[0] = Dt_Set.Columns["ST_ACCEPT_DATE"];
                keys_pick[1] = Dt_Set.Columns["PICK_BATCH"];
                keys_pick[2] = Dt_Set.Columns["ITEM"];
                keys_pick[3] = Dt_Set.Columns["PERIOD"];
                keys_pick[4] = Dt_Set.Columns["CHAN_NO"];
                keys_pick[5] = Dt_Set.Columns["VIRTUAL_CODE"];
                Dt_Set.CaseSensitive = true;
                Dt_Set.PrimaryKey = keys_pick;
            }
            vPICK_SELECT = "1";

            if (dtTmp_Set != null)
            {
                if (dtTmp_Set.Rows.Count > 0)
                {
                    DataRow[] DDrs1 = dtTmp_Set.Select("VIRTUAL_CODE = '" + SLP_VIRTUAL_CODE.Text + "' and PERIOD = '" + txtPERIOD.Text + "'");
                    if (DDrs1.Length > 0)
                    {
                        DataRow[] DDrs = Dt_Set.Select("VIRTUAL_CODE = '" + SLP_VIRTUAL_CODE.Text + "' and PERIOD = '" + txtPERIOD.Text + "'");
                        foreach (DataRow dr in DDrs)
                            Dt_Set.Rows.Remove(dr);

                        for (int i = 0; i < dtTmp_Set.Rows.Count; i++) //再全部新增該品號、期別的「通路管制設定」資料
                        {
                            DataRow dr = Dt_Set.NewRow();
                            dr["ST_ACCEPT_DATE"] = dtTmp_Set.Rows[i]["ST_ACCEPT_DATE"].ToString();
                            dr["PICK_BATCH"] = dtTmp_Set.Rows[i]["PICK_BATCH"].ToString();
                            dr["ITEM"] = dtTmp_Set.Rows[i]["ITEM"].ToString();
                            dr["PERIOD"] = dtTmp_Set.Rows[i]["PERIOD"].ToString();
                            dr["CHAN_NO"] = dtTmp_Set.Rows[i]["CHAN_NO"].ToString();
                            dr["VIRTUAL_CODE"] = dtTmp_Set.Rows[i]["VIRTUAL_CODE"].ToString();
                            dr["CHAN_NAME"] = dtTmp_Set.Rows[i]["CHAN_NAME"].ToString();
                            dr["PICK_SELECT"] = dtTmp_Set.Rows[i]["PICK_SELECT"].ToString();
                            dr["CREATEUID"] = dtTmp_Set.Rows[i]["CREATEUID"].ToString();
                            dr["CREATEDATE"] = dtTmp_Set.Rows[i]["CREATEDATE"];
                            dr["UPDATEUID"] = dtTmp_Set.Rows[i]["UPDATEUID"].ToString();
                            dr["UPDATEDATE"] = dtTmp_Set.Rows[i]["UPDATEDATE"];

                            Dt_Set.Rows.Add(dr);

                            if (dtTmp_Set.Rows[i]["PICK_SELECT"].ToString() == "2")
                                vPICK_SELECT = "2";
                        }
                    }
                    else
                    {
                        string pick = "";
                        ParameterList.Clear();
                        ParameterList.Add(txtPLAN_ACCEPT_DATE.Text);
                        ParameterList.Add(txtPICK_BATCH.Text);
                        ParameterList.Add(SLP_VIRTUAL_CODE.Text);
                        ParameterList.Add(txtPERIOD.Text);
                        ParameterList.Add(Session["UID"].ToString());
                        PURModel.MaintainPurchaseDeliveryGoods BCO = new PURModel.MaintainPurchaseDeliveryGoods(ConnectionDB);
                        DataTable dt_Set = BCO.QueryChanPickControl(ParameterList);
                        if (radPICK_SELECT1.Checked) pick = "2"; else pick = "1";
                        foreach (DataRow dr1 in dt_Set.Rows)
                            dr1["PICK_SELECT"] = pick;
                        Dt_Set.Merge(dt_Set);
                    }
                }
                Session[SessionIDName_Pick] = Dt_Set;
            }
            else
            {
                DataRow[] DDrs = Dt_Set.Select("VIRTUAL_CODE = '" + SLP_VIRTUAL_CODE.Text + "' and PERIOD = '" + txtPERIOD.Text + "'");
                foreach (DataRow dr in DDrs)
                {
                    if (radPICK_SELECT1.Checked)
                        dr["PICK_SELECT"] = "2";
                    else
                        dr["PICK_SELECT"] = "1";
                }
                Session[SessionIDName_Pick] = Dt_Set;
            }
        }
        //重新再判斷一次(若使用者只按管制鈕,不進入管制設定裏,就不會執行上述程式碼
        if (radPICK_SELECT1.Checked) vPICK_SELECT = "2"; else vPICK_SELECT = "1";

        DataRow dRow = DetailDt.NewRow();
        dRow["VIRTUAL_CODE"] = SLP_VIRTUAL_CODE.Text;
        dRow["ITEM"] = SLP_VIRTUAL_CODE.Text.Substring(0, 6);
        dRow["PERIOD"] = txtPERIOD.Text;
        dRow["PICK_SELECT"] = vPICK_SELECT;
        dRow["ONWAY_QTY"] = lblONWAY_QTY.Text;
        dRow["ONHD_QTY"] = lblONHD_QTY.Text;
        dRow["DIS_QTY"] = lblDIS_QTY.Text;
        dRow["DIFF_QTY"] = lblDIFF_QTY.Text;
        dRow["DATATYPE"] = "0";
        DetailDt.Rows.Add(dRow);

        Session[SessionIDName] = DetailDt;
        GridView1.DataSource = DetailDt;
        GridView1.DataBind();
        if (GridView1.Rows.Count > 0)
        {
            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                if (GridView1.Rows[i].RowType == DataControlRowType.DataRow)
                {
                    ((PIC.VDS2G.WebUI.SLP.MKT_SLP_GiftItem)GridView1.Rows[i].FindControl("VIRTUAL_CODE")).ReadOnly = true;
                    ((PIC.VDS2G.WebUI.SLP.SLP_ItemPeriod)GridView1.Rows[i].FindControl("PERIOD")).ReadOnly = true;
                    if (hid_PageStatus.Text == "LOAD")
                    {
                        ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Enabled = true;
                        ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT2")).Enabled = true;
                        if (((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked)
                            ((Button)GridView1.Rows[i].FindControl("btn_GV_Set")).Enabled = true;
                        else
                            ((Button)GridView1.Rows[i].FindControl("btn_GV_Set")).Enabled = false;
                    }
                    else
                    {
                        ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Enabled = false;
                        ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT2")).Enabled = false;
                        ((Button)GridView1.Rows[i].FindControl("btn_GV_Set")).Enabled = true;
                    }
                    ((CheckBox)GridView1.Rows[i].FindControl("chkGV_Del")).Enabled = true;
                    ((Button)GridView1.Rows[i].FindControl("btn_GV_Find")).Enabled = true;
                }
                ((CheckBox)GridView1.HeaderRow.FindControl("chkAll")).Enabled = true;
            }
            ReBindBtn_Set();

            this.txtPLAN_ACCEPT_DATE.ReadOnly = true;
            this.txtPICK_BATCH.ReadOnly = true;
            this.txtPICK_BATCH.CssClass = "readtxtbox";
            this.chkPICK_SELECT_1.Enabled = false;
            this.chkPICK_SELECT_2.Enabled = false;
        }
        panAdd.Visible = false;
        Btn_InsertItem.Enabled = true;
        btnSave.Enabled = true; //存檔
        btnCancel.Enabled = true; //取消
        btnDelItem.Enabled = true; //刪除品號
        btnImportOnDate.Enabled = true; //指定日期匯入
        ViewState["Insert"] = "0"; //解除新增狀態
        Session["isFirst" + PageTimeStamp.Value] = "1"; //解除第一次執行通路管制設定

        string outPick = "", outRestrain = "";
        getGridPickCnt(out outPick, out outRestrain);
        LabelQueryRecordCount.Text = "品項數:理貨品:" + outPick + " 筆 管制品:" + outRestrain + " 筆&nbsp;&nbsp;&nbsp;&nbsp;";
        GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, true, string.Empty, this.btnSave, WUI_GMToolbarV.ClickAction.ButtonClick);
        SLP_VIRTUAL_CODE.ReadOnly = false;
        txtPERIOD.ReadOnly = false;
        txtPERIOD.CssClass = "";
        GridView1_Control();

        //if (hid_AddDetail.Value == "ADD_DETAIL")
        //{
        //    txtPLAN_ACCEPT_DATE.ReadOnly = false;
        //    txtPICK_BATCH.ReadOnly = false;
        //    txtPICK_BATCH.CssClass = "";
        //    chkPICK_SELECT_1.Enabled = true;
        //    chkPICK_SELECT_2.Enabled = true;
        //}
    }