20240416 质量月报
This commit is contained in:
@@ -1499,11 +1499,19 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||
var db = Funs.DB;
|
||||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||||
var list = new List<Model.CheckStatisc>();
|
||||
int i = 1;
|
||||
|
||||
int Quantity1Sum = 0;
|
||||
int Quantity2Sum = 0;
|
||||
int CheckNum = 0;//本月检查点数
|
||||
int TotalCheckNum = 0;//累计检查点数
|
||||
|
||||
int OKNum = 0;//本月检查合格点数
|
||||
int TotalOKNum = 0;//累计检查合格点数
|
||||
|
||||
string Quantity1Sum = String.Empty;//本月检查合格点数/本月检查点数
|
||||
string Quantity2Sum = String.Empty;//累计检查合格点数/累计检查点数
|
||||
|
||||
|
||||
//加载所有单位
|
||||
var units = from x in Funs.DB.Project_ProjectUnit
|
||||
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
|
||||
@@ -1521,43 +1529,85 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||
c.CheckDate,
|
||||
c.ProjectId,
|
||||
u.UnitId,
|
||||
u.UnitName
|
||||
u.UnitName,
|
||||
c.IsOnceQualified
|
||||
};
|
||||
var AllList = query.ToList();
|
||||
var monethCount = query
|
||||
.Where(x => (x.CheckDate >= Convert.ToDateTime(startDate) && x.CheckDate <= Convert.ToDateTime(endDate)));
|
||||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||||
model.Id = Guid.NewGuid().ToString();
|
||||
model.ContentName = item.UnitName;
|
||||
model.MonthsCount = monethCount.Count();
|
||||
model.ProjectCount = AllList.Count();
|
||||
model.ReportId = ReportId;
|
||||
|
||||
|
||||
Model.CheckStatisc checkStatisc = new Model.CheckStatisc();
|
||||
checkStatisc.Id = Guid.NewGuid().ToString();
|
||||
checkStatisc.ReportId = ReportId;
|
||||
checkStatisc.WorkName = item.UnitName;
|
||||
checkStatisc.CheckNum = monethCount.Count();
|
||||
checkStatisc.TotalCheckNum = AllList.Count();
|
||||
checkStatisc.OKNum = monethCount.Count(x => x.IsOnceQualified == true);
|
||||
checkStatisc.TotalOKNum = AllList.Count(x => x.IsOnceQualified == true);
|
||||
|
||||
if (checkStatisc.CheckNum != 0)//被除数不能为零
|
||||
{
|
||||
checkStatisc.OneOKRate = Math.Round((double)checkStatisc.OKNum / (double)checkStatisc.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
checkStatisc.OneOKRate = "0%";
|
||||
}
|
||||
|
||||
if (checkStatisc.TotalCheckNum != 0)//被除数不能为零
|
||||
{
|
||||
checkStatisc.TotalOneOKRate = Math.Round((double)checkStatisc.TotalOKNum / (double)checkStatisc.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
checkStatisc.TotalOneOKRate = "0%";
|
||||
}
|
||||
//如果是修改,查询表中数据
|
||||
if (objType == "1")
|
||||
{
|
||||
var NewModel = db.Report_CQMS_MonthReportItem.FirstOrDefault(x => x.ReportId == ReportId && x.ContentName == item.UnitName && x.ReType == "10");
|
||||
if (NewModel != null)
|
||||
{
|
||||
model.RectificationRate = NewModel.RectificationRate;
|
||||
model.Remarks = NewModel.Remarks;
|
||||
checkStatisc.Remarks = NewModel.Remarks;
|
||||
}
|
||||
}
|
||||
list.Add(model);
|
||||
list.Add(checkStatisc);
|
||||
|
||||
CheckNum += checkStatisc.CheckNum;
|
||||
TotalCheckNum += checkStatisc.TotalCheckNum;
|
||||
|
||||
OKNum += checkStatisc.OKNum;
|
||||
TotalOKNum += checkStatisc.TotalOKNum;
|
||||
|
||||
Quantity1Sum += monethCount.Count();
|
||||
Quantity2Sum += AllList.Count();
|
||||
i++;
|
||||
}
|
||||
|
||||
gvInspectionDataInspection.DataSource = list;
|
||||
gvInspectionDataInspection.DataBind();
|
||||
|
||||
if (CheckNum != 0)//被除数不能为零
|
||||
{
|
||||
Quantity1Sum = Math.Round((double)OKNum / (double)CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
Quantity1Sum = "0%";
|
||||
}
|
||||
if (TotalCheckNum != 0)//被除数不能为零
|
||||
{
|
||||
Quantity2Sum = Math.Round((double)TotalOKNum / (double)TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||
}
|
||||
else
|
||||
{
|
||||
Quantity2Sum = "0%";
|
||||
}
|
||||
|
||||
//合计
|
||||
JObject summary = new JObject();
|
||||
summary.Add("ContentName", "合计");
|
||||
summary.Add("MonthsCount", Quantity1Sum.ToString());
|
||||
summary.Add("ProjectCount", Quantity2Sum.ToString());
|
||||
summary.Add("WorkName", "合计");
|
||||
summary.Add("OneOKRate", Quantity1Sum.ToString());
|
||||
summary.Add("TotalOneOKRate", Quantity2Sum.ToString());
|
||||
|
||||
gvInspectionDataInspection.SummaryData = summary;
|
||||
#endregion
|
||||
@@ -1647,7 +1697,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||
}
|
||||
else
|
||||
{
|
||||
OneOKRate = "0%";
|
||||
OneOKRate = "0";
|
||||
}
|
||||
if (TotalCheckNum != 0)//被除数不能为零
|
||||
{
|
||||
@@ -1655,7 +1705,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||
}
|
||||
else
|
||||
{
|
||||
TotalOneOKRate = "0%";
|
||||
TotalOneOKRate = "0";
|
||||
}
|
||||
|
||||
//检验批统计:土建
|
||||
@@ -2071,7 +2121,8 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||
u.UnitId,
|
||||
u.UnitName,
|
||||
c.IssuedDate,
|
||||
c.Status
|
||||
c.Status,
|
||||
c.ImplementationFrontState,
|
||||
};
|
||||
|
||||
var AllList = query.ToList();
|
||||
@@ -2083,8 +2134,8 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||
NCRStatisc.WorkName = item.UnitName;
|
||||
//NCRStatisc.CurrentPeriodOkNum = unitNCRStatic.Count(x => x.Status == "3");
|
||||
//NCRStatisc.OKNum = AllList.Count(x => x.Status == "3");
|
||||
NCRStatisc.CurrentPeriodOkNum = unitNCRStatic.Count();
|
||||
NCRStatisc.OKNum = AllList.Count();
|
||||
NCRStatisc.CurrentPeriodOkNum = unitNCRStatic.Where(x => x.ImplementationFrontState.Trim().Equals("已闭合")).Count();
|
||||
NCRStatisc.OKNum = AllList.Where(x => x.ImplementationFrontState.Trim().Equals("已闭合")).Count();
|
||||
|
||||
NCRStatisc.CheckNum = AllList.Count();
|
||||
|
||||
@@ -3427,10 +3478,10 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||
{
|
||||
ReportId = ReportId,
|
||||
ReType = "10",
|
||||
ContentName = values.Value<string>("ContentName"),
|
||||
MonthsCount = values.Value<int>("MonthsCount"),
|
||||
ProjectCount = values.Value<int>("ProjectCount"),
|
||||
//RectificationRate = values.Value<string>("RectificationRate"),
|
||||
ContentName = values.Value<string>("WorkName"),
|
||||
RectificationRate = values.Value<string>("OneOKRate"),
|
||||
TotationRate = values.Value<string>("TotalOneOKRate"),
|
||||
|
||||
Remarks = values.Value<string>("Remarks"),
|
||||
};
|
||||
if (gvInspectionDataInspection.Rows[rowIndex].DataKeys.Length > 0)
|
||||
|
||||
Reference in New Issue
Block a user