修改移交

This commit is contained in:
2024-08-09 10:48:15 +08:00
parent cc639f4cab
commit 8c3bd0fe80
65 changed files with 1335 additions and 471 deletions
@@ -2,9 +2,12 @@
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Web.Services.Description;
using BLL;
using Newtonsoft.Json.Linq;
using NPOI.SS.Formula.Functions;
namespace FineUIPro.Web.Transfer.Chart
@@ -23,7 +26,7 @@ namespace FineUIPro.Web.Transfer.Chart
ddlSystemNo.Items.Insert(indexRow, new FineUIPro.ListItem(t.System_No, t.System_No));
indexRow++;
}
AnalyseData();
}
}
@@ -144,6 +147,8 @@ namespace FineUIPro.Web.Transfer.Chart
protected void BtnAnalyse_Click(object sender, EventArgs e)
{
this.AnalyseData();
BindGrid1();
BindGrid2();
}
/// <summary>
@@ -174,6 +179,295 @@ namespace FineUIPro.Web.Transfer.Chart
protected void ddlSystemNo_SelectedIndexChanged(object sender, EventArgs e)
{
this.AnalyseData();
BindGrid1();
BindGrid2();
}
#region
#region
/// <summary>
/// 分页下拉
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid1();
}
/// <summary>
/// 分页索引事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid1();
}
/// <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;
BindGrid1();
}
/// <summary>
/// 分页下拉
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize2_SelectedIndexChanged(object sender, EventArgs e)
{
Grid2.PageSize = Convert.ToInt32(ddlPageSize2.SelectedValue);
BindGrid2();
}
/// <summary>
/// 分页索引事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid2_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid2();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid2_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
Grid2.SortDirection = e.SortDirection;
Grid2.SortField = e.SortField;
BindGrid2();
}
#endregion
/// <summary>
/// 查询绑定数据
/// </summary>
public void BindGrid1()
{
List<SqlParameter> listStr = new List<SqlParameter>();
string _systemNo = string.Empty;
_systemNo = ddlSystemNo.SelectedValue;
StringBuilder strSql = new StringBuilder("");
strSql.AppendLine(" IF OBJECT_ID('tempdb..#AllPunchlistFromSortTemp1') IS NOT NULL drop table #AllPunchlistFromSortTemp1; ");
strSql.AppendLine(" IF OBJECT_ID('tempdb..#PunchlistFromSortTemp1') IS NOT NULL drop table #PunchlistFromSortTemp1; ");
strSql.AppendLine(" select * INTO #AllPunchlistFromSortTemp1 from Transfer_PunchlistFrom(NOLOCK) where ProjectId=@ProjectId ");
if (!string.IsNullOrWhiteSpace(_systemNo))
{
strSql.AppendLine(" AND System_No=@System_No ");
listStr.Add(new SqlParameter("@System_No", _systemNo));
}
strSql.AppendLine(" select Disc,cast(0 as decimal(18,2)) Cat_A_Count,cast(0 as decimal(18,2)) Cat_B_Count,cast(0 as decimal(18,2)) Cat_C_Count,cast(0 as decimal(18,2)) Cat_D_Count INTO #PunchlistFromSortTemp1 from #AllPunchlistFromSortTemp1 Group by Disc; ");
strSql.AppendLine(" update a set a.Cat_A_Count=(select count(1) from #AllPunchlistFromSortTemp1 b where a.Disc=b.Disc AND (isnull(b.Cat,'')='A' or isnull(b.Cat,'')='a')) ");
strSql.AppendLine(",a.Cat_B_Count=(select count(1) from #AllPunchlistFromSortTemp1 b where a.Disc=b.Disc AND (isnull(b.Cat,'')='B' or isnull(b.Cat,'')='b')) ");
strSql.AppendLine(",a.Cat_C_Count=(select count(1) from #AllPunchlistFromSortTemp1 b where a.Disc=b.Disc AND (isnull(b.Cat,'')='C' or isnull(b.Cat,'')='c')) ");
strSql.AppendLine(",a.Cat_D_Count=(select count(1) from #AllPunchlistFromSortTemp1 b where a.Disc=b.Disc AND (isnull(b.Cat,'')='D' or isnull(b.Cat,'')='d')) ");
strSql.AppendLine("from #PunchlistFromSortTemp1 a;");
strSql.AppendLine("select * from #PunchlistFromSortTemp1 ");
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
strSql.AppendLine(" order by Disc ");
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql.ToString(), parameter);
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
//合计
int cat_A_Count = 0;
int cat_B_Count = 0;
int cat_C_Count = 0;
int cat_D_Count = 0;
foreach (DataRow row in tb.Rows)
{
cat_A_Count += Convert.ToInt32(row["Cat_A_Count"]);
cat_B_Count += Convert.ToInt32(row["Cat_B_Count"]);
cat_C_Count += Convert.ToInt32(row["Cat_C_Count"]);
cat_D_Count += Convert.ToInt32(row["Cat_D_Count"]);
}
JObject summary = new JObject();
summary.Add("Disc", "合计");
summary.Add("Cat_A_Count", cat_A_Count.ToString());
summary.Add("Cat_B_Count", cat_B_Count.ToString());
summary.Add("Cat_C_Count", cat_C_Count.ToString());
summary.Add("Cat_D_Count", cat_D_Count.ToString());
Grid1.SummaryData = summary;
}
/// <summary>
/// 查询绑定数据
/// </summary>
public void BindGrid2()
{
List<SqlParameter> listStr = new List<SqlParameter>();
string _systemNo = string.Empty;
_systemNo = ddlSystemNo.SelectedValue;
StringBuilder strSql = new StringBuilder("");
strSql.AppendLine(" IF OBJECT_ID('tempdb..#AllPunchlistFromSortTemp2') IS NOT NULL drop table #AllPunchlistFromSortTemp2; ");
strSql.AppendLine(" IF OBJECT_ID('tempdb..#PunchlistFromSortTemp2') IS NOT NULL drop table #PunchlistFromSortTemp2; ");
strSql.AppendLine(" select * INTO #AllPunchlistFromSortTemp2 from Transfer_PunchlistFrom(NOLOCK) where ProjectId=@ProjectId ");
if (!string.IsNullOrWhiteSpace(_systemNo))
{
strSql.AppendLine(" AND System_No=@System_No ");
listStr.Add(new SqlParameter("@System_No", _systemNo));
}
strSql.AppendLine(" select Action_By,cast(0 as decimal(18,2)) Cat_All_Count,cast(0 as decimal(18,2)) Cat_A_Count,cast(0 as decimal(18,2)) Cat_B_Count,cast(0 as decimal(18,2)) Cat_C_Count,cast(0 as decimal(18,2)) Cat_D_Count INTO #PunchlistFromSortTemp2 from #AllPunchlistFromSortTemp2 Group by Action_By; ");
strSql.AppendLine(" update a set a.Cat_A_Count=(select count(1) from #AllPunchlistFromSortTemp2 b where a.Action_By=b.Action_By AND (isnull(b.Cat,'')='A' or isnull(b.Cat,'')='a')) ");
strSql.AppendLine(",a.Cat_B_Count=(select count(1) from #AllPunchlistFromSortTemp2 b where a.Action_By=b.Action_By AND (isnull(b.Cat,'')='B' or isnull(b.Cat,'')='b')) ");
strSql.AppendLine(",a.Cat_C_Count=(select count(1) from #AllPunchlistFromSortTemp2 b where a.Action_By=b.Action_By AND (isnull(b.Cat,'')='C' or isnull(b.Cat,'')='c')) ");
strSql.AppendLine(",a.Cat_D_Count=(select count(1) from #AllPunchlistFromSortTemp2 b where a.Action_By=b.Action_By AND (isnull(b.Cat,'')='D' or isnull(b.Cat,'')='d')) ");
strSql.AppendLine("from #PunchlistFromSortTemp2 a;");
strSql.AppendLine(" update #PunchlistFromSortTemp2 set Cat_All_Count=Cat_A_Count+Cat_B_Count+Cat_C_Count+Cat_D_Count; ");
strSql.AppendLine("select * from #PunchlistFromSortTemp2 ");
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
strSql.AppendLine(" order by Action_By ");
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql.ToString(), parameter);
Grid2.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid2.DataSource = table;
Grid2.DataBind();
//合计
int cat_A_Count = 0;
int cat_B_Count = 0;
int cat_C_Count = 0;
int cat_D_Count = 0;
int cat_All_Count = 0;
foreach (DataRow row in tb.Rows)
{
cat_All_Count += Convert.ToInt32(row["Cat_All_Count"]);
cat_A_Count += Convert.ToInt32(row["Cat_A_Count"]);
cat_B_Count += Convert.ToInt32(row["Cat_B_Count"]);
cat_C_Count += Convert.ToInt32(row["Cat_C_Count"]);
cat_D_Count += Convert.ToInt32(row["Cat_D_Count"]);
}
JObject summary = new JObject();
summary.Add("Action_By", "合计");
summary.Add("Cat_All_Count", cat_All_Count.ToString());
summary.Add("Cat_A_Count", cat_A_Count.ToString());
summary.Add("Cat_B_Count", cat_B_Count.ToString());
summary.Add("Cat_C_Count", cat_C_Count.ToString());
summary.Add("Cat_D_Count", cat_D_Count.ToString());
Grid2.SummaryData = summary;
}
protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
{
if (TabStrip1.ActiveTabIndex == 2)
{
ddlSystemNo.Hidden = false;
ddlDateType.Hidden = true;
drpChartType.Hidden = true;
BindGrid1();
}
else if (TabStrip1.ActiveTabIndex == 3)
{
ddlSystemNo.Hidden = false;
ddlDateType.Hidden = true;
drpChartType.Hidden = true;
BindGrid2();
}
else if (TabStrip1.ActiveTabIndex == 4)
{
ddlDateType.Hidden = true;
drpChartType.Hidden = true;
ddlSystemNo.Hidden = true;
BindGrid3();
}
else {
this.AnalyseData();
ddlSystemNo.Hidden = false;
ddlDateType.Hidden = false;
drpChartType.Hidden = false;
}
}
#endregion
#region
/// <summary>
/// 数据绑定
/// </summary>
public void BindGrid3()
{
StringBuilder strSql = new StringBuilder("");
strSql.AppendLine("IF OBJECT_ID('tempdb..#AllPunchlistFromProgressTemp') IS NOT NULL drop table #AllPunchlistFromProgressTemp; ");
strSql.AppendLine("IF OBJECT_ID('tempdb..#PunchlistFromProgressTemp') IS NOT NULL drop table #PunchlistFromProgressTemp; ");
strSql.AppendLine(" select System_No,Actual_Date,Cleared_By,Confirmed_By,Verified_By,ProjectId ");
strSql.AppendLine(" INTO #AllPunchlistFromProgressTemp from Transfer_PunchlistFrom where ProjectId = @ProjectId ");
strSql.AppendLine(" select System_No,count(System_No) SystemNoCount,cast(0 as decimal(18,2)) ActualDateCount ");
strSql.AppendLine(" ,cast(0 as decimal(18,2)) ClearedByCount,cast(0 as decimal(18,2)) ConfirmedByCount,cast(0 as decimal(18,2)) VerifiedByCount ");
strSql.AppendLine(" INTO #PunchlistFromProgressTemp from #AllPunchlistFromProgressTemp where ProjectId = @ProjectId group by System_No ");
strSql.AppendLine(" update a set a.ActualDateCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND isnull(b.Actual_Date,'')<>'') ");
strSql.AppendLine(" ,a.ClearedByCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND isnull(b.Cleared_By,'')<>'') ");
strSql.AppendLine(" ,a.ConfirmedByCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND isnull(b.Confirmed_By,'')<>'') ");
strSql.AppendLine(" ,a.VerifiedByCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND isnull(b.Verified_By,'')<>'') ");
strSql.AppendLine(" from #PunchlistFromProgressTemp a ");
strSql.AppendLine(" select * from #PunchlistFromProgressTemp ");
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
strSql.AppendLine(" order by System_No ");
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql.ToString(), parameter);
Grid3.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid3.DataSource = table;
Grid3.DataBind();
}
/// <summary>
/// 分页下拉
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize3_SelectedIndexChanged(object sender, EventArgs e)
{
Grid3.PageSize = Convert.ToInt32(ddlPageSize3.SelectedValue);
BindGrid3();
}
/// <summary>
/// 分页索引事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid3_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid3();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid3_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
Grid3.SortDirection = e.SortDirection;
Grid3.SortField = e.SortField;
BindGrid3();
}
#endregion
}
}