2023-10-12

This commit is contained in:
李鹏飞 2023-10-12 22:17:57 +08:00
parent 871784610c
commit d61950897d
3 changed files with 150 additions and 81 deletions

View File

@ -81,7 +81,8 @@ namespace BLL
x.RemarkCode,
x.Unit,
x.UsedPlace,
x.EquipmentNO
x.EquipmentNO,
x.EquipmentOrMatail
};
}
@ -141,7 +142,7 @@ namespace BLL
newInspectionEquipment.UsedPlace = inspectionEquipment.UsedPlace;
newInspectionEquipment.Attribute = inspectionEquipment.Attribute;
newInspectionEquipment.AuditMan = inspectionEquipment.AuditMan;
newInspectionEquipment.EquipmentOrMatail = inspectionEquipment.EquipmentOrMatail;
newInspectionEquipment.Status = inspectionEquipment.Status;
db.Comprehensive_InspectionEquipment.InsertOnSubmit(newInspectionEquipment);
db.SubmitChanges();
@ -176,6 +177,7 @@ namespace BLL
newInspectionEquipment.Attribute = inspectionEquipment.Attribute;
newInspectionEquipment.AuditMan = inspectionEquipment.AuditMan;
newInspectionEquipment.Status = inspectionEquipment.Status;
newInspectionEquipment.EquipmentOrMatail = inspectionEquipment.EquipmentOrMatail;
db.SubmitChanges();
}
}

View File

@ -7,6 +7,7 @@ using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Model;
using SgManager.AI;
using AspNet = System.Web.UI.WebControls;
namespace FineUIPro.Web.CQMS.ManageReport
@ -99,6 +100,8 @@ namespace FineUIPro.Web.CQMS.ManageReport
this.txtStartDate.Text = string.IsNullOrEmpty(Request.Params["startdate"])? string.Format("{0:yyyy-MM-dd}", DateTime.Now): Request.Params["startdate"];
this.txtEndDate.Text = string.IsNullOrEmpty(Request.Params["enddate"]) ? string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(this.txtStartDate.Text).AddMonths(1).AddDays(-1)): Request.Params["enddate"];
//this.txtStartDate.Text = string.IsNullOrEmpty(Request.Params["startdate"]) ? string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(-6)) : Request.Params["startdate"];
//this.txtEndDate.Text = string.IsNullOrEmpty(Request.Params["enddate"]) ? string.Format("{0:yyyy-MM-dd}", DateTime.Now) : Request.Params["enddate"];
//this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", "2022-11-02 01:01:00");
//this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", "2023-10-18 01:01:00");
}
@ -518,42 +521,60 @@ 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);
foreach (var item in totalManagementList)
workNames = totalManagementList.Select(x => x.UnitWorkId).DefaultIfEmpty().Distinct()?.ToList();
foreach (string item in workNames)
{
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_UnitWork ins = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(divisionProject.UnitWorkId);
Model.WBS_UnitWork ins = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(item);
if (ins != null)
{
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);
checkStatisc.CheckNum = managementList.Count(x => x.UnitWorkId == item);
checkStatisc.TotalCheckNum = totalManagementList.Count(x => x.UnitWorkId == item);
checkStatisc.OKNum = managementList.Count(x => x.UnitWorkId == item && x.IsOnceQualified == true);
checkStatisc.TotalOKNum = totalManagementList.Count(x => x.UnitWorkId == item && 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);
}
}
}
}
}
//foreach (var item in totalManagementList)
//{
// 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_UnitWork ins = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(divisionProject.UnitWorkId);
// if (ins != null)
// {
// 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);
// }
// }
// }
// }
//}
/*if (cNProfessionalId == BLL.Const.CNProfessionalCVId) //土建按单位工程统计
{
@ -1158,6 +1179,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
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);
var unitList= UnitService.GetUnitListByProjectId(this.CurrUser.LoginProjectId).Select(x=>x.UnitId).ToList();
if (project != null)
{
if (project.StartDate != null)
@ -1167,7 +1189,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
}
int i = 1;
var q = from x in db.Solution_CQMSConstructSolution
where x.CompileDate >= Convert.ToDateTime(startDate) && x.CompileDate <= Convert.ToDateTime(endDate)
where x.CompileDate >= Convert.ToDateTime(startDate) && x.CompileDate <= Convert.ToDateTime(endDate) && unitList.Contains(x.UnitId) &&x.ProjectId==this.CurrUser.LoginProjectId
group x by new { x.UnitId, State = x.State == "3", ProjectId = x.ProjectId == project.ProjectId }
into g
select new
@ -1177,7 +1199,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
};
var total = from x in db.Solution_CQMSConstructSolution
where x.CompileDate >= projectStartDate && x.CompileDate <= DateTime.Now
where x.CompileDate >= projectStartDate && x.CompileDate <= DateTime.Now && unitList.Contains(x.UnitId) && x.ProjectId == this.CurrUser.LoginProjectId
group x by new { x.UnitId, ProjectId = x.ProjectId == project.ProjectId }
into g
select new

View File

@ -96,8 +96,10 @@ namespace FineUIPro.Web.CQMS.ManageReport
else
{
//this.txtStartDate.Text = string.IsNullOrEmpty(Request.Params["startdate"]) ? string.Format("{0:yyyy-MM-dd}", DateTime.Now) : Request.Params["startdate"];
// this.txtEndDate.Text = string.IsNullOrEmpty(Request.Params["enddate"]) ? string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(this.txtStartDate.Text).AddMonths(1).AddDays(-1)) : Request.Params["enddate"];
this.txtStartDate.Text = string.IsNullOrEmpty(Request.Params["startdate"]) ? string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(-6)) : Request.Params["startdate"];
this.txtEndDate.Text = string.IsNullOrEmpty(Request.Params["enddate"]) ? string.Format("{0:yyyy-MM-dd}", DateTime.Now ): Request.Params["enddate"];
this.txtEndDate.Text = string.IsNullOrEmpty(Request.Params["enddate"]) ? string.Format("{0:yyyy-MM-dd}", DateTime.Now) : Request.Params["enddate"];
//this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", "2022-11-02 01:01:00");
//this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", "2023-10-18 01:01:00");
}
@ -517,42 +519,60 @@ 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);
foreach (var item in totalManagementList)
workNames = totalManagementList.Select(x => x.UnitWorkId).DefaultIfEmpty().Distinct()?.ToList();
foreach (string item in workNames)
{
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_UnitWork ins = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(divisionProject.UnitWorkId);
Model.WBS_UnitWork ins = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(item);
if (ins != null)
{
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);
checkStatisc.CheckNum = managementList.Count(x => x.UnitWorkId == item);
checkStatisc.TotalCheckNum = totalManagementList.Count(x => x.UnitWorkId == item);
checkStatisc.OKNum = managementList.Count(x => x.UnitWorkId == item && x.IsOnceQualified == true);
checkStatisc.TotalOKNum = totalManagementList.Count(x => x.UnitWorkId == item && 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);
}
}
}
}
}
//foreach (var item in totalManagementList)
//{
// 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_UnitWork ins = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(divisionProject.UnitWorkId);
// if (ins != null)
// {
// 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);
// }
// }
// }
// }
//}
/*if (cNProfessionalId == BLL.Const.CNProfessionalCVId) //土建按单位工程统计
{
@ -881,12 +901,12 @@ namespace FineUIPro.Web.CQMS.ManageReport
//当期集合
List<Model.Comprehensive_NCRManagement> managementList = BLL.NCRManagementService.GetNCRManagementListByUnitNameAndDate(this.CurrUser.LoginProjectId, item, startDate, endDate);
//累计集合
List<Model.Comprehensive_NCRManagement> sumManagementList = BLL.NCRManagementService.GetNCRManagementListByUnitNameAndDate(this.CurrUser.LoginProjectId, item, projectStartDate, endDate);
List<Model.Comprehensive_NCRManagement> sumManagementList = BLL.NCRManagementService.GetNCRManagementListByUnitNameAndDate(this.CurrUser.LoginProjectId, item, projectStartDate, DateTime.Now);
Model.NCRReportStatisc NCRStatisc = new Model.NCRReportStatisc();
NCRStatisc.Num = i;
NCRStatisc.WorkName = BLL.UnitService.getUnitNamesUnitIds(item);
NCRStatisc.CurrentPeriodOkNum = managementList.Count(x => x.CompleteDate != null);
NCRStatisc.OKNum = sumManagementList.Count(x => x.CompleteDate != null);
NCRStatisc.CurrentPeriodOkNum = managementList.Count(x => x.Status == "3");
NCRStatisc.OKNum = sumManagementList.Count(x => x.Status == "3");
NCRStatisc.CheckNum = sumManagementList.Count;
if (NCRStatisc.CheckNum != 0)//被除数不能为零
{
@ -920,6 +940,18 @@ namespace FineUIPro.Web.CQMS.ManageReport
}
StatisticsList.Add(StatisticsLast);
}
else
{
Model.NCRReportStatisc StatisticsLast = new Model.NCRReportStatisc();
StatisticsLast.Num = 0;
StatisticsLast.WorkName = "合计";
StatisticsLast.CurrentPeriodOkNum = 0;
StatisticsLast.OKNum = 0;
StatisticsLast.CheckNum = 0;
StatisticsLast.OKRate = "0%";
StatisticsList.Add(StatisticsLast);
}
this.gvNCRStatisc.DataSource = StatisticsList;
this.gvNCRStatisc.DataBind();
}
@ -966,7 +998,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
foreach (var item in cNProfessionals)
{
//专业下所有集合
List<Model.Comprehensive_DesignChangeOrder> totalManagementList = BLL.DesignChangeOrderService.GetDesignChangeOrderListByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, item.CNProfessionalId, projectStartDate, endDate);
List<Model.Comprehensive_DesignChangeOrder> totalManagementList = BLL.DesignChangeOrderService.GetDesignChangeOrderListByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, item.CNProfessionalId, projectStartDate, DateTime.Now);
//专业下当期集合
List<Model.Comprehensive_DesignChangeOrder> managementList = BLL.DesignChangeOrderService.GetDesignChangeOrderListByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, item.CNProfessionalId, startDate, endDate);
Model.CheckStatisc checkStatisc = new Model.CheckStatisc();
@ -976,8 +1008,8 @@ namespace FineUIPro.Web.CQMS.ManageReport
checkStatisc.TotalCheckNum = totalManagementList.Count();
checkStatisc.OKNum = managementList.Count(x => x.ApprovalDate != null);
checkStatisc.TotalOKNum = totalManagementList.Count(x => x.ApprovalDate != null);
checkStatisc.OneOKRate = managementList.Count(x => x.HandleState == "3").ToString(); //当期完成数
checkStatisc.TotalOneOKRate = totalManagementList.Count(x => x.HandleState == "3").ToString(); //累计完成数
checkStatisc.OneOKRate = managementList.Count(x => x.Status == "3").ToString(); //当期完成数
checkStatisc.TotalOneOKRate = totalManagementList.Count(x => x.Status == "3").ToString(); //累计完成数
if (checkStatisc.CheckNum > 0 || checkStatisc.TotalCheckNum > 0 || checkStatisc.OKNum > 0 || checkStatisc.TotalOKNum > 0)
{
StatisticsList.Add(checkStatisc);
@ -1145,6 +1177,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
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);
var unitList = UnitService.GetUnitListByProjectId(this.CurrUser.LoginProjectId).Select(x => x.UnitId).ToList();
if (project != null)
{
if (project.StartDate != null)
@ -1154,7 +1187,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
}
int i = 1;
var q = from x in db.Solution_CQMSConstructSolution
where x.CompileDate >= Convert.ToDateTime(startDate) && x.CompileDate <= Convert.ToDateTime(endDate)
where x.CompileDate >= Convert.ToDateTime(startDate) && x.CompileDate <= Convert.ToDateTime(endDate) && unitList.Contains(x.UnitId) && x.ProjectId == this.CurrUser.LoginProjectId
group x by new { x.UnitId, State = x.State == "3", ProjectId = x.ProjectId == project.ProjectId }
into g
select new
@ -1162,24 +1195,36 @@ namespace FineUIPro.Web.CQMS.ManageReport
UnitName = BLL.UnitService.GetUnitNameByUnitId(g.Key.UnitId),
Count = g.Key.UnitId.Count(),
};
var total = from x in db.Solution_CQMSConstructSolution
where x.CompileDate >= projectStartDate && x.CompileDate <= DateTime.Now && unitList.Contains(x.UnitId) && x.ProjectId == this.CurrUser.LoginProjectId
group x by new { x.UnitId, 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
item.Count,
AllCount = (int)total.ToList().Where(x => x.UnitName == item.UnitName).Select(x => x.Count).FirstOrDefault()
});
if (result.Count() > 0) //增加总计
{
int totalCount = result.Sum(item => item.Count);
int totalAllCount = result.Sum(item => item.AllCount);
result = result.Concat(new[]
{
new
{
Index = result.Count() + 1,
UnitName = "合计",
Count = totalCount
Count = totalCount,
AllCount= totalAllCount
}
});
}
@ -1193,7 +1238,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);
}