2023-09-27
This commit is contained in:
@@ -109,6 +109,8 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
NCRBindStatisc();//NCR统计
|
||||
DesignChangeOrderBindStatisc();//设计变更统计
|
||||
PassWelderBindStatisc();//合格焊工统计
|
||||
ConstructionStatisticsr();//施工方案统计
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,45 +506,46 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
List<Model.View_CQMS_InspectionManagementDetail> totalManagementList = BLL.InspectionManagementService.getInspectionManagementDetailListByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, cNProfessionalId, projectStartDate, endDate, false);
|
||||
//专业下当期集合
|
||||
List<Model.View_CQMS_InspectionManagementDetail> managementList = BLL.InspectionManagementService.getInspectionManagementDetailListByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, cNProfessionalId, startDate, endDate, false);
|
||||
if (cNProfessionalId == BLL.Const.CNProfessionalCVId) //土建按单位工程统计
|
||||
foreach (var item in totalManagementList)
|
||||
{
|
||||
foreach (var item in totalManagementList)
|
||||
Model.WBS_BreakdownProject breakdownProject = BLL.BreakdownProjectService.GetBreakdownProjectById(item.ControlPointType);
|
||||
if (breakdownProject != null)
|
||||
{
|
||||
Model.WBS_BreakdownProject breakdownProject = BLL.BreakdownProjectService.GetBreakdownProjectById(item.ControlPointType);
|
||||
if (breakdownProject != null)
|
||||
Model.WBS_DivisionProject divisionProject = BLL.DivisionProjectService.GetDivisionProjectById(breakdownProject.DivisionProjectId);
|
||||
if (divisionProject != null)
|
||||
{
|
||||
Model.WBS_DivisionProject divisionProject = BLL.DivisionProjectService.GetDivisionProjectById(breakdownProject.DivisionProjectId);
|
||||
if (divisionProject != null)
|
||||
Model.WBS_UnitWork ins = BLL.UnitWorkService.getUnitWorkByUnitWorkId(divisionProject.UnitWorkId);
|
||||
if (ins != null)
|
||||
{
|
||||
Model.WBS_UnitWork ins = BLL.UnitWorkService.getUnitWorkByUnitWorkId(divisionProject.UnitWorkId);
|
||||
if (ins != null)
|
||||
if (!workNames.Contains(ins.UnitWorkName)) //新增记录
|
||||
{
|
||||
if (!workNames.Contains(ins.UnitWorkName)) //新增记录
|
||||
{
|
||||
Model.CheckStatisc checkStatisc = new Model.CheckStatisc();
|
||||
checkStatisc.Num = i;
|
||||
checkStatisc.WorkName = ins.UnitWorkName;
|
||||
workNames.Add(ins.UnitWorkName);
|
||||
checkStatisc.CheckNum = managementList.Count(x => x.ControlPointType == item.ControlPointType);
|
||||
checkStatisc.TotalCheckNum = totalManagementList.Count(x => x.ControlPointType == item.ControlPointType);
|
||||
checkStatisc.OKNum = managementList.Count(x => x.ControlPointType == item.ControlPointType && x.IsOnceQualified == true);
|
||||
checkStatisc.TotalOKNum = totalManagementList.Count(x => x.ControlPointType == item.ControlPointType && x.IsOnceQualified == true);
|
||||
StatisticsList.Add(checkStatisc);
|
||||
i++;
|
||||
}
|
||||
else //更新已有记录
|
||||
{
|
||||
Model.CheckStatisc checkStatisc1 = StatisticsList.FirstOrDefault(x => x.WorkName == ins.UnitWorkName);
|
||||
checkStatisc1.CheckNum += managementList.Count(x => x.ControlPointType == item.ControlPointType);
|
||||
checkStatisc1.TotalCheckNum += totalManagementList.Count(x => x.ControlPointType == item.ControlPointType);
|
||||
checkStatisc1.OKNum += managementList.Count(x => x.ControlPointType == item.ControlPointType && x.IsOnceQualified == true);
|
||||
checkStatisc1.TotalOKNum += totalManagementList.Count(x => x.ControlPointType == item.ControlPointType && x.IsOnceQualified == true);
|
||||
}
|
||||
Model.CheckStatisc checkStatisc = new Model.CheckStatisc();
|
||||
checkStatisc.Num = i;
|
||||
checkStatisc.WorkName = ins.UnitWorkName;
|
||||
workNames.Add(ins.UnitWorkName);
|
||||
checkStatisc.CheckNum = managementList.Count(x => x.ControlPointType == item.ControlPointType);
|
||||
checkStatisc.TotalCheckNum = totalManagementList.Count(x => x.ControlPointType == item.ControlPointType);
|
||||
checkStatisc.OKNum = managementList.Count(x => x.ControlPointType == item.ControlPointType && x.IsOnceQualified == true);
|
||||
checkStatisc.TotalOKNum = totalManagementList.Count(x => x.ControlPointType == item.ControlPointType && x.IsOnceQualified == true);
|
||||
StatisticsList.Add(checkStatisc);
|
||||
i++;
|
||||
}
|
||||
else //更新已有记录
|
||||
{
|
||||
Model.CheckStatisc checkStatisc1 = StatisticsList.FirstOrDefault(x => x.WorkName == ins.UnitWorkName);
|
||||
checkStatisc1.CheckNum += managementList.Count(x => x.ControlPointType == item.ControlPointType);
|
||||
checkStatisc1.TotalCheckNum += totalManagementList.Count(x => x.ControlPointType == item.ControlPointType);
|
||||
checkStatisc1.OKNum += managementList.Count(x => x.ControlPointType == item.ControlPointType && x.IsOnceQualified == true);
|
||||
checkStatisc1.TotalOKNum += totalManagementList.Count(x => x.ControlPointType == item.ControlPointType && x.IsOnceQualified == true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*if (cNProfessionalId == BLL.Const.CNProfessionalCVId) //土建按单位工程统计
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in totalManagementList)
|
||||
@@ -577,7 +580,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
foreach (var item in StatisticsList)
|
||||
{
|
||||
if (item.CheckNum != 0)//被除数不能为零
|
||||
@@ -675,7 +678,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.Header)
|
||||
{
|
||||
string headerStr = "序号#工作名称#检查(点) 本周,累计#合格(点) 本周,累计#一次合格率 本周,累计";
|
||||
string headerStr = "序号#单位工程#检查(点) 本周,累计#合格(点) 本周,累计#一次合格率 本周,累计";
|
||||
DynamicTHeaderHepler dHelper = new DynamicTHeaderHepler();
|
||||
dHelper.SplitTableHeader(e.Row, headerStr);
|
||||
}
|
||||
@@ -691,7 +694,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.Header)
|
||||
{
|
||||
string headerStr = "序号#工作名称#检查(点) 本周,累计#合格(点) 本周,累计#一次合格率 本周,累计";
|
||||
string headerStr = "序号#单位工程#检查(点) 本周,累计#合格(点) 本周,累计#一次合格率 本周,累计";
|
||||
DynamicTHeaderHepler dHelper = new DynamicTHeaderHepler();
|
||||
dHelper.SplitTableHeader(e.Row, headerStr);
|
||||
}
|
||||
@@ -706,7 +709,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.Header)
|
||||
{
|
||||
string headerStr = "序号#工作名称#检查(点) 本周,累计#合格(点) 本周,累计#一次合格率 本周,累计";
|
||||
string headerStr = "序号#单位工程#检查(点) 本周,累计#合格(点) 本周,累计#一次合格率 本周,累计";
|
||||
DynamicTHeaderHepler dHelper = new DynamicTHeaderHepler();
|
||||
dHelper.SplitTableHeader(e.Row, headerStr);
|
||||
}
|
||||
@@ -721,7 +724,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.Header)
|
||||
{
|
||||
string headerStr = "序号#工作名称#检查(点) 本周,累计#合格(点) 本周,累计#一次合格率 本周,累计";
|
||||
string headerStr = "序号#单位工程#检查(点) 本周,累计#合格(点) 本周,累计#一次合格率 本周,累计";
|
||||
DynamicTHeaderHepler dHelper = new DynamicTHeaderHepler();
|
||||
dHelper.SplitTableHeader(e.Row, headerStr);
|
||||
}
|
||||
@@ -736,7 +739,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.Header)
|
||||
{
|
||||
string headerStr = "序号#工作名称#检查(点) 本周,累计#合格(点) 本周,累计#一次合格率 本周,累计";
|
||||
string headerStr = "序号#单位工程#检查(点) 本周,累计#合格(点) 本周,累计#一次合格率 本周,累计";
|
||||
DynamicTHeaderHepler dHelper = new DynamicTHeaderHepler();
|
||||
dHelper.SplitTableHeader(e.Row, headerStr);
|
||||
}
|
||||
@@ -751,7 +754,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.Header)
|
||||
{
|
||||
string headerStr = "序号#工作名称#检查(点) 本周,累计#合格(点) 本周,累计#一次合格率 本周,累计";
|
||||
string headerStr = "序号#单位工程#检查(点) 本周,累计#合格(点) 本周,累计#一次合格率 本周,累计";
|
||||
DynamicTHeaderHepler dHelper = new DynamicTHeaderHepler();
|
||||
dHelper.SplitTableHeader(e.Row, headerStr);
|
||||
}
|
||||
@@ -766,7 +769,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.Header)
|
||||
{
|
||||
string headerStr = "序号#工作名称#检查(点) 本周,累计#合格(点) 本周,累计#一次合格率 本周,累计";
|
||||
string headerStr = "序号#单位工程#检查(点) 本周,累计#合格(点) 本周,累计#一次合格率 本周,累计";
|
||||
DynamicTHeaderHepler dHelper = new DynamicTHeaderHepler();
|
||||
dHelper.SplitTableHeader(e.Row, headerStr);
|
||||
}
|
||||
@@ -842,8 +845,9 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
Model.NCRReportStatisc NCRStatisc = new Model.NCRReportStatisc();
|
||||
NCRStatisc.Num = i;
|
||||
NCRStatisc.WorkName = BLL.UnitService.getUnitNamesUnitIds(item);
|
||||
NCRStatisc.OKNum = managementList.Count(x => x.CompleteDate != null);
|
||||
NCRStatisc.CheckNum = sumManagementList.Count(x => x.CompleteDate != null);
|
||||
NCRStatisc.CurrentPeriodOkNum = managementList.Count(x => x.CompleteDate != null);
|
||||
NCRStatisc.OKNum = sumManagementList.Count(x => x.CompleteDate != null);
|
||||
NCRStatisc.CheckNum = sumManagementList.Count;
|
||||
if (NCRStatisc.CheckNum != 0)//被除数不能为零
|
||||
{
|
||||
NCRStatisc.OKRate = Math.Round((double)NCRStatisc.OKNum / (double)NCRStatisc.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
@@ -862,6 +866,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
StatisticsLast.WorkName = "合计";
|
||||
foreach (Model.NCRReportStatisc item in StatisticsList)
|
||||
{
|
||||
StatisticsLast.CurrentPeriodOkNum += item.CurrentPeriodOkNum;
|
||||
StatisticsLast.OKNum += item.OKNum;
|
||||
StatisticsLast.CheckNum += item.CheckNum;
|
||||
}
|
||||
@@ -889,7 +894,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.Header)
|
||||
{
|
||||
string headerStr = "序号#接收单位#本周已完成#累计已完成#累计完成比例";
|
||||
string headerStr = "序号#接收单位#本周已完成#累计已完成#NCR总数#累计完成比例";
|
||||
DynamicTHeaderHepler dHelper = new DynamicTHeaderHepler();
|
||||
dHelper.SplitTableHeader(e.Row, headerStr);
|
||||
}
|
||||
@@ -1004,23 +1009,53 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
orderby y.UnitCode
|
||||
select new { x.UnitId, y.UnitName };
|
||||
|
||||
var db = Funs.DB;
|
||||
foreach (var item in units)
|
||||
{
|
||||
//单位下所有集合
|
||||
List<Model.BS_Welder> totalWelderList = BLL.PersonManageService.GetWelderListByUnitId(this.CurrUser.LoginProjectId, item.UnitId);
|
||||
List<Model.BS_Welder> welderList = BLL.PersonManageService.GetWelderListByUnitIdAndDate(this.CurrUser.LoginProjectId, item.UnitId, startDate, endDate);
|
||||
|
||||
var query = from c in db.Comprehensive_InspectionPerson
|
||||
|
||||
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||||
|
||||
from u in unitJoin.DefaultIfEmpty()
|
||||
join cn in db.Base_CNProfessional on c.CNProfessionalId equals cn.CNProfessionalId into cnJoin
|
||||
|
||||
from cn in cnJoin.DefaultIfEmpty()
|
||||
join p in db.Base_Post on c.PostId equals p.PostId into postJoin
|
||||
|
||||
from p in postJoin.DefaultIfEmpty()
|
||||
where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
|
||||
select new
|
||||
|
||||
{
|
||||
c.InspectionPersonId,
|
||||
c.ProjectId,
|
||||
u.UnitId,
|
||||
u.UnitName,
|
||||
c.PersonName,
|
||||
c.ApprovalTime,
|
||||
cn.ProfessionalName,
|
||||
p.PostName
|
||||
|
||||
};
|
||||
|
||||
//单位下所有集合
|
||||
// List<Model.BS_Welder> totalWelderList = BLL.PersonManageService.GetWelderListByUnitId(this.CurrUser.LoginProjectId, item.UnitId);
|
||||
//List<Model.BS_Welder> welderList = BLL.PersonManageService.GetWelderListByUnitIdAndDate(this.CurrUser.LoginProjectId, item.UnitId, startDate, endDate);
|
||||
var totalWelderList = query.ToList();
|
||||
var welderList = query
|
||||
.Where(x => (x.ApprovalTime >= Convert.ToDateTime(startDate) && x.ApprovalTime <= Convert.ToDateTime(endDate)));
|
||||
Model.PassWelderStatisc passWelderStatisc = new Model.PassWelderStatisc();
|
||||
passWelderStatisc.Num = i;
|
||||
passWelderStatisc.UnitName = item.UnitName;
|
||||
passWelderStatisc.PipeMountGuard = welderList.Count(x => x.WED_Remark == "管道");
|
||||
passWelderStatisc.PipeTotal = totalWelderList.Count(x => x.WED_Remark == "管道");
|
||||
passWelderStatisc.SteelStructureMountGuard = welderList.Count(x => x.WED_Remark == "钢结构");
|
||||
passWelderStatisc.SteelStructureTotal = totalWelderList.Count(x => x.WED_Remark == "钢结构");
|
||||
passWelderStatisc.EquipmentMountGuard = welderList.Count(x => x.WED_Remark == "设备");
|
||||
passWelderStatisc.EquipmentTotal = totalWelderList.Count(x => x.WED_Remark == "设备");
|
||||
passWelderStatisc.OtherMountGuard = welderList.Count(x => x.WED_Remark == "其他");
|
||||
passWelderStatisc.OtherTotal = totalWelderList.Count(x => x.WED_Remark == "其他");
|
||||
passWelderStatisc.PipeMountGuard = welderList.Count(x => x.ProfessionalName == "管道" && x.PostName == "焊工");
|
||||
passWelderStatisc.PipeTotal = totalWelderList.Count(x => x.ProfessionalName == "管道" && x.PostName == "焊工");
|
||||
passWelderStatisc.SteelStructureMountGuard = welderList.Count(x => x.ProfessionalName == "土建" && x.PostName == "焊工");
|
||||
passWelderStatisc.SteelStructureTotal = totalWelderList.Count(x => x.ProfessionalName == "土建" && x.PostName == "焊工");
|
||||
passWelderStatisc.EquipmentMountGuard = welderList.Count(x => x.ProfessionalName == "设备" && x.PostName == "焊工");
|
||||
passWelderStatisc.EquipmentTotal = totalWelderList.Count(x => x.ProfessionalName == "设备" && x.PostName == "焊工");
|
||||
passWelderStatisc.OtherMountGuard = welderList.Count(x => x.ProfessionalName != "管道" && x.ProfessionalName != "土建" && x.ProfessionalName != "设备" && x.PostName == "焊工");
|
||||
passWelderStatisc.OtherTotal = totalWelderList.Count(x => x.ProfessionalName != "管道" && x.ProfessionalName != "土建" && x.ProfessionalName != "设备" && x.PostName == "焊工");
|
||||
StatisticsList.Add(passWelderStatisc);
|
||||
i++;
|
||||
}
|
||||
@@ -1063,6 +1098,70 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 施工方案统计
|
||||
public void ConstructionStatisticsr()
|
||||
{
|
||||
var db = Funs.DB;
|
||||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||||
DateTime projectStartDate = Convert.ToDateTime("2015-01-01");
|
||||
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||||
if (project != null)
|
||||
{
|
||||
if (project.StartDate != null)
|
||||
{
|
||||
projectStartDate = Convert.ToDateTime(project.StartDate);
|
||||
}
|
||||
}
|
||||
int i = 1;
|
||||
var q = from x in db.Solution_CQMSConstructSolution
|
||||
where x.CompileDate >= Convert.ToDateTime(startDate) && x.CompileDate <= Convert.ToDateTime(endDate)
|
||||
group x by new { x.UnitId, State = x.State == "3", ProjectId = x.ProjectId == project.ProjectId }
|
||||
into g
|
||||
select new
|
||||
{
|
||||
UnitName = BLL.UnitService.GetUnitNameByUnitId(g.Key.UnitId),
|
||||
Count = g.Key.UnitId.Count(),
|
||||
};
|
||||
var result = q.ToList().Select((item, index) => new
|
||||
{
|
||||
Index = index + 1,
|
||||
item.UnitName,
|
||||
item.Count
|
||||
|
||||
});
|
||||
if (result.Count() > 0) //增加总计
|
||||
{
|
||||
int totalCount = result.Sum(item => item.Count);
|
||||
result = result.Concat(new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
Index = result.Count() + 1,
|
||||
UnitName = "合计",
|
||||
Count = totalCount
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.gvConstructionStatistics.DataSource = result;
|
||||
this.gvConstructionStatistics.DataBind();
|
||||
|
||||
}
|
||||
|
||||
protected void gvConstructionStatistics_RowCreated(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.Header)
|
||||
{
|
||||
string headerStr = "序号#报审单位#完成数量";
|
||||
DynamicTHeaderHepler dHelper = new DynamicTHeaderHepler();
|
||||
dHelper.SplitTableHeader(e.Row, headerStr);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 下周质量控制重点
|
||||
/// <summary>
|
||||
/// 增加下周质量控制重点
|
||||
@@ -1146,6 +1245,8 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||
NCRBindStatisc();//NCR统计
|
||||
DesignChangeOrderBindStatisc();//设计变更统计
|
||||
PassWelderBindStatisc();//合格焊工统计
|
||||
ConstructionStatisticsr();//施工方案统计
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user