You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

95 lines
3.0 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ChangKeTec.Wms.Models.Wms;
using CK.SCP.Controller;
using CK.SCP.Models.ScpEntity;
using CK.SCP.Utils;
using FineUI;
namespace SCP.Views.SupplierData
{
public partial class SCP_STOCK : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindDetail();
}
}
public void BindDetail()
{
SearchV_TB_ASN_DETAILData((ret) =>
{
Grid1.RecordCount = ret.Count();
var list = SortAndPage<VIEW_STOCK_VEND>(ret, Grid1);
Grid1.DataSource = list;
Grid1.DataBind();
});
}
public void SearchV_TB_ASN_DETAILData(Action<IQueryable<VIEW_STOCK_VEND>> p_action)
{
VIEW_STOCK_VEND _entity = new VIEW_STOCK_VEND();
_entity.PartCode = txtPartcode.Text;
_entity.UserInVendIds = CurrentUser.VenderList;
SCP_WMS_CONTROLLER.Get_VIEW_STOCK_DETAIL(_entity, (_ret) =>
{
if (_ret.State == ReturnStatus.Succeed)
{
p_action(_ret.Result);
}
});
}
/// <summary>
protected void btnSearch_Click(object sender, EventArgs e)
{
BindDetail();
}
protected void Grid1_PageIndexChange(object sender, FineUI.GridPageEventArgs e)
{
BindDetail();
}
protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue);
BindDetail();
}
protected void btnOutput_Click(object sender, EventArgs e)
{
List<VIEW_STOCK_VEND> _ls = new List<VIEW_STOCK_VEND>();
for (int i = 0, count = Grid1.Rows.Count; i < count; i++)
{
VIEW_STOCK_VEND inv = new VIEW_STOCK_VEND();
object[] rowDataKeys = Grid1.DataKeys[i];
inv.PartCode = rowDataKeys[1].ToString();//零件号
inv.PartDesc1 = rowDataKeys[2].ToString();//零件名称
inv.VendId = rowDataKeys[3].ToString();//供应商编码
if (rowDataKeys[4] != null)
{
inv.qty = decimal.Parse(rowDataKeys[4].ToString());//数量
}
_ls.Add(inv);
}
var aaa = ToDataTable(_ls);
var bb = GetHtmlString(aaa);
Dictionary<string, string> cellheader = new Dictionary<string, string>
{
{ "PartCode", "零件号" },
{ "PartDesc1", "零件名称" },
{ "VendId", "供应商编号" },
{ "qty", "库存数量" }
};
string url = EntityListToExcel2003(cellheader, _ls, "库存明细");
}
}
}