Beispiel #1
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;
        }
    }