Example #1
0
    private void reCnt()
    {
        try
        {
            AcceptDate.ReadOnly = true;
            int intRes;
            DataTable Dt;

            PIC.VDS2G.VSM.IVM.MaintainPickOutData MBCO = new PIC.VDS2G.VSM.IVM.MaintainPickOutData(ConntionDB);

            ParameterList.Clear();

            ParameterList.Add(AcceptDate.Text);
            ParameterList.Add(Session["UID"].ToString());
            intRes = MBCO.GetSTAcceptData(ParameterList, DBT, out Dt);

            if (intRes == 0)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "ExecutedOut", "alert(' 此門市進貨日已執行過出庫作業 ');", true);
            }
            else
            {
                if (Dt.Rows.Count != 0)
                {
                    btnTrans.Enabled = true;
                    btnCntQty.Enabled = false;
                    AcceptDate.ReadOnly = true;
                    BindGrid(Dt);
                    GridView1.Sort("SORT_SEQ", SortDirection.Descending);
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "enablebtnTrans", string.Format("$get('{0}').disabled=false;", btnTrans.ClientID), true);
                }
                else
                {
                    btnTrans.Enabled = false;
                    btnCntQty.Enabled = true;
                    AcceptDate.ReadOnly = false;
                    ErrorMsgLabel.Text = "查無資料";
                    //ScriptManager.RegisterStartupScript(Page, this.GetType(), "NoDataAlert", "alert(' 查無資料 ');", true);
                }
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #2
0
    protected void btnCntQty_Click(object sender, EventArgs e)
    {
        try
        {
            // javascript 將[計算數量]及[轉單作業]二顆按鈕disable
            //btnCntQty.Enabled = false;
            //btnTrans.Enabled = false;
            //AcceptDate.ReadOnly = true;

            ExecDate.Text = "";
            OutNo.Text = "";
            ErrorMsgLabel.Text = "";

            string strIsAcceptDate = string.Empty; //for MaintainAcceptDate.IsAcceptDate 回傳值

            int intRes = 0;  //for MaintainPickOutData.GetPickOutData 回傳值
            string strInout_NO = string.Empty;  //for MaintainPickOutData.GetPickOutData out參數
            string strUpdatedate = string.Empty;  //for MaintainPickOutData.GetPickOutData out參數
            string strUpdateid = string.Empty;  //for MaintainPickOutData.GetPickOutData out參數

            int intGetData = 0;  //for MaintainPickOutData.GetSTAcceptData 回傳值
            DataTable Dt;  //for MaintainPickOutData.GetSTAcceptData out參數

            PIC.VDS2G.LGT.CGR.MaintainAcceptDate BCO = new PIC.VDS2G.LGT.CGR.MaintainAcceptDate(ConntionDB);
            PIC.VDS2G.VSM.IVM.MaintainPickOutData MBCO = new PIC.VDS2G.VSM.IVM.MaintainPickOutData(ConntionDB);

            ParameterList.Clear();

            ParameterList.Add(AcceptDate.Text);

            strIsAcceptDate = BCO.IsAcceptDate(ParameterList);

            if (strIsAcceptDate == "0")  //所輸入日期不為門市進貨日
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "NotAcceptDate", "alert(' 所輸入日期不為門市進貨日,請重新輸入 ');", true);
                //ScriptManager.RegisterStartupScript(this, this.GetType(), "enablebtnCntQty", string.Format("$get('{0}').disabled=false;", btnCntQty.ClientID), true);
                btnCntQty.Enabled = true;
                AcceptDate.ReadOnly = false;
                SetClinetFocus(((TextBox)AcceptDate.FindControl("TextBoxCode")).ClientID);
                return;
            }
            else  //抓取出庫資料
            {
                ParameterList.Clear();
                ParameterList.Add(AcceptDate.Text);
                intRes = MBCO.GetPickOutData(ParameterList, out strInout_NO, out strUpdatedate, out strUpdateid);

                switch (intRes)
                {
                    case 0:  //表示找不到符合的出庫資料
                        ParameterList.Clear();
                        ParameterList.Add(AcceptDate.Text);
                        ParameterList.Add(Session["UID"].ToString());
                        intGetData = MBCO.GetSTAcceptData(ParameterList, DBT, out Dt);
                        if (intGetData == 0)
                        {
                            ScriptManager.RegisterStartupScript(Page, this.GetType(), "ExecutedOut", "alert(' 此門市進貨日已執行過出庫作業 ');", true);
                            //ScriptManager.RegisterStartupScript(this, this.GetType(), "enablebtnCntQty", string.Format("$get('{0}').disabled=false;", btnCntQty.ClientID), true);
                            btnCntQty.Enabled = true;
                            AcceptDate.ReadOnly = false;
                            return;
                        }
                        else
                        {
                            if (Dt.Rows.Count > 0)
                            {
                                BindGrid(Dt);
                                GridView1.Sort("SORT_SEQ", SortDirection.Descending);
                                btnTrans.Enabled = true;
                                btnCntQty.Enabled = false;
                                AcceptDate.ReadOnly = true;

                                //ScriptManager.RegisterStartupScript(this, this.GetType(), "enablebtnTrans", string.Format("$get('{0}').disabled=false;", btnTrans.ClientID), true);
                                break;
                            }
                            else
                            {
                                ErrorMsgLabel.Text = "查無資料";
                            }
                        }
                        break;
                    case 1: //表示已有出庫資料
                        OutNo.Text = strInout_NO;
                        ExecDate.Text = strUpdatedate;
                        ExecID.Text = strUpdateid;
                        btnTrans.Enabled = false;
                        btnCntQty.Enabled = true;
                        AcceptDate.ReadOnly = false;
                        break;
                    case 2: //表示曾有人執行過計算的動作,但未執行出庫
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ConfirmReCount", "if (confirm('是否刪除已計算資料重新執行計算?')){document.all['" + btnCntQty.ClientID + "'].disabled=true;__doPostBack('reCnt','');}", true);

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

    }
Example #3
0
    protected void btnTrans_Click(object sender, EventArgs e)
    {
        try
        {
            string strInout_NO = string.Empty;
            string strMsg = string.Empty;
            int intRes = 0;

            if (AcceptDate.Text != DateTime.Now.ToString("yyyy/MM/dd"))
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "IVM121", "alert('非門市進貨日出庫時間無法執行轉單作業');", true);
                return;
            }

            PIC.VDS2G.VSM.IVM.MaintainPickOutData MBCO = new PIC.VDS2G.VSM.IVM.MaintainPickOutData(ConntionDB);
            ParameterList.Clear();

            if (checkQty())
            {
                ParameterList.Add(AcceptDate.Text);
                ParameterList.Add("PICK");
                ParameterList.Add("");
                ParameterList.Add(Session["UID"].ToString());

                #region Trace使用的LOG(不需要刪除,平常不會開啟) Make By Arther 2009/10/1 10:41

                Trace.Warn("使用者:" + Session["UID"].ToString() + "於" + DateTime.Now.ToString() + "開始轉單!!");

                #endregion

                intRes = MBCO.ExecPickOut(ParameterList, null, out strInout_NO, out strMsg);

                #region Trace使用的LOG(不需要刪除,平常不會開啟) Make By Arther 2009/10/1 10:41

                Trace.Warn("使用者:" + Session["UID"].ToString() + "於" + DateTime.Now.ToString() + "結束轉單!!");

                #endregion

                if (intRes == 0)
                {
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "ExecutedOut", "alert(' 此門市進貨日已執行過出庫作業 ');", true);
                }
                else if (intRes == 1)
                {
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "ExecutedOut", "alert(' 庫存數與出庫數不符合,請重新執行計算 ');", true);
                }
                else if (intRes == 2)
                {
                    OutNo.Text = strInout_NO;
                    ExecDate.Text = DateTime.Today.ToString("yyyy/MM/dd");
                    ExecID.Text = Session["UID"].ToString();

                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "ExecutedSuccess", "alert(' 出庫轉單作業完成 ');", true);
                    btnTrans.Enabled = false;
                    DataTable Dt = (DataTable)Session["IVM121_" + PageTimeStamp.Value];
                    Dt.Clear();
                    BindGrid(Dt);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "OtherMessage", "alert(' " + strMsg + " ');", true);
                }

            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "chkQty", "alert(' 庫存量不符合 ');", true);
                //GridView1.Sort("SORT_SEQ", SortDirection.Descending);

                //btnCntQty.Enabled = true;
                //AcceptDate.ReadOnly = false;
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
    }
Example #4
0
    private void SetDefaultValue()
    {
        //呼叫MaintainAcceptDate.GetNextAcceptDate,傳入參數@Date=系統日-1
        //接收回傳參數@AccepDate 填入 [門市進貨日] 欄位

        string strDate = string.Empty;

        IVMModel.MaintainPickOutData BCO = new PIC.VDS2G.VSM.IVM.MaintainPickOutData(ConntionDB);

        ParameterList.Clear();

        ParameterList.Add(DateTime.Today.AddDays(-1).ToString("yyyy/MM/dd"));

        strDate = BCO.GetNextAcceptDate(ParameterList);

        AcceptDate.Text = strDate;

        ExecID.Text = Session["UID"].ToString();

        btnTrans.Enabled = false;
        //btnTrans.Attributes.Add("disabled", "true");
    }