📄 returnstocklist.aspx.cs
字号:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using BLL;
namespace 金利来分销管理系统.Stock
{
public partial class ReturnStockList : System.Web.UI.Page
{
//实例化BLL层
BLL.Stock.StockFormBll stockformbllshow;
BLL.Stock.Stock_SetailsBll stocksetailbllshow;
BLL.Employee.EmployeeBll employeebllshow;
BLL.Store.StoreBll storeIDshow;
public ReturnStockList()
{
stockformbllshow = new BLL.Stock.StockFormBll();
stocksetailbllshow = new BLL.Stock.Stock_SetailsBll();
employeebllshow = new BLL.Employee.EmployeeBll();
storeIDshow = new BLL.Store.StoreBll();
}
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(), "44") == true)
{
//登陆人
this.lblName.Text = Session["employee_id"].ToString();
//通过“已入库”查询采购单据表中的采购编号
List<Model.Stock.Stock_SetailsModel> list = stockformbllshow.StockFormSelectByOK("已入库");
foreach (var item in list)
{
this.ddlStockID.Items.Add(item.stockform_id);
}
this.gvShow.DataSource = stockformbllshow.StockFormSelectByOK("已入库");
this.gvShow.DataBind();
}
else
{
Response.Write("<script>alert('你无权查看此功能,请与管理员联系');location.href='../Aboutus.aspx'</script>");
}
}
}
}
//采购单据编号
protected void ddlStockID_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.ddlStockID.SelectedValue == "请选择采购单据编号")
{
this.gvShow.DataSource = null;
this.gvShow.DataBind();
this.btnOK.Visible = false;
}
else
{
//通过采购单据编号显示数据
this.gvShow.DataSource = stocksetailbllshow.stocksetailbystockform(this.ddlStockID.Text);
this.gvShow.DataBind();
this.btnOK.Visible = true;
}
}
//生成采购单据
protected void btnOK_Click(object sender, EventArgs e)
{
if (this.ddlStockID.SelectedValue != "请选择采购单据编号")
{
//按单据号,找出单据信息
List<Model.Stock.Stock_SetailsModel> stockshow = stocksetailbllshow.stocksetailbystockform(this.ddlStockID.Text);
//有几行记录,就循环几次,首先比对仓库库存和单据数量
foreach (Model.Stock.Stock_SetailsModel item in stockshow)
{
//通过商品在库存中
Model.Store.StoreModel storemodel = storeIDshow.SelectStoreByProduct(100, item.product_id, item.stock_setails_color);
//判断甲方的库存量是否充足
if (storemodel.store_size1 < item.stock_setails_s1 || storemodel.store_size2 < item.stock_setails_s2 || storemodel.store_size3 < item.stock_setails_s3 || storemodel.store_size4 < item.stock_setails_s4 || storemodel.store_size5 < item.stock_setails_s5 || storemodel.store_size6 < item.stock_setails_s6 || storemodel.store_size7 < item.stock_setails_s7)
{
this.lblshow.Visible = true;
return;
}
}
stockformbllshow.StockFormReturnUpdate(this.ddlStockID.Text, 2, "未通过");
Response.Write("<script>alert('退货申请已提交')</script>");
//清空数据
this.gvShow.DataSource = null;
this.gvShow.DataBind();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -