예제 #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;
        }
    }
예제 #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;
        }

    }