2024-09-18 10:48:34 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Web;
|
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.CLGL
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class ArrivalStatistics : PageBase
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
2024-10-10 10:06:11 +08:00
|
|
|
|
drpWarehouse.DataTextField = "Text";
|
|
|
|
|
|
drpWarehouse.DataValueField = "Value";
|
|
|
|
|
|
drpWarehouse.DataSource = BLL.DropListService.HJGL_WarehouseCode();
|
|
|
|
|
|
drpWarehouse.DataBind();
|
2024-09-18 10:48:34 +08:00
|
|
|
|
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
|
|
|
|
|
// 绑定表格
|
2024-11-27 17:05:01 +08:00
|
|
|
|
// this.BindGrid();
|
2024-09-18 10:48:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 绑定数据
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 绑定数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void BindGrid()
|
2024-11-18 18:09:50 +08:00
|
|
|
|
{
|
2024-10-10 10:06:11 +08:00
|
|
|
|
var tb = BLL.TwArrivalStatisticsService.GetStatistics(this.CurrUser.LoginProjectId, txtMaterialCode.Text.Trim(), drpWarehouse.SelectedValue);
|
2024-09-27 18:17:21 +08:00
|
|
|
|
|
2024-11-18 18:09:50 +08:00
|
|
|
|
if (tb.Count() > 0)
|
|
|
|
|
|
{
|
2024-11-27 17:05:01 +08:00
|
|
|
|
decimal needNum = 0;
|
|
|
|
|
|
decimal realNum = 0;
|
|
|
|
|
|
needNum = tb.Sum(x => x.NeedNum);
|
|
|
|
|
|
realNum = tb.Sum(x => x.RealNum > x.NeedNum ? x.NeedNum : x.RealNum);
|
|
|
|
|
|
lbRate.Text = "总体匹配率:" + Math.Round(realNum * 100 / needNum, 4) + "%";
|
2024-11-18 18:09:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
lbRate.Text = "总体匹配率:0%";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-18 10:48:34 +08:00
|
|
|
|
//tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
|
|
|
|
Grid1.DataSource = tb;
|
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
|
}
|
2024-11-18 18:09:50 +08:00
|
|
|
|
|
2024-09-18 10:48:34 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region GV 数据操作
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 过滤表头
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
//protected void Grid1_FilterChange(object sender, EventArgs e)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// this.BindGrid();
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 分页
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Grid1.PageIndex = e.NewPageIndex;
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Grid1.SortDirection = e.SortDirection;
|
|
|
|
|
|
this.Grid1.SortField = e.SortField;
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 分页显示条数下拉框
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue);
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 关闭弹出窗
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 关闭弹出窗
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 导出按钮
|
|
|
|
|
|
/// 导出按钮
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnOut_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Response.ClearContent();
|
|
|
|
|
|
string filename = Funs.GetNewFileName();
|
|
|
|
|
|
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("材料库存表" + filename, System.Text.Encoding.UTF8) + ".xls");
|
|
|
|
|
|
Response.ContentType = "application/excel";
|
|
|
|
|
|
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
|
|
|
|
|
this.Grid1.PageSize = 500;
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
Response.Write(GetGridTableHtml(Grid1));
|
|
|
|
|
|
Response.End();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 导出方法
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="grid"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private string GetGridTableHtml(Grid grid)
|
|
|
|
|
|
{
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
|
|
|
|
|
|
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
|
|
|
|
|
|
sb.Append("<tr>");
|
|
|
|
|
|
foreach (GridColumn column in grid.Columns)
|
|
|
|
|
|
{
|
|
|
|
|
|
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
|
|
|
|
|
|
}
|
|
|
|
|
|
sb.Append("</tr>");
|
|
|
|
|
|
foreach (GridRow row in grid.Rows)
|
|
|
|
|
|
{
|
|
|
|
|
|
sb.Append("<tr>");
|
|
|
|
|
|
foreach (GridColumn column in grid.Columns)
|
|
|
|
|
|
{
|
|
|
|
|
|
string html = row.Values[column.ColumnIndex].ToString();
|
|
|
|
|
|
if (column.ColumnID == "tfNumber")
|
|
|
|
|
|
{
|
|
|
|
|
|
html = (row.FindControl("lblNumber") as System.Web.UI.WebControls.Label).Text;
|
|
|
|
|
|
}
|
|
|
|
|
|
sb.AppendFormat("<td>{0}</td>", html);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sb.Append("</tr>");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sb.Append("</table>");
|
|
|
|
|
|
|
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnSearch_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|