Ejemplo n.º 1
0
    /// <summary>
    /// 配量計算 2009-07-02 cyhsu add
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void BusBtn_CalcDisQty_Click(object sender, EventArgs e)
    {
        try
        {
            #region 參數檢查
            if (DISNOTxt.Text == "")
            {
                throw new Exception("配本序號未產生,請先存檔");
            }
            if (SLP_ApproveDate.Text != "")
            {
                throw new Exception("配本已確認,不可重算配量");
            }
            if (SLP_SKU1.Text == "")
            {
                throw new Exception("配本商品未設定!");
            }
            if (SLP_ItemPeriod1.Text == "")
            {
                throw new Exception("未設定期別!");
            }
            if (SLP_PARAM1.Text == "")
            {
                if (iDataSource != 0)//2010/03/03 added
                {
                    throw new Exception("非經由到貨配本設定之資料不可進行配量計算!");
                }
                else
                {
                    throw new Exception("配本方式未設定!");
                }
            }

            #endregion
            #region 執行計算
            ALOModel.MaintainDisRecord BCO = new ALOModel.MaintainDisRecord(ConnectionDB);

            BCO.ProcessCalculateDisQty(DISNOTxt.Text,
                                       SLP_SKU1.Text,
                                       SLP_ItemPeriod1.Text,
                                       SLP_Boolean_CountNoEff.Text,
                                       Session["UID"].ToString(),
                                       SLP_PARAM1.Text,
                                       RootNoHidden.Value,
                                       null);
            #endregion
            #region 更新UI

            ALOItemBind(SLP_SKU1.Text,
                        SLP_ItemPeriod1.Text
                        );

            ScriptManager.RegisterStartupScript(this, this.GetType(), "ClientScript", "alert('配量計算完成!!');", true);
            #endregion
        }
        catch (Exception ex)
        {
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {
            UpdatePanel_ErrorMessage.Update();
        }

    }