using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.Model;
using CY.BLL.OA;
using CY.Infrastructure.Common;
using CY.Infrastructure.Query;
using CY.BLL.Sys;
using System.Data;
using CY.BLL;
namespace CY.WebForm.Pages.procurement
{
public partial class OutOfStorageList : BasePage
{
OA_StaffBLL bll_OA_StaffBLL = null;
Sys_DictionaryBLL _Sys_DictionaryBLL = null;
OA_SuppliersBLL _OA_SuppliersBLL = null;
OA_CommodityBLL _OA_CommodityBLL = null;
OA_GoodsInfoBLL _OA_GoodsInfoBLL = null;
OA_ProcurementBLL _OA_ProcurementBLL = null;
OA_WarehouseInfoBLL _OA_WarehouseInfoBLL = null;
OA_Procurement Procuremet = null;
OA_SpecificationBLL _OA_SpecificationBLL = null;
OA_OutOfStorageBLL _OA_OutOfStorageBLL = null;
OA_BrandBLL _OA_BrandBLL = null;
OA_PaperWeightBLL _OA_PaperWeightBLL = null;
public OutOfStorageList()
{
_OA_PaperWeightBLL = new OA_PaperWeightBLL();
_OA_BrandBLL = new OA_BrandBLL();
bll_OA_StaffBLL = new OA_StaffBLL();
_OA_OutOfStorageBLL = new OA_OutOfStorageBLL();
_OA_SpecificationBLL = new OA_SpecificationBLL();
_OA_WarehouseInfoBLL = new OA_WarehouseInfoBLL();
Procuremet = new OA_Procurement();
_OA_CommodityBLL = new OA_CommodityBLL();
_Sys_DictionaryBLL = new Sys_DictionaryBLL();
_OA_SuppliersBLL = new OA_SuppliersBLL();
_OA_GoodsInfoBLL = new OA_GoodsInfoBLL();
_OA_ProcurementBLL = new OA_ProcurementBLL();
}
protected void Page_Load(object sender, EventArgs e)
{
UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
//UCPager1.AspNetPager.PageSize =20;
if (!IsPostBack)
{
InitialData();
BindList();
}
}
protected void btn_Register_Click(object sender, EventArgs e)
{
BindList();
}
protected void InitialData()
{
//仓库
this.selWarehouseId.DataSource = _OA_WarehouseInfoBLL.getAllWarehouseInfo(CurrentUser.MemberId);
this.selWarehouseId.DataTextField = "WarehouseName";
this.selWarehouseId.DataValueField = "Keyid";
this.selWarehouseId.DataBind();
this.selWarehouseId.Items.Insert(0, new ListItem("全部", ""));
//货品类别
this.dwCommity.DataSource = _OA_CommodityBLL.SelectModelPage(CurrentUser.MemberId, "", "True");
this.dwCommity.DataValueField = "Keyid";
this.dwCommity.DataTextField = "CommodityName";
this.dwCommity.DataBind();
this.dwCommity.Items.Insert(0, new ListItem("全部", ""));
this.dwGoodsList.Items.Insert(0, new ListItem("全部", ""));
this.dwGoodsList.Items.Insert(0, new ListItem("全部", ""));
this.dwPaperWeight.Items.Insert(0, new ListItem("全部", ""));
this.dwSpecification.Items.Insert(0, new ListItem("全部", ""));
}
///
/// 类别选取
///
///
///
protected void dwCommity_SelectedIndexChanged(object sender, EventArgs e)
{
DataTable ds = _OA_GoodsInfoBLL.SlectModleByCommity(this.dwCommity.SelectedValue, CurrentUser.MemberId);
if (ds.Rows.Count > 0)
{
this.dwGoodsList.DataSource = ds;
this.dwGoodsList.DataTextField = "GoodsName";
this.dwGoodsList.DataValueField = "Keyid";
this.dwGoodsList.DataBind();
this.dwGoodsList.Items.Insert(0, new ListItem("全部", ""));
}
else
{
this.dwGoodsList.Items.Clear();
this.dwGoodsList.Items.Insert(0, new ListItem("全部", ""));
}
BindList();
// indecChage();
}
///
/// 根据产品名初始化数据
///
///
///
protected void dwGoodsList_SelectedIndexChanged(object sender, EventArgs e)
{
indecChage();
BindList();
}
///
/// 根据货品类别和货品名称选择规格和品牌
///
protected void indecChage()
{
//品牌
DataTable dt_brand = _OA_BrandBLL.getAllBrand(CurrentUser.MemberId, this.dwCommity.SelectedValue, this.dwGoodsList.SelectedValue);
if (dt_brand.Rows.Count > 0)
{
this.dwBrand.DataSource = dt_brand;
this.dwBrand.DataTextField = "Name";
this.dwBrand.DataValueField = "Keyid";
this.dwBrand.DataBind();
this.dwBrand.Items.Insert(0, new ListItem("全部", ""));
}
else
{
this.dwBrand.Items.Clear();
this.dwBrand.Items.Insert(0, new ListItem("全部", ""));
}
DataTable dt_Specefiction = _OA_SpecificationBLL.getAllSpecification(CurrentUser.MemberId, this.dwCommity.SelectedValue, this.dwGoodsList.SelectedValue);
//规格
if (dt_Specefiction.Rows.Count > 0)
{
this.dwSpecification.DataSource = dt_Specefiction;
this.dwSpecification.DataTextField = "Name";
this.dwSpecification.DataValueField = "Keyid";
this.dwSpecification.DataBind();
this.dwSpecification.Items.Insert(0, new ListItem("全部", ""));
}
else
{
this.dwSpecification.Items.Clear();
this.dwSpecification.Items.Insert(0, new ListItem("全部", ""));
}
DataTable dt_PaperWeight = _OA_PaperWeightBLL.getPaperWeight(CurrentUser.MemberId, this.dwCommity.SelectedValue, this.dwGoodsList.SelectedValue);
//克重
if (dt_PaperWeight.Rows.Count > 0)
{
this.dwPaperWeight.DataSource = dt_PaperWeight;
this.dwPaperWeight.DataTextField = "Name";
this.dwPaperWeight.DataValueField = "Keyid";
this.dwPaperWeight.DataBind();
this.dwPaperWeight.Items.Insert(0, new ListItem("全部", ""));
}
}
protected void BindList()
{
Pagination pa = new Pagination();
pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
pa.PageSize = UCPager1.AspNetPager.PageSize;
ReOutOfStorageList.DataSource = _OA_OutOfStorageBLL.getModelList(pa, CurrentUser.MemberId, this.selOpretor.Value, this.selInfoType.Value, "", this.dwGoodsList.SelectedValue, this.selWarehouseId.Value, this.txtRegTimeStart.Value.ToDateTime2(), this.txtRegTimeEnd.Value.ToDateTime2(), this.dwGoodsList.SelectedValue, this.dwSpecification.SelectedValue, this.dwPaperWeight.SelectedValue,this.dwCommity.SelectedValue);
ReOutOfStorageList.DataBind();
UCPager1.AspNetPager.RecordCount = pa.RecordCount;
}
protected void AspNetPager1_PageChanged(object src, EventArgs e)
{
BindList();
}
}
}