移交管理

This commit is contained in:
2024-11-18 15:14:57 +08:00
parent 6c7bb34357
commit 9d4672a210
53 changed files with 4021 additions and 2409 deletions
@@ -18,17 +18,17 @@ namespace FineUIPro.Web.Transfer.Chart
{
if (!IsPostBack)
{
ddlSystemNo.Hidden = true;
ddlSubSysNo.Hidden = true;
ddlDateType.Hidden = true;
drpChartType.Hidden = true;
BtnAnalyse.Hidden = true;
var systemNos = Funs.DB.Transfer_PunchlistFrom.Where(x => x.ProjectId == this.CurrUser.LoginProjectId).GroupBy(p => new { p.System_No }).Select(p => new { System_No = p.Key.System_No }).ToList();
var systemNos = Funs.DB.Transfer_PunchlistFrom.Where(x => x.ProjectId == this.CurrUser.LoginProjectId).GroupBy(p => new { p.Sub_Sys_No }).Select(p => new { SubSysNo = p.Key.Sub_Sys_No }).ToList();
int indexRow = 1;
ddlSystemNo.Items.Insert(0, new FineUIPro.ListItem("ALL", ""));
ddlSubSysNo.Items.Insert(0, new FineUIPro.ListItem("ALL", ""));
foreach (var t in systemNos)
{
ddlSystemNo.Items.Insert(indexRow, new FineUIPro.ListItem(t.System_No, t.System_No));
ddlSubSysNo.Items.Insert(indexRow, new FineUIPro.ListItem(t.SubSysNo, t.SubSysNo));
indexRow++;
}
AnalyseData();
@@ -62,13 +62,13 @@ namespace FineUIPro.Web.Transfer.Chart
/// </summary>
private void AnalyseData()
{
string _systemNo = ddlSystemNo.SelectedValue;
string _systemNo = ddlSubSysNo.SelectedValue;
if (_systemNo == null)
_systemNo = "";
_systemNo = _systemNo.Trim();
//_systemNo为空则查全部
var forms = from x in Funs.DB.Transfer_PunchlistFrom
where x.ProjectId == this.CurrUser.LoginProjectId && (x.System_No == _systemNo || _systemNo == "")
where x.ProjectId == this.CurrUser.LoginProjectId && (x.Sub_Sys_No == _systemNo || _systemNo == "")
select x;
string _dateType = ddlDateType.SelectedValue;
@@ -239,7 +239,7 @@ namespace FineUIPro.Web.Transfer.Chart
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlSystemNo_SelectedIndexChanged(object sender, EventArgs e)
protected void ddlSubSysNo_SelectedIndexChanged(object sender, EventArgs e)
{
this.AnalyseData();
BindGrid1();
@@ -322,15 +322,15 @@ namespace FineUIPro.Web.Transfer.Chart
{
List<SqlParameter> listStr = new List<SqlParameter>();
string _systemNo = string.Empty;
_systemNo = ddlSystemNo.SelectedValue;
_systemNo = ddlSubSysNo.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(" AND Sub_Sys_No=@SubSysNo ");
listStr.Add(new SqlParameter("@SubSysNo", _systemNo));
}
strSql.AppendLine(@" select Disc,
cast(0 as decimal(18, 2)) Cat_A_Count,
@@ -465,15 +465,15 @@ namespace FineUIPro.Web.Transfer.Chart
{
List<SqlParameter> listStr = new List<SqlParameter>();
string _systemNo = string.Empty;
_systemNo = ddlSystemNo.SelectedValue;
_systemNo = ddlSubSysNo.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(" AND Sub_Sys_No=@SubSysNo ");
listStr.Add(new SqlParameter("@SubSysNo", _systemNo));
}
strSql.AppendLine(@" select Action_By,
cast(0 as decimal(18, 2)) Cat_A_Count,
@@ -606,7 +606,7 @@ namespace FineUIPro.Web.Transfer.Chart
{
if (TabStrip1.ActiveTabIndex == 0)
{
ddlSystemNo.Hidden = true;
ddlSubSysNo.Hidden = true;
ddlDateType.Hidden = true;
drpChartType.Hidden = true;
BtnAnalyse.Hidden = true;
@@ -614,7 +614,7 @@ namespace FineUIPro.Web.Transfer.Chart
}
else if (TabStrip1.ActiveTabIndex == 2)
{
ddlSystemNo.Hidden = false;
ddlSubSysNo.Hidden = false;
ddlDateType.Hidden = true;
drpChartType.Hidden = true;
BtnAnalyse.Hidden = false;
@@ -622,7 +622,7 @@ namespace FineUIPro.Web.Transfer.Chart
}
else if (TabStrip1.ActiveTabIndex == 3)
{
ddlSystemNo.Hidden = false;
ddlSubSysNo.Hidden = false;
ddlDateType.Hidden = true;
drpChartType.Hidden = true;
BtnAnalyse.Hidden = false;
@@ -632,14 +632,14 @@ namespace FineUIPro.Web.Transfer.Chart
{
ddlDateType.Hidden = true;
drpChartType.Hidden = true;
ddlSystemNo.Hidden = true;
ddlSubSysNo.Hidden = true;
BtnAnalyse.Hidden = false;
BindGrid3();
}
else
{
this.AnalyseData();
ddlSystemNo.Hidden = false;
ddlSubSysNo.Hidden = false;
ddlDateType.Hidden = false;
drpChartType.Hidden = false;
BtnAnalyse.Hidden = false;
@@ -658,15 +658,15 @@ namespace FineUIPro.Web.Transfer.Chart
strSql.AppendLine("IF OBJECT_ID('tempdb..#PunchlistFromProgressTemp') IS NOT NULL drop table #PunchlistFromProgressTemp; ");
strSql.AppendLine(" select * INTO #AllPunchlistFromProgressTemp from Transfer_PunchlistFrom(NOLOCK) where ProjectId=@ProjectId ");
//strSql.AppendLine(" select System_No,count(System_No) SystemNoCount,cast(0 as decimal(18,2)) ActualDateCount ");
//strSql.AppendLine(" select Sub_Sys_No,count(Sub_Sys_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(" INTO #PunchlistFromProgressTemp from #AllPunchlistFromProgressTemp where ProjectId = @ProjectId group by Sub_Sys_No ");
//strSql.AppendLine(" update a set a.ActualDateCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND isnull(b.Actual_Date,'')<>'') ");
//strSql.AppendLine(" ,a.ClearedByCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND isnull(b.Cleared_By,'')<>'') ");
//strSql.AppendLine(" ,a.ConfirmedByCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND isnull(b.Confirmed_By,'')<>'') ");
//strSql.AppendLine(" ,a.VerifiedByCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND isnull(b.Verified_By,'')<>'') ");
strSql.AppendLine(@" select System_No,
strSql.AppendLine(@" select Sub_Sys_No,
cast(0 as decimal(18, 2)) Cat_A_Count,
cast(0 as decimal(18, 2)) Cat_A_Countf,cast(0 as decimal(18, 2)) Cat_A_CountPercent, cast(0 as decimal(18, 2)) Cat_A_CountWUH, cast(0 as decimal(18, 2)) Cat_A_CountBASF,
cast(0 as decimal(18, 2)) Cat_B_Count,
@@ -677,36 +677,36 @@ namespace FineUIPro.Web.Transfer.Chart
cast(0 as decimal(18, 2)) Cat_D_Countf,cast(0 as decimal(18, 2)) Cat_D_CountPercent, cast(0 as decimal(18, 2)) Cat_D_CountWUH, cast(0 as decimal(18, 2)) Cat_D_CountBASF,
cast(0 as decimal(18, 2)) allCount,cast(0 as decimal(18, 2)) allfinshedCount,cast(0 as decimal(18, 2)) allCountPercent,cast(0 as decimal(18, 2)) allWUH, cast(0 as decimal(18, 2)) allBASF
INTO #PunchlistFromProgressTemp
from #AllPunchlistFromProgressTemp Group by System_No; ");
from #AllPunchlistFromProgressTemp Group by Sub_Sys_No; ");
strSql.AppendLine(@" update a set
allCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No),
allfinshedCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No and (b.Required_Date is not null or b.Required_Date!='')),
allWUH=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No and (b.Confirmed_Date is not null or b.Confirmed_Date!='')),
allBASF=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No and (b.Verified_Date is not null or b.Verified_Date!='')),
allCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No),
allfinshedCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No and (b.Required_Date is not null or b.Required_Date!='')),
allWUH=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No and (b.Confirmed_Date is not null or b.Confirmed_Date!='')),
allBASF=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No and (b.Verified_Date is not null or b.Verified_Date!='')),
a.Cat_A_Count=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='A' or isnull(b.Cat,'')='a')),
a.Cat_A_Count=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='A' or isnull(b.Cat,'')='a')),
a.Cat_A_Countf=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='A' or isnull(b.Cat,'')='a') and (b.Required_Date is not null or b.Required_Date!='')),
a.Cat_A_CountWUH=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='A' or isnull(b.Cat,'')='a') and (b.Confirmed_Date is not null or b.Confirmed_Date!='')),
a.Cat_A_CountBASF=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='A' or isnull(b.Cat,'')='a') and (b.Verified_Date is not null or b.Verified_Date!=''))
a.Cat_A_Countf=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='A' or isnull(b.Cat,'')='a') and (b.Required_Date is not null or b.Required_Date!='')),
a.Cat_A_CountWUH=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='A' or isnull(b.Cat,'')='a') and (b.Confirmed_Date is not null or b.Confirmed_Date!='')),
a.Cat_A_CountBASF=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='A' or isnull(b.Cat,'')='a') and (b.Verified_Date is not null or b.Verified_Date!=''))
,a.Cat_B_Count=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='B' or isnull(b.Cat,'')='b')) ,
,a.Cat_B_Count=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='B' or isnull(b.Cat,'')='b')) ,
a.Cat_B_Countf=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='B' or isnull(b.Cat,'')='b') and (b.Required_Date is not null or b.Required_Date!='')),
a.Cat_B_CountWUH=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='B' or isnull(b.Cat,'')='b') and (b.Confirmed_Date is not null or b.Confirmed_Date!='')),
a.Cat_B_CountBASF=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='B' or isnull(b.Cat,'')='b') and (b.Verified_Date is not null or b.Verified_Date!=''))
a.Cat_B_Countf=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='B' or isnull(b.Cat,'')='b') and (b.Required_Date is not null or b.Required_Date!='')),
a.Cat_B_CountWUH=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='B' or isnull(b.Cat,'')='b') and (b.Confirmed_Date is not null or b.Confirmed_Date!='')),
a.Cat_B_CountBASF=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='B' or isnull(b.Cat,'')='b') and (b.Verified_Date is not null or b.Verified_Date!=''))
,a.Cat_C_Count=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='C' or isnull(b.Cat,'')='c')) ,
,a.Cat_C_Count=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='C' or isnull(b.Cat,'')='c')) ,
a.Cat_C_Countf=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='C' or isnull(b.Cat,'')='c') and (b.Required_Date is not null or b.Required_Date!='')),
a.Cat_C_CountWUH=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='C' or isnull(b.Cat,'')='c') and (b.Confirmed_Date is not null or b.Confirmed_Date!='')),
a.Cat_C_CountBASF=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='C' or isnull(b.Cat,'')='c') and (b.Verified_Date is not null or b.Verified_Date!=''))
a.Cat_C_Countf=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='C' or isnull(b.Cat,'')='c') and (b.Required_Date is not null or b.Required_Date!='')),
a.Cat_C_CountWUH=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='C' or isnull(b.Cat,'')='c') and (b.Confirmed_Date is not null or b.Confirmed_Date!='')),
a.Cat_C_CountBASF=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='C' or isnull(b.Cat,'')='c') and (b.Verified_Date is not null or b.Verified_Date!=''))
,a.Cat_D_Count=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='D' or isnull(b.Cat,'')='d')) ,
a.Cat_D_Countf=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='D' or isnull(b.Cat,'')='d') and (b.Required_Date is not null or b.Required_Date!='')),
a.Cat_D_CountWUH=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='D' or isnull(b.Cat,'')='d') and (b.Confirmed_Date is not null or b.Confirmed_Date!='')),
a.Cat_D_CountBASF=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND (isnull(b.Cat,'')='D' or isnull(b.Cat,'')='d') and (b.Verified_Date is not null or b.Verified_Date!=''))
,a.Cat_D_Count=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='D' or isnull(b.Cat,'')='d')) ,
a.Cat_D_Countf=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='D' or isnull(b.Cat,'')='d') and (b.Required_Date is not null or b.Required_Date!='')),
a.Cat_D_CountWUH=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='D' or isnull(b.Cat,'')='d') and (b.Confirmed_Date is not null or b.Confirmed_Date!='')),
a.Cat_D_CountBASF=(select count(1) from #AllPunchlistFromProgressTemp b where a.Sub_Sys_No=b.Sub_Sys_No AND (isnull(b.Cat,'')='D' or isnull(b.Cat,'')='d') and (b.Verified_Date is not null or b.Verified_Date!=''))
from #PunchlistFromProgressTemp a;");
@@ -723,7 +723,7 @@ namespace FineUIPro.Web.Transfer.Chart
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
strSql.AppendLine(" order by System_No ");
strSql.AppendLine(" order by Sub_Sys_No ");
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql.ToString(), parameter);
Grid3.RecordCount = tb.Rows.Count;
@@ -772,14 +772,20 @@ namespace FineUIPro.Web.Transfer.Chart
allBASF += Convert.ToInt32(row["allBASF"]);
}
var Cat_A_CountPercent = 100 * ((float)Cat_A_Countf / (float)cat_A_Count);
var Cat_B_CountPercent = 100 * ((float)Cat_B_Countf / (float)cat_B_Count);
var Cat_C_CountPercent = 100 * ((float)Cat_C_Countf / (float)cat_C_Count);
var Cat_D_CountPercent = 100 * ((float)Cat_D_Countf / (float)cat_D_Count);
var allCountPercent = 100 * ((float)allfinshedCount / (float)allCount);
//var Cat_A_CountPercent = 100 * ((float)Cat_A_Countf / (float)cat_A_Count);
//var Cat_B_CountPercent = 100 * ((float)Cat_B_Countf / (float)cat_B_Count);
//var Cat_C_CountPercent = 100 * ((float)Cat_C_Countf / (float)cat_C_Count);
//var Cat_D_CountPercent = 100 * ((float)Cat_D_Countf / (float)cat_D_Count);
//var allCountPercent = 100 * ((float)allfinshedCount / (float)allCount);
var Cat_A_CountPercent = Cat_A_Countf > 0 && cat_A_Count > 0 ? 100 * ((decimal)(Cat_A_Countf / cat_A_Count)) : 0;
var Cat_B_CountPercent = Cat_B_Countf > 0 && cat_B_Count > 0 ? 100 * ((decimal)(Cat_B_Countf / cat_B_Count)) : 0;
var Cat_C_CountPercent = Cat_C_Countf > 0 && cat_C_Count > 0 ? 100 * ((decimal)(Cat_C_Countf / cat_C_Count)) : 0;
var Cat_D_CountPercent = Cat_D_Countf > 0 && cat_D_Count > 0 ? 100 * ((decimal)(Cat_D_Countf / cat_D_Count)) : 0;
var allCountPercent = allfinshedCount > 0 && allCount > 0 ? 100 * ((decimal)(allfinshedCount / allCount)) : 0;
JObject summary = new JObject();
summary.Add("System_No", "合计");
summary.Add("SubSysNo", "合计");
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());