252 lines
9.2 KiB
C#
252 lines
9.2 KiB
C#
|
using BLL;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using System.Data.SqlClient;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
using System.Web.UI;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
|
|||
|
namespace FineUIPro.Web.Welder
|
|||
|
{
|
|||
|
public partial class PerformanceInquiry : PageBase
|
|||
|
{
|
|||
|
#region 加载
|
|||
|
/// <summary>
|
|||
|
/// 加载页面
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
var unit = (from x in Funs.DB.HJGL_PW_IsoInfo
|
|||
|
select x.BSU_ID).Distinct();
|
|||
|
var u = from x in unit
|
|||
|
join y in Funs.DB.Base_Unit on x equals y.UnitId
|
|||
|
select new { UnitId = x, y.UnitName };
|
|||
|
|
|||
|
///单位
|
|||
|
drpUnitS.Items.Clear();
|
|||
|
this.drpUnitS.DataTextField = "UnitName";
|
|||
|
this.drpUnitS.DataValueField = "UnitId";
|
|||
|
this.drpUnitS.DataSource = u;
|
|||
|
this.drpUnitS.DataBind();
|
|||
|
Funs.FineUIPleaseSelect(this.drpUnitS);
|
|||
|
|
|||
|
//材质
|
|||
|
//this.drpSteelS.DataTextField = "STE_Code";
|
|||
|
//this.drpSteelS.DataValueField = "STE_ID";
|
|||
|
//this.drpSteelS.DataSource = BLL.HJGL_MaterialService.GetSteelList();
|
|||
|
//this.drpSteelS.DataBind();
|
|||
|
//Funs.FineUIPleaseSelect(this.drpSteelS);
|
|||
|
//焊工
|
|||
|
this.drpWED_IDS.DataTextField = "WED_Name";
|
|||
|
this.drpWED_IDS.DataValueField = "WED_ID";
|
|||
|
this.drpWED_IDS.DataSource = (from x in Funs.DB.HJGL_BS_Welder orderby x.WED_Name select x).ToList();
|
|||
|
this.drpWED_IDS.DataBind();
|
|||
|
Funs.FineUIPleaseSelect(this.drpWED_IDS);
|
|||
|
//项目
|
|||
|
this.drpProjectIdS.DataTextField = "ProjectCode";
|
|||
|
this.drpProjectIdS.DataValueField = "ProjectId";
|
|||
|
this.drpProjectIdS.DataSource = (from x in Funs.DB.Base_Project orderby x.ProjectCode select x).ToList();
|
|||
|
this.drpProjectIdS.DataBind();
|
|||
|
Funs.FineUIPleaseSelect(this.drpProjectIdS);
|
|||
|
|
|||
|
Funs.FineUIPleaseSelect(this.drpInstallation);
|
|||
|
|
|||
|
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|||
|
// 绑定表格
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 绑定数据
|
|||
|
/// </summary>
|
|||
|
private void BindGrid()
|
|||
|
{
|
|||
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|||
|
if (this.drpUnitS.SelectedValue != BLL.Const._Null)
|
|||
|
{
|
|||
|
listStr.Add(new SqlParameter("@unitcode", this.drpUnitS.SelectedValue));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
listStr.Add(new SqlParameter("@unitcode", null));
|
|||
|
}
|
|||
|
|
|||
|
listStr.Add(new SqlParameter("@steel", null));
|
|||
|
|
|||
|
//if (this.drpSteelS.SelectedValue != BLL.Const._Null)
|
|||
|
//{
|
|||
|
// listStr.Add(new SqlParameter("@steel", this.drpSteelS.SelectedValue));
|
|||
|
//}
|
|||
|
//else
|
|||
|
//{
|
|||
|
// listStr.Add(new SqlParameter("@steel", null));
|
|||
|
//}
|
|||
|
if (this.drpWED_IDS.SelectedValue != BLL.Const._Null)
|
|||
|
{
|
|||
|
listStr.Add(new SqlParameter("@WED_ID", this.drpWED_IDS.SelectedValue));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
listStr.Add(new SqlParameter("@WED_ID", null));
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(this.txtStartDate.Text.Trim()))
|
|||
|
{
|
|||
|
listStr.Add(new SqlParameter("@date1", this.txtStartDate.Text.Trim()));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
listStr.Add(new SqlParameter("@date1", null));
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(this.txtEndDate.Text.Trim()))
|
|||
|
{
|
|||
|
listStr.Add(new SqlParameter("@date2", this.txtEndDate.Text.Trim()));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
listStr.Add(new SqlParameter("@date2", null));
|
|||
|
}
|
|||
|
|
|||
|
if (this.drpProjectIdS.SelectedValue != BLL.Const._Null)
|
|||
|
{
|
|||
|
string projectIds = string.Empty;
|
|||
|
foreach (string pro in drpProjectIdS.SelectedValueArray)
|
|||
|
{
|
|||
|
projectIds = projectIds + pro + ",";
|
|||
|
}
|
|||
|
listStr.Add(new SqlParameter("@projectId", projectIds));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
listStr.Add(new SqlParameter("@projectId", null));
|
|||
|
}
|
|||
|
|
|||
|
if (this.drpInstallation.SelectedValue != BLL.Const._Null)
|
|||
|
{
|
|||
|
listStr.Add(new SqlParameter("@installationId", this.drpInstallation.SelectedValue));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
listStr.Add(new SqlParameter("@installationId", null));
|
|||
|
}
|
|||
|
|
|||
|
SqlParameter[] parameter = listStr.ToArray();
|
|||
|
DataTable tb = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_welderPerformance", parameter);
|
|||
|
this.Grid1.RecordCount = tb.Rows.Count;
|
|||
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|||
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|||
|
Grid1.DataSource = table;
|
|||
|
Grid1.DataBind();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 分页 排序
|
|||
|
/// <summary>
|
|||
|
/// 分页
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|||
|
{
|
|||
|
Grid1.PageIndex = e.NewPageIndex;
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 分页显示条数下拉框
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 排序
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
|||
|
{
|
|||
|
Grid1.SortDirection = e.SortDirection;
|
|||
|
Grid1.SortField = e.SortField;
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 查询
|
|||
|
/// <summary>
|
|||
|
/// 查询
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.BindGrid();
|
|||
|
}
|
|||
|
|
|||
|
protected void DropDownList_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (this.drpProjectIdS.SelectedValueArray.Length > 0)
|
|||
|
{
|
|||
|
string[] array = this.drpProjectIdS.SelectedValueArray;
|
|||
|
List<string> str = new List<string>();
|
|||
|
foreach (var item in array)
|
|||
|
{
|
|||
|
if (item != BLL.Const._Null)
|
|||
|
{
|
|||
|
str.Add(item);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
this.drpProjectIdS.SelectedValueArray = str.ToArray();
|
|||
|
if (this.drpProjectIdS.SelectedValueArray[0] != Const._Null && drpProjectIdS.SelectedValue != null)
|
|||
|
{
|
|||
|
if (this.drpProjectIdS.SelectedValueArray.Length == 1 && BLL.Project_InstallationService.GetInstallationList(drpProjectIdS.SelectedValueArray[0]) != null)
|
|||
|
{
|
|||
|
this.drpInstallation.Items.Clear();
|
|||
|
this.drpInstallation.DataTextField = "Text";
|
|||
|
this.drpInstallation.DataValueField = "Value";
|
|||
|
this.drpInstallation.DataSource = BLL.Project_InstallationService.GetInstallationList(drpProjectIdS.SelectedValueArray[0]);
|
|||
|
this.drpInstallation.DataBind();
|
|||
|
Funs.FineUIPleaseSelect(this.drpInstallation);
|
|||
|
}
|
|||
|
|
|||
|
List<string> projectIds = new List<string>();
|
|||
|
foreach (string pro in drpProjectIdS.SelectedValueArray)
|
|||
|
{
|
|||
|
projectIds.Add(pro);
|
|||
|
}
|
|||
|
var unit = (from x in Funs.DB.HJGL_PW_IsoInfo
|
|||
|
where projectIds.Contains(x.ProjectId)
|
|||
|
select x.BSU_ID).Distinct();
|
|||
|
var u = from x in unit
|
|||
|
join y in Funs.DB.Base_Unit on x equals y.UnitId
|
|||
|
select new { UnitId = x, y.UnitName };
|
|||
|
|
|||
|
///单位
|
|||
|
drpUnitS.Items.Clear();
|
|||
|
this.drpUnitS.DataTextField = "UnitName";
|
|||
|
this.drpUnitS.DataValueField = "UnitId";
|
|||
|
this.drpUnitS.DataSource = u;
|
|||
|
this.drpUnitS.DataBind();
|
|||
|
Funs.FineUIPleaseSelect(this.drpUnitS);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.drpProjectIdS.SelectedValue = BLL.Const._Null;
|
|||
|
}
|
|||
|
this.BindGrid();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|