Example #1
0
    private void databindDDL()
    {
        MaintainAssign BCO = new MaintainAssign(ConntionDB);
        DataTable Dt = BCO.QueryChanNameItem();

        this.ddlChanNo.DataSource = Dt;
        this.ddlChanNo.DataTextField = "chan_name";
        this.ddlChanNo.DataValueField = "chan_no";
        this.ddlChanNo.DataBind();
        if (ddlChanNo.Items.Count > 0)
        {
            ddlChanNo.SelectedIndex = 0;
            Dt = BCO.GetStoreByChanNo(ddlChanNo.SelectedItem.Value);
            this.ddlStore.DataSource = Dt;
            ddlStore.DataTextField = "name";
            ddlStore.DataValueField = "store";
            ddlStore.DataBind();
            if (ddlStore.Items.Count > 0)
                ddlStore.SelectedIndex = 0;
        }
    }
Example #2
0
    protected void QueryItemDataUpdate()
    {

        if (this.ddlChanNo.SelectedItem.Value == string.Empty ||
           this.SLP_SKU.Text == string.Empty || this.SLP_Period.Text == string.Empty)
            return;

        ParameterList.Clear();
        ParameterList.Add(this.SLP_SKU.Text);
        // ParameterList.Add("119709");
        ParameterList.Add(this.ddlStore.SelectedItem.Value);
        ParameterList.Add(this.ddlChanNo.SelectedItem.Value);
        ParameterList.Add(this.SLP_Period.Text);
        ParameterList.Add(this.SLP_AcceptDate.Text.Replace("/", "").Trim());

        string sChanItem = "";
        string sListPrice = "";
        string sTTLAssignQty = "";
        string sSTAcceptQty = "";
        string sOnhdQty = "";
        string sSecOnhdQty = "";
        string sMessage = "";

        MaintainAssign BCO = new MaintainAssign(ConntionDB);
        BCO.QueryItemData(ParameterList, out sChanItem, out sListPrice, out sTTLAssignQty, out sSTAcceptQty, out sOnhdQty, out sSecOnhdQty, out sMessage);
        this.txtChanItem.Text = sChanItem;
        this.txtListPrice.Text = sListPrice;
        this.txtTTLAssignQty.Text = sTTLAssignQty;
        this.txtSTAcceptQty.Text = sSTAcceptQty;
        this.txtOnhdQty.Text = sOnhdQty;
        this.txtSecOnhdQty.Text = sSecOnhdQty;


    }
Example #3
0
    private string CheckWdsItem(out string strMSG)
    {
        
        //0.V_ITEM    IN VARCHAR2,                                  
        //1.V_PERIOD  IN VARCHAR2,
        //2.V_CHAN_NO IN VARCHAR2,
        //3.V_STORE   IN VARCHAR2,        
        //P_MSG  OUT VARCHAR2
        //P_REUSLT  OUT VARCHAR2
        ParameterList.Clear();        
        ParameterList.Add(this.SLP_SKU.Text);
        ParameterList.Add(this.SLP_Period.Text);
        ParameterList.Add(this.ddlChanNo.SelectedItem.Value);
        ParameterList.Add(this.ddlStore.SelectedItem.Value);

        string strResult = string.Empty;
        MaintainAssign BCO = new MaintainAssign(ConntionDB);
        BCO.CheckWdsItem(ParameterList, out strResult, out strMSG);
        return strResult;
    }
Example #4
0
    public static string GetStoreData(string txtChanNo)
    {

        MaintainAssign BCO = new MaintainAssign(ConntionDB);
        //        return sQualifyCondition;
        DataTable dt = BCO.GetStoreByChanNo(txtChanNo);
        string sRet = dt.Rows.Count.ToString() + ",";
        foreach (DataRow dr in dt.Rows)
        {
            //a)呼叫MaintainDisStore.DeleteDisStoreByChan();
            sRet = sRet + dr["Store"].ToString() + "," + dr["name"].ToString() + ",";
        }
        return sRet;

    }
Example #5
0
    private DataTable SetAcceptDataMode(out string strErr)
    {
        string sAcceptNo = this.Request["acceptno"].ToString();

        MaintainAssign BCO = new MaintainAssign(ConntionDB);
        DataTable dt = BCO.QueryByAcceptNo(sAcceptNo);
        string sChan_no = "";
        string sStore = "";
        strErr = string.Empty;

        foreach (DataRow dr in dt.Rows)
        {
            //a)呼叫MaintainDisStore.DeleteDisStoreByChan();
            string sItem = dr["item"].ToString();
            string sPeriod = dr["period"].ToString();
            string sTempChan_no = "";
            string sTempStore = "";
            string sAcceptQty = "";
            BCO.QueryChanNoByItemPeriod(sItem, sPeriod, out sTempChan_no, out sTempStore, out sAcceptQty);

            if (sTempChan_no == string.Empty)
            {
                dr["ID"] = "F";
            }
            else if (sChan_no == string.Empty && sTempChan_no != string.Empty)
            {
                sChan_no = sTempChan_no;
                sStore = sTempStore;
                this.ddlChanNo.SelectedValue = sChan_no;
                this.ddlStore.SelectedValue = sStore;


                dr["ST_ACCEPT_QTY"] = sAcceptQty;
                dr["ID"] = "T";
            }
            else if (sChan_no == sTempChan_no)
            {
                dr["ST_ACCEPT_QTY"] = sAcceptQty;
                dr["ID"] = "T";

            }
            else
            {
                dr["ID"] = "F";
            }

        }

        for (int idx = dt.Rows.Count - 1; idx >= 0; --idx)
        {

            DataRow dr = dt.Rows[idx];
            if (dr["ID"].ToString() == "F")
            {
                dr.Delete();
                continue;
            }
            ParameterList.Clear();
            ParameterList.Add(dr["item"].ToString());
            ParameterList.Add(sStore);
            ParameterList.Add(sChan_no);
            ParameterList.Add(dr["period"].ToString());
            ParameterList.Add(DateTime.Today.ToString("yyyyMMdd"));

            string sChanItem = "";
            string sListPrice = "";
            string sTTLAssignQty = "";
            string sSTAcceptQty = "";
            string sOnhdQty = "";
            string sSecOnhdQty = "";
            string sMessage = "";
            BCO.QueryItemData(ParameterList, out sChanItem, out sListPrice, out sTTLAssignQty, out sSTAcceptQty, out sOnhdQty, out sSecOnhdQty, out sMessage);
            dr["chan_item"] = sChanItem;
            dr["ListPrice"] = sListPrice;
            dr["Total_assign_Qty"] = sTTLAssignQty;
            dr["Total_St_Accept_Qty"] = sSTAcceptQty;
            dr["onhd_qty"] = sOnhdQty;
            dr["onhdx_qty"] = sSecOnhdQty;

            ParameterList.Clear();

            if (sMessage != "OK")
            {
                strErr += "品號 " + dr["item"] + "期別 " + dr["period"] + " " + sMessage + "<br>";
            }

        }
        dt.AcceptChanges();
        //    ScriptManager.RegisterStartupScript(Page, this.GetType(),
        //        "VGI022.aspx", "alert(' " + dt.Rows.Count.ToString() + " ');", true);
        if (dt.Rows.Count > 0)
        {
            this.ddlChanNo.Enabled = false;
            this.ddlStore.Enabled = false;
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "NoDataAlert.aspx", "alert('驗收資料皆已進行指配作業,無對應的指配資料可建立');", true);
        }

        return dt;
    }
Example #6
0
 protected void ddlChanNo_SelectedIndexChanged(object sender, EventArgs e)
 {
     MaintainAssign BCO = new MaintainAssign(ConntionDB);
     DataTable Dt = BCO.GetStoreByChanNo(ddlChanNo.SelectedItem.Value);
     this.ddlStore.DataSource = Dt;
     ddlStore.DataTextField = "name";
     ddlStore.DataValueField = "store";
     ddlStore.DataBind();
     if (ddlStore.Items.Count > 0)
         ddlStore.SelectedIndex = 0;
 }
Example #7
0
    public static string QueryItemData(string txtChanNo, string txtStore, string txtItem, string txtPeriod, string txtAcceptDate)
    {
        //      aChanNo ,aStore , aItem , aPeriod , aAcceptDate 
        bool HaveData = false;
        ArrayList meterList = new ArrayList();
        meterList.Clear();


        meterList.Add(txtItem.Trim());
        meterList.Add(txtStore.Trim());
        meterList.Add(txtChanNo.Trim());
        meterList.Add(txtPeriod.Trim());
        meterList.Add(txtAcceptDate.Replace("/", "").Trim());

        string sChanItem = "324234";
        string sListPrice = "324234";
        string sTTLAssignQty = "324234";
        string sSTAcceptQty = "324234";
        string sOnhdQty = "324234";
        string sSecOnhdQty = "324234";
        string sMessage = "";
        //        return sChanItem + "," + sListPrice + "," + sTTLAssignQty + "," + sSTAcceptQty + "," + sOnhdQty + "," + sSecOnhdQty;
        MaintainAssign BCO = new MaintainAssign(ConntionDB);
        HaveData = BCO.QueryItemData(meterList, out sChanItem, out sListPrice, out sTTLAssignQty, out sSTAcceptQty, out sOnhdQty, out sSecOnhdQty, out sMessage);
        if (HaveData == true)
        {
            string strRes = string.Empty;

            if (sMessage.Substring((sMessage.Length - 2), 2) != "OK")
            {
                strRes = sMessage;
            }
            else
            {
                ParameterList.Clear();

                ParameterList.Add(txtItem.Trim());
                ParameterList.Add(txtPeriod.Trim());
                ParameterList.Add(txtChanNo.Trim());

                if (BCO.checkChanItem(ParameterList))
                {
                    strRes = "";
                }
                else
                {
                    strRes = "通路到期日小於系統日 不可進行該品號期別的新增";
                }
            }
            return sChanItem + "&" + sListPrice + "&" + sTTLAssignQty + "&" + sSTAcceptQty + "&" + sOnhdQty + "&" + sSecOnhdQty + "&" + strRes;
        }
        else
        {
            return "";
        }
    }
Example #8
0
    protected void btnAssignNoExpore_Click(object sender, EventArgs e)
    {

        //      ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "if (confirm('理貨商品己擷取,是否重新擷取商品?')){this.disabled=true;__doPostBack('Trans','');}", true);

        #region 前置檢查與參數過濾

        string par_AssignNo = this.txt_AssignNo.Text;
        string par_AcceptDate = this.SLP_AcceptDate.Text;
        string par_ChanNo = this.txtChanNo.Text;
        string par_Store = this.txtStore.Text;
        //        string par_CREATEUID = "vds2gdev"; par_CREATEUID = par_CREATEUID.ToUpper();
        string par_CREATEUID = Session["UID"].ToString();
        #endregion


        #region 組合查詢條件至ArrayList
        ArrayList ParameterList = new ArrayList();
        ParameterList.Clear();
        ParameterList.Add(GetValueSetParameter(par_AssignNo, "string"));
        ParameterList.Add(GetValueSetParameter(par_AcceptDate, "string"));
        ParameterList.Add(GetValueSetParameter(par_ChanNo, "string"));
        ParameterList.Add(GetValueSetParameter(par_Store, "string"));
        ParameterList.Add(GetValueSetParameter(par_CREATEUID, "string"));


        #endregion

        MaintainAssign BCO = new MaintainAssign(ConntionDB);
        string sTranNo;
        BCO.ExportAssign(ParameterList, out sTranNo);
        if (sTranNo == string.Empty)
            ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGI041.aspx", "alert(' 此指配單號已被匯出過!! ');", true);
        else
        {
            this.txt_OutNo1.Text = sTranNo;
            ScriptManager.RegisterStartupScript(Page, this.GetType(), "VGI041.aspx", "alert(' 指配單號匯出成功!! ');", true);

        }



    }
Example #9
0
    //檢查是否有可使用儲格,並回傳轉入及轉出的儲格
    private bool CheckForRemove(out string strOutLS, out string strInLS)
    {
        MaintainAssign BCO = new MaintainAssign(ConntionDB);
        BCO.QueryLocateSection(out strOutLS, out strInLS);

        if (strOutLS == "")
        {
            ErrorMsgLabel.Text = "查無轉出儲格";
            return false;
        }

        if (strInLS == "")
        {
            ErrorMsgLabel.Text = "查無轉入儲格";
            return false;
        }
        return true;
    }
Example #10
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            string par_AcceptDate = this.SLP_AcceptDate.Text;
            string par_ChanNo = this.ddlChanNo.SelectedValue;
            string par_Store = this.ddlStore.SelectedValue;

            string par_CREATEUID = Session["UID"].ToString();

            #region 檢查

            if (par_ChanNo.Trim() == string.Empty)
            {
                throw new Exception("通路未設定!!");
            }

            if (par_Store.Trim() == string.Empty)
            {
                throw new Exception("廠商門市未設定!!");
            }

            if (this.txt_PageStatus.Text != "QUERY" && (this.SLP_SKU.Text != string.Empty || this.SLP_Period.Text != string.Empty))
            {
                QueryItemDataUpdate();
                throw new Exception("明細資料在編輯狀態,不可儲存!!");
            }

            #endregion

            #region 建立移轉單

            if (Request["formtype"] == "1")//由驗收單畫面連過來
            {

                //檢查是否需要建移轉單
                //如果[出庫儲位庫存量] < [進貨數量],要建移轉單
                if (checkNeedRemove())
                {
                    string strOutLS = string.Empty;
                    string strInLS = string.Empty;

                    if (CheckForRemove(out strOutLS, out strInLS))
                    {
                        string strMainID = string.Empty;
                        string strRemoveNo = string.Empty;
                        ArrayList ErrList = new ArrayList();
                        bool result = false;

                        DataTable Dt_Detail = MakeDetailTable(strOutLS, strInLS);

                        ParameterList.Clear();
                        ParameterList.Add(par_CREATEUID);
                        ParameterList.Add(par_AcceptDate);
                        ParameterList.Add("M3");

                        PIC.VDS2G.VSM.IVM.MaintainRemoveData bco = new PIC.VDS2G.VSM.IVM.MaintainRemoveData(ConntionDB);
                        result = bco.CreateRemoveData(ParameterList, Dt_Detail, null, out strMainID, out strRemoveNo, out ErrList);

                        if (result == false)
                        {
                            throw new Exception("無足夠儲位,無法建立移轉單");
                        }
                    }
                    else
                    {
                        throw new Exception("查無儲格資料,無法建立移轉單");
                    }
                }
            }

            #endregion

            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(par_AcceptDate, "string"));
            ParameterList.Add(GetValueSetParameter(par_ChanNo, "string"));
            ParameterList.Add(GetValueSetParameter(par_Store, "string"));
            ParameterList.Add(GetValueSetParameter(par_CREATEUID, "string"));

            string sAssignNo = "";
            string sAcceptNo = "";
            string sOutNo = "";

            string SessionIDName = "VGI022_" + PageTimeStamp.Value;

            DataTable dt = (DataTable)Session[SessionIDName];
            if (dt.Rows.Count == 0)
            {
                throw new Exception("無明細項目資料!!");
            }

            MaintainAssign BCO = new MaintainAssign(ConntionDB);

            BCO.CreateAssign(ParameterList, null, dt, out sAssignNo, out sAcceptNo, out sOutNo);

            this.txt_AssignNo.Text = sAssignNo;
            this.txt_AcceptNo.Text = sAcceptNo;
            this.txt_OutNo.Text = sOutNo;

            IDList.Clear();

            if (Session["VGI02QueryID"] != null)
            {

                IDList = (ArrayList)Session["VGI02QueryID"];
                IDList.Clear();
            }

            Response.Redirect("VGI022.aspx?ID=" + txt_AssignNo.Text + "&mode=VIEW&Code=VGI02", false);

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


        #region 存檔後狀態設定

        //        this.hid_PageStatus.Value = "VIEW";
        //        this.txt_PageStatus.Text = "VIEW";
        //        SetPageStatus();

        #endregion

    }
Example #11
0
    //GridView1 資料繫結
    private void databind_Dtl()
    {
        try
        {
            MaintainAssign BCO = new MaintainAssign(ConntionDB);
            ParameterList.Clear();
            ParameterList.Add(this.Request["ID"].ToString());
            ParameterList.Add(this.txtStore.Text);

            DataTable Dt = BCO.QueryItemDataDetail(ParameterList);

            foreach (DataRow dr in Dt.Rows)
            {
                //a)呼叫MaintainDisStore.DeleteDisStoreByChan();
                string sTempListPrice = "";
                string sTempTTLQty = "";
                ParameterList.Clear();
                ParameterList.Add(dr["item"]);
                // ParameterList.Add("119709");
                ParameterList.Add(this.txtStore.Text);
                ParameterList.Add(this.txtChanNo.Text);
                ParameterList.Add(dr["period"]);
                // ParameterList.Add("000001");

                ParameterList.Add(SLP_AcceptDate.Text.Replace("/", ""));
                BCO.QueryItemListPriceTTLQty(ParameterList, out sTempListPrice, out sTempTTLQty);
                dr["ListPrice"] = sTempListPrice;
                dr["Total_assign_Qty"] = sTempTTLQty;
            }

            string SessionIDName = "VGI022_" + PageTimeStamp.Value;

            Session[SessionIDName] = Dt;
            GridView1.DataSource = Dt;

            GridView1.PageIndex = 0;
            GridView1.DataBind();
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #12
0
    //表頭資料繫結
    private bool databind_Mst()
    {
        bool ret = false;
        try
        {
            ParameterList.Clear();
            ParameterList.Add(this.Request["ID"].ToString());
            MaintainAssign BCO = new MaintainAssign(ConntionDB);

            DataTable DtMain = BCO.QueryItemDataMaster(ParameterList);

            if (DtMain.Rows.Count == 1)//&& 
            {
                ret = true;
                txt_AssignNo.Text = DtMain.Rows[0]["assign_no"].ToString();
                SLP_AcceptDate.Text = DtMain.Rows[0]["st_accept_date"].ToString();
                txt_AcceptNo.Text = DtMain.Rows[0]["st_accept_no"].ToString();
                this.txtChanNo.Text = DtMain.Rows[0]["chan_no"].ToString();
                this.txtStore.Text = DtMain.Rows[0]["store"].ToString();

                txt_OutNo.Text = DtMain.Rows[0]["out_no"].ToString();

                //    txt_OutNo1.Text = DtMain.Rows[0]["out_no"].ToString(); 
            }
            else
            {
                ret = false;
                string sAssignNo = this.Request["ID"].ToString().ToUpper();
                //int idx = IDList.IndexOf(sAssignNo);
                //if (idx != -1)
                //     IDList.Remove(sAssignNo);

                //Session["VGI02QueryID"] = IDList;
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "VG022.aspx", "alert(' 此筆指配單(" + sAssignNo + ")已被其他使用者刪除,請點選上一筆/下一筆鈕繼續查詢 ');", true);

            }
            return ret;
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
            return ret;
        }
    }
Example #13
0
    }//page_load
    /// databindDDL 繫結查詢資料到DropDownList
    /// </summary>
    private void databindDDL()
    {
        DataTable Dt = bco.QueryChanNameItem();

        ddlChanNo.DataSource = Dt;
        ddlChanNo.DataTextField = "chan_name";
        ddlChanNo.DataValueField = "chan_no";
        ddlChanNo.DataBind();
        if (ddlChanNo.Items.Count > 0)
        {
            ddlChanNo.SelectedIndex = 0;
            MaintainAssign bcoMA = new MaintainAssign(ConntionDB);
            Dt = bcoMA.GetStoreByChanNo(ddlChanNo.SelectedItem.Value);
            this.ddlStore.DataSource = Dt;
            DataRow drMyRow = Dt.NewRow();
            drMyRow["name"] = "全部";
            drMyRow["store"] = "";
            Dt.Rows.InsertAt(drMyRow, 0);
            ddlStore.DataTextField = "name";
            ddlStore.DataValueField = "store";
            ddlStore.DataBind();
            if (ddlStore.Items.Count > 0)
                ddlStore.SelectedIndex = 0;
        }
    }
Example #14
0
 protected void ddlChanNo_SelectedIndexChanged(object sender, EventArgs e)
 {
     MaintainAssign BCO = new MaintainAssign(ConntionDB);
     DataTable Dt = bco.GetStoreByChanNo(ddlChanNo.SelectedItem.Value);
     this.ddlStore.DataSource = Dt;
     DataRow drMyRow = Dt.NewRow();
     drMyRow["name"] = "全部";
     drMyRow["store"] = "";
     Dt.Rows.InsertAt(drMyRow, 0);
     ddlStore.DataTextField = "name";
     ddlStore.DataValueField = "store";
     ddlStore.DataBind();
     if (ddlStore.Items.Count > 0)
         ddlStore.SelectedIndex = 0;
 }