📄 addallreserve.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;
using System.Data;
using Model.Stock;
namespace 金利来_转aspx_
{
public partial class AddAllReserve : System.Web.UI.Page
{
//实例化BLL层的方法
BLL.Store.StoreBll bllshow;
public AddAllReserve()
{
bllshow = new BLL.Store.StoreBll();
}
protected void Page_Load(object sender, EventArgs e)
{
//if (!IsPostBack)
//{
//}
}
//查询按钮
protected void btnChaXun_Click(object sender, EventArgs e)
{
List<Model.Stock.Stock_SetailsModel> insertstoreallshow = bllshow.InsertStoreShow(Convert.ToInt32(bllshow.GettypeID(this.ddlLeiXing.Text)),this.ddlRuKuDanHao.Text);
this.GridView1.DataSource = insertstoreallshow;
this.GridView1.DataBind();
}
//出入库提交按钮
protected void btnTiJiao_Click(object sender, EventArgs e)
{
if (ddlLeiXing.Text == "请选择类型")
{
Response.Write("<script>window.alert('请先选择单据类型')</script>");
}
if (ddlLeiXing.Text == "采购进货")
{
//将需要操作的数据放入ls集合里
List<Model.Stock.Stock_SetailsModel> ls = bllshow.InsertStoreShow(Convert.ToInt32(bllshow.GettypeID(this.ddlLeiXing.Text)), this.ddlRuKuDanHao.Text);
foreach (Stock_SetailsModel item in ls)
{
//如果该仓库存在该编号,同颜色商品
if (bllshow.InsertStoreCheck(item.product_id, int.Parse(this.lblCangKuID.Text), item.stock_setails_color) == 1 && ddlLeiXing.Text == "采购进货")
{
//修改该仓库,该商品,该颜色的信息
bllshow.InsertStoreUp(int.Parse(this.lblCangKuID.Text), item.product_id, item.stock_setails_color, item.stock_setails_s1, item.stock_setails_s2, item.stock_setails_s3, item.stock_setails_s4, item.stock_setails_s5, item.stock_setails_s6, item.stock_setails_s7, item.stock_setails_sum);
}
//如果该仓库不存在该编号,同颜色商品
if (bllshow.InsertStoreCheck(item.product_id, int.Parse(this.lblCangKuID.Text), item.stock_setails_color) == 0 && ddlLeiXing.Text == "采购进货")
{
//添加一条信息
bllshow.InsertStoreInto(int.Parse(this.lblCangKuID.Text), item.product_id, item.stock_setails_color, item.stock_setails_s1, item.stock_setails_s2, item.stock_setails_s3, item.stock_setails_s4, item.stock_setails_s5, item.stock_setails_s6, item.stock_setails_s7, item.stock_setails_sum);
}
}
Response.Write("<script>window.alert('入库操作成功')</script>");
bllshow.UpstateStock(ddlRuKuDanHao.Text, "已入库",3);
this.lblshow.Visible = false;
}
if (ddlLeiXing.Text == "采购退货")
{
//将需要操作的数据放入ls集合里
List<Model.Stock.Stock_SetailsModel> ls = bllshow.InsertStoreShow(Convert.ToInt32(bllshow.GettypeID(this.ddlLeiXing.Text)), this.ddlRuKuDanHao.Text);
//有几行记录,就循环几次,首先比对仓库库存和单据数量
foreach (Model.Stock.Stock_SetailsModel item in ls)
{
//通过商品在库存中
Model.Store.StoreModel storemodel = bllshow.SelectStoreByProduct(int.Parse(this.lblCangKuID.Text), 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;
}
}
//以上验证通过,几行记录,修改几次
foreach (Model.Stock.Stock_SetailsModel item in ls)
{
//退货,不会出现商品不存在的情况,直接修改
bllshow.OutStoreUp(int.Parse(this.lblCangKuID.Text), item.product_id, item.stock_setails_color, item.stock_setails_s1, item.stock_setails_s2, item.stock_setails_s3, item.stock_setails_s4, item.stock_setails_s5, item.stock_setails_s6, item.stock_setails_s7, item.stock_setails_sum);
}
Response.Write("<script>window.alert('出库操作成功')</script>");
bllshow.UpstateStock(ddlRuKuDanHao.Text, "已出库", 4);
this.lblshow.Visible = false;
}
}
//当选定值发生改变时
protected void ddlLeiXing_SelectedIndexChanged(object sender, EventArgs e)
{
this.lblshow.Visible = false;
if (ddlLeiXing.Text == "请选择类型")
{
ddlRuKuDanHao.Items.Clear();
ddlRuKuDanHao.Items.Add("请选择单据号");
}
if (ddlLeiXing.Text == "采购进货")
{
ddlRuKuDanHao.Items.Clear();
//将采购单据的编号添加到DropDownList里
List<Model.Stock.Stock_SetailsModel> stockformid = bllshow.SelectStockFormIDwhere(Convert.ToInt32(bllshow.GettypeID(this.ddlLeiXing.Text)));
foreach (var item in stockformid)
{
ddlRuKuDanHao.Items.Add(item.stockform_id);
}
}
if (ddlLeiXing.Text == "采购退货")
{
ddlRuKuDanHao.Items.Clear();
//将采购单据的编号添加到DropDownList里
List<Model.Stock.Stock_SetailsModel> stockformid = bllshow.SelectStockFormIDwhere(Convert.ToInt32(bllshow.GettypeID(this.ddlLeiXing.Text)));
foreach (var item in stockformid)
{
ddlRuKuDanHao.Items.Add(item.stockform_id);
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -