private void QueryData()
    {
        #region
        try
        {
            string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

            ALOModel.MaintainDisRecord BCO = new ALOModel.MaintainDisRecord(ConnectionDB);

            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(s_DIS_NO);
            ParameterList.Add(s_ITEM);
            ParameterList.Add(s_PERIOD);

            DataTable dt = BCO.QueryDisStoreWithImportPOInfo(ParameterList);
            if (dt != null && dt.Rows.Count > 0)
            {
                this.btn_Save.Enabled = true;
                this.gv_Result.DataSource = dt;
                this.gv_Result.PageSize = 10;
                this.gv_Result.PageIndex = 0;
                this.gv_Result.DataBind();
                Session[SessionIDName] = dt;
            }
            else
            {
                ResultMsgLabel.Text = "查無資料";
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }

        #endregion
    }
Example #2
0
    /// <summary>
    /// 執行
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnExecute_Click(object sender, EventArgs e)
    {
        try
        {
            StringBuilder sb = new StringBuilder();

            #region 檢查複製條件
            if (this.txt_DIS_NO_OLD.Text == "")
            { sb.Append("配本序號不可為空值 \n\r"); }
            if (this.SLP_SKU_OLD.Text == "")
            { sb.Append("品號不可為空值 \n\r"); }
            if (this.SLP_ItemPeriod_OLD.Text == "")
            { sb.Append("期別不可為空值 \n\r"); }
            if (this.SLP_SKU_NEW.Text == "")
            { sb.Append("新品號不可為空值 \n\r"); }
            if (this.SLP_ItemPeriod_NEW.Text == "")
            { sb.Append("新期別不可為空值 \n\r"); }
            if (sb.ToString().Trim() != "")
            {
                throw new Exception(sb.ToString().Trim());
            }
            #endregion

            #region 執行複製
            ArrayList ParameterList = new ArrayList();//20091113
            ParameterList.Clear();
            ParameterList.Add(this.txt_DIS_NO_OLD.Text);//配本序號
            ParameterList.Add(this.SLP_SKU_OLD.Text);//品號
            ParameterList.Add(this.SLP_ItemPeriod_OLD.Text);//期別
            ParameterList.Add(this.SLP_SKU_NEW.Text);//新品號
            ParameterList.Add(this.SLP_ItemPeriod_NEW.Text);//新期別
            ParameterList.Add(Session["UID"].ToString());//使用者

            ALOModel.MaintainDisRecord BCOM = new ALOModel.MaintainDisRecord(ConnectionDB);
            string sDis_No_New = BCOM.CopyToNewRecord(ParameterList, null);
            
            this.RightMsgLabel.Text = "執行成功";
            this.txt_DIS_NO_NEW.Text = sDis_No_New;
            
            //string strJS = string.Format("alert(執行成功');", txt_DIS_NO_NEW.ClientID, txt_DIS_NO_NEW.Text);
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "ALO115.aspx", strJS, true);


            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #3
0
    private string ProcessConfirm(string strStAcceptDate, string strDisNoForAry, Int32 iProcessingAryIndex)
    {
        #region
        bool bResult = false;
        string strCallbackResult = "";
        string strResult = "", strErrMsg = "";
        string strPrefixed = "POP_DisApproveError";
        string strDisNo = "", strNextDisNo = "";
        string[] strAryDisAry = strDisNoForAry.Split(";".ToCharArray());
        try
        {
            fmStatus = FormStatus.fmProcess;

            ALOModel.MaintainDisRecord BCO = new ALOModel.MaintainDisRecord(ConnectionDB);
            if (iProcessingAryIndex < strAryDisAry.Length)
            {

                strDisNo = strAryDisAry[iProcessingAryIndex];

                ArrayList ParameterList = new ArrayList();//20091113

                ParameterList.Clear();
                ParameterList.Add(strStAcceptDate);
                ParameterList.Add(strDisNo);
                ParameterList.Add("VDS_ALO_DIS_STORE");
                ParameterList.Add(Session["UID"].ToString());

                bResult = BCO.ProcessConfirm(ParameterList, out strResult, out strErrMsg, null);

                if (!bResult)
                {
                    Session[string.Format("{0}_DISNO_{1}", strPrefixed, PageTimeStamp.Value)] = string.Format("{0},", strDisNo);
                    Session[string.Format("{0}_OPTYPE_{1}", strPrefixed, PageTimeStamp.Value)] = "1";
                }

                iProcessingAryIndex = iProcessingAryIndex + 1;

                if (iProcessingAryIndex < strAryDisAry.Length)
                {
                    strNextDisNo = strAryDisAry[iProcessingAryIndex];
                }
                else
                {
                    strNextDisNo = "X";//表示已執行到最後一筆
                }

                //0:DIS_NO字串For陣列用-
                //1:下一筆陣列Index-
                //2:執行結果-
                //3:錯誤訊息-
                //4:要關閉執行狀態的DIS_NO-
                //5:要開啟執行狀態的DIS_NO-
                //6:是否有累積執行錯誤之DIS_NO-
                //7:ST_ACCEPT_DATE ClientID-
                //8:ResultMsgLabel ClientID-
                //9:ErrMsgLabel ClientID-
                //10:將再開啟之控制項字串陣列

                string strCtrlIDToUnLock = string.Format("{0}", btn_Query.ClientID);

                strCallbackResult = string.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}-{8}-{9}-{10}",
                    strDisNoForAry,
                    iProcessingAryIndex,
                    bResult ? "OK" : "NG",
                    strErrMsg,
                    strDisNo,
                    strNextDisNo,
                    Session[string.Format("{0}_DISNO_{1}", strPrefixed, PageTimeStamp.Value)] == null ? "0" : "1",
                    ((TextBox)SLP_SLPDate1.FindControl("TextBoxCode")).ClientID,
                    ResultMsgLabel.ClientID,
                    ErrorMsgLabel.ClientID,
                    strCtrlIDToUnLock
                    );
            }

        }
        catch (Exception ex)
        {
            throw ex;
        }

        return strCallbackResult;
        #endregion
    }
Example #4
0
    private string ProcessConfirmFromBridge(string strStAcceptDate, string strDisNoForAry, string strCtrlPending, Int32 iProcessingAryIndex)
    {
        #region
        bool bResult = false, bResultCheck = false;
        string strCallbackResult = "";
        string strResult = "", strErrMsg = "", strErrMsgCheck = "";
        string strPrefixed = "POP_DisApproveError";
        string strDisNo = "", strNextDisNo = "";
        string strDIS_QTY = "";
        string[] strAryDisAry = strDisNoForAry.Split(";".ToCharArray());
        string[] strAryCtrlPending = strCtrlPending.Split(";".ToCharArray());

        try
        {
            fmStatus = FormStatus.fmProcess;

            ALOModel.MaintainDisRecord BCO = new ALOModel.MaintainDisRecord(ConnectionDB);
            if (iProcessingAryIndex < strAryDisAry.Length)
            {

                strDisNo = strAryDisAry[iProcessingAryIndex];

                ArrayList ParameterList = new ArrayList();//20091113

                //---------------------------------------------------------------------
                //2010/02/09 added:確認前檢核
                ALOModel.MaintainDisCRMRecord BCO3 = new ALOModel.MaintainDisCRMRecord(ConnectionDB);
                ParameterList.Clear();
                ParameterList.Add(strStAcceptDate);
                ParameterList.Add(strDisNo);
                try
                {
                    bResultCheck = BCO3.Pick_Control_Check(ParameterList, out strErrMsgCheck);
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                //---------------------------------------------------------------------


                ParameterList.Clear();
                ParameterList.Add(strStAcceptDate);
                ParameterList.Add(strDisNo);
                ParameterList.Add("VDS_ALO_DIS_STORE");
                ParameterList.Add(strAryCtrlPending[5]);

                try
                {
                    bResult = BCO.ProcessConfirm(ParameterList, out strResult, out strErrMsg, null);
                }
                catch (Exception ex)
                {
                    throw ex;
                }


                if (!bResult)
                {
                    Session[string.Format("{0}_DISNO_{1}", strPrefixed, strAryCtrlPending[0])] += string.Format("{0},", strDisNo);
                    Session[string.Format("{0}_OPTYPE_{1}", strPrefixed, strAryCtrlPending[0])] = "1";
                    Session[string.Format("{0}_ERRMSG_{1}", strPrefixed, strAryCtrlPending[0])] += string.Format("配本序號:{0},{1}{2}{3};\r\n", strDisNo, strErrMsgCheck, bResultCheck ? "" : ",", strErrMsg);
                }
                else
                {
                    if (!bResultCheck)
                    {
                        Session[string.Format("{0}_ERRMSG_{1}", strPrefixed, strAryCtrlPending[0])] += string.Format("配本序號:{0},{1};\r\n", strDisNo, strErrMsgCheck);
                    }
                }


                ALOModel.ProcessMultiDisRecords BCO2 = new ALOModel.ProcessMultiDisRecords(ConnectionDB);
                DataTable dtTemp = BCO2.QueryDisItemForALO20(GetQueryParams(strStAcceptDate, strDisNo, bResult));
                if (dtTemp != null && dtTemp.Rows.Count > 0)
                    strDIS_QTY = dtTemp.Rows[0]["DIS_QTY"].ToString().Trim();

                iProcessingAryIndex = iProcessingAryIndex + 1;

                if (iProcessingAryIndex < strAryDisAry.Length)
                {
                    strNextDisNo = strAryDisAry[iProcessingAryIndex];
                }
                else
                {
                    strNextDisNo = "X";//表示已執行到最後一筆
                }

                //0:DIS_NO字串For陣列用-
                //1:下一筆陣列Index-
                //2:執行結果-
                //3:錯誤訊息-
                //4:要關閉執行狀態的DIS_NO-
                //5:要開啟執行狀態的DIS_NO-
                //6:是否有累積執行錯誤之DIS_NO-
                //7:ST_ACCEPT_DATE ClientID-
                //8:ResultMsgLabel ClientID-
                //9:ErrMsgLabel ClientID-
                //10:將再開啟之控制項字串陣列
                //11:DIS_QTY
                string strCtrlIDToUnLock = string.Format("{0}", strAryCtrlPending[1]);

                strCallbackResult = string.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}-{8}-{9}-{10}-{11}",
                    strDisNoForAry,
                    iProcessingAryIndex,
                    bResult ? "OK" : "NG",
                    Session[string.Format("{0}_ERRMSG_{1}", strPrefixed, strAryCtrlPending[0])].ToString(),//strErrMsg,
                    strDisNo,
                    strNextDisNo,
                    Session[string.Format("{0}_DISNO_{1}", strPrefixed, strAryCtrlPending[0])] == null ? "0" : "1",
                    strAryCtrlPending[2],
                    strAryCtrlPending[3],
                    strAryCtrlPending[4],
                    strCtrlIDToUnLock,
                    strDIS_QTY
                    );
            }

        }
        catch (Exception ex)
        {
            throw ex;
        }

        return strCallbackResult;
        #endregion
    }
Example #5
0
    //查詢鈕
    protected void btnQuery_Click(object sender, EventArgs e)
    {
        btnSave.Enabled = false;
        GridView2.DataSource = null;
        GridView2.DataBind();
        UpdatePanel1.Update();
        if(txtPeriod.Text=="")
        {
            lblMsg.Text = "請輸入欲查期數";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "ALO125_Focus", "document.all['" + txtPeriod.ClientID + "'].focus(); document.all['" + txtPeriod.ClientID + "'].select();", true);
            return;
        }
        if (txtPeriod.Text == "0")
        {
            lblMsg.Text = "欲查期數需大於0";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "ALO125_Focus", "document.all['" + txtPeriod.ClientID + "'].focus(); document.all['" + txtPeriod.ClientID + "'].select();", true);
            return;
        }
        if (txtReturnRate.Text == "")
        {
            lblMsg.Text = "請輸入退貨率";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "ALO125_Focus", "document.all['" + txtReturnRate.ClientID + "'].focus(); document.all['" + txtReturnRate.ClientID + "'].select();", true);
            return;
        }
        try
        {
            DataTable dt = new DataTable();
            string SessionIDName = "ALO125_dt5" + PageTimeStamp.Value;

            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(Request.QueryString["pPG_ID"]);
            ParameterList.Add(PageTimeStamp.Value + Session["UID"].ToString());
            ParameterList.Add(Request.QueryString["pDisNo"]);
            ParameterList.Add(Request.QueryString["pItem"]);
            ParameterList.Add(Request.QueryString["pPeriod"]);
            ParameterList.Add(txtPeriod.Text);//V_PERIOD_CNT
            ParameterList.Add(radGreater.Checked ? "1" : "0");
            ParameterList.Add(txtReturnRate.Text);
            ParameterList.Add(Session["UID"].ToString());
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            dt = bco.QueryDisStoreByReturnRate(ParameterList);
            Session[SessionIDName] = dt;
            GridView2.DataSource = dt;
            GridView2.PageSize = int.Parse(TextBoxPagesize.Text.Length == 0 ? "20" : TextBoxPagesize.Text);
            GridView2.DataBind();
            GridView2.Visible = true;
            UpdatePanel1.Update();
            if (dt.Rows.Count > 0) { txtTune.Enabled = true; btnConfirm.Enabled = true; txtPeriod.Enabled = true; UpdatePanel6.Update(); UpdatePanel7.Update(); } else btnConfirm.Enabled = false;
        }
        catch (Exception ex) { lblMsg.Text = ex.Message; }
    }
    /// <summary>
    /// 將目前頁面Gridview資料存入DB中
    /// </summary>
    private void SaveCurrentPageDataToDB()
    {
        #region

        try
        {
            #region

            //V_DIS_NO         IN VARCHAR2,
            //V_ITEM           IN VARCHAR2,
            //V_PERIOD         IN VARCHAR2,
            //V_VALUE_ARR      IN VARCHAR2,--更新陣列組合:ID_DIS_QTY, ID_DIS_QTY,....
            //V_USER_ID        IN VARCHAR2,
            //V_SESSION_ID     IN VARCHAR2,
            //V_PG_ID          IN VARCHAR2

            string strVALUE_ARR = "";
            Label lblID = null;
            TextBox txtDIS_QTY = null;
            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(s_DIS_NO);
            ParameterList.Add(s_ITEM);
            ParameterList.Add(s_PERIOD);

            for (Int32 i = 0; i <= GridView1.Rows.Count - 1; i++)
            {
                lblID = (Label)GridView1.Rows[i].FindControl("lblID");
                txtDIS_QTY = (TextBox)GridView1.Rows[i].FindControl("txtDIS_QTY");
                strVALUE_ARR += string.Format("{0}_{1},", lblID.Text.Trim(), txtDIS_QTY.Text.Trim());
            }

            if (strVALUE_ARR.Trim() != "")
            {
                if (strVALUE_ARR.Substring(strVALUE_ARR.Length - 1, 1) == ",")
                {
                    strVALUE_ARR = strVALUE_ARR.Substring(0, strVALUE_ARR.Length - 1);
                }
            }

            ParameterList.Add(strVALUE_ARR);
            ParameterList.Add(Session["UID"].ToString());
            ParameterList.Add(string.Format("{0}{1}", PageTimeStamp.Value, Session["UID"].ToString()));//無底線
            ParameterList.Add(s_WorkId);
            #endregion

            ALOModel.MaintainDisRecord BCO = new ALOModel.MaintainDisRecord(ConnectionDB);
            BCO.UpdateALO12TmpDisQty(ParameterList, null);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        #endregion
    }
        public bool UpdateItemAndChanRefer(DataTable dtDisItemReferDiff, DataTable dtDisItemReferAdd, DataTable dtDisItemReferDelete,
            DataTable dtDisChanOld, DataTable dtDisChanNew, DataTable dtDisItemReferNew, string vItem, string vPeriod, DbTransaction RootDBT)
        {
            bool bResult = false;
            bool IsRootTranscation = false;

            try
            {
                //判斷是否有傳入Root Transcation 
                IsRootTranscation = (RootDBT == null) ? true : false;

                #region 啟動交易或指定RootTranscation

                if (IsRootTranscation)
                {
                    //獨立呼叫啟動Transcation
                    Conn = USEDB.CreateConnection();
                    Conn.Open();
                    DBT = Conn.BeginTransaction();
                }
                else
                {
                    DBT = RootDBT;
                }

                #endregion

                MaintainDisChanRefer BCODisChanRefer = new MaintainDisChanRefer(ConnectionDB);
                DataTable dtAvailableChan = null;
                ArrayList ParameterList = new ArrayList();
                ArrayList ParameterList2 = new ArrayList();

                //  處理刪除:dtDel
                if (dtDisItemReferDelete != null && dtDisItemReferDelete.Rows.Count > 0)
                {
                    #region
                    foreach (DataRow dr in dtDisItemReferDelete.Rows)
                    {
                        //a)呼叫MaintainDisItemRefer.DeleteDisItemRefer();
                        ParameterList.Clear();
                        ParameterList.Add(dr["ID"]);
                        ParameterList.Add(dr["DIS_NO"]);
                        ParameterList.Add(dr["ITEM"]);
                        ParameterList.Add(dr["PERIOD"]);
                        ParameterList.Add(dr["RITEM"]);
                        ParameterList.Add(dr["RPERIOD"]);
                        ParameterList.Add(dr["REFER_RATE"]);
                        ParameterList.Add(dr["UPDATEDATE"]);
                        ParameterList.Add(dr["UPDATEUID"]);
                        bResult = DeleteDisItemRefer(ParameterList, DBT);

                        //b)呼叫MaintainDisChanRefer.DeleteChanReferByReferItem();
                        if (dtDisChanOld != null)
                        {
                            foreach (DataRow dr2 in dtDisChanOld.Rows)
                            {
                                ParameterList2.Clear();
                                ParameterList2.Add(dr2["ID"]);//此處傳的ID無法使用,因為傳的是VDS_ALO_DIS_CHAN的,需要的是VDS_ALO_DIS_CHAN_REFER
                                ParameterList2.Add(dr["DIS_NO"]);
                                ParameterList2.Add(dr["ITEM"]);
                                ParameterList2.Add(dr2["CHAN_NO"]);
                                ParameterList2.Add(dr["PERIOD"]);
                                ParameterList2.Add(dr["RITEM"]);
                                ParameterList2.Add(dr["RPERIOD"]);
                                ParameterList2.Add(dr["REFER_RATE"]);
                                ParameterList2.Add(dr2["UPDATEDATE"]);
                                ParameterList2.Add(dr2["UPDATEUID"]);
                                bResult = BCODisChanRefer.DeleteChanReferByReferItem(ParameterList2, DBT);
                            }
                        }

                    }
                    #endregion
                }

                //  處理新增:dtAdd
                if (dtDisItemReferAdd != null && dtDisItemReferAdd.Rows.Count > 0)
                {
                    #region
                    if (dtDisChanNew == null || dtDisChanNew.Rows.Count <= 0)
                    {
                        MaintainDisRecord BCODisRecord = new MaintainDisRecord(ConnectionDB);
                        ParameterList.Clear();
                        ParameterList.Add(vItem);
                        ParameterList.Add(vPeriod);
                        dtAvailableChan = BCODisRecord.QueryForSelectDisChan(ParameterList);
                    }
                    else
                    {
                        dtAvailableChan = dtDisChanNew;
                    }

                    for (Int32 i = 0; i <= dtDisItemReferAdd.Rows.Count - 1; i++)
                    {
                        //20090804 added:先刪除
                        ParameterList.Clear();
                        ParameterList.Add(dtDisItemReferAdd.Rows[i]["DIS_NO"]);
                        ParameterList.Add(dtDisItemReferAdd.Rows[i]["ITEM"]);
                        ParameterList.Add(dtDisItemReferAdd.Rows[i]["PERIOD"]);
                        bResult = BCODisChanRefer.DeleteOldChanRefer(ParameterList, DBT);
                        break;
                    }


                    for (Int32 i = 0; i <= dtDisItemReferAdd.Rows.Count - 1; i++)
                    {
                        //1.逐筆建立商品參照檔資訊
                        ParameterList.Clear();
                        ParameterList.Add(dtDisItemReferAdd.Rows[i]["DIS_NO"]);
                        ParameterList.Add(dtDisItemReferAdd.Rows[i]["ITEM"]);
                        ParameterList.Add(dtDisItemReferAdd.Rows[i]["PERIOD"]);
                        ParameterList.Add(dtDisItemReferAdd.Rows[i]["RITEM"]);
                        ParameterList.Add(dtDisItemReferAdd.Rows[i]["RPERIOD"]);
                        ParameterList.Add(dtDisItemReferAdd.Rows[i]["REFER_RATE"]);
                        ParameterList.Add(dtDisItemReferAdd.Rows[i]["CREATEDATE"]);
                        ParameterList.Add(dtDisItemReferAdd.Rows[i]["CREATEUID"]);

                        bResult = CreateDisItemReferFor111(ParameterList, DBT);
                    }

                    for (Int32 i = 0; i <= dtDisItemReferNew.Rows.Count - 1; i++)//因為在此之前會做全部刪除的動作,但dtDisItemReferAdd不會記錄未變更的筆數,所以傳入dtDisItemReferNew
                    {
                        //2.建立品項通路參照資訊
                        for (Int32 k = 0; k <= dtAvailableChan.Rows.Count - 1; k++)
                        {
                            ParameterList2.Clear();
                            ParameterList2.Add(dtDisItemReferNew.Rows[i]["DIS_NO"]);
                            ParameterList2.Add(dtDisItemReferNew.Rows[i]["ITEM"]);
                            ParameterList2.Add(dtDisItemReferNew.Rows[i]["PERIOD"]);
                            ParameterList2.Add(dtAvailableChan.Rows[k]["CHAN_NO"]);
                            ParameterList2.Add(dtDisItemReferNew.Rows[i]["RITEM"]);
                            ParameterList2.Add(dtDisItemReferNew.Rows[i]["RPERIOD"]);
                            ParameterList2.Add(dtDisItemReferNew.Rows[i]["REFER_RATE"]);
                            ParameterList2.Add(dtDisItemReferNew.Rows[i]["CREATEDATE"]);
                            ParameterList2.Add(dtDisItemReferNew.Rows[i]["CREATEUID"]);

                            bResult = BCODisChanRefer.CreateDisChanRefer(ParameterList2, DBT);
                        }
                    }
                    #endregion
                }

                //  處理更新:dtUpdate
                if (dtDisItemReferDiff != null && dtDisItemReferDiff.Rows.Count > 0)
                {
                    #region
                    foreach (DataRow dr in dtDisItemReferDiff.Rows)
                    {
                        //1.逐筆更新商品參照檔資訊
                        ParameterList.Clear();

                        //old
                        ParameterList.Add(dr["DIS_NO"]);
                        ParameterList.Add(dr["ITEM"]);
                        ParameterList.Add(dr["PERIOD"]);
                        ParameterList.Add(dr["RITEM"]);
                        ParameterList.Add(dr["RPERIOD"]);
                        //new
                        ParameterList.Add(dr["DIS_NO"]);
                        ParameterList.Add(dr["ITEM"]);
                        ParameterList.Add(dr["PERIOD"]);
                        ParameterList.Add(dr["RITEM"]);
                        ParameterList.Add(dr["RPERIOD"]);
                        ParameterList.Add(dr["REFER_RATE"]);
                        ParameterList.Add(dr["UPDATEDATE"]);
                        ParameterList.Add(dr["UPDATEUID"]);

                        bResult = UpdateDisItemReferFor111_2(ParameterList, DBT);

                        if (dtDisChanNew == null || dtDisChanNew.Rows.Count <= 0)
                        {
                            MaintainDisRecord BCODisRecord = new MaintainDisRecord(ConnectionDB);
                            ParameterList.Clear();
                            ParameterList.Add(vItem);
                            ParameterList.Add(vPeriod);
                            dtAvailableChan = BCODisRecord.QueryForSelectDisChan(ParameterList);
                        }
                        else
                        {
                            dtAvailableChan = dtDisChanNew;
                        }

                        for (Int32 k = 0; k <= dtAvailableChan.Rows.Count - 1; k++)
                        {
                            //2.更新品項通路參照資訊
                            ParameterList2.Clear();
                            //old                            
                            ParameterList2.Add(dr["DIS_NO"]);
                            ParameterList2.Add(dr["ITEM"]);
                            ParameterList2.Add(dr["PERIOD"]);
                            ParameterList2.Add(dtAvailableChan.Rows[k]["CHAN_NO"]);
                            ParameterList2.Add(dr["RITEM"]);
                            ParameterList2.Add(dr["RPERIOD"]);
                            //new
                            ParameterList2.Add(dr["DIS_NO"]);
                            ParameterList2.Add(dr["ITEM"]);
                            ParameterList2.Add(dr["PERIOD"]);
                            ParameterList2.Add(dtAvailableChan.Rows[k]["CHAN_NO"]);
                            ParameterList2.Add(dr["RITEM"]);
                            ParameterList2.Add(dr["RPERIOD"]);
                            ParameterList2.Add(dr["REFER_RATE"]);
                            ParameterList2.Add(dr["UPDATEDATE"]);
                            ParameterList2.Add(dr["UPDATEUID"]);
                            bResult = BCODisChanRefer.UpdateDisChanRefer2(ParameterList2, DBT);
                        }

                    }
                    #endregion
                }


                #region 交易成功

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation成立
                    DBT.Commit();
                }

                bResult = true;
                #endregion
            }
            catch (Exception ex)
            {
                #region 交易失敗

                bResult = false;

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation失敗
                    DBT.Rollback();
                }

                #endregion

                throw GetNewException(ex);
            }
            finally
            {
                #region 判斷是否關閉交易連線

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation,關閉連線
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion

            }

            return bResult;
        }
Example #8
0
    private void GetParamUsedCount()
    {
        #region
        try
        {
            ALOModel.MaintainDisRecord BCO1 = new ALOModel.MaintainDisRecord(ConntionDB);
            ArrayList ParameterList = new ArrayList();//20091112
            ParameterList.Clear();
            ParameterList.Add(s_PARAMCODE);
            i_UsedCount = BCO1.QueryParamUsedCount(ParameterList).ToString();
        }
        catch (Exception ex) 
        {
            ErrorMsgLabel.Text = ex.Message;

        }
        #endregion

    }
Example #9
0
    //門市查詢
    protected void btnQ4_Click(object sender, EventArgs e)
    {
        if (SLP_STORE_S.Text.Trim() == "" && SLP_STORE_E.Text.Trim() == "")
        {
            lblErrorQ2.Text = "請輸入門市起迄";
            return;
        }
        else if (SLP_STORE_S.Text.Trim().Length > 0 && SLP_STORE_E.Text.Trim().Length == 0)
        {
            lblErrorQ2.Text = "請輸入門市迄";
            return;
        }
        else if (SLP_STORE_S.Text.Trim().Length == 0 && SLP_STORE_E.Text.Trim().Length > 0)
        {
            lblErrorQ2.Text = "請輸入門市起";
            return;
        }
        else if (SLP_STORE_S.TextBox_Name.Text == "查無資料")
        {
            lblErrorQ2.Text = "請輸入正確之門市起";
            return;
        }
        else if (SLP_STORE_E.TextBox_Name.Text == "查無資料")
        {
            lblErrorQ2.Text = "請輸入正確之門市迄";
            return;
        }
        else if (SLP_STORE_S.Text.Trim().Length > 0 && SLP_STORE_E.Text.Trim().Length > 0)
        {
            if (SLP_STORE_S.Text.Trim().Length > SLP_STORE_E.Text.Trim().Length)
            {
                lblErrorQ2.Text = "門市起不可大於門市迄";
                return;
            }
            else
            {
                if (string.Compare(SLP_STORE_S.Text.Trim(), SLP_STORE_E.Text.Trim()) > 0)
                {
                    lblErrorQ2.Text = "門市起不可大於門市迄";
                    return;
                }
            }
        }
        try
        {
            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(PageTimeStamp.Value + Session["UID"].ToString());
            ParameterList.Add("ALO121"); //V_PG_ID
            ParameterList.Add(txtDIS_NO.Text); //配本序號
            ParameterList.Add(hidITEM.Value); //配本商品品號
            ParameterList.Add(hidPERIOD.Value); //配本商品期別
            ParameterList.Add(SLP_STORE_S.Text); //貨架代號
            ParameterList.Add(SLP_STORE_E.Text); //貨架代號
            ParameterList.Add(Session["UID"].ToString()); //登入者
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            DataTable dt = new DataTable();
            dt = bco.QureryDisStoreForStoreRange(ParameterList);
            txtQueryTotRec.Text = dt.Rows.Count.ToString();
            ComputeTotQty(dt); //計算查詢總配量
            string SessionIDName = "ALO121_dt5" + PageTimeStamp.Value;
            Session[SessionIDName] = dt;
            if (dt.Rows.Count == 0)
            {
                lblErrorQ2.Text = "查無資料";
                GridView2.DataSource = null;
            }
            else
                GridView2.DataSource = CopyTable(dt);
            GridView2.DataBind();
            Resize_Div(GridView2.Rows.Count);
            UpdatePanel1.Update();
        }
        catch (Exception ex) { this.lblErrorQ2.Text = ex.Message; }
    }
Example #10
0
    //門市篩選
    protected void btnQ3_Click(object sender, EventArgs e)
    {
        try
        {
            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(PageTimeStamp.Value + Session["UID"].ToString());
            ParameterList.Add("ALO121"); //V_PG_ID
            ParameterList.Add(txtDIS_NO.Text); //配本序號
            ParameterList.Add(hidITEM.Value); //配本商品品號
            ParameterList.Add(hidPERIOD.Value); //配本商品期別
            ParameterList.Add(rblS.SelectedValue); //
            ParameterList.Add(rblE.SelectedValue); //
            ParameterList.Add(rblO.SelectedValue); //
            ParameterList.Add(Session["UID"].ToString()); //登入者
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            DataTable dt = new DataTable();
            dt = bco.QureryDisStoreForSales(ParameterList);
            txtQueryTotRec.Text = dt.Rows.Count.ToString();
            ComputeTotQty(dt); //計算查詢總配量
            string SessionIDName = "ALO121_dt5" + PageTimeStamp.Value;
            Session[SessionIDName] = dt;
            if (dt.Rows.Count == 0)
            {
                lblErrorQ2.Text = "查無資料";
                GridView2.DataSource = null;
            }
            else
                GridView2.DataSource = CopyTable(dt);
            GridView2.DataBind();
            Resize_Div(GridView2.Rows.Count);
            UpdatePanel1.Update();
        }
        catch (Exception ex) { this.lblErrorQ2.Text = ex.Message; }
    }
Example #11
0
    //區域查詢
    protected void btnQ1_Click(object sender, EventArgs e)
    {
        if (SLP_CHAN_NO_Q.Text.Trim() == "" && SLP_Z_O.Text.Trim() == "" && SLP_BUSINESS_NO.Text.Trim() == "" && SLP_AREA_CODE.Text.Trim() == "" && SLP_D_O.Text.Trim() == "")
        {
            lblErrorQ2.Text = "請至少需輸入一項查詢條件";
            return;
        }
        else if (SLP_D_O.Text.Trim() != "" && SLP_Z_O.Text.Trim() == "")
        {
            lblErrorQ2.Text = "請輸入該區課所屬營業所";
            return;
        }
        else if (SLP_D_O.TextBox_Name.Text == "查無資料")
        {
            lblErrorQ2.Text = "請輸入正確之營業所下轄區課";
            return;
        }
        try
        {
            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(PageTimeStamp.Value + Session["UID"].ToString());
            ParameterList.Add("ALO121"); //V_PG_ID
            ParameterList.Add(txtDIS_NO.Text); //配本序號
            ParameterList.Add(hidITEM.Value); //配本商品品號
            ParameterList.Add(hidPERIOD.Value); //配本商品期別
            ParameterList.Add(SLP_CHAN_NO_Q.Text); //通路
            ParameterList.Add(SLP_Z_O.Text); //營業所
            ParameterList.Add(SLP_BUSINESS_NO.Text); //商圈
            ParameterList.Add(SLP_AREA_CODE.Text); //縣市
            ParameterList.Add(SLP_D_O.Text); //區課
            ParameterList.Add(Session["UID"].ToString()); //登入者
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            DataTable dt = new DataTable();
            dt = bco.QueryDisStoreForArea(ParameterList);
            txtQueryTotRec.Text = dt.Rows.Count.ToString();
            ComputeTotQty(dt); //計算查詢總配量

            string SessionIDName = "ALO121_dt5" + PageTimeStamp.Value;
            Session[SessionIDName] = dt;
            if (dt.Rows.Count == 0)
            {
                lblErrorQ2.Text = "查無資料";
                GridView2.DataSource = null;
            }
            else
                GridView2.DataSource = CopyTable(dt);
            GridView2.DataBind();
            Resize_Div(GridView2.Rows.Count);
            UpdatePanel1.Update();
        }
        catch (Exception ex) { this.lblErrorQ2.Text = ex.Message; }
    }
Example #12
0
    //解除
    protected void btnRelease4_Click(object sender, EventArgs e)
    {
        string SessionIDName = "ALO121_dt3" + PageTimeStamp.Value;
        DataTable dt = (DataTable)Session[SessionIDName];
        dt.PrimaryKey = new DataColumn[] { dt.Columns["N_ROWNUM"] };
        try
        {
            DataRow Dr = dt.Rows.Find(int.Parse(hidNum_Chan.Value));
            DateTime DT = DateTime.Now; //異動時間
            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(txtDIS_NO.Text); //配本序號
            ParameterList.Add(hidITEM.Value); //配本商品品號
            ParameterList.Add(hidPERIOD.Value); //配本商品期別
            ParameterList.Add(Dr["CHAN_NO"].ToString()); //配本通路
            ParameterList.Add(Session["UID"].ToString()); //登入者
            ParameterList.Add(DT);
            ParameterList.Add(Dr["UPDATEUID"].ToString());
            ParameterList.Add(Dr["UPDATEDATE"].ToString());
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            bco.UnLockDisChan(ParameterList, null);
            Dr["IS_LOCK"] = "0";
            Dr["UPDATEUID"] = Session["UID"].ToString();
            Dr["UPDATEDATE"] = DT; //修改DataTable的異動時間,以與DB同步
            dt.AcceptChanges();
            Session[SessionIDName] = dt;
            SLP_CHAN_NO1.Text = Dr["CHAN_NO"].ToString();
            btnQuery3_Click(SLP_CHAN_NO1.Text);
            string SessionIDName1 = "ALO121_dt5" + PageTimeStamp.Value;
            GridView2.DataSource = CopyTable((DataTable)Session[SessionIDName1]);
            GridView2.DataBind();
            Resize_Div(GridView2.Rows.Count);
            UpdatePanel1.Update();
        }
        catch (Exception ex) { this.lblErrorQ1.Text = ex.Message; lblErrorQ1.Visible = true; dt.RejectChanges(); }
    }
Example #13
0
    //確認更新(從ALO123<批次調整>回來後做的更新)
    protected void btnConfirm1_Click(object sender, EventArgs e)
    {
        try
        {
            ArrayList ParameterList = new ArrayList();//20091113

            if (ViewState["hidPG_ID"].ToString() == "ALO123")
            {
                ParameterList.Clear();
                ParameterList.Add(PageTimeStamp.Value + Session["UID"].ToString());
                ParameterList.Add(txtDIS_NO.Text); //配本序號
                ParameterList.Add(Request.QueryString["pItem"]); //配本商品品號
                ParameterList.Add(Request.QueryString["pPeriod"]); //配本商品期別
                ParameterList.Add(Request.QueryString["pChanNo"]);
                ParameterList.Add(Session["UID"].ToString()); //登入者
                ParameterList.Add("ALO121"); //V_PG_ID
                BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
                DataTable dt = new DataTable();
                bco.UpdateDisStoreFromTmp(ParameterList, null);
                lblErrorQ1.Text = "批次更新成功 !!";
                lblErrorQ1.Visible = true;
            }
            if (ViewState["hidGridView_PG_ID"].ToString() == "GridView2")
            {
                ParameterList.Clear();
                ParameterList.Add(PageTimeStamp.Value + Session["UID"].ToString());
                ParameterList.Add(txtDIS_NO.Text); //配本序號
                ParameterList.Add(hidITEM.Value); //配本商品品號
                ParameterList.Add(hidPERIOD.Value); //配本商品期別
                ParameterList.Add(hidChan_No.Value);
                ParameterList.Add(Session["UID"].ToString()); //登入者
                ParameterList.Add("ALO121"); //V_PG_ID
                BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
                DataTable dt = new DataTable();
                bco.UpdateDisStoreFromTmp(ParameterList, null);
                lblErrorQ1.Text += "<br \\>門市明細更新成功 !!";
                lblErrorQ1.Visible = true;
            }
            get_ZO(txtDIS_NO.Text);
            UpdatePanel3.Update();
            btnConfirm1.Enabled = false;
            ViewState["hidPG_ID"] = "";
            ViewState["hidGridView_PG_ID"] = "";
        }
        catch (Exception ex) { this.lblErrorQ1.Text = ex.Message; lblErrorQ1.Visible = true; }
    }
Example #14
0
    //配量微調
    protected void btnFineTune_Click(object sender, EventArgs e)
    {
        try
        {
            #region 刪除VDS_ALO_122_TMP

            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(PageTimeStamp.Value + Session["UID"].ToString());
            ParameterList.Add(Session["UID"].ToString()); //登入者
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            bco.DeleteOldTmpDataFor122(ParameterList, null);

            #endregion

            #region 新增VDS_ALO_122_TMP

            ParameterList.Clear();
            ParameterList.Add(PageTimeStamp.Value + Session["UID"].ToString());
            ParameterList.Add(Session["UID"].ToString());
            bco.Create122TmpDataFrom121(ParameterList, null);
            Response.Redirect("ALO122.aspx?Code=ALO12&pPG_ID=ALO121&PageTimeStamp=" + PageTimeStamp.Value +
                              "&pDate=" + DateTime.Parse(SLP_ST_ACCEPT_DATE.Text).ToShortDateString() +
                              "&pDisNo=" + txtDIS_NO.Text +
                              "&pItem=" + hidITEM.Value +
                              "&pPeriod=" + hidPERIOD.Value +
                              "&pChanNo=" + hidChan_No2.Value +
                              "&pDIS_TOT_OQTY=" + txtDIS_TOT_OQTY.Text +  //通路合計
                              "&pN_DIS_TOT_QTY=" + txtN_DIS_TOT_QTY.Text + //路線合計
                              "&pN_MAX_ROUTE=" + SLP_N_MAX_ROUTE.Text +
                              "&pN_MIN_ROUTE=" + SLP_N_MIN_ROUTE.Text +
                              "&pRoot_No=" + hidRoot_No.Value +
                              "&pN_DisTotQty=" + txtZO_Sum.Text + //總配量
                              "&pN_PageTotQty=" + lblQueryTotRec.Text //頁面合計配量 
                              );

            #endregion

        }
        catch (Exception ex) { this.lblErrorQ1.Text = ex.Message; lblErrorQ1.Visible = true; }
    }
Example #15
0
    //GridView2的更新鈕
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        Button btn = sender as Button;
        GridViewRow gr = (btn.BindingContainer as GridViewRow);
        int i = gr.RowIndex;
        TextBox tb = (TextBox)GridView2.Rows[i].FindControl("txtDIS_QTY");
        Label lb = (Label)GridView2.Rows[i].FindControl("lblDIS_QTY");
        if (tb.Text.Trim().Length > 0)
        {
            uint idx;
            bool isNum = uint.TryParse(tb.Text, out idx);
            if (isNum)
            {
                if (idx < 0)
                {
                    ErrorMsgLabel.Text = "配本數量必須大於0";
                    ErrorMsgLabel.Visible = true;
                    return;
                }
                string SessionIDName = "ALO121_dt5" + PageTimeStamp.Value;
                DataTable dt = (DataTable)Session[SessionIDName];
                dt.PrimaryKey = new DataColumn[] { dt.Columns["ID"] };

                ArrayList ParameterList = new ArrayList();//20091113

                try
                {
                    DataRow Dr = dt.Rows.Find(((Label)GridView2.Rows[i].FindControl("lblID")).Text);
                    DateTime DT = DateTime.Now; //異動時間
                    ParameterList.Clear();
                    ParameterList.Add(((Label)GridView2.Rows[i].FindControl("lblID")).Text); //ID
                    ParameterList.Add(txtDIS_NO.Text); //配本序號
                    ParameterList.Add(Dr["ITEM"].ToString()); //配本商品品號
                    ParameterList.Add(Dr["PERIOD"].ToString()); //配本商品期別
                    ParameterList.Add(Dr["CHAN_NO"].ToString()); //配本通路
                    ParameterList.Add(Dr["STORE"].ToString()); //配本門市
                    ParameterList.Add(tb.Text); //配本數量
                    ParameterList.Add(Session["UID"].ToString()); //登入者
                    ParameterList.Add(Dr["UPDATEUID"].ToString());
                    ParameterList.Add(Dr["UPDATEDATE"].ToString());
                    ParameterList.Add(DT);
                    BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
                    bco.UpdateStoreDisQtyFor121(ParameterList, null);
                    //更新通路合計配量及路線合計配量
                    txtDIS_TOT_OQTY.Text = Convert.ToString(int.Parse(txtDIS_TOT_OQTY.Text) + (int.Parse(tb.Text) - int.Parse(lb.Text)));
                    txtN_DIS_TOT_QTY.Text = txtDIS_TOT_OQTY.Text;

                    Dr["DIS_QTY"] = tb.Text;
                    Dr["UPDATEUID"] = Session["UID"].ToString();
                    Dr["UPDATEDATE"] = DT; //修改DataTable的異動時間,以與DB同步
                    dt.AcceptChanges();
                    Session[SessionIDName] = dt;
                    GridView2.DataSource = CopyTable(dt);
                    GridView2.DataBind();
                    btnConfirm1.Enabled = true;
                    ViewState["hidGridView_PG_ID"] = "GridView2";//用以判斷是否門市清單已修改
                    UpdatePanel1.Update();
                    btnPrev2.Enabled = true;
                    btnNext2.Enabled = true;
                    btnQuery2.Enabled = true;
                    btnQuery4.Enabled = true;
                }
                catch (Exception ex) { this.ErrorMsgLabel.Text = ex.Message; ErrorMsgLabel.Visible = true; dt.RejectChanges(); }
            }
            else
            {
                //ScriptManager.RegisterStartupScript(this, this.GetType(), "ALO121_Alert", "alert('請輸入數字');", true);
                ErrorMsgLabel.Text = "請輸入數字";
                ErrorMsgLabel.Visible = true;
                return;
            }
        }
        else
        {
            //ScriptManager.RegisterStartupScript(this, this.GetType(), "ALO121_Alert", "alert('配本數量必須大於0');", true);
            ErrorMsgLabel.Text = "配本數量必須大於0";
            ErrorMsgLabel.Visible = true;
            return;
        }
    }
Example #16
0
    //查詢營業所
    private void get_ZO(string dis_no)
    {
        try
        {
            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(dis_no); //配本序號
            DataTable dt = new DataTable();
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            dt = bco.QueryDisQtyForZO(ParameterList);
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    switch (dr["Z_O"].ToString())
                    {
                        case "A":
                            txtZO_A.Text = dr["Z_O_SUM_DIS_QTY"].ToString().Trim().Length == 0 ? "0" : dr["Z_O_SUM_DIS_QTY"].ToString().Trim();
                            break;
                        case "B":
                            txtZO_B.Text = dr["Z_O_SUM_DIS_QTY"].ToString().Trim().Length == 0 ? "0" : dr["Z_O_SUM_DIS_QTY"].ToString().Trim();
                            break;
                        case "D":
                            txtZO_D.Text = dr["Z_O_SUM_DIS_QTY"].ToString().Trim().Length == 0 ? "0" : dr["Z_O_SUM_DIS_QTY"].ToString().Trim();
                            break;
                        case "E":
                            txtZO_E.Text = dr["Z_O_SUM_DIS_QTY"].ToString().Trim().Length == 0 ? "0" : dr["Z_O_SUM_DIS_QTY"].ToString().Trim();
                            break;
                        case "H":
                            txtZO_H.Text = dr["Z_O_SUM_DIS_QTY"].ToString().Trim().Length == 0 ? "0" : dr["Z_O_SUM_DIS_QTY"].ToString().Trim();
                            break;
                        case "C":
                            txtZO_C.Text = dr["Z_O_SUM_DIS_QTY"].ToString().Trim().Length == 0 ? "0" : dr["Z_O_SUM_DIS_QTY"].ToString().Trim();
                            break;
                    }
                }
                txtZO_Sum.Text = Convert.ToString(Int32.Parse(txtZO_A.Text) + Int32.Parse(txtZO_B.Text) + Int32.Parse(txtZO_C.Text) + Int32.Parse(txtZO_D.Text) + Int32.Parse(txtZO_E.Text) + Int32.Parse(txtZO_H.Text));
            }
            dt.Clear();
            dt.Dispose();
        }
        catch (Exception ex) { this.lblErrorQ1.Text = ex.Message; lblErrorQ1.Visible = true; }
    }
Example #17
0
    /// <summary>
    /// 查詢配本門市
    /// </summary>
    /// <param name="dis_no">配本序號</param>
    /// <param name="item">配本商品品號</param>
    /// <param name="period">配本商品期別</param>
    /// <param name="from">0:原查詢,1:從其它程式回來的查詢</param>
    private void getStore(string dis_no, string item, string period)
    {
        try
        {
            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(dis_no); //配本序號
            ParameterList.Add(item); //配本商品品號
            ParameterList.Add(period); //配本商品期別
            ParameterList.Add(PageTimeStamp.Value + Session["UID"].ToString());
            ParameterList.Add(Session["UID"].ToString()); //登入者
            DataTable dt = new DataTable();
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            if (Request.QueryString["PageTimeStamp"] != null)//由其它頁面返回
            {
                if (!(item == Request.QueryString["pItem"] && period == Request.QueryString["pPeriod"]))
                {
                    dt = bco.CreateAndQueryDisStoreFor121(ParameterList);
                    if (ViewState["isChanged"] != null)
                        if (ViewState["isChanged"].ToString() == "0")
                            ViewState["isChanged"] = "1";
                }
                else
                {
                    //ViewState["isChanged"] = 0:未查詢過其它品號、期別資料,使用QueryDisStoreFor121查詢門市資料
                    //1:表已查過其它品號、期別資料,原資料已被刪除,使用CreateAndQueryDisStoreFor121查詢門市資料
                    //null:表不是從ALO123回來的情況,使用CreateAndQueryDisStoreFor121查詢門市資料
                    if (ViewState["isChanged"] != null)
                        if (ViewState["isChanged"].ToString() == "0")
                        {
                            if (Request.QueryString["pChanNo"] != null)//曾傳通路至其它頁面
                                if (Request.QueryString["pChanNo"] != "")
                                {
                                    QueryChan('1');
                                    return;
                                }
                                else //由其它頁面返回,未傳通路2資料至其它頁面,查詢全通路資料
                                    dt = bco.QueryDisStoreFor121(ParameterList);
                            else
                                dt = bco.QueryDisStoreFor121(ParameterList);
                        }
                        else
                            dt = bco.CreateAndQueryDisStoreFor121(ParameterList);
                    else
                        dt = bco.CreateAndQueryDisStoreFor121(ParameterList);
                }
            }
            else
                dt = bco.CreateAndQueryDisStoreFor121(ParameterList);

            txtQueryTotRec.Text = dt.Rows.Count.ToString();
            ComputeTotQty(dt); //計算查詢總配量

            string SessionIDName = "ALO121_dt5" + PageTimeStamp.Value;
            Session[SessionIDName] = dt;

            if (dt.Rows.Count > 0)
            {
                btnPOP_DisStoreSet.Enabled = (SLP_APPROVE_DATE.Text == string.Empty);
                GridView2.DataSource = CopyTable(dt);//產生Rx_ITEM及Rx_PERIOD都不為空值的DataTable;
                GridView2.DataBind();
                Resize_Div(GridView2.Rows.Count);
                UpdatePanel1.Update();

            }
            else
            {
                btnPOP_DisStoreSet.Enabled = false;
                GridView2.DataSource = null;
                GridView2.DataBind();
                Resize_Div(GridView2.Rows.Count);
                UpdatePanel1.Update();
            }
        }
        catch (Exception ex) { this.lblErrorQ1.Text = ex.Message; lblErrorQ1.Visible = true; }
    }
Example #18
0
    //數量查詢
    protected void btnQ5_Click(object sender, EventArgs e)
    {
        if (SLP_DIS_NO.Text.Trim() == "" && SLP_BUY_FLAG.Text.Trim() == "" && txtN_RANK_LEVEL.Text.Trim() == "" && SLP_B1_ST_ACCEPT_QTY.Text.Trim() == "" && SLP_B1_POS_QTY.Text.Trim() == "" && SLP_B1_SALES_QTY.Text.Trim() == "" && SLP_POS_RATE.Text.Trim() == "" && SLP_SALES_QTY.Text.Trim() == "" && SLP_SALES_RATE.Text.Trim() == "" && SLP_B2_ST_ACCEPT_QTY.Text.Trim() == "" && SLP_B2_SALES_QTY.Text.Trim() == "" && SLP_B3_ST_ACCEPT_QT.Text.Trim() == "" && SLP_B3_SALES_QTY.Text.Trim() == "" && SLP_IR1_ST_ACCEPT_QTY.Text.Trim() == "" && SLP_IR1_SALES_QTY.Text.Trim() == "" && SLP_IR2_ST_ACCEPT_QTY.Text.Trim() == "" && SLP_IR2_SALES_QTY.Text.Trim() == "" && SLP_IR3_ST_ACCEPT_QTY.Text.Trim() == "" && SLP_IR3_SALES_QTY.Text.Trim() == "" && SLP_IR4_ST_ACCEPT_QTY.Text.Trim() == "" && SLP_IR4_SALES_QTY.Text.Trim() == "")
        {
            lblErrorQ2.Text = "請至少輸入一項選擇條件";
            return;
        }
        try
        {
            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(PageTimeStamp.Value + Session["UID"].ToString());
            ParameterList.Add("ALO121"); //V_PG_ID
            ParameterList.Add(txtDIS_NO.Text); //配本序號
            ParameterList.Add(hidITEM.Value); //配本商品品號
            ParameterList.Add(hidPERIOD.Value); //配本商品期別
            ParameterList.Add(Session["UID"].ToString()); //登入者
            if (SLP_BUY_FLAG.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_BUY_FLAG.Text); //買斷判斷
            ParameterList.Add(txtN_RANK_LEVEL.Text); //門市等級
            ParameterList.Add(Resolve_Op(SLP_DIS_NO.Operator)); //配本數量運算子
            if (SLP_DIS_NO.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_DIS_NO.Text); //配本數量
            ParameterList.Add(Resolve_Op(SLP_POS_RATE.Operator)); //POS銷%運算子
            if (SLP_POS_RATE.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_POS_RATE.Text); //POS銷%
            ParameterList.Add(Resolve_Op(SLP_SALES_QTY.Operator)); //平均實銷(實銷數量運算子)
            if (SLP_SALES_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_SALES_QTY.Text); //平均實銷(實銷數量)
            ParameterList.Add(Resolve_Op(SLP_SALES_RATE.Operator)); //平均銷%(實銷率%運算子)
            if (SLP_SALES_RATE.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_SALES_RATE.Text); //平均銷%(實銷率%)
            ParameterList.Add(Resolve_Op(SLP_B1_ST_ACCEPT_QTY.Operator)); //前期進貨
            if (SLP_B1_ST_ACCEPT_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_B1_ST_ACCEPT_QTY.Text); //前期進貨
            ParameterList.Add(Resolve_Op(SLP_B1_SALES_QTY.Operator)); //前期實銷運算子
            if (SLP_B1_SALES_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_B1_SALES_QTY.Text); //前期實銷
            ParameterList.Add(Resolve_Op(SLP_B1_POS_QTY.Operator)); //前期POS運算子
            if (SLP_B1_POS_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_B1_POS_QTY.Text); //前期POS
            ParameterList.Add(Resolve_Op(SLP_B2_ST_ACCEPT_QTY.Operator)); //前2期進貨運算子
            if (SLP_B2_ST_ACCEPT_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_B2_ST_ACCEPT_QTY.Text); //前2期進貨
            ParameterList.Add(Resolve_Op(SLP_B2_SALES_QTY.Operator)); //前2期實銷運算子
            if (SLP_B2_SALES_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_B2_SALES_QTY.Text); //前2期實銷
            ParameterList.Add(Resolve_Op(SLP_B3_ST_ACCEPT_QT.Operator)); //前3期進貨運算子
            if (SLP_B3_ST_ACCEPT_QT.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_B3_ST_ACCEPT_QT.Text); //前3期進貨
            ParameterList.Add(Resolve_Op(SLP_B3_SALES_QTY.Operator)); //前3期實銷運算子
            if (SLP_B3_SALES_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_B3_SALES_QTY.Text); //前3期實銷
            ParameterList.Add(Resolve_Op(SLP_IR1_ST_ACCEPT_QTY.Operator)); //參照1進貨運算子
            if (SLP_IR1_ST_ACCEPT_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_IR1_ST_ACCEPT_QTY.Text); //參照1進貨
            ParameterList.Add(Resolve_Op(SLP_IR2_ST_ACCEPT_QTY.Operator)); //參照2進貨運算子
            if (SLP_IR2_ST_ACCEPT_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_IR2_ST_ACCEPT_QTY.Text); //參照2進貨
            ParameterList.Add(Resolve_Op(SLP_IR3_ST_ACCEPT_QTY.Operator)); //參照3進貨運算子
            if (SLP_IR3_ST_ACCEPT_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_IR3_ST_ACCEPT_QTY.Text); //參照3進貨
            ParameterList.Add(Resolve_Op(SLP_IR4_ST_ACCEPT_QTY.Operator)); //參照4進貨運算子
            if (SLP_IR4_ST_ACCEPT_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_IR4_ST_ACCEPT_QTY.Text); //參照4進貨
            ParameterList.Add(Resolve_Op(SLP_IR1_SALES_QTY.Operator)); //參照1實銷運算子
            if (SLP_IR1_SALES_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_IR1_SALES_QTY.Text); //參照1實銷
            ParameterList.Add(Resolve_Op(SLP_IR2_SALES_QTY.Operator)); //參照2實銷運算子
            if (SLP_IR2_SALES_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_IR2_SALES_QTY.Text); //參照2實銷
            ParameterList.Add(Resolve_Op(SLP_IR3_SALES_QTY.Operator)); //參照3實銷運算子
            if (SLP_IR3_SALES_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_IR3_SALES_QTY.Text); //參照3實銷
            ParameterList.Add(Resolve_Op(SLP_IR4_SALES_QTY.Operator)); //參照4實銷運算子
            if (SLP_IR4_SALES_QTY.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_IR4_SALES_QTY.Text); //參照4實銷
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            DataTable dt = new DataTable();
            dt = bco.QureryDisStoreForQty(ParameterList);
            txtQueryTotRec.Text = dt.Rows.Count.ToString();
            ComputeTotQty(dt); //計算查詢總配量

            string SessionIDName = "ALO121_dt5" + PageTimeStamp.Value;
            Session[SessionIDName] = dt;
            if (dt.Rows.Count == 0)
            {
                lblErrorQ2.Text = "查無資料";
                GridView2.DataSource = null;
            }
            else
                GridView2.DataSource = CopyTable(dt);
            GridView2.DataBind();
            Resize_Div(GridView2.Rows.Count);
            UpdatePanel1.Update();
        }
        catch (Exception ex) { this.lblErrorQ2.Text = ex.Message; }
    }
        public bool CreateItemAndChanRefer(DataTable dtDisItemRefer, DataTable dtDisChan, string vDisNo, string vItem, string vPeriod, DbTransaction RootDBT)
        {
            #region
            bool bResult = false;
            bool IsRootTranscation = false;

            try
            {
                //判斷是否有傳入Root Transcation 
                IsRootTranscation = (RootDBT == null) ? true : false;


                #region 啟動交易或指定RootTranscation

                if (IsRootTranscation)
                {
                    //獨立呼叫啟動Transcation
                    Conn = USEDB.CreateConnection();
                    Conn.Open();
                    DBT = Conn.BeginTransaction();
                    System.Web.HttpContext.Current.Trace.Warn(string.Format("使用者:{0} 於{1}.CreateItemAndChanRefer.Open Connetction:{2} ",
                                                                     System.Web.HttpContext.Current.Session["UID"].ToString(),
                                                                      DateTime.Now.ToString(),
                                                                      DBT.GetHashCode().ToString())
                                                              );

                }
                else
                {
                    DBT = RootDBT;
                    System.Web.HttpContext.Current.Trace.Warn(string.Format("使用者:{0} 於{1}.CreateItemAndChanRefer.Used Old Connetction:{2} ",
                                                                     System.Web.HttpContext.Current.Session["UID"].ToString(),
                                                                      DateTime.Now.ToString(),
                                                                      DBT.GetHashCode().ToString())
                                                              );

                }

                #endregion

                DataTable dtAvailableChan = null;
                ArrayList ParameterList = new ArrayList();
                ArrayList ParameterList2 = new ArrayList();


                //4.1) 檢查目前配本通路暫存檔是否有值,無值則選擇所有可配通路 
                if (dtDisChan == null || dtDisChan.Rows.Count <= 0)
                {
                    MaintainDisRecord BCODisRecord = new MaintainDisRecord(ConnectionDB);
                    ParameterList.Clear();
                    ParameterList.Add(vItem);
                    ParameterList.Add(vPeriod);
                    dtAvailableChan = BCODisRecord.QueryForSelectDisChan(ParameterList);
                }
                else
                {
                    dtAvailableChan = dtDisChan;
                }

                //4.2) 處理新增

                if (dtDisItemRefer != null && dtDisItemRefer.Rows.Count > 0)
                {
                    MaintainDisChanRefer BCODisChanRefer = new MaintainDisChanRefer(ConnectionDB);


                    for (Int32 i = 0; i <= dtDisItemRefer.Rows.Count - 1; i++)
                    {
                        //1.逐筆建立商品參照檔資訊
                        ParameterList.Clear();
                        ParameterList.Add(vDisNo);
                        ParameterList.Add(vItem);
                        ParameterList.Add(vPeriod);
                        ParameterList.Add(dtDisItemRefer.Rows[i]["RITEM"]);
                        ParameterList.Add(dtDisItemRefer.Rows[i]["RPERIOD"]);
                        ParameterList.Add(dtDisItemRefer.Rows[i]["REFER_RATE"]);
                        ParameterList.Add(dtDisItemRefer.Rows[i]["CREATEDATE"]);
                        ParameterList.Add(dtDisItemRefer.Rows[i]["CREATEUID"]);

                        bResult = CreateDisItemReferFor111(ParameterList, DBT);

                        //2.建立品項通路參照資訊

                        for (Int32 k = 0; k <= dtAvailableChan.Rows.Count - 1; k++)
                        {

                            ParameterList2.Clear();
                            ParameterList2.Add(vDisNo);
                            ParameterList2.Add(vItem);
                            ParameterList2.Add(vPeriod);
                            ParameterList2.Add(dtAvailableChan.Rows[k]["CHAN_NO"]);
                            ParameterList2.Add(dtDisItemRefer.Rows[i]["RITEM"]);
                            ParameterList2.Add(dtDisItemRefer.Rows[i]["RPERIOD"]);
                            ParameterList2.Add(dtDisItemRefer.Rows[i]["REFER_RATE"]);
                            ParameterList2.Add(dtDisItemRefer.Rows[i]["CREATEDATE"]);
                            ParameterList2.Add(dtDisItemRefer.Rows[i]["CREATEUID"]);

                            bResult = BCODisChanRefer.CreateDisChanRefer(ParameterList2, DBT);
                        }
                    }
                }

                #region 交易成功

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation成立
                    DBT.Commit();
                }

                #endregion
            }
            catch (Exception ex)
            {
                #region 交易失敗

                bResult = false;

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation失敗
                    DBT.Rollback();
                }

                #endregion

                throw GetNewException(ex);
            }
            finally
            {
                #region 判斷是否關閉交易連線

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation,關閉連線
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion

            }

            return bResult;
            #endregion
        }
Example #20
0
    private void UC_RecLast()
    {
        try
        {
            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            DataTable dt = new DataTable();
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            dt = bco.QueryDisMainFor121(ParameterList, '4');
            if (dt.Rows.Count > 0)
            {
                Clear_Fields();
                txtDIS_NO.Text = dt.Rows[0]["DIS_NO"].ToString();
                btnQuery1_Click(null, null);
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
    }
    /// <summary>
    /// 查詢資料
    /// </summary>
    private void QueryData()
    {
        #region
        try
        {
            string SessionIDName;
            DataTable dt = new DataTable();

            if (Session[s_SessionIDName] != null)
            {
                if (dtDisStore == null)
                {
                    dt = (DataTable)Session[s_SessionIDName];
                }
                else
                {
                    dt = dtDisStore;
                }
            }
            else
            {
                #region 查詢設定資料
                ALOModel.MaintainDisRecord BCO = new ALOModel.MaintainDisRecord(ConnectionDB);
                ArrayList ParameterList = new ArrayList();
                ParameterList.Clear();
                ParameterList.Add(s_DIS_NO);
                ParameterList.Add(s_ITEM);
                ParameterList.Add(s_PERIOD);
                ParameterList.Add(PageTimeStamp.Value + Session["UID"].ToString());
                ParameterList.Add(Session["UID"].ToString()); //登入者
                ParameterList.Add(s_WorkId);

                dt = BCO.QueryDisStoreFor121(ParameterList);

                #endregion
            }


            #region DataBind

            if (dt != null && dt.Rows.Count > 0)
            {
                dtDisStore = dt.Copy();
                GridView1.DataSource = dtDisStore;
                GridView1.PageSize = 15;

                if (SLP_Store1.Text.Trim() != "")
                {
                    GridView1.PageIndex = GetPageIndexByParam(SLP_Store1.Text.Trim());
                }
                else
                {
                    GridView1.PageIndex = 0;
                }

                GridView1.PagerStyle.HorizontalAlign = HorizontalAlign.Left;
                GridView1.DataBind();

                //up_GridView.Update();
                dt.Dispose();
            }

            #endregion
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }

        #endregion
    }
Example #22
0
    /// <summary>
    /// 通路2查詢bco.QueryDisStoreForChanAndRoute
    /// </summary>
    /// <param name="from">0:原查詢,1:由其它程式返回</param>
    private void QueryChan(char from)
    {
        try
        {
            if (SLP_N_MAX_ROUTE.Text.Trim().Length > 0 && SLP_N_MIN_ROUTE.Text.Trim().Length > 0)
                if (string.Compare(SLP_N_MAX_ROUTE.Text, SLP_N_MIN_ROUTE.Text) > 0)
                {
                    lblErrorQ1.Visible = true;
                    lblErrorQ1.Text = "路線起不可大於路線迄";
                    return;
                }
            if (from == '0')
                //查詢合計欄位:通路店數、通路合計配量、路線店數、路線合計配量
                getTotal_Chan(txtDIS_NO.Text, SLP_ST_ACCEPT_DATE.Text.Length == 0 ? "" : Convert.ToDateTime(SLP_ST_ACCEPT_DATE.Text).ToString("yyyyMMdd"), hidITEM.Value, hidPERIOD.Value, SLP_CHAN_NO2.Text, SLP_N_MAX_ROUTE.Text, SLP_N_MIN_ROUTE.Text, '2');

            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(PageTimeStamp.Value + Session["UID"].ToString());
            ParameterList.Add(txtDIS_NO.Text); //配本序號
            ParameterList.Add(hidITEM.Value); //配本商品品號
            ParameterList.Add(hidPERIOD.Value); //配本商品期別
            ParameterList.Add(hidChan_No2.Value); //通路2
            ParameterList.Add(SLP_N_MAX_ROUTE.Text); //路線起
            ParameterList.Add(SLP_N_MIN_ROUTE.Text); //路線迄
            ParameterList.Add(Session["UID"].ToString()); //登入者
            DataTable dt = new DataTable();
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            dt = bco.QueryDisStoreForChanAndRoute(ParameterList);
            txtQueryTotRec.Text = "0";
            if (dt.Rows.Count > 0)
            {
                txtQueryTotRec.Text = dt.Rows.Count.ToString();//GridView2的查詢總筆數
                ComputeTotQty(dt); //計算查詢總配量
            }
            string SessionIDName = "ALO121_dt5" + PageTimeStamp.Value;
            Session[SessionIDName] = dt;
            if (dt.Rows.Count == 0)
                GridView2.DataSource = null;
            else
                GridView2.DataSource = CopyTable(dt);
            GridView2.DataBind();
            Resize_Div(GridView2.Rows.Count);
            UpdatePanel1.Update();
        }
        catch (Exception ex)
        {
            if (ex.Message.IndexOf("UPDATE門市121配本暫存檔時發生異常,因無資料") != -1)
            {
                lblErrorQ1.Text = "無此通路路線資料";
                lblErrorQ1.Visible = true;
                //ScriptManager.RegisterStartupScript(this, this.GetType(), "ALO121_Alert", "alert('無此通路路線資料');", true);
            }
            else
            {
                lblErrorQ1.Text = ex.Message;
                lblErrorQ1.Visible = true;
            }
        }
    }
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        #region
        //先更新暫存檔
        SaveCurrentPageDataToDB();
        SaveCurrentPageDataToTmp();

        StringBuilder sb = new StringBuilder();
        try
        {
            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(string.Format("{0}{1}", PageTimeStamp.Value, Session["UID"].ToString()));//無底線
            ParameterList.Add(s_DIS_NO); //配本序號
            ParameterList.Add(s_ITEM);   //品號
            ParameterList.Add(s_PERIOD); //期別
            ParameterList.Add(null);     //通路
            ParameterList.Add(Session["UID"].ToString()); //登入者
            ParameterList.Add(s_WorkId); //V_PG_ID
            ALOModel.MaintainDisRecord BCO = new ALOModel.MaintainDisRecord(ConnectionDB);
            BCO.UpdateDisStoreFromTmp(ParameterList, null);

            Session[s_SessionIDName] = null;//離開前清空
            ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('確認更新成功');window.close();", true);
        }
        catch (Exception ex)
        {
            this.ErrorMsgLabel.Text = ex.Message;
            this.UpdatePanel1.Update();
            //ScriptManager.RegisterStartupScript(this, this.GetType(), "", "AlertErroAndSetfocus('" + ex.Message + "','" + iCheck.ToString() + "');", true);
        }
        #endregion
    }
Example #24
0
    private void UC_RecPre()
    {
        try
        {
            if (txtDIS_NO.Text.Trim().Length > 0)
            {
                ArrayList ParameterList = new ArrayList();//20091113

                ParameterList.Clear();
                ParameterList.Add(txtDIS_NO.Text.Trim()); //配本序號
                DataTable dt = new DataTable();
                BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
                dt = bco.QueryDisMainFor121(ParameterList, '3');
                if (dt.Rows.Count > 0)
                {
                    Clear_Fields();
                    txtDIS_NO.Text = dt.Rows[0]["DIS_NO"].ToString();
                    btnQuery1_Click(null, null);
                }
                else
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "NoData", "alert('已無上一筆資料');", true);
            }
            else
                ScriptManager.RegisterStartupScript(this, this.GetType(), "NoData", "alert('請先輸入配本序號');", true);
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #25
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         string SessionIDName = "ALO125_dt5" + PageTimeStamp.Value;
         DataTable dt = (DataTable)Session[SessionIDName];
         BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
         bco.do_UpdateTmpStoreDisQty(Request.QueryString["pPG_ID"], Session["UID"].ToString(), PageTimeStamp.Value + Session["UID"].ToString(), null, dt, chkTune.Checked);
         lblMsg.Text = "更動資料確認完成 !!";
         txtTune.Text = "";
         btnConfirm.Enabled = false;
         btnSave.Enabled = false;
         GridView2.DataSource = null;
         GridView2.DataBind();
         GridView2.Visible = false;
         UpdatePanel1.Update();//GridView
         UpdatePanel7.Update();//調整比率
     }
     catch (Exception ex) { lblMsg.Text = ex.Message; }
 }
Example #26
0
    protected void btnQuery1_Click(object sender, EventArgs e)
    {
        //Session裏的dt變數:
        //dt -> 配本主檔
        //dt1 -> 配本商品
        //dt2 -> 營業所
        //dt3 -> 配本通路
        //dt4 -> 合計欄位:通路店數、通路合計配量
        //dt5 -> 配本門市

        try
        {
            string SessionIDName = "ALO121_dt1" + PageTimeStamp.Value;
            DataTable Sdt = (DataTable)Session[SessionIDName];
            if (Sdt != null) { Sdt.Clear(); Sdt.Dispose(); }
            SessionIDName = "ALO121_dt2" + PageTimeStamp.Value;
            Sdt = (DataTable)Session[SessionIDName];
            if (Sdt != null) { Sdt.Clear(); Sdt.Dispose(); }
            SessionIDName = "ALO121_dt3" + PageTimeStamp.Value;
            Sdt = (DataTable)Session[SessionIDName];
            if (Sdt != null) { Sdt.Clear(); Sdt.Dispose(); }
            SessionIDName = "ALO121_dt4" + PageTimeStamp.Value;
            Sdt = (DataTable)Session[SessionIDName];
            if (Sdt != null) { Sdt.Clear(); Sdt.Dispose(); }
            SessionIDName = "ALO121_dt5" + PageTimeStamp.Value;
            Sdt = (DataTable)Session[SessionIDName];
            if (Sdt != null) { Sdt.Clear(); Sdt.Dispose(); }

            SessionIDName = "";

            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(txtDIS_NO.Text.Trim()); //配本序號
            if (SLP_DIS_DATE.Text.Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_DIS_DATE.Text); //配本日期
            if (SLP_ST_ACCEPT_DATE.Text.Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_ST_ACCEPT_DATE.Text); //門市進貨日
            if (SLP_APPROVE_DATE.Text.Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_APPROVE_DATE.Text); //確認日期

            //查詢配本主檔
            DataTable dt = new DataTable();
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            dt = bco.QueryDisMainFor121(ParameterList, '0');

            if (dt.Rows.Count > 0)
            {
                Clear_Fields();
                btnExport1.Enabled = true;
                txtDIS_NO.Text = dt.Rows[0]["DIS_NO"].ToString();
                SLP_DIS_DATE.Text = dt.Rows[0]["DIS_DATE"].ToString();
                SLP_ST_ACCEPT_DATE.Text = dt.Rows[0]["ST_ACCEPT_DATE"].ToString();
                SLP_APPROVE_DATE.Text = dt.Rows[0]["APPROVE_DATE"].ToString();

                DisableQueryFields(true);

                string item, period;
                //查詢配本商品
                getDis_Item(dt.Rows[0]["DIS_NO"].ToString(), SLP_APPROVE_DATE.Text, out item, out period);
                if (item == "") { lblErrorQ1.Text = "無商品資料"; lblErrorQ1.Visible = true; EnableButton(false); DisableQueryFields(false); return; }
                if (period == "") { lblErrorQ1.Text = "無期別資料"; lblErrorQ1.Visible = true; EnableButton(false); DisableQueryFields(false); return; }

                txtZO_A.Text = "0"; //台北
                txtZO_B.Text = "0"; //新竹
                txtZO_D.Text = "0"; //台中
                txtZO_E.Text = "0"; //嘉義
                txtZO_H.Text = "0"; //高雄
                txtZO_C.Text = "0"; //總部
                txtZO_Sum.Text = "0"; //合計

                //本邏輯判斷要放在getDis_Chan函式之前,因getDis_Chan另外判斷若查無資料則通路1、通路2不可查詢
                if (SLP_APPROVE_DATE.Text == "")
                    EnableButton(true);
                else //已確認,可查詢,不可修改 2011/1/29 by Tony
                {
                    //品號查詢
                    btnPrev2.Enabled = true;
                    btnNext2.Enabled = true;
                    btnQuery2.Enabled = true;
                    btnConditionQuery.Enabled = true;
                    //通路1查詢
                    btnPrev3.Enabled = true;
                    btnNext3.Enabled = true;
                    btnQuery3.Enabled = true;
                    //通路2查詢
                    btnQuery4.Enabled = true;
                }

                //查詢營業所
                get_ZO(dt.Rows[0]["DIS_NO"].ToString());

                //查詢配本通路
                getDis_Chan(dt.Rows[0]["DIS_NO"].ToString(), item, period);

                //查詢合計欄位:通路店數、通路合計配量
                getTotal_Chan(dt.Rows[0]["DIS_NO"].ToString(), dt.Rows[0]["ST_ACCEPT_DATE"].ToString().Length == 0 ? "" : Convert.ToDateTime(dt.Rows[0]["ST_ACCEPT_DATE"].ToString()).ToString("yyyyMMdd"), item, period, "", "", "", '0');

                //建立配本門市暫存、查詢配本門市
                getStore(dt.Rows[0]["DIS_NO"].ToString(), item, period);
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.FindExport, true, "", btnExport1, WUI_GMToolbarV.ClickAction.ButtonClick);
            }
            else
            {
                lblErrorQ1.Text = "查無資料";
                lblErrorQ1.Visible = true;
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.FindExport, false, "", btnExport1, WUI_GMToolbarV.ClickAction.ButtonClick);
            }

        }
        catch (Exception ex) { this.lblErrorQ1.Text = ex.Message; lblErrorQ1.Visible = true; }
    }
Example #27
0
    private string ProcessRemoveFromBridge(string strDisNoForAry, string strCtrlPending, Int32 iProcessingAryIndex)
    {
        #region
        bool bResult = false;
        string strCallbackResult = "";
        string strResult = "", strErrMsg = "";
        string strPrefixed = "POP_DisApproveError";
        string strDisNo = "", strNextDisNo = "";
        string[] strAryDisAry = strDisNoForAry.Split(";".ToCharArray());
        string[] strAryCtrlPending = strCtrlPending.Split(";".ToCharArray());

        try
        {
            fmStatus = FormStatus.fmProcess;

            ALOModel.MaintainDisRecord BCO = new ALOModel.MaintainDisRecord(ConnectionDB);
            if (iProcessingAryIndex < strAryDisAry.Length)
            {

                strDisNo = strAryDisAry[iProcessingAryIndex];

                ArrayList ParameterList = new ArrayList();//20091113
                ParameterList.Clear();
                ParameterList.Add(strDisNo);
                ParameterList.Add(strAryCtrlPending[5]);
                ParameterList.Add(DateTime.Now);

                bResult = BCO.ProcessCancelConfirm(ParameterList, out strResult, out strErrMsg, null);

                if (!bResult)
                {
                    Session[string.Format("{0}_DISNO_{1}", strPrefixed, strAryCtrlPending[0])] = string.Format("{0},", strDisNo);
                    Session[string.Format("{0}_OPTYPE_{1}", strPrefixed, strAryCtrlPending[0])] = "1";
                }

                iProcessingAryIndex = iProcessingAryIndex + 1;

                if (iProcessingAryIndex < strAryDisAry.Length)
                {
                    strNextDisNo = strAryDisAry[iProcessingAryIndex];
                }
                else
                {
                    strNextDisNo = "X";//表示已執行到最後一筆
                }

                //0:DIS_NO字串For陣列用-
                //1:下一筆陣列Index-
                //2:執行結果-
                //3:錯誤訊息-
                //4:要關閉執行狀態的DIS_NO-
                //5:要開啟執行狀態的DIS_NO-
                //6:是否有累積執行錯誤之DIS_NO-
                //7:ST_ACCEPT_DATE ClientID-
                //8:ResultMsgLabel ClientID-
                //9:ErrMsgLabel ClientID
                //10:將再開啟之控制項字串陣列

                string strCtrlIDToUnLock = string.Format("{0}", strAryCtrlPending[1]);

                strCallbackResult = string.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}-{8}-{9}-{10}",
                    strDisNoForAry,
                    iProcessingAryIndex,
                    bResult ? "OK" : "NG",
                    strErrMsg,
                    strDisNo,
                    strNextDisNo,
                    Session[string.Format("{0}_DISNO_{1}", strPrefixed, strAryCtrlPending[0])] == null ? "0" : "1",
                    strAryCtrlPending[2],
                    strAryCtrlPending[3],
                    strAryCtrlPending[4],
                    strCtrlIDToUnLock
                    );
            }

        }
        catch (Exception ex)
        {
            throw ex;
        }

        return strCallbackResult;
        #endregion
    }
Example #28
0
    /// <summary>
    /// POP_StoreSet頁面回來
    /// </summary>
    /// <param name="dis_no">配本序號</param>
    /// <param name="item">品號</param>
    /// <param name="period">期別</param>
    /// <param name="chan_no">通路</param>
    private void Query_Data_POP(string dis_no)
    {
        //Session裏的dt變數:
        //dt -> 配本主檔
        //dt1 -> 配本商品
        //dt2 -> 營業所
        //dt3 -> 配本通路
        //dt4 -> 合計欄位:通路店數、通路合計配量
        //dt5 -> 配本門市

        try
        {
            string SessionIDName = "";

            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(dis_no); //配本序號
            ParameterList.Add(System.DBNull.Value); //配本日期
            ParameterList.Add(System.DBNull.Value); //門市進貨日
            ParameterList.Add(System.DBNull.Value); //確認日期

            //查詢配本主檔
            DataTable dt = new DataTable();
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            dt = bco.QueryDisMainFor121(ParameterList, '0');

            //btnCancel1_Click(null, null);
            if (dt.Rows.Count > 0)
            {
                btnExport1.Enabled = true;
                txtDIS_NO.Text = dt.Rows[0]["DIS_NO"].ToString();
                SLP_DIS_DATE.Text = dt.Rows[0]["DIS_DATE"].ToString();
                SLP_ST_ACCEPT_DATE.Text = dt.Rows[0]["ST_ACCEPT_DATE"].ToString();
                SLP_APPROVE_DATE.Text = dt.Rows[0]["APPROVE_DATE"].ToString();

                DisableQueryFields(true);

                if (SLP_APPROVE_DATE.Text == "")
                    EnableButton(true);

                txtZO_A.Text = "0"; //台北
                txtZO_B.Text = "0"; //新竹
                txtZO_D.Text = "0"; //台中
                txtZO_E.Text = "0"; //嘉義
                txtZO_H.Text = "0"; //高雄
                txtZO_C.Text = "0"; //總部
                txtZO_Sum.Text = "0"; //合計

                //重新查詢出配本商品
                //string item, period;
                //getDis_Item(dt.Rows[0]["DIS_NO"].ToString(), SLP_APPROVE_DATE.Text, out item, out period);
                //if (Request.QueryString["pItem"] != null)
                //    SLP_ITEM.Text = Request.QueryString["pItem"];
                //else
                //    SLP_ITEM.Text = item;

                //if (Request.QueryString["pPeriod"] != null)
                //    SLP_PERIOD.Text = Request.QueryString["pPeriod"];
                //else
                //    SLP_PERIOD.Text = period;
                ////帶出其它畫面回來的品號、期別
                //btnQuery2_Click(null, null);

                //查詢營業所
                get_ZO(dt.Rows[0]["DIS_NO"].ToString());

                //查詢配本通路
                //getDis_Chan(dt.Rows[0]["DIS_NO"].ToString(), Request.QueryString["pItem"], Request.QueryString["pPeriod"]);
                getDis_Chan(dt.Rows[0]["DIS_NO"].ToString(), SLP_ITEM.Text, SLP_PERIOD.Text);
                btnQuery3_Click(SLP_CHAN_NO1.Text);

                //查詢合計欄位:路線店數、路線合計配量
                getTotal_Chan(txtDIS_NO.Text, SLP_ST_ACCEPT_DATE.Text.Length == 0 ? "" : Convert.ToDateTime(SLP_ST_ACCEPT_DATE.Text).ToString("yyyyMMdd"), hidITEM.Value, hidPERIOD.Value, hidChan_No2.Value, SLP_N_MAX_ROUTE.Text, SLP_N_MIN_ROUTE.Text, '2');

                //建立配本門市暫存、查詢配本門市
                hidITEM.Value = SLP_ITEM.Text;
                hidPERIOD.Value = SLP_PERIOD.Text;
                #region 查詢門市
                ParameterList.Clear();
                ParameterList.Add(txtDIS_NO.Text); //配本序號
                ParameterList.Add(SLP_ITEM.Text); //配本商品品號
                ParameterList.Add(SLP_PERIOD.Text); //配本商品期別
                ParameterList.Add(PageTimeStamp.Value + Session["UID"].ToString());
                ParameterList.Add("ALO121"); //工作頁面
                //DataTable dt = new DataTable();
                BCO.MaintainDisRecord bco1 = new BCO.MaintainDisRecord(ConnectionDB);
                dt = bco1.QueryPageDisStore(ParameterList);
                txtQueryTotRec.Text = dt.Rows.Count.ToString();
                ComputeTotQty(dt); //計算查詢總配量

                SessionIDName = "ALO121_dt5" + PageTimeStamp.Value;
                Session[SessionIDName] = dt;

                if (dt.Rows.Count > 0)
                {
                    btnPOP_DisStoreSet.Enabled = (SLP_APPROVE_DATE.Text == string.Empty);
                    GridView2.DataSource = CopyTable(dt);//產生Rx_ITEM及Rx_PERIOD都不為空值的DataTable;
                    GridView2.DataBind();
                    Resize_Div(GridView2.Rows.Count);
                    UpdatePanel1.Update();

                }
                else
                {
                    btnPOP_DisStoreSet.Enabled = false;
                    GridView2.DataSource = null;
                    GridView2.DataBind();
                    Resize_Div(GridView2.Rows.Count);
                    UpdatePanel1.Update();
                }
                #endregion
                //if (hidChan_No2.Value == "")
                //    getStore(dt.Rows[0]["DIS_NO"].ToString(), SLP_ITEM.Text, SLP_PERIOD.Text);
                //getStore(dt.Rows[0]["DIS_NO"].ToString(), Request.QueryString["pItem"], Request.QueryString["pPeriod"]);
                //else
                //    QueryChan('1');
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.FindExport, true, "", btnExport1, WUI_GMToolbarV.ClickAction.ButtonClick);
            }
            else
            {
                lblErrorQ1.Text = "查無資料";
                lblErrorQ1.Visible = true;
                //ScriptManager.RegisterStartupScript(this, this.GetType(), "NoData", "alert('查無資料');", true);
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.FindExport, false, "", btnExport1, WUI_GMToolbarV.ClickAction.ButtonClick);
            }
            dt.Dispose();
        }
        catch (Exception ex) { this.lblErrorQ1.Text = ex.Message; lblErrorQ1.Visible = true; }
    }
Example #29
0
    protected void btnExecute_Click(object sender, EventArgs e)
    {
        try
        {
            StringBuilder sb = new StringBuilder();

            #region 檢查計算條件
            if (this.txt_DIS_NO_OLD.Text == "")
            { sb.Append("配本序號不應為空值,請回前頁 \n\r"); }
            if (this.rb_ChanType.SelectedValue == "1")//個別通路
            {
                if (this.SLP_StoreChain1.Text == "")
                {
                    sb.Append("通路設定=個別通路時,通路代號不可為空值 \n\r");
                }
            }
            if (this.SLP_FrontCnt.Text == "")
            { sb.Append("前幾家不可為空值 \n\r"); }
            else
            {
                if (Int32.Parse(this.SLP_FrontCnt.Text.Trim()) > vNonLokcCnt)
                {
                    sb.AppendFormat("前幾家數量不可大於現在未鎖定配本門市數{0}! \n\r", vNonLokcCnt);
                }
                else if (Int32.Parse(this.SLP_FrontCnt.Text.Trim()) <= 0)
                {
                    sb.Append("前幾家數量應 >0 ! \n\r");
                }

            }
            if (this.SLP_AdjustQty.Text == "")
            { sb.Append("調整數量不可為空值 \n\r"); }
            else if (this.SLP_AdjustQty.Text == "0")
            { sb.Append("調整數量不可為0 \n\r"); }
            if (sb.ToString().Trim() != "")
            {
                throw new Exception(sb.ToString().Trim());
            }
            #endregion

            #region 執行升降冪設定
            ArrayList ParameterList = new ArrayList();//20091113
            ParameterList.Clear();
            ParameterList.Add(s_DIS_NO);//配本序號
            ParameterList.Add(s_ITEM);//品號
            ParameterList.Add(s_PERIOD);//期別
            if (rb_ChanType.SelectedValue == "0")
            {
                ParameterList.Add(null); //通路
            }
            else
            {
                ParameterList.Add(this.SLP_StoreChain1.Text);//通路
            }
            ParameterList.Add(Int32.Parse(this.rb_OrderType.Text.Trim()));//升降冪
            ParameterList.Add(Int32.Parse(this.SLP_FrontCnt.Text.Trim()));//前幾家
            ParameterList.Add(Int32.Parse(this.SLP_AdjustQty.Text.Trim()));//加減數量
            ParameterList.Add(Session["UID"].ToString());//使用者

            ALOModel.MaintainDisRecord BCOM = new ALOModel.MaintainDisRecord(ConnectionDB);
            Int32 iAdjSumQty = BCOM.CalculateForAscendorDescend(ParameterList, null);
            this.txt_AdjustSumQty.Text = iAdjSumQty.ToString();

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #30
0
    /// <summary>
    /// ALO122頁面取消回來
    /// </summary>
    /// <param name="dis_no">配本序號</param>
    /// <param name="item">品號</param>
    /// <param name="period">期別</param>
    /// <param name="chan_no">通路</param>
    /// <param name="DIS_TOT_OQTY">通路合計配量</param>
    /// <param name="N_DIS_TOT_QTY">路線合計配量</param>
    /// <param name="N_MAX_ROUTE">路線起</param>
    /// <param name="N_MIN_ROUTE">路線迄</param>
    //private void Query_Data(string dis_no, string item, string period, string chan_no, string DIS_TOT_OQTY, string N_DIS_TOT_QTY, string N_MAX_ROUTE, string N_MIN_ROUTE)
    private void Query_Data(string dis_no)
    {
        //Session裏的dt變數:
        //dt -> 配本主檔
        //dt1 -> 配本商品
        //dt2 -> 營業所
        //dt3 -> 配本通路
        //dt4 -> 合計欄位:通路店數、通路合計配量
        //dt5 -> 配本門市

        try
        {
            string SessionIDName = "";

            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(dis_no); //配本序號
            ParameterList.Add(System.DBNull.Value); //配本日期
            ParameterList.Add(System.DBNull.Value); //門市進貨日
            ParameterList.Add(System.DBNull.Value); //確認日期

            //查詢配本主檔
            DataTable dt = new DataTable();
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            dt = bco.QueryDisMainFor121(ParameterList, '0');

            //btnCancel1_Click(null, null);
            if (dt.Rows.Count > 0)
            {
                btnExport1.Enabled = true;
                txtDIS_NO.Text = dt.Rows[0]["DIS_NO"].ToString();
                SLP_DIS_DATE.Text = dt.Rows[0]["DIS_DATE"].ToString();
                SLP_ST_ACCEPT_DATE.Text = dt.Rows[0]["ST_ACCEPT_DATE"].ToString();
                SLP_APPROVE_DATE.Text = dt.Rows[0]["APPROVE_DATE"].ToString();

                DisableQueryFields(true);

                if (SLP_APPROVE_DATE.Text == "")
                    EnableButton(true);

                txtZO_A.Text = "0"; //台北
                txtZO_B.Text = "0"; //新竹
                txtZO_D.Text = "0"; //台中
                txtZO_E.Text = "0"; //嘉義
                txtZO_H.Text = "0"; //高雄
                txtZO_C.Text = "0"; //總部
                txtZO_Sum.Text = "0"; //合計

                //查詢配本商品
                //string SessionIDName1 = "ALO121_dt1" + PageTimeStamp.Value;
                //DataTable Dt = (DataTable)Session[SessionIDName1];

                //DataRow[] Dr = Dt.Select("ITEM='" + Request.QueryString["pItem"] + "' and PERIOD='" + Request.QueryString["pPeriod"] + "'");
                //Fill_Field(Request.QueryString["pItem"], Request.QueryString["pPeriod"], Request.QueryString["pPeriod"], Dr[0]["N_PER_QTY"].ToString(), Dr[0]["ID"].ToString(), Dr[0]["N_ROWNUM"].ToString(), Dr[0]["Root_No"].ToString());

                //重新查詢出配本商品
                string item, period;
                getDis_Item(dt.Rows[0]["DIS_NO"].ToString(), SLP_APPROVE_DATE.Text, out item, out period);
                if (Request.QueryString["pItem"] != null)
                    SLP_ITEM.Text = Request.QueryString["pItem"];
                else
                    SLP_ITEM.Text = item;

                if (Request.QueryString["pPeriod"] != null)
                    SLP_PERIOD.Text = Request.QueryString["pPeriod"];
                else
                    SLP_PERIOD.Text = period;
                //帶出其它畫面回來的品號、期別
                btnQuery2_Click(null, null);

                //查詢營業所
                get_ZO(dt.Rows[0]["DIS_NO"].ToString());

                //查詢配本通路
                //getDis_Chan(dt.Rows[0]["DIS_NO"].ToString(), Request.QueryString["pItem"], Request.QueryString["pPeriod"]);
                getDis_Chan(dt.Rows[0]["DIS_NO"].ToString(), SLP_ITEM.Text, SLP_PERIOD.Text);
                //SLP_CHAN_NO1.Text = Request.QueryString["pChanNo"];
                btnQuery3_Click(SLP_CHAN_NO1.Text);

                //查詢合計欄位:路線店數、路線合計配量
                getTotal_Chan(txtDIS_NO.Text, SLP_ST_ACCEPT_DATE.Text.Length == 0 ? "" : Convert.ToDateTime(SLP_ST_ACCEPT_DATE.Text).ToString("yyyyMMdd"), hidITEM.Value, hidPERIOD.Value, hidChan_No2.Value, SLP_N_MAX_ROUTE.Text, SLP_N_MIN_ROUTE.Text, '2');

                //建立配本門市暫存、查詢配本門市
                hidITEM.Value = (Request.QueryString["pItem"] != null) ? Request.QueryString["pItem"] : SLP_ITEM.Text;
                hidPERIOD.Value = (Request.QueryString["pPeriod"] != null) ? Request.QueryString["pPeriod"] : SLP_PERIOD.Text;
                if (hidChan_No2.Value == "")
                    getStore(dt.Rows[0]["DIS_NO"].ToString(), SLP_ITEM.Text, SLP_PERIOD.Text);
                //getStore(dt.Rows[0]["DIS_NO"].ToString(), Request.QueryString["pItem"], Request.QueryString["pPeriod"]);
                else
                    QueryChan('1');
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.FindExport, true, "", btnExport1, WUI_GMToolbarV.ClickAction.ButtonClick);
            }
            else
            {
                lblErrorQ1.Text = "查無資料";
                lblErrorQ1.Visible = true;
                //ScriptManager.RegisterStartupScript(this, this.GetType(), "NoData", "alert('查無資料');", true);
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.FindExport, false, "", btnExport1, WUI_GMToolbarV.ClickAction.ButtonClick);
            }
        }
        catch (Exception ex) { this.lblErrorQ1.Text = ex.Message; lblErrorQ1.Visible = true; }
    }