关键事项、周进度、月度计划

This commit is contained in:
2025-03-24 14:21:16 +08:00
parent 4ee7d38c78
commit 477afee030
58 changed files with 4929 additions and 1732 deletions
@@ -49,35 +49,37 @@ namespace FineUIPro.Web.JDGL.Check
StatisticsList = new List<Model.JDGL_MonthPlan>();
int i = 1;
Model.SGGLDB db = Funs.DB;
//周期集合
List<JDGL_MonthPlan> totalList = new List<JDGL_MonthPlan>();
//累计集合
List<JDGL_MonthPlan> sumTotalList = new List<JDGL_MonthPlan>();
if (cycle == "1")
{//按月
DateTime months = Convert.ToDateTime(this.txtMonths.Text + "-01");
//所有集合
//周期集合
totalList = (from x in db.JDGL_MonthPlan where x.ProjectId == this.CurrUser.LoginProjectId && x.Months == months select x).ToList();
//所有集合
//累计集合
sumTotalList = (from x in db.JDGL_MonthPlan where x.ProjectId == this.CurrUser.LoginProjectId && x.Months <= months select x).ToList();
}
else if (cycle == "2")
{//按年(以上一年度12月份至本年度11月份为一个周期)
DateTime sDate = Convert.ToDateTime(this.txtYear.Text + "-12-01").AddYears(-1);
DateTime eDate = Convert.ToDateTime(this.txtYear.Text + "-12-01");
//所有集合
//周期集合
totalList = (from x in db.JDGL_MonthPlan where x.ProjectId == this.CurrUser.LoginProjectId && x.Months >= sDate && x.Months < eDate select x).ToList();
//所有集合
//累计集合
sumTotalList = (from x in db.JDGL_MonthPlan where x.ProjectId == this.CurrUser.LoginProjectId && x.Months < eDate select x).ToList();
}
else
else if (cycle == "3")
{//按项目周期
//所有集合
//周期集合
totalList = (from x in db.JDGL_MonthPlan where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
//所有集合
//累计集合
sumTotalList = (from x in db.JDGL_MonthPlan where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
}
////所有集合
////周期集合
//var totalList = from x in db.JDGL_MonthPlan where x.ProjectId == this.CurrUser.LoginProjectId && x.Months == months select x;
////所有集合
////累计集合
//var sumTotalList = from x in db.JDGL_MonthPlan where x.ProjectId == this.CurrUser.LoginProjectId && x.Months <= months select x;
if (this.ckType.SelectedValue == "1") //按责任单位
@@ -89,7 +91,7 @@ namespace FineUIPro.Web.JDGL.Check
select y;
foreach (var item in pUnit)
{
//期集合
//期集合
var list = totalList.Where(x => x.UnitId == item.UnitId);
Model.JDGL_MonthPlan JDGL_MonthPlan = new Model.JDGL_MonthPlan();
JDGL_MonthPlan.NodeContent = item.UnitName;
@@ -111,17 +113,25 @@ namespace FineUIPro.Web.JDGL.Check
}
else //按五环责任人
{
var user = (from x in db.Sys_User
join y in db.JDGL_MonthPlan on x.UserId equals y.DutyPerson
where y.ProjectId == this.CurrUser.LoginProjectId
orderby x.UserId
select x).Distinct().ToList();
foreach (var item in user)
var users = UserService.GetUserList();
var dutyPersonIds = (from x in db.JDGL_MonthPlan
where x.ProjectId == this.CurrUser.LoginProjectId
select x.DutyPerson).Distinct().ToList();
var userIds = string.Join(",", dutyPersonIds.ToArray()).Split(',').Distinct().Where(x => x != null && x != "").ToList();
//var user = (from x in db.Sys_User
// join y in db.JDGL_MonthPlan on x.UserId equals y.DutyPerson
// where y.ProjectId == this.CurrUser.LoginProjectId
// orderby x.UserId
// select x).Distinct().ToList();
foreach (var item in userIds)
{
//所有集合
var list = totalList.Where(x => x.DutyPerson == item.UserId);
var user = users.Where(x => x.UserId == item).FirstOrDefault();
//周期集合
var list = totalList.Where(x => x.DutyPerson.Contains(item));
Model.JDGL_MonthPlan JDGL_MonthPlan = new Model.JDGL_MonthPlan();
JDGL_MonthPlan.NodeContent = item.UserName;
JDGL_MonthPlan.NodeContent = user.UserName;
int a = list.Count();
int b = list.Count(x => x.RealDate.HasValue);
JDGL_MonthPlan.UnitId = a.ToString();
@@ -156,22 +166,22 @@ namespace FineUIPro.Web.JDGL.Check
}
StatisticsList.Add(StatisticsLast);
}
//增加累计
Model.JDGL_MonthPlan StatisticsSum = new Model.JDGL_MonthPlan();
StatisticsSum.NodeContent = "累计";
int c = sumTotalList.Count();
int d = sumTotalList.Count(x => x.RealDate.HasValue);
StatisticsSum.UnitId = c.ToString();
StatisticsSum.DutyPerson = d.ToString();
if (c != 0)//被除数不能为零
{
StatisticsSum.Remark = Math.Round((double)d / (double)c * 100, 2) + "%";//保留两位小数、后四舍五入
}
else
{
StatisticsSum.Remark = "0%";
}
StatisticsList.Add(StatisticsSum);
////增加累计
//Model.JDGL_MonthPlan StatisticsSum = new Model.JDGL_MonthPlan();
//StatisticsSum.NodeContent = "累计";
//int c = sumTotalList.Count();
//int d = sumTotalList.Count(x => x.RealDate.HasValue);
//StatisticsSum.UnitId = c.ToString();
//StatisticsSum.DutyPerson = d.ToString();
//if (c != 0)//被除数不能为零
//{
// StatisticsSum.Remark = Math.Round((double)d / (double)c * 100, 2) + "%";//保留两位小数、后四舍五入
//}
//else
//{
// StatisticsSum.Remark = "0%";
//}
//StatisticsList.Add(StatisticsSum);
this.Grid1.DataSource = StatisticsList;
this.Grid1.DataBind();
}