using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL.OA;
using CY.BLL;
using CY.Model;
using CY.Infrastructure.Common;
using CY.BLL.Sys;
using CY.Infrastructure.Query;
using System.Data;
namespace CY.WebForm.Pages.business
{
public partial class AgConWarehouse : BasePage
{
OA_BrandBLL _OA_BrandBLL = null;
OA_CargoSpaceBLL _OA_CargoSpaceBLL = null;
OA_CommodityBLL _OA_CommodityBLL = null;
OA_WarehouseInfoBLL _OA_WarehouseInfoBLL = null;
OA_SpecificationBLL _OA_SpecificationBLL = null;
OA_InventoryBLL _OA_InventoryBLL = null;
OA_GoodsInfoBLL _OA_GoodsInfoBLL = null;
OA_PaperWeightBLL _OA_PaperWeightBLL = null;
string Keyid;
OA_CommoditySpeciAssociateBLL _OA_CommoditySpeciAssociateBLL = null;
public AgConWarehouse()
{
_OA_PaperWeightBLL = new OA_PaperWeightBLL();
_OA_GoodsInfoBLL = new OA_GoodsInfoBLL();
_OA_CommoditySpeciAssociateBLL = new OA_CommoditySpeciAssociateBLL();
_OA_InventoryBLL = new OA_InventoryBLL();
_OA_WarehouseInfoBLL = new OA_WarehouseInfoBLL();
_OA_CargoSpaceBLL = new OA_CargoSpaceBLL();
_OA_BrandBLL = new OA_BrandBLL();
_OA_CommodityBLL = new OA_CommodityBLL();
_OA_SpecificationBLL = new OA_SpecificationBLL();
}
string CommodityValue = null;
protected void Page_Load(object sender, EventArgs e)
{
if (Request["CommidityType"].ToString() == "纸张")
{
OA_Commodity model = _OA_CommodityBLL.getCommodityId(CurrentUser.MemberId);
if (model != null)
CommodityValue = model.Keyid.ToString2();
}
else
{
OA_Commodity model = _OA_CommodityBLL.getBanCaiId(CurrentUser.MemberId);
if (model != null)
CommodityValue = model.Keyid.ToString2();
}
UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
if (!IsPostBack)
{
///货品名称
DataTable ds = _OA_GoodsInfoBLL.SlectModleByCommity(CommodityValue,CurrentUser.MemberId);
if (ds.Rows.Count > 0)
{
dwGoodsList.DataSource = ds;
dwGoodsList.DataTextField = "GoodsName";
dwGoodsList.DataValueField = "Keyid";
dwGoodsList.DataBind();
dwGoodsList.Items.Insert(0, new ListItem("请选择", ""));
}
else
{
dwGoodsList.Items.Clear();
dwGoodsList.Items.Insert(0, new ListItem("请选择", ""));
}
this.selWarehouseId.DataSource = _OA_WarehouseInfoBLL.getAllWarehouseInfo(CurrentUser.MemberId);
this.selWarehouseId.DataValueField = "Keyid";
this.selWarehouseId.DataTextField = "WarehouseName";
this.selWarehouseId.DataBind();
selWarehouseId.Items.Insert(0, new ListItem("请选择", ""));
indecChage();
BindList();
}
}
///
/// 根据产品名初始化数据
///
///
///
protected void dwGoodsList_SelectedIndexChanged(object sender, EventArgs e)
{
indecChage();
}
///
/// 根据货品类别和货品名称选择规格和品牌
///
protected void indecChage()
{
///品牌
DataTable dt_brand = _OA_BrandBLL.getAllBrand(CurrentUser.MemberId, this.CommodityValue, this.dwGoodsList.SelectedValue);
if (dt_brand.Rows.Count > 0)
{
dwBrand.DataSource = dt_brand;
dwBrand.DataTextField = "Name";
dwBrand.DataValueField = "Keyid";
dwBrand.DataBind();
dwBrand.Items.Insert(0, new ListItem("请选择", ""));
}
else
{
dwBrand.Items.Clear();
dwBrand.Items.Insert(0, new ListItem("请选择", ""));
}
DataTable dt_Specefiction = _OA_SpecificationBLL.getAllSpecification(CurrentUser.MemberId, this.CommodityValue, this.dwGoodsList.SelectedValue);
///规格
if (dt_Specefiction.Rows.Count > 0)
{
dwSpecification.DataSource = dt_Specefiction;
dwSpecification.DataTextField = "Name";
dwSpecification.DataValueField = "Keyid";
dwSpecification.DataBind();
dwSpecification.Items.Insert(0, new ListItem("请选择", ""));
}
else
{
dwSpecification.Items.Clear();
dwSpecification.Items.Insert(0, new ListItem("请选择", ""));
}
DataTable dt_PaperWeight = _OA_PaperWeightBLL.getPaperWeight(CurrentUser.MemberId, this.CommodityValue, this.dwGoodsList.SelectedValue);
///克重
if (dt_PaperWeight.Rows.Count > 0)
{
dwPaperWeight.DataSource = dt_PaperWeight;
dwPaperWeight.DataTextField = "Name";
dwPaperWeight.DataValueField = "Keyid";
dwPaperWeight.DataBind();
dwPaperWeight.Items.Insert(0, new ListItem("请选择", ""));
}
}
protected void BindList()
{
Pagination pa = new Pagination();
pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
pa.PageSize = UCPager1.AspNetPager.PageSize;
ReInventoryList.DataSource = _OA_InventoryBLL.SelectModelList(pa, CurrentUser.MemberId, this.dwPaperWeight.SelectedValue, this.selWarehouseId.Value, this.dwSpecification.SelectedValue, this.dwBrand.SelectedValue, CommodityValue, this.dwGoodsList.SelectedValue,"",DateTime.MinValue,DateTime.MaxValue);
ReInventoryList.DataBind();
UCPager1.AspNetPager.RecordCount = pa.RecordCount;
}
protected void AspNetPager1_PageChanged(object src, EventArgs e)
{
BindList();
}
protected void btn_Register_Click(object sender, EventArgs e)
{
BindList();
}
}
}