修改移交
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
using BLL;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using static FineUIPro.Web.CQMS.Performance.Performance;
|
||||
using AspNet = System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.Transfer.Chart
|
||||
{
|
||||
@@ -85,7 +89,9 @@ namespace FineUIPro.Web.Transfer.Chart
|
||||
|
||||
ts.PlanPWD,PlanJWD,McPlan,
|
||||
SubmitPackage,ActualPWD,ActualJWD,ActualMC,Commissioning,
|
||||
IaQian,TcccQ,SystemStatus,TurnoverDescription,ts.Remark
|
||||
IaQian,TcccQ,SystemStatus,TurnoverDescription,ts.Remark,
|
||||
ISNULL(pwdACount,0) pwdACount,ISNULL(pwdBCount,0) pwdBCount,ISNULL(pwdCCount,0) pwdCCount,
|
||||
ISNULL(fwdACount,0) fwdACount,ISNULL(fwdBCount,0) fwdBCount,ISNULL(fwdCCount,0) fwdCCount
|
||||
from(
|
||||
SELECT SystemNo,ProjectId FROM Transfer_LHCSystemList group by SystemNo,ProjectId
|
||||
) f
|
||||
@@ -168,12 +174,39 @@ namespace FineUIPro.Web.Transfer.Chart
|
||||
left join (select count(*)as TpScount,ProjectId,SystemName from Transfer_Plumbing where FINAL_Status='Completed'
|
||||
group by ProjectId,SystemName)
|
||||
tp1 on f.ProjectId=tp1.ProjectId and f.SystemNo=tp1.SystemName
|
||||
|
||||
left join (select count(*) as pwdACount,ProjectId,System_No from Transfer_PunchlistFrom where Status!='Completed'
|
||||
and Punch_Type='PWD' and Cat='A' group by ProjectId,System_No)
|
||||
tpA on f.ProjectId=tpA.ProjectId and f.SystemNo=tpA.System_No
|
||||
|
||||
left join (select count(*) as pwdBCount,ProjectId,System_No from Transfer_PunchlistFrom where Status!='Completed'
|
||||
and Punch_Type='PWD' and Cat='B' group by ProjectId,System_No)
|
||||
tpB on f.ProjectId=tpB.ProjectId and f.SystemNo=tpB.System_No
|
||||
|
||||
left join (select count(*) as pwdCCount,ProjectId,System_No from Transfer_PunchlistFrom where Status!='Completed'
|
||||
and Punch_Type='PWD' and Cat='C' group by ProjectId,System_No)
|
||||
tpC on f.ProjectId=tpC.ProjectId and f.SystemNo=tpC.System_No
|
||||
|
||||
left join (select count(*) as fwdACount,ProjectId,System_No from Transfer_PunchlistFrom where Status!='Completed'
|
||||
and Punch_Type='FWD' and Cat='A' group by ProjectId,System_No)
|
||||
tpfA on f.ProjectId=tpfA.ProjectId and f.SystemNo=tpfA.System_No
|
||||
|
||||
left join (select count(*) as fwdBCount,ProjectId,System_No from Transfer_PunchlistFrom where Status!='Completed'
|
||||
and Punch_Type='FWD' and Cat='B' group by ProjectId,System_No)
|
||||
tpfB on f.ProjectId=tpfB.ProjectId and f.SystemNo=tpfB.System_No
|
||||
|
||||
left join (select count(*) as fwdCCount,ProjectId,System_No from Transfer_PunchlistFrom where Status!='Completed'
|
||||
and Punch_Type='FWD' and Cat='C' group by ProjectId,System_No)
|
||||
tpfC on f.ProjectId=tpfC.ProjectId and f.SystemNo=tpfC.System_No
|
||||
|
||||
where f.ProjectId = @ProjectId";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||||
|
||||
if (!string.IsNullOrEmpty(ddlSystemNo.SelectedValue))
|
||||
{
|
||||
strSql += " AND SystemNo='" + ddlSystemNo.SelectedValue + "' ";
|
||||
}
|
||||
|
||||
strSql += " order by SystemNo ";
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
@@ -265,8 +298,9 @@ namespace FineUIPro.Web.Transfer.Chart
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string id = Grid1.SelectedRowID;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SystemstatusEdit.aspx?Id={0}", id, "编辑 - ")));
|
||||
|
||||
string SystemNo = Grid1.SelectedRowID;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SystemstatusEdit.aspx?SystemNo={0}", SystemNo, "编辑 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -279,13 +313,135 @@ namespace FineUIPro.Web.Transfer.Chart
|
||||
/// </summary>
|
||||
/// <param name="systemNo"></param>
|
||||
/// <returns></returns>
|
||||
protected string totalper(object systemNo) {
|
||||
protected string totalper(object systemNo)
|
||||
{
|
||||
string rate = string.Empty;
|
||||
if (systemNo != null) {
|
||||
if (systemNo != null)
|
||||
{
|
||||
var pid = CurrUser.LoginProjectId;
|
||||
var scode = systemNo.ToString();
|
||||
//根据systemNo和projectid获取所有数据 和完成的数据
|
||||
#region 九个表的数据
|
||||
var list1 = Funs.DB.Transfer_Piping.Where(x => x.ProjectId == pid && x.SYSTEM == scode).ToList();
|
||||
var list2 = Funs.DB.Transfer_StaticEquipment.Where(x => x.ProjectId == pid && x.SYSTEM == scode).ToList();
|
||||
var list3 = Funs.DB.Transfer_RotatingEquipment.Where(x => x.ProjectId == pid && x.SYSTEM == scode).ToList();
|
||||
var list4 = Funs.DB.Transfer_Instrumentation.Where(x => x.ProjectId == pid && x.SystemName == scode).ToList();
|
||||
var list5 = Funs.DB.Transfer_Electrical.Where(x => x.ProjectId == pid && x.SystemName == scode).ToList();
|
||||
var list6 = Funs.DB.Transfer_Civil_Structure.Where(x => x.ProjectId == pid && x.SystemName == scode).ToList();
|
||||
var list7 = Funs.DB.Transfer_Firefighting.Where(x => x.ProjectId == pid && x.SystemName == scode).ToList();
|
||||
var list8 = Funs.DB.Transfer_Telecom.Where(x => x.ProjectId == pid && x.SystemName == scode).ToList();
|
||||
#endregion
|
||||
|
||||
float allcount = (list1.Count + list2.Count + list3.Count + list4.Count +
|
||||
list5.Count + list6.Count + list7.Count + list8.Count);
|
||||
|
||||
float allScount = (list1.Where(x => x.FINALStatus == "Completed").ToList().Count + list2.Where(x => x.MechanicalFINALStatus == "Completed").ToList().Count
|
||||
+ list3.Where(x => x.MechanicalFINALStatus == "Completed").ToList().Count + list4.Where(x => x.FINAL_Status == "Completed").ToList().Count +
|
||||
list5.Where(x => x.FINAL_Status == "Completed").ToList().Count + list6.Where(x => x.FINAL_Status == "Completed").ToList().Count
|
||||
+ list7.Where(x => x.FINAL_Status == "Completed").ToList().Count + list8.Where(x => x.FINAL_Status == "Completed").ToList().Count
|
||||
);
|
||||
|
||||
if (Convert.ToInt32(allcount)==0)
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
var rateF = 100 * (allScount / allcount);
|
||||
rate = rateF.ToString("F2");
|
||||
}
|
||||
return rate;
|
||||
}
|
||||
|
||||
#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 = 100000;
|
||||
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)
|
||||
//{
|
||||
// if (column.ColumnID != "ckbIsSelected" && column.ColumnID != "Punish" && column.ColumnID != "Del")
|
||||
// {
|
||||
// sb.AppendFormat("<td>{0}</td>", column.HeaderText);
|
||||
// }
|
||||
//}
|
||||
//sb.Append("</tr>");
|
||||
MultiHeaderTable mht = new MultiHeaderTable();
|
||||
mht.ResolveMultiHeaderTable(Grid1.Columns);
|
||||
|
||||
foreach (List<object[]> rows in mht.MultiTable)
|
||||
{
|
||||
sb.Append("<tr>");
|
||||
foreach (object[] cell in rows)
|
||||
{
|
||||
int rowspan = Convert.ToInt32(cell[0]);
|
||||
int colspan = Convert.ToInt32(cell[1]);
|
||||
GridColumn column = cell[2] as GridColumn;
|
||||
if (column.Hidden == false)
|
||||
{
|
||||
sb.AppendFormat("<th{0}{1}{2}>{3}</th>",
|
||||
rowspan != 1 ? " rowspan=\"" + rowspan + "\"" : "",
|
||||
colspan != 1 ? " colspan=\"" + colspan + "\"" : "",
|
||||
colspan != 1 ? " style=\"text-align:center;\"" : "",
|
||||
column.HeaderText);
|
||||
}
|
||||
}
|
||||
sb.Append("</tr>");
|
||||
}
|
||||
foreach (GridRow row in grid.Rows)
|
||||
{
|
||||
sb.Append("<tr>");
|
||||
//if (row.Grid.gr.Hidden == false) {
|
||||
foreach (GridColumn column in mht.Columns)
|
||||
{
|
||||
if (column.ColumnID != "ckbIsSelected" && column.ColumnID != "Punish" && column.ColumnID != "Del")
|
||||
{
|
||||
string html = row.Values[column.ColumnIndex].ToString();
|
||||
|
||||
if (column.ColumnID == "tfPageIndex")
|
||||
{
|
||||
html = (row.FindControl("lblPageIndex") as AspNet.Label).Text;
|
||||
}
|
||||
|
||||
else if (column.ColumnID == "Count4")
|
||||
{
|
||||
html = (row.FindControl("Label5") as AspNet.Label).Text;
|
||||
}
|
||||
|
||||
sb.AppendFormat("<td>{0}</td>", html);
|
||||
}
|
||||
}
|
||||
//}
|
||||
sb.Append("</tr>");
|
||||
}
|
||||
|
||||
sb.Append("</table>");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user