2023-10-26
This commit is contained in:
parent
5fb9c49964
commit
a2acdd4259
Binary file not shown.
|
@ -3,11 +3,14 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.UI;
|
using System.Web.UI;
|
||||||
using System.Web.UI.WebControls;
|
using System.Web.UI.WebControls;
|
||||||
using BLL;
|
using BLL;
|
||||||
|
using FineUIPro.Web.DataShow;
|
||||||
using Model;
|
using Model;
|
||||||
|
using NPOI.SS.Formula.Functions;
|
||||||
using SgManager.AI;
|
using SgManager.AI;
|
||||||
using AspNet = System.Web.UI.WebControls;
|
using AspNet = System.Web.UI.WebControls;
|
||||||
namespace FineUIPro.Web.CQMS.ManageReport
|
namespace FineUIPro.Web.CQMS.ManageReport
|
||||||
|
@ -895,21 +898,42 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||||
{
|
{
|
||||||
projectStartDate = project.StartDate.Value;
|
projectStartDate = project.StartDate.Value;
|
||||||
}
|
}
|
||||||
//所有集合
|
var units = from x in Funs.DB.Project_ProjectUnit
|
||||||
List<Model.Comprehensive_NCRManagement> totalManagementList = BLL.NCRManagementService.GetNCRManagementListByDate(this.CurrUser.LoginProjectId, startDate, endDate);
|
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
|
||||||
List<string> unitNames = (from x in totalManagementList select x.ReceiveUnit).Distinct().ToList();
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitType == BLL.Const.ProjectUnitType_2
|
||||||
foreach (var item in unitNames)
|
orderby y.UnitCode
|
||||||
|
select new { x.UnitId, y.UnitName };
|
||||||
|
var db = Funs.DB;
|
||||||
|
foreach (var item in units)
|
||||||
{
|
{
|
||||||
//当期集合
|
|
||||||
List<Model.Comprehensive_NCRManagement> managementList = BLL.NCRManagementService.GetNCRManagementListByUnitNameAndDate(this.CurrUser.LoginProjectId, item, startDate, endDate);
|
var query = from c in db.Comprehensive_NCRManagement
|
||||||
//累计集合
|
|
||||||
List<Model.Comprehensive_NCRManagement> sumManagementList = BLL.NCRManagementService.GetNCRManagementListByUnitNameAndDate(this.CurrUser.LoginProjectId, item, projectStartDate, DateTime.Now);
|
join u in db.Base_Unit on c.ReceiveUnit equals u.UnitId into unitJoin
|
||||||
|
|
||||||
|
from u in unitJoin.DefaultIfEmpty()
|
||||||
|
where c.ProjectId == this.CurrUser.LoginProjectId && c.ReceiveUnit == item.UnitId
|
||||||
|
select new
|
||||||
|
|
||||||
|
{
|
||||||
|
c.NCRManagementId,
|
||||||
|
c.ProjectId,
|
||||||
|
u.UnitId,
|
||||||
|
u.UnitName,
|
||||||
|
c.IssuedDate,
|
||||||
|
c.Status
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var AllList = query.ToList();
|
||||||
|
var unitNCRStatic = query
|
||||||
|
.Where(x => (x.IssuedDate >= Convert.ToDateTime(startDate) && x.IssuedDate <= Convert.ToDateTime(endDate)));
|
||||||
Model.NCRReportStatisc NCRStatisc = new Model.NCRReportStatisc();
|
Model.NCRReportStatisc NCRStatisc = new Model.NCRReportStatisc();
|
||||||
NCRStatisc.Num = i;
|
NCRStatisc.Num = i;
|
||||||
NCRStatisc.WorkName = BLL.UnitService.getUnitNamesUnitIds(item);
|
NCRStatisc.WorkName = item.UnitName;
|
||||||
NCRStatisc.CurrentPeriodOkNum = managementList.Count(x => x.Status == "3");
|
NCRStatisc.CurrentPeriodOkNum = unitNCRStatic.Count(x => x.Status == "3" );
|
||||||
NCRStatisc.OKNum = sumManagementList.Count(x => x.Status == "3");
|
NCRStatisc.OKNum = AllList.Count(x => x.Status == "3");
|
||||||
NCRStatisc.CheckNum = sumManagementList.Count;
|
NCRStatisc.CheckNum = AllList.Count();
|
||||||
if (NCRStatisc.CheckNum != 0)//被除数不能为零
|
if (NCRStatisc.CheckNum != 0)//被除数不能为零
|
||||||
{
|
{
|
||||||
NCRStatisc.OKRate = Math.Round((double)NCRStatisc.OKNum / (double)NCRStatisc.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
NCRStatisc.OKRate = Math.Round((double)NCRStatisc.OKNum / (double)NCRStatisc.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||||
|
@ -1179,6 +1203,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||||||
DateTime projectStartDate = Convert.ToDateTime("2015-01-01");
|
DateTime projectStartDate = Convert.ToDateTime("2015-01-01");
|
||||||
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||||||
|
List<Model.CQMSConstructSolutionStatisc> StatisticsList = new List<Model.CQMSConstructSolutionStatisc>();
|
||||||
var unitList= UnitService.GetUnitListByProjectId(this.CurrUser.LoginProjectId).Select(x=>x.UnitId).ToList();
|
var unitList= UnitService.GetUnitListByProjectId(this.CurrUser.LoginProjectId).Select(x=>x.UnitId).ToList();
|
||||||
if (project != null)
|
if (project != null)
|
||||||
{
|
{
|
||||||
|
@ -1188,50 +1213,128 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int i = 1;
|
int i = 1;
|
||||||
var q = from x in db.Solution_CQMSConstructSolution
|
var units = from x in Funs.DB.Project_ProjectUnit
|
||||||
where x.CompileDate >= Convert.ToDateTime(startDate) && x.CompileDate <= Convert.ToDateTime(endDate) && unitList.Contains(x.UnitId) &&x.ProjectId==this.CurrUser.LoginProjectId
|
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
|
||||||
group x by new { x.UnitId, State = x.State == "3", ProjectId = x.ProjectId == project.ProjectId }
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitType == BLL.Const.ProjectUnitType_2
|
||||||
into g
|
orderby y.UnitCode
|
||||||
select new
|
select new { x.UnitId, y.UnitName };
|
||||||
|
|
||||||
|
foreach (var item in units)
|
||||||
{
|
{
|
||||||
UnitName=BLL.UnitService.GetUnitNameByUnitId(g.Key.UnitId),
|
|
||||||
Count = g.Key.UnitId.Count(),
|
var query = from c in db.Solution_CQMSConstructSolution
|
||||||
|
|
||||||
|
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||||||
|
|
||||||
|
from u in unitJoin.DefaultIfEmpty()
|
||||||
|
|
||||||
|
where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
|
||||||
|
select new
|
||||||
|
|
||||||
|
{
|
||||||
|
c.ConstructSolutionId,
|
||||||
|
c.ProjectId,
|
||||||
|
u.UnitId,
|
||||||
|
u.UnitName,
|
||||||
|
c.State,
|
||||||
|
c.CompileDate
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var total = from x in db.Solution_CQMSConstructSolution
|
var AllList = query.ToList();
|
||||||
where x.CompileDate >= projectStartDate && x.CompileDate <= DateTime.Now && unitList.Contains(x.UnitId) && x.ProjectId == this.CurrUser.LoginProjectId
|
var unitNCRStatic = query
|
||||||
group x by new { x.UnitId, ProjectId = x.ProjectId == project.ProjectId }
|
.Where(x => (x.CompileDate >= Convert.ToDateTime(startDate) && x.CompileDate <= Convert.ToDateTime(endDate)));
|
||||||
into g
|
Model.CQMSConstructSolutionStatisc NCRStatisc = new Model.CQMSConstructSolutionStatisc();
|
||||||
select new
|
NCRStatisc.Num = i;
|
||||||
{
|
NCRStatisc.UnitName = item.UnitName;
|
||||||
UnitName = BLL.UnitService.GetUnitNameByUnitId(g.Key.UnitId),
|
NCRStatisc.CheckNum = unitNCRStatic.Count(x => x.State == "3");
|
||||||
Count = g.Key.UnitId.Count(),
|
NCRStatisc.AllNum = AllList.Count();
|
||||||
};
|
|
||||||
var result = q.ToList().Select((item, index) => new
|
|
||||||
{
|
|
||||||
Index = index + 1,
|
|
||||||
item.UnitName,
|
|
||||||
item.Count,
|
|
||||||
AllCount= (int)total.ToList().Where(x => x.UnitName == item.UnitName).Select(x=>x.Count).FirstOrDefault()
|
|
||||||
|
|
||||||
});
|
StatisticsList.Add(NCRStatisc);
|
||||||
if (result.Count()>0) //增加总计
|
i++;
|
||||||
{
|
|
||||||
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,
|
|
||||||
AllCount= totalAllCount
|
|
||||||
}
|
}
|
||||||
});
|
if (StatisticsList.Count() > 0) //增加总计
|
||||||
|
{
|
||||||
|
Model.CQMSConstructSolutionStatisc StatisticsLast = new Model.CQMSConstructSolutionStatisc();
|
||||||
|
StatisticsLast.Num = StatisticsList.Count() + 1;
|
||||||
|
StatisticsLast.UnitName = "合计";
|
||||||
|
foreach (Model.CQMSConstructSolutionStatisc item in StatisticsList)
|
||||||
|
{
|
||||||
|
StatisticsLast.CheckNum += item.CheckNum;
|
||||||
|
StatisticsLast.AllNum += item.AllNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.gvConstructionStatistics.DataSource = result;
|
StatisticsList.Add(StatisticsLast);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Model.CQMSConstructSolutionStatisc StatisticsLast = new Model.CQMSConstructSolutionStatisc();
|
||||||
|
StatisticsLast.Num = 0;
|
||||||
|
StatisticsLast.UnitName = "合计";
|
||||||
|
StatisticsLast.CheckNum = 0;
|
||||||
|
StatisticsLast.AllNum = 0;
|
||||||
|
StatisticsList.Add(StatisticsLast);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//var q = from x in db.Solution_CQMSConstructSolution
|
||||||
|
// join y in units on x.UnitId equals y.UnitId
|
||||||
|
// 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
|
||||||
|
// {
|
||||||
|
// UnitName=BLL.UnitService.GetUnitNameByUnitId(g.Key.UnitId),
|
||||||
|
// Count = g.Key.UnitId.Count(),
|
||||||
|
// };
|
||||||
|
|
||||||
|
//var total = from x in db.Solution_CQMSConstructSolution
|
||||||
|
// join y in units on x.UnitId equals y.UnitId
|
||||||
|
// 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 total = from x in units
|
||||||
|
// join y in db.Solution_CQMSConstructSolution on x.UnitId equals y.UnitId into unitJoin
|
||||||
|
// from u in unitJoin.DefaultIfEmpty()
|
||||||
|
// where u.ProjectId == this.CurrUser.LoginProjectId
|
||||||
|
// select new
|
||||||
|
// {
|
||||||
|
// UnitName= x.UnitName,
|
||||||
|
// u.ConstructSolutionId,
|
||||||
|
// u.CompileDate
|
||||||
|
|
||||||
|
// };
|
||||||
|
//var result = total.ToList().Select((item, index) => new
|
||||||
|
//{
|
||||||
|
// Index = index + 1,
|
||||||
|
// item.UnitName,
|
||||||
|
// Count = (int)total.ToList().Where(x => x.UnitName == item.UnitName && x.CompileDate >= Convert.ToDateTime(startDate) && x.CompileDate <= Convert.ToDateTime(endDate)).Count(),
|
||||||
|
// AllCount = (int)total.ToList().Where(x => x.UnitName == item.UnitName).Count()
|
||||||
|
|
||||||
|
//});
|
||||||
|
//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,
|
||||||
|
// AllCount= totalAllCount
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//}
|
||||||
|
|
||||||
|
this.gvConstructionStatistics.DataSource = StatisticsList;
|
||||||
this.gvConstructionStatistics.DataBind();
|
this.gvConstructionStatistics.DataBind();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -893,21 +893,42 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||||
{
|
{
|
||||||
projectStartDate = project.StartDate.Value;
|
projectStartDate = project.StartDate.Value;
|
||||||
}
|
}
|
||||||
//所有集合
|
var units = from x in Funs.DB.Project_ProjectUnit
|
||||||
List<Model.Comprehensive_NCRManagement> totalManagementList = BLL.NCRManagementService.GetNCRManagementListByDate(this.CurrUser.LoginProjectId, startDate, endDate);
|
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
|
||||||
List<string> unitNames = (from x in totalManagementList select x.ReceiveUnit).Distinct().ToList();
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitType == BLL.Const.ProjectUnitType_2
|
||||||
foreach (var item in unitNames)
|
orderby y.UnitCode
|
||||||
|
select new { x.UnitId, y.UnitName };
|
||||||
|
var db = Funs.DB;
|
||||||
|
foreach (var item in units)
|
||||||
{
|
{
|
||||||
//当期集合
|
|
||||||
List<Model.Comprehensive_NCRManagement> managementList = BLL.NCRManagementService.GetNCRManagementListByUnitNameAndDate(this.CurrUser.LoginProjectId, item, startDate, endDate);
|
var query = from c in db.Comprehensive_NCRManagement
|
||||||
//累计集合
|
|
||||||
List<Model.Comprehensive_NCRManagement> sumManagementList = BLL.NCRManagementService.GetNCRManagementListByUnitNameAndDate(this.CurrUser.LoginProjectId, item, projectStartDate, DateTime.Now);
|
join u in db.Base_Unit on c.ReceiveUnit equals u.UnitId into unitJoin
|
||||||
|
|
||||||
|
from u in unitJoin.DefaultIfEmpty()
|
||||||
|
where c.ProjectId == this.CurrUser.LoginProjectId && c.ReceiveUnit == item.UnitId
|
||||||
|
select new
|
||||||
|
|
||||||
|
{
|
||||||
|
c.NCRManagementId,
|
||||||
|
c.ProjectId,
|
||||||
|
u.UnitId,
|
||||||
|
u.UnitName,
|
||||||
|
c.IssuedDate,
|
||||||
|
c.Status
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var AllList = query.ToList();
|
||||||
|
var unitNCRStatic = query
|
||||||
|
.Where(x => (x.IssuedDate >= Convert.ToDateTime(startDate) && x.IssuedDate <= Convert.ToDateTime(endDate)));
|
||||||
Model.NCRReportStatisc NCRStatisc = new Model.NCRReportStatisc();
|
Model.NCRReportStatisc NCRStatisc = new Model.NCRReportStatisc();
|
||||||
NCRStatisc.Num = i;
|
NCRStatisc.Num = i;
|
||||||
NCRStatisc.WorkName = BLL.UnitService.getUnitNamesUnitIds(item);
|
NCRStatisc.WorkName = item.UnitName;
|
||||||
NCRStatisc.CurrentPeriodOkNum = managementList.Count(x => x.Status == "3");
|
NCRStatisc.CurrentPeriodOkNum = unitNCRStatic.Count(x => x.Status == "3");
|
||||||
NCRStatisc.OKNum = sumManagementList.Count(x => x.Status == "3");
|
NCRStatisc.OKNum = AllList.Count(x => x.Status == "3");
|
||||||
NCRStatisc.CheckNum = sumManagementList.Count;
|
NCRStatisc.CheckNum = AllList.Count();
|
||||||
if (NCRStatisc.CheckNum != 0)//被除数不能为零
|
if (NCRStatisc.CheckNum != 0)//被除数不能为零
|
||||||
{
|
{
|
||||||
NCRStatisc.OKRate = Math.Round((double)NCRStatisc.OKNum / (double)NCRStatisc.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
NCRStatisc.OKRate = Math.Round((double)NCRStatisc.OKNum / (double)NCRStatisc.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||||||
|
@ -1177,6 +1198,7 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||||||
DateTime projectStartDate = Convert.ToDateTime("2015-01-01");
|
DateTime projectStartDate = Convert.ToDateTime("2015-01-01");
|
||||||
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||||||
|
List<Model.CQMSConstructSolutionStatisc> StatisticsList = new List<Model.CQMSConstructSolutionStatisc>();
|
||||||
var unitList = UnitService.GetUnitListByProjectId(this.CurrUser.LoginProjectId).Select(x => x.UnitId).ToList();
|
var unitList = UnitService.GetUnitListByProjectId(this.CurrUser.LoginProjectId).Select(x => x.UnitId).ToList();
|
||||||
if (project != null)
|
if (project != null)
|
||||||
{
|
{
|
||||||
|
@ -1186,50 +1208,128 @@ namespace FineUIPro.Web.CQMS.ManageReport
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int i = 1;
|
int i = 1;
|
||||||
var q = from x in db.Solution_CQMSConstructSolution
|
var units = from x in Funs.DB.Project_ProjectUnit
|
||||||
where x.CompileDate >= Convert.ToDateTime(startDate) && x.CompileDate <= Convert.ToDateTime(endDate) && unitList.Contains(x.UnitId) && x.ProjectId == this.CurrUser.LoginProjectId
|
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
|
||||||
group x by new { x.UnitId, State = x.State == "3", ProjectId = x.ProjectId == project.ProjectId }
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitType == BLL.Const.ProjectUnitType_2
|
||||||
into g
|
orderby y.UnitCode
|
||||||
select new
|
select new { x.UnitId, y.UnitName };
|
||||||
|
|
||||||
|
foreach (var item in units)
|
||||||
{
|
{
|
||||||
UnitName = BLL.UnitService.GetUnitNameByUnitId(g.Key.UnitId),
|
|
||||||
Count = g.Key.UnitId.Count(),
|
var query = from c in db.Solution_CQMSConstructSolution
|
||||||
|
|
||||||
|
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||||||
|
|
||||||
|
from u in unitJoin.DefaultIfEmpty()
|
||||||
|
|
||||||
|
where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
|
||||||
|
select new
|
||||||
|
|
||||||
|
{
|
||||||
|
c.ConstructSolutionId,
|
||||||
|
c.ProjectId,
|
||||||
|
u.UnitId,
|
||||||
|
u.UnitName,
|
||||||
|
c.State,
|
||||||
|
c.CompileDate
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var total = from x in db.Solution_CQMSConstructSolution
|
var AllList = query.ToList();
|
||||||
where x.CompileDate >= projectStartDate && x.CompileDate <= DateTime.Now && unitList.Contains(x.UnitId) && x.ProjectId == this.CurrUser.LoginProjectId
|
var unitNCRStatic = query
|
||||||
group x by new { x.UnitId, ProjectId = x.ProjectId == project.ProjectId }
|
.Where(x => (x.CompileDate >= Convert.ToDateTime(startDate) && x.CompileDate <= Convert.ToDateTime(endDate)));
|
||||||
into g
|
Model.CQMSConstructSolutionStatisc NCRStatisc = new Model.CQMSConstructSolutionStatisc();
|
||||||
select new
|
NCRStatisc.Num = i;
|
||||||
{
|
NCRStatisc.UnitName = item.UnitName;
|
||||||
UnitName = BLL.UnitService.GetUnitNameByUnitId(g.Key.UnitId),
|
NCRStatisc.CheckNum = unitNCRStatic.Count(x => x.State == "3");
|
||||||
Count = g.Key.UnitId.Count(),
|
NCRStatisc.AllNum = AllList.Count();
|
||||||
};
|
|
||||||
var result = q.ToList().Select((item, index) => new
|
|
||||||
{
|
|
||||||
Index = index + 1,
|
|
||||||
item.UnitName,
|
|
||||||
item.Count,
|
|
||||||
AllCount = (int)total.ToList().Where(x => x.UnitName == item.UnitName).Select(x => x.Count).FirstOrDefault()
|
|
||||||
|
|
||||||
});
|
StatisticsList.Add(NCRStatisc);
|
||||||
if (result.Count() > 0) //增加总计
|
i++;
|
||||||
{
|
|
||||||
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,
|
|
||||||
AllCount= totalAllCount
|
|
||||||
}
|
}
|
||||||
});
|
if (StatisticsList.Count() > 0) //增加总计
|
||||||
|
{
|
||||||
|
Model.CQMSConstructSolutionStatisc StatisticsLast = new Model.CQMSConstructSolutionStatisc();
|
||||||
|
StatisticsLast.Num = StatisticsList.Count() + 1;
|
||||||
|
StatisticsLast.UnitName = "合计";
|
||||||
|
foreach (Model.CQMSConstructSolutionStatisc item in StatisticsList)
|
||||||
|
{
|
||||||
|
StatisticsLast.CheckNum += item.CheckNum;
|
||||||
|
StatisticsLast.AllNum += item.AllNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.gvConstructionStatistics.DataSource = result;
|
StatisticsList.Add(StatisticsLast);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Model.CQMSConstructSolutionStatisc StatisticsLast = new Model.CQMSConstructSolutionStatisc();
|
||||||
|
StatisticsLast.Num = 0;
|
||||||
|
StatisticsLast.UnitName = "合计";
|
||||||
|
StatisticsLast.CheckNum = 0;
|
||||||
|
StatisticsLast.AllNum = 0;
|
||||||
|
StatisticsList.Add(StatisticsLast);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//var q = from x in db.Solution_CQMSConstructSolution
|
||||||
|
// join y in units on x.UnitId equals y.UnitId
|
||||||
|
// 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
|
||||||
|
// {
|
||||||
|
// UnitName=BLL.UnitService.GetUnitNameByUnitId(g.Key.UnitId),
|
||||||
|
// Count = g.Key.UnitId.Count(),
|
||||||
|
// };
|
||||||
|
|
||||||
|
//var total = from x in db.Solution_CQMSConstructSolution
|
||||||
|
// join y in units on x.UnitId equals y.UnitId
|
||||||
|
// 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 total = from x in units
|
||||||
|
// join y in db.Solution_CQMSConstructSolution on x.UnitId equals y.UnitId into unitJoin
|
||||||
|
// from u in unitJoin.DefaultIfEmpty()
|
||||||
|
// where u.ProjectId == this.CurrUser.LoginProjectId
|
||||||
|
// select new
|
||||||
|
// {
|
||||||
|
// UnitName= x.UnitName,
|
||||||
|
// u.ConstructSolutionId,
|
||||||
|
// u.CompileDate
|
||||||
|
|
||||||
|
// };
|
||||||
|
//var result = total.ToList().Select((item, index) => new
|
||||||
|
//{
|
||||||
|
// Index = index + 1,
|
||||||
|
// item.UnitName,
|
||||||
|
// Count = (int)total.ToList().Where(x => x.UnitName == item.UnitName && x.CompileDate >= Convert.ToDateTime(startDate) && x.CompileDate <= Convert.ToDateTime(endDate)).Count(),
|
||||||
|
// AllCount = (int)total.ToList().Where(x => x.UnitName == item.UnitName).Count()
|
||||||
|
|
||||||
|
//});
|
||||||
|
//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,
|
||||||
|
// AllCount= totalAllCount
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//}
|
||||||
|
|
||||||
|
this.gvConstructionStatistics.DataSource = StatisticsList;
|
||||||
this.gvConstructionStatistics.DataBind();
|
this.gvConstructionStatistics.DataBind();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15092,12 +15092,14 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="TestRun\BeforeTestRun\TailTermHandle.aspx.cs">
|
<Compile Include="TestRun\BeforeTestRun\TailTermHandle.aspx.cs">
|
||||||
<DependentUpon>TailTermHandle.aspx</DependentUpon>
|
<DependentUpon>TailTermHandle.aspx</DependentUpon>
|
||||||
|
<SubType>ASPXCodeBehind</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="TestRun\BeforeTestRun\TailTermHandle.aspx.designer.cs">
|
<Compile Include="TestRun\BeforeTestRun\TailTermHandle.aspx.designer.cs">
|
||||||
<DependentUpon>TailTermHandle.aspx</DependentUpon>
|
<DependentUpon>TailTermHandle.aspx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="TestRun\BeforeTestRun\TailTermHandleList.aspx.cs">
|
<Compile Include="TestRun\BeforeTestRun\TailTermHandleList.aspx.cs">
|
||||||
<DependentUpon>TailTermHandleList.aspx</DependentUpon>
|
<DependentUpon>TailTermHandleList.aspx</DependentUpon>
|
||||||
|
<SubType>ASPXCodeBehind</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="TestRun\BeforeTestRun\TailTermHandleList.aspx.designer.cs">
|
<Compile Include="TestRun\BeforeTestRun\TailTermHandleList.aspx.designer.cs">
|
||||||
<DependentUpon>TailTermHandleList.aspx</DependentUpon>
|
<DependentUpon>TailTermHandleList.aspx</DependentUpon>
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
namespace Model
|
||||||
|
{
|
||||||
|
public class CQMSConstructSolutionStatisc
|
||||||
|
{
|
||||||
|
private int num;
|
||||||
|
/// <summary>
|
||||||
|
/// 序号
|
||||||
|
/// </summary>
|
||||||
|
public int Num
|
||||||
|
{
|
||||||
|
get { return num; }
|
||||||
|
set { num = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string unitName;
|
||||||
|
/// <summary>
|
||||||
|
/// 接收单位
|
||||||
|
/// </summary>
|
||||||
|
public string UnitName
|
||||||
|
{
|
||||||
|
get { return unitName; }
|
||||||
|
set { unitName = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private int checkNum;
|
||||||
|
/// <summary>
|
||||||
|
/// 审批完成数
|
||||||
|
/// </summary>
|
||||||
|
public int CheckNum
|
||||||
|
{
|
||||||
|
get { return checkNum; }
|
||||||
|
set { checkNum = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private int allNum;
|
||||||
|
/// <summary>
|
||||||
|
/// 已完成
|
||||||
|
/// </summary>
|
||||||
|
public int AllNum
|
||||||
|
{
|
||||||
|
get { return allNum; }
|
||||||
|
set { allNum = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -170,6 +170,7 @@
|
||||||
<Compile Include="CostControlDetailItem.cs" />
|
<Compile Include="CostControlDetailItem.cs" />
|
||||||
<Compile Include="CQMS\CheckItem.cs" />
|
<Compile Include="CQMS\CheckItem.cs" />
|
||||||
<Compile Include="CQMS\CheckStatisc.cs" />
|
<Compile Include="CQMS\CheckStatisc.cs" />
|
||||||
|
<Compile Include="CQMS\CQMSConstructSolutionStatisc.cs" />
|
||||||
<Compile Include="CQMS\FileCabinetItem.cs" />
|
<Compile Include="CQMS\FileCabinetItem.cs" />
|
||||||
<Compile Include="CQMS\InspectionManagementStatistics.cs" />
|
<Compile Include="CQMS\InspectionManagementStatistics.cs" />
|
||||||
<Compile Include="CQMS\NCRReportStatisc.cs" />
|
<Compile Include="CQMS\NCRReportStatisc.cs" />
|
||||||
|
|
Loading…
Reference in New Issue