?? removeexec.aspx.cs
字號:
?using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Model;
namespace 金利來分銷管理系統.Remove
{
public partial class RemoveExec : System.Web.UI.Page
{
BLL.Remove.RemoveBll bllshow;
BLL.Store.StoreBll storeIDshow;
BLL.Employee.EmployeeBll employeebllshow;
List<Model.Remove.RemoveModel> show = new List<Model.Remove.RemoveModel>();
public RemoveExec()
{
bllshow = new BLL.Remove.RemoveBll();
storeIDshow = new BLL.Store.StoreBll();
employeebllshow = new BLL.Employee.EmployeeBll();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
//用戶權限
if (Session["employee_id"] == null)
{
Response.Write("<script>alert('請您登陸系統');location.href='../Enter.aspx'</script>");
}
else
{
if (employeebllshow.UserRole(Session["role_id"].ToString(), "39") == true)
{
//獲得通過審核的調撥單據放入DropDownList里
List<Model.Remove.RemoveModel> removeIDok = bllshow.SelectRemoveIDok();
foreach (var item in removeIDok)
{
this.ddlRemoveID.Items.Add(item.remove_id);
}
}
else
{
Response.Write("<script>alert('你無權查看此功能,請與管理員聯系');location.href='../Aboutus.aspx'</script>");
}
}
}
}
//當單據選擇發生改變時
protected void ddlRemoveID_SelectedIndexChanged(object sender, EventArgs e)
{
this.lblshow.Visible = false;
List<Model.Remove.RemoveModel> show = bllshow.SelectRemove(this.ddlRemoveID.Text);
foreach (var item in show)
{
this.lblgoid.Text = item.remove_go;
this.lbltoid.Text = item.remove_to;
}
this.gvshow.DataSource = bllshow.SelectRemoveList(this.ddlRemoveID.Text);
this.gvshow.DataBind();
}
//執行
protected void btnOK_Click(object sender, EventArgs e)
{
if (this.ddlRemoveID.SelectedValue !="請選擇單據號")
{
//按單據號,找出該單據詳細
List<Model.Remove.RemoveModel> removeshow = bllshow.SelectRemoveList(this.ddlRemoveID.Text);
//有幾行記錄,就循環幾次,首先比對倉庫庫存和單據數量
foreach (Model.Remove.RemoveModel item in removeshow)
{
//通過商品在庫存中
Model.Store.StoreModel storemodel = storeIDshow.SelectStoreByProduct(int.Parse(this.lblgoid.Text), item.Product_id,item.remove_list_color);
//判斷甲方的庫存量是否充足
if (storemodel.store_size1 < item.remove_list_size1 || storemodel.store_size2 < item.remove_list_size2 || storemodel.store_size3 < item.remove_list_size3 || storemodel.store_size4 < item.remove_list_size4 || storemodel.store_size5 < item.remove_list_size5 || storemodel.store_size6 < item.remove_list_size6 || storemodel.store_size7 < item.remove_list_size7)
{
this.lblshow.Visible = true;
return;
}
}
//通過以上驗證,有幾行記錄,就循環幾次
foreach (Model.Remove.RemoveModel item in removeshow)
{
//判斷該商品在乙方倉庫有無,如果有
if (storeIDshow.InsertStoreCheck(item.Product_id, int.Parse(this.lbltoid.Text), item.remove_list_color) == 1)
{
//甲方倉庫修改
storeIDshow.OutStoreUp(int.Parse(this.lblgoid.Text), item.Product_id, item.remove_list_color, item.remove_list_size1, item.remove_list_size2, item.remove_list_size3, item.remove_list_size4, item.remove_list_size5, item.remove_list_size6, item.remove_list_size7, item.remove_list_sum);
//乙方倉庫修改
storeIDshow.InsertStoreUp(int.Parse(this.lbltoid.Text), item.Product_id, item.remove_list_color, item.remove_list_size1, item.remove_list_size2, item.remove_list_size3, item.remove_list_size4, item.remove_list_size5, item.remove_list_size6, item.remove_list_size7, item.remove_list_sum);
//修改單據狀態
//bllshow.UpRemove(this.ddlRemoveID.Text, '員', this.txtadvice.Text, this.rblistState.SelectedValue);
}
//判斷該商品在乙方倉庫有無,如果無
if (storeIDshow.InsertStoreCheck(item.Product_id, int.Parse(this.lbltoid.Text), item.remove_list_color) == 0)
{
//甲方倉庫修改
storeIDshow.OutStoreUp(int.Parse(this.lblgoid.Text), item.Product_id, item.remove_list_color, item.remove_list_size1, item.remove_list_size2, item.remove_list_size3, item.remove_list_size4, item.remove_list_size5, item.remove_list_size6, item.remove_list_size7, item.remove_list_sum);
//乙方倉庫添加
storeIDshow.InsertStoreInto(int.Parse(this.lbltoid.Text), item.Product_id, item.remove_list_color, item.remove_list_size1, item.remove_list_size2, item.remove_list_size3, item.remove_list_size4, item.remove_list_size5, item.remove_list_size6, item.remove_list_size7, item.remove_list_sum);
}
}
this.lblshow.Visible = false;
storeIDshow.Upstate(ddlRemoveID.Text, "已入庫");
Response.Write("<script>alert('操作成功')</script>");
this.ddlRemoveID.Items.Remove(this.ddlRemoveID.Text);
this.ddlRemoveID.SelectedIndex = 0;
}
else
{
Response.Write("<script>alert('未選擇單據號')</script>");
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -