protected void btnExecute_Click(object sender, EventArgs e) { try { string s_Chan_No, s_Chan_Option;// 通路,計算類別 //計算類別 if (this.rbtn_Chan.Checked) { s_Chan_No = null; s_Chan_Option = "0"; } else { s_Chan_No = (this.SLP_StoreChain1.Text.Trim() == "") ? null : this.SLP_StoreChain1.Text.Trim(); s_Chan_Option = "1"; } #region 執行計算 ArrayList ParameterList = new ArrayList();//20091113 ParameterList.Clear(); ParameterList.Add(s_DIS_NO); ParameterList.Add(s_ITEM); ParameterList.Add(s_PERIOD); ParameterList.Add(s_Chan_No); ParameterList.Add(s_Chan_Option); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(s_SESSION_ID); ALOModel.MaintainDisRecord BCO = new ALOModel.MaintainDisRecord(ConnectionDB); bool bResult; if (this.rbtn_Chan.Checked) //通路計算 { bResult = BCO.CalculateDisQtyByChanRatio(ParameterList, null); } else { bResult = BCO.CalculateDisQtyByAreaRatio(ParameterList, null); } if (bResult) { #region new #region 取得待處理資訊 #region 產生暫存檔資訊 try { ALOModel.MaintainDisRecord BCO2 = new ALOModel.MaintainDisRecord(ConnectionDB); ParameterList.Clear(); ParameterList.Add(s_DIS_NO); ParameterList.Add(s_ITEM); ParameterList.Add(s_PERIOD); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(s_SESSION_ID); bool bResult2 = BCO2.CreateALO116TMP(ParameterList); if (!bResult2) { throw new Exception("建立暫存檔失敗"); } } catch (Exception ex) { this.ErrorMsgLabel.Text = ex.Message; return; } #endregion QueryAllChanData(); //取得通路資料 QueryAllAreaData(); //取得區域資料 #endregion this.up_Chan.Update(); this.up_Area.Update(); if (this.rbtn_Chan.Checked)//通路比例分配 { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "LockOrUnLockButtonInGridviewControl(false,'gv_Chan','btn');LockOrUnLockButtonInGridviewControl(true,'gv_Area','btn');", true); } else//區域比例分配 { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "LockOrUnLockButtonInGridviewControl(true,'gv_Chan','btn');LockOrUnLockButtonInGridviewControl(false,'gv_Area','btn');", true); } #endregion this.RightMsgLabel.Text = "計算完成"; this.up_Msg.Update(); #region old //if (this.rbtn_Chan.Checked) //通路計算 //{ // QueryAllChanData(); // this.up_Chan.Update(); //} //else //{ // QueryAllAreaData(); // this.up_Area.Update(); //} #endregion } #endregion } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message; } }