Merge branch 'master' of http://121.41.2.71:3000/wyw/mh_jy_safe
This commit is contained in:
commit
9f65215457
@ -949,9 +949,6 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
overFinishCount = group.Where(i => i.IS_OVERTIME == 1 && i.IS_PUBLISH == 5).Count()
|
||||
}).ToList();
|
||||
foreach (var item in results)
|
||||
{
|
||||
var departInfo = departments.FirstOrDefault(t => t.ID == item.departmetId);
|
||||
if (departInfo != null)
|
||||
{
|
||||
T_FM_WORK_TICKET_COMPLETION completion = new T_FM_WORK_TICKET_COMPLETION();
|
||||
completion.MONTH = i;
|
||||
@ -964,6 +961,9 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
completion.ORG_ID = filter.GetOrgId();
|
||||
completion.START_TIME = i;
|
||||
completion.END_TIME = monthEnd;
|
||||
var departInfo = departments.FirstOrDefault(t => t.ID == item.departmetId);
|
||||
if (departInfo != null)
|
||||
{
|
||||
if (departInfo.DEPARTMENT_TYPE == 10|| departInfo.DEPARTMENT_TYPE == 5)
|
||||
{
|
||||
completion.DEPARTMENT_ID = item.departmetId;
|
||||
@ -985,8 +985,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
completion.TEAM_ID = item.departmetId;
|
||||
completion.TEAM_NAME = departInfo?.NAME;
|
||||
}
|
||||
completions.Add(completion);
|
||||
}
|
||||
completions.Add(completion);
|
||||
}
|
||||
}
|
||||
this.UnifiedCommit(() =>
|
||||
|
||||
@ -430,10 +430,10 @@ namespace APT.PP.WebApi.Controllers.Api
|
||||
var users = this.GetEntities<T_FM_USER>(t => t.ENABLE_STATUS == 0 && !t.CODE.Contains("admin"), new BaseFilter(filter.OrgId));
|
||||
filter.IgnoreDataRule = true;
|
||||
Expression<Func<T_SK_SECURITY_INSPECTION_NOTICE, bool>> expression = i => i.IS_DELETED == false && i.CHECK_TIME != null && i.CHECK_TIME.Value.Date == DateTime.Now.Date && i.CHECK_TIME.Value.Hour == DateTime.Now.Hour;
|
||||
List<T_SK_SECURITY_INSPECTION_NOTICE> notices = this.GetOrderEntities(expression, filter, new string[] { "Nav_CheckNoticeFiles", "Nav_CheckNoticeDetails.Nav_CheckNoticeDetailUsers", "Nav_CheckNoticeDetails.Nav_CheckNoticeDetailBasics" }).ToList();
|
||||
List<T_SK_SECURITY_INSPECTION_NOTICE> notices = this.GetEntities(expression, filter, new string[] { "Nav_CheckNoticeFiles", "Nav_CheckNoticeDetails.Nav_CheckNoticeDetailUsers", "Nav_CheckNoticeDetails.Nav_CheckNoticeDetailBasics" }).ToList();
|
||||
var noticeExsisIds = notices.Select(t => t.ID).ToList();
|
||||
Expression<Func<T_SK_SECURITY_INSPECTION_RECORD, bool>> expression2 = i => i.IS_DELETED == false && i.SECURITY_INSPECTION_NOTICE_ID != null && noticeExsisIds.Contains((Guid)i.SECURITY_INSPECTION_NOTICE_ID);
|
||||
List<T_SK_SECURITY_INSPECTION_RECORD> recordExsis = this.GetOrderEntities(expression2, filter).ToList();
|
||||
List<T_SK_SECURITY_INSPECTION_RECORD> recordExsis = this.GetEntities(expression2, filter).ToList();
|
||||
var recordExsisIds = recordExsis.Select(t => t.SECURITY_INSPECTION_NOTICE_ID).Distinct().ToList();
|
||||
notices = notices.Where(t => !recordExsisIds.Contains(t.ID)).ToList();
|
||||
if (notices != null && notices.Any())
|
||||
@ -605,11 +605,11 @@ namespace APT.PP.WebApi.Controllers.Api
|
||||
"Nav_CheckNoticeDetails.RISK_AREA_ID","Nav_CheckNoticeDetails.CHECK_CONTENTS_ID","Nav_CheckNoticeDetails.CHECKCONTENT","Nav_CheckNoticeDetails.CHECKPROOF","Nav_CheckNoticeDetails.CHECKSTANDARD",
|
||||
"Nav_CheckNoticeFiles.IMG_FILE_ID", "Nav_CheckNoticeDetails.Nav_CheckNoticeDetailUsers.USER_ID", "Nav_CheckNoticeDetails.Nav_CheckNoticeDetailBasics.LAW_ID" }; //指定字段,包括导航属性
|
||||
Expression<Func<T_SK_SECURITY_INSPECTION_NOTICE, bool>> expression = i => i.IS_DELETED == false && i.CHECK_TIME != null && i.CHECK_TIME.Value.Date == dtNow.Date && i.CHECK_TIME <= dtNow && (i.STATUS == PFStandardStatus.Archived || i.STATUS == PFStandardStatus.Sign);
|
||||
List<T_SK_SECURITY_INSPECTION_NOTICE> notices = this.GetOrderEntities(expression, baseFilter).ToList();
|
||||
List<T_SK_SECURITY_INSPECTION_NOTICE> notices = this.GetEntities(expression, baseFilter).ToList();
|
||||
var noticeExsisIds = notices.Select(t => t.ID).ToList();
|
||||
baseFilter.SelectField = new string[] { "ID", "SECURITY_INSPECTION_NOTICE_ID" }; //指定字段,包括导航属性
|
||||
Expression<Func<T_SK_SECURITY_INSPECTION_RECORD, bool>> expression2 = i => i.IS_DELETED == false && i.SECURITY_INSPECTION_NOTICE_ID != null && noticeExsisIds.Contains((Guid)i.SECURITY_INSPECTION_NOTICE_ID);
|
||||
List<T_SK_SECURITY_INSPECTION_RECORD> recordExsis = this.GetOrderEntities(expression2, baseFilter).ToList();
|
||||
List<T_SK_SECURITY_INSPECTION_RECORD> recordExsis = this.GetEntities(expression2, baseFilter).ToList();
|
||||
var recordExsisIds = recordExsis.Select(t => t.SECURITY_INSPECTION_NOTICE_ID).Distinct().ToList();
|
||||
notices = notices.Where(t => !recordExsisIds.Contains(t.ID)).ToList();
|
||||
//排班表
|
||||
@ -1241,7 +1241,7 @@ namespace APT.PP.WebApi.Controllers.Api
|
||||
var plan = this.GetEntity<T_SK_IDENTIFY_EVALUATION_PLAN>(t => t.STATUS == PFStandardStatus.Archived, "Nav_Details.Nav_DetailUsers");
|
||||
filter.IgnoreDataRule = true;
|
||||
Expression<Func<T_SK_RISK_IDENTIFY, bool>> expression = t => t.IDENTIFY_EVALUATION_PLAN_ID == plan.ID;
|
||||
List<T_SK_RISK_IDENTIFY> oldidentitys = this.GetOrderEntities(expression, filter).ToList();
|
||||
List<T_SK_RISK_IDENTIFY> oldidentitys = this.GetEntities(expression, filter).ToList();
|
||||
var applyUserIds = oldidentitys.Select(t => t.APPLY_USER_ID).Distinct().ToList();
|
||||
//var plans = this.GetEntities<T_SK_IDENTIFY_EVALUATION_PLAN>(t => t.ISSEND == false && t.START_DATE.Value.Date == dtNow.Date && t.STATUS == PFStandardStatus.Archived, new BaseFilter(filter.OrgId), "Nav_Details.Nav_DetailUsers");
|
||||
if (plan != null)
|
||||
@ -1417,7 +1417,7 @@ namespace APT.PP.WebApi.Controllers.Api
|
||||
List<T_SK_RISK_IDENTIFY_DETAIL_MEASURE> mesList = new List<T_SK_RISK_IDENTIFY_DETAIL_MEASURE>();
|
||||
filter.IgnoreDataRule = true;
|
||||
Expression<Func<T_SK_IDENTIFY_EVALUATION_PLAN, bool>> expression = t => t.IS_DELETED == false && t.ISSEND == false && t.START_DATE.Value.Date == dtNow.Date && t.STATUS == PFStandardStatus.Archived;
|
||||
List<T_SK_IDENTIFY_EVALUATION_PLAN> plans = this.GetOrderEntities(expression, filter, new string[] { "Nav_Details.Nav_DetailUsers", "Nav_Requires" }).ToList();
|
||||
List<T_SK_IDENTIFY_EVALUATION_PLAN> plans = this.GetEntities(expression, filter, new string[] { "Nav_Details.Nav_DetailUsers", "Nav_Requires" }).ToList();
|
||||
//var plans = this.GetEntities<T_SK_IDENTIFY_EVALUATION_PLAN>(t => t.ISSEND == false && t.START_DATE.Value.Date == dtNow.Date && t.STATUS == PFStandardStatus.Archived, new BaseFilter(filter.OrgId), "Nav_Details.Nav_DetailUsers");
|
||||
if (plans != null && plans.Any())
|
||||
{
|
||||
@ -1680,15 +1680,15 @@ namespace APT.PP.WebApi.Controllers.Api
|
||||
baseFilter.IgnoreDataRule = true;
|
||||
baseFilter.SelectField = new string[] { "ID", "START_DATE", "END_DATE" }; //指定字段,包括导航属性
|
||||
Expression<Func<T_SK_IDENTIFY_EVALUATION_PLAN, bool>> expression = i => i.END_DATE.Value.Date == dtNow.Date && i.STATUS == PFStandardStatus.Archived;
|
||||
List<T_SK_IDENTIFY_EVALUATION_PLAN> planTemps = this.GetOrderEntities(expression, baseFilter, "Nav_Requires").ToList();
|
||||
List<T_SK_IDENTIFY_EVALUATION_PLAN> planTemps = this.GetEntities(expression, baseFilter, "Nav_Requires").ToList();
|
||||
var planIds = planTemps.Select(t => t.ID).ToList();
|
||||
var newFilter = new BaseFilter(filter.GetOrgId());
|
||||
newFilter.IgnoreDataRule = true;
|
||||
baseFilter.SelectField = new string[] { "ID", "IDENTIFY_EVALUATION_PLAN_ID", "STATUS", "APPLY_DEPARTMENT_ID", "APPLY_USER_ID", "CONTENTS" }; //指定字段,包括导航属性
|
||||
Expression<Func<T_SK_RISK_IDENTIFY_RESULT, bool>> expressionTemp = i => planIds.Contains((Guid)i.IDENTIFY_EVALUATION_PLAN_ID);
|
||||
List<T_SK_RISK_IDENTIFY_RESULT> identityResults = this.GetOrderEntities(expressionTemp, newFilter).ToList();
|
||||
List<T_SK_RISK_IDENTIFY_RESULT> identityResults = this.GetEntities(expressionTemp, newFilter).ToList();
|
||||
Expression<Func<T_SK_RISK_IDENTIFY, bool>> newexpression = i => planIds.Contains((Guid)i.IDENTIFY_EVALUATION_PLAN_ID);
|
||||
List<T_SK_RISK_IDENTIFY> identityTemps = this.GetOrderEntities(newexpression, newFilter).ToList();
|
||||
List<T_SK_RISK_IDENTIFY> identityTemps = this.GetEntities(newexpression, newFilter).ToList();
|
||||
identitys = identityTemps.Where(t => t.STATUS != PFStandardStatus.Archived && t.STATUS != PFStandardStatus.Close).ToList();
|
||||
var identityPlanIds = identityTemps.Select(t => t.IDENTIFY_EVALUATION_PLAN_ID).Distinct().ToList();
|
||||
planIds = planIds.Where(t => identityPlanIds.Contains(t)).Distinct().ToList();
|
||||
@ -3451,7 +3451,7 @@ namespace APT.PP.WebApi.Controllers.Api
|
||||
baseFilter.IgnoreDataRule = true;
|
||||
baseFilter.SelectField = new string[] { "MineType", "CHECK_TYPE_ID", "APPLY_DEPARTMENT_ID", "APPLY_USER_ID", "PLANCHECKFREQUENCY", "DEPARTMENT_TYPE" }; //指定字段,包括导航属性
|
||||
//Expression<Func<T_SK_SECURITY_INSPECTION_NOTICE, bool>> expression = i => i.IS_DELETED == false && i.CREATE_TIME.Value.Date == dt.Date;
|
||||
//List<T_SK_SECURITY_INSPECTION_NOTICE> noticeExsiss = this.GetOrderEntities(expression, baseFilter).ToList();
|
||||
//List<T_SK_SECURITY_INSPECTION_NOTICE> noticeExsiss = this.GetEntities(expression, baseFilter).ToList();
|
||||
foreach (var item in setList)
|
||||
{
|
||||
List<Guid> userIds = new List<Guid>();
|
||||
@ -4646,7 +4646,7 @@ namespace APT.PP.WebApi.Controllers.Api
|
||||
}
|
||||
}
|
||||
//Expression<Func<T_SK_RISK_IDENTIFY, bool>> expression = i => i.IS_DELETED == false && i.APPLY_USER_ID !=null && userIds.Contains((Guid)i.APPLY_USER_ID) && i.APPLY_USER_ID != wfm.ID;
|
||||
//List<T_SK_RISK_IDENTIFY> riskIdetitys = this.GetOrderEntities(expression, baseFilter).ToList();
|
||||
//List<T_SK_RISK_IDENTIFY> riskIdetitys = this.GetEntities(expression, baseFilter).ToList();
|
||||
//var riskIdentityIds = riskIdetitys.Select(t => t.ID).ToList();
|
||||
//var identityDetails = GetEntities<T_SK_RISK_IDENTIFY_DETAIL>(i => riskIdentityIds.Contains(i.RISK_IDENTIFY_ID), new BaseFilter(filter.OrgId)).ToList();
|
||||
//var deleteIds = identityDetails.Select(t => t.ID).ToList();
|
||||
@ -4983,7 +4983,7 @@ namespace APT.PP.WebApi.Controllers.Api
|
||||
dt = DateTime.Parse(filter.Parameter1);
|
||||
}
|
||||
Expression<Func<T_SK_SECURITY_INSPECTION_NOTICE, bool>> expression = i => i.IS_DELETED == false && i.CREATE_TIME.Value.Date == dt.Date;
|
||||
List<T_SK_SECURITY_INSPECTION_NOTICE> noticeExsiss = this.GetOrderEntities(expression, baseFilter).ToList();
|
||||
List<T_SK_SECURITY_INSPECTION_NOTICE> noticeExsiss = this.GetEntities(expression, baseFilter).ToList();
|
||||
DateTime minTime = dt.AddMinutes(0);
|
||||
DateTime maxTime = dt.AddMinutes(60);
|
||||
var shiftClassList = this.GetEntities<T_FM_DEPARTMENT_SCHEDULING>(s => s.START_TIME > minTime && s.START_TIME <= maxTime && s.START_TIME != s.END_TIME && s.Nav_Team.ENABLE_STATUS == 0 && s.TEAM_ID != null, new BaseFilter(filter.OrgId), "Nav_DepartmentSchedulingDetail.Nav_Person").ToList();
|
||||
@ -5553,10 +5553,10 @@ namespace APT.PP.WebApi.Controllers.Api
|
||||
baseFilter.IgnoreDataRule = true;
|
||||
baseFilter.SelectField = new string[] { "PRODUCTION_UNIT_ID", "CHECK_TYPE_ID", "APPLY_DEPARTMENT_ID", "APPLY_USER_ID", "PLANCHECKFREQUENCY", "DEPARTMENT_TYPE", "CREATE_TIME" }; //指定字段,包括导航属性
|
||||
Expression<Func<T_SK_SECURITY_INSPECTION_NOTICE, bool>> expression = i => i.IS_DELETED == false && (i.CREATE_TIME.Value.Date == DateTime.Now.Date || i.CREATE_TIME.Value.Date == DateTime.Now.AddDays(-1).Date);
|
||||
List<T_SK_SECURITY_INSPECTION_NOTICE> noticeExsiss = this.GetOrderEntities(expression, baseFilter).ToList();
|
||||
List<T_SK_SECURITY_INSPECTION_NOTICE> noticeExsiss = this.GetEntities(expression, baseFilter).ToList();
|
||||
baseFilter.SelectField = new string[] { "PRODUCTION_UNIT_ID", "CHECK_TYPE_ID", "APPLY_DEPARTMENT_ID", "APPLY_USER_ID", "PLANCHECKFREQUENCY", "DEPARTMENT_TYPE", "CREATE_TIME" };
|
||||
Expression<Func<T_SK_SECURITY_INSPECTION_RECORD, bool>> expressionR = i => i.IS_DELETED == false && (i.CREATE_TIME.Value.Date == DateTime.Now.Date || i.CREATE_TIME.Value.Date == DateTime.Now.AddDays(-1).Date);
|
||||
List<T_SK_SECURITY_INSPECTION_RECORD> recordExsiss = this.GetOrderEntities(expressionR, baseFilter).ToList();
|
||||
List<T_SK_SECURITY_INSPECTION_RECORD> recordExsiss = this.GetEntities(expressionR, baseFilter).ToList();
|
||||
//取岗位排查表
|
||||
var postCheckList = list.Where(t => t.CheckTypeId != null && checkTypeIds.Contains((Guid)t.CheckTypeId)).ToList();
|
||||
if (postCheckList != null && postCheckList.Any())
|
||||
@ -6058,7 +6058,7 @@ namespace APT.PP.WebApi.Controllers.Api
|
||||
baseFilter.IgnoreDataRule = true;
|
||||
baseFilter.SelectField = new string[] { "PRODUCTION_UNIT_ID", "CHECK_TYPE_ID", "APPLY_DEPARTMENT_ID", "APPLY_USER_ID", "PLANCHECKFREQUENCY", "DEPARTMENT_TYPE", "CREATE_TIME" }; //指定字段,包括导航属性
|
||||
Expression<Func<T_SK_SECURITY_INSPECTION_NOTICE, bool>> expression = i => i.IS_DELETED == false && (i.CREATE_TIME.Value.Date == DateTime.Now.Date || i.CREATE_TIME.Value.Date == DateTime.Now.AddDays(-1).Date);
|
||||
List<T_SK_SECURITY_INSPECTION_NOTICE> noticeExsiss = this.GetOrderEntities(expression, baseFilter).ToList();
|
||||
List<T_SK_SECURITY_INSPECTION_NOTICE> noticeExsiss = this.GetEntities(expression, baseFilter).ToList();
|
||||
foreach (var set in checkSets)
|
||||
{
|
||||
var setUserIds = checkSetUsers.Where(t => t.CHECK_SET_ID == set.ID).Select(m => m.USER_ID).Distinct().ToList();
|
||||
@ -6612,10 +6612,10 @@ namespace APT.PP.WebApi.Controllers.Api
|
||||
baseFilter.IgnoreDataRule = true;
|
||||
baseFilter.SelectField = new string[] { "PRODUCTION_UNIT_ID", "CHECK_TYPE_ID", "APPLY_DEPARTMENT_ID", "APPLY_USER_ID", "PLANCHECKFREQUENCY", "DEPARTMENT_TYPE", "CREATE_TIME" }; //指定字段,包括导航属性
|
||||
Expression<Func<T_SK_SECURITY_INSPECTION_NOTICE, bool>> expression = i => i.IS_DELETED == false && (i.CREATE_TIME.Value.Date == dtNow.Date || i.CREATE_TIME.Value.Date == dtNow.AddDays(-1).Date);
|
||||
List<T_SK_SECURITY_INSPECTION_NOTICE> noticeExsiss = this.GetOrderEntities(expression, baseFilter).ToList();
|
||||
List<T_SK_SECURITY_INSPECTION_NOTICE> noticeExsiss = this.GetEntities(expression, baseFilter).ToList();
|
||||
baseFilter.SelectField = new string[] { "PRODUCTION_UNIT_ID", "CHECK_TYPE_ID", "APPLY_DEPARTMENT_ID", "APPLY_USER_ID", "PLANCHECKFREQUENCY", "DEPARTMENT_TYPE", "CREATE_TIME" };
|
||||
Expression<Func<T_SK_SECURITY_INSPECTION_RECORD, bool>> expressionR = i => i.IS_DELETED == false && (i.CREATE_TIME.Value.Date == dtNow.Date || i.CREATE_TIME.Value.Date == dtNow.AddDays(-1).Date);
|
||||
List<T_SK_SECURITY_INSPECTION_RECORD> recordExsiss = this.GetOrderEntities(expressionR, baseFilter).ToList();
|
||||
List<T_SK_SECURITY_INSPECTION_RECORD> recordExsiss = this.GetEntities(expressionR, baseFilter).ToList();
|
||||
//查有没有休假代理人
|
||||
var userVacations = this.GetEntities<T_FM_USER_VACATION_SET>(t => t.START_DATE <= dtNow && t.END_DATE >= dtNow, new BaseFilter(filter.GetOrgId()), "Nav_Agent");
|
||||
//检查清单
|
||||
|
||||
@ -7,11 +7,14 @@ using APT.Infrastructure.Api.Redis;
|
||||
using APT.Infrastructure.Core;
|
||||
using APT.MS.Domain.Entities.BI;
|
||||
using APT.MS.Domain.Entities.HM;
|
||||
using APT.MS.Domain.Entities.SC.BI;
|
||||
using APT.MS.Domain.Entities.SK;
|
||||
using APT.MS.Domain.Enums.SK;
|
||||
using APT.SC.WebApi.Controllers.Api.BIController;
|
||||
using APT.Utility;
|
||||
using log4net.Core;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Org.BouncyCastle.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -546,8 +549,8 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("GetHomeInfo")]
|
||||
public JsonActionResult<HomeResult> GetHomeInfo([FromBody] KeywordFilter filter)
|
||||
[HttpPost, Route("GetHomeInfoOld")]
|
||||
public JsonActionResult<HomeResult> GetHomeInfoOld([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return SafeExecute(() =>
|
||||
{
|
||||
@ -1232,6 +1235,436 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("GetHomeInfo")]
|
||||
public JsonActionResult<HomeResult> GetHomeInfo([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return SafeExecute(() =>
|
||||
{
|
||||
//按生产单元 获取数据
|
||||
HomeResult result = new HomeResult();
|
||||
//if (string.IsNullOrEmpty(filter.Keyword))
|
||||
//{
|
||||
// return result;
|
||||
//}
|
||||
//int MineType = int.Parse(filter.Keyword);
|
||||
|
||||
|
||||
//根据 日期 yyyyMMddHH MineType 获取信息 Redis信息
|
||||
//如果是有效的直接返回 否则更新
|
||||
var orgId = APT.Infrastructure.Api.AppContext.CurrentSession.OrgId;
|
||||
var redisCode = string.Format(RedisCacheKey.HomeResult, orgId);
|
||||
DateTime dtNow = DateTime.Now;
|
||||
|
||||
|
||||
#region 判断 从Redis中获取数据 有就直接返回到前端 没有就按原来的进行搜索 最后再判断存入Redis中
|
||||
|
||||
bool isRedisConfig = true;
|
||||
var redisConfig = APT.Infrastructure.Api.ConfigurationManager.AppSettings["RedisFormConfig"];
|
||||
List<HomeResultMineType> listHomeRedis = null;
|
||||
if (!string.IsNullOrEmpty(redisConfig))
|
||||
isRedisConfig = bool.Parse(redisConfig);
|
||||
|
||||
if (isRedisConfig && CsRedisManager.KeyExists(redisCode))
|
||||
listHomeRedis = CsRedisManager.StringGet<List<HomeResultMineType>>(redisCode);
|
||||
|
||||
if (listHomeRedis != null && listHomeRedis.Count() > 0)
|
||||
{
|
||||
foreach (var item in listHomeRedis)
|
||||
{
|
||||
//if (item.MineType == MineType)
|
||||
{
|
||||
if (dtNow.ToString("yyyyMMddHH") == item.yyyyMMddHH)
|
||||
{
|
||||
result = item.result;
|
||||
}
|
||||
else
|
||||
{
|
||||
listHomeRedis.Remove(item);//Key不匹配 过期数据删除
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//redis获取到了数据
|
||||
//if (result != null && (result.ListC != null || result.ListCYear != null || result.ListSafeCheckYearMonth != null))
|
||||
//{
|
||||
// return result;
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Collection was modified, enumeration operation may not execute(foreach) 不要 SelectField 看看结果 如果继续报错 返回来
|
||||
//TODO wyw SelectField
|
||||
|
||||
//BaseFilter filterD = new BaseFilter();
|
||||
//filterD.SelectField = new List<string> { "ID", "NAME", "DEPARTMENT_TYPE", "PARENT_ID", "MineType" };
|
||||
//var listDep1MineType = GetEntities<T_FM_DEPARTMENT>(t => t.MineType.HasValue && t.MineType == MineType && t.DEPARTMENT_TYPE == 10, filterD, null);//部门就可以了 因为都相向 统计了
|
||||
|
||||
var listDep1MineType = GetEntities<T_FM_DEPARTMENT>(t => t.ENABLE_STATUS == 0, null, null);//部门就可以了 因为都相向 统计了
|
||||
|
||||
#endregion
|
||||
|
||||
if (listDep1MineType == null || !listDep1MineType.Any())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
List<T_FM_DEPARTMENT> listDep = new List<T_FM_DEPARTMENT>();
|
||||
listDep = listDep1MineType.ToList();
|
||||
|
||||
|
||||
#region //月度 隐患整改情况
|
||||
string Val = string.Empty;// 0 ,1,2,3
|
||||
//string NameMonth = dtNow.AddMonths(-5).Month.ToString() + "月," + dtNow.AddMonths(-4).Month.ToString() + "月," + dtNow.AddMonths(-3).Month.ToString() + "月," + dtNow.AddMonths(-2).Month.ToString() + "月," + dtNow.AddMonths(-1).Month.ToString() + "月," + dtNow.Month.ToString() + "月";
|
||||
string NameMonth = dtNow.AddMonths(-5).ToString("yyyy-MM") + "," + dtNow.AddMonths(-4).ToString("yyyy-MM") + "," + dtNow.AddMonths(-3).ToString("yyyy-MM") + "," + dtNow.AddMonths(-2).ToString("yyyy-MM") + "," + dtNow.AddMonths(-1).ToString("yyyy-MM") + "," + dtNow.ToString("yyyy-MM");
|
||||
List<HomeCorrect> listC = new List<HomeCorrect>();
|
||||
//HomeCorrect modelC = null;
|
||||
bool isNormal = true;//数据是否正常
|
||||
var newFilter = new BaseFilter(orgId);
|
||||
newFilter.IgnoreDataRule = true;
|
||||
var hiddens = GetEntities<T_SK_HIDDEN_DANGER_RECTIFY_RECORD>(e => e.APPLY_DEPARTMENT_ID.HasValue && e.CREATE_TIME.HasValue && e.CREATE_TIME.Value.Year == dtNow.Year, newFilter);
|
||||
|
||||
var startTime = dtNow.AddMonths(-6);
|
||||
var currentTime = Convert.ToDateTime(startTime.Year + "-" + startTime.Month + "-01 00:00:00");
|
||||
//var groupDepart = hiddens.GroupBy(t => t.APPLY_DEPARTMENT_ID);
|
||||
//if (groupDepart.Any())
|
||||
{
|
||||
//foreach (var item in groupDepart)
|
||||
{
|
||||
for (DateTime i = currentTime; i <= dtNow; i = i.AddMonths(1))
|
||||
{
|
||||
var monthStart = Convert.ToDateTime(i.Year + "-" + i.Month + "-01 00:00:00");
|
||||
var monthEnd = Convert.ToDateTime(monthStart.AddMonths(1).AddDays(-1).ToString().Replace("0:00:00", "23:59:59"));
|
||||
if (i.Date <= startTime.Date)
|
||||
{
|
||||
monthStart = startTime;
|
||||
}
|
||||
if (i.Date >= dtNow.Date)
|
||||
{
|
||||
monthEnd = dtNow;
|
||||
}
|
||||
var alls = hiddens.Where(t => t.CREATE_TIME >= monthStart && t.CREATE_TIME <= monthEnd);
|
||||
var onTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE <= t.RECITIFY_TIME);
|
||||
if (onTimes.Any())
|
||||
{
|
||||
HomeCorrect modelC = new HomeCorrect();
|
||||
modelC.Val = onTimes.Count().ToString();
|
||||
modelC.SOURCENAME = "按时整改隐患";
|
||||
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||
modelC.YEAR = monthStart.Year;
|
||||
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||
listC.Add(modelC);
|
||||
}
|
||||
else
|
||||
{
|
||||
HomeCorrect modelC = new HomeCorrect();
|
||||
modelC.Val = "0";
|
||||
modelC.SOURCENAME = "按时整改隐患";
|
||||
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||
modelC.YEAR = monthStart.Year;
|
||||
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||
listC.Add(modelC);
|
||||
}
|
||||
var overTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE > t.RECITIFY_TIME);
|
||||
if (overTimes.Any())
|
||||
{
|
||||
HomeCorrect modelC = new HomeCorrect();
|
||||
modelC.Val = overTimes.Count().ToString();
|
||||
modelC.SOURCENAME = "超期整改隐患";
|
||||
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||
modelC.YEAR = monthStart.Year;
|
||||
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||
listC.Add(modelC);
|
||||
}
|
||||
else
|
||||
{
|
||||
HomeCorrect modelC = new HomeCorrect();
|
||||
modelC.Val = "0";
|
||||
modelC.SOURCENAME = "超期整改隐患";
|
||||
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||
modelC.YEAR = monthStart.Year;
|
||||
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||
listC.Add(modelC);
|
||||
}
|
||||
var noTimes = alls.Where(t => t.STATUS != BaseData.Domain.Enums.PF.PFStandardStatus.Archived);
|
||||
if (noTimes.Any())
|
||||
{
|
||||
HomeCorrect modelC = new HomeCorrect();
|
||||
modelC.Val = noTimes.Count().ToString();
|
||||
modelC.SOURCENAME = "未整改隐患";
|
||||
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||
modelC.YEAR = monthStart.Year;
|
||||
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||
listC.Add(modelC);
|
||||
}
|
||||
else
|
||||
{
|
||||
HomeCorrect modelC = new HomeCorrect();
|
||||
modelC.Val = "0";
|
||||
modelC.SOURCENAME = "未整改隐患";
|
||||
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||
modelC.YEAR = monthStart.Year;
|
||||
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||
listC.Add(modelC);
|
||||
}
|
||||
if (alls.Any())
|
||||
{
|
||||
var val = onTimes.Count() + overTimes.Count();
|
||||
var count = alls.Count();
|
||||
HomeCorrect modelC = new HomeCorrect();
|
||||
modelC.Val = count == 0 ?"0":((decimal)Math.Round(100.00 * val / count, 2)).ToString();
|
||||
modelC.SOURCENAME = "隐患整改率";
|
||||
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||
modelC.YEAR = monthStart.Year;
|
||||
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||
listC.Add(modelC);
|
||||
}
|
||||
else
|
||||
{
|
||||
HomeCorrect modelC = new HomeCorrect();
|
||||
modelC.Val = "0";
|
||||
modelC.SOURCENAME = "隐患整改率";
|
||||
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||
modelC.YEAR = monthStart.Year;
|
||||
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||
listC.Add(modelC);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
List<HomeCorrect> listC2 = new List<HomeCorrect>();
|
||||
if (listC.Any())
|
||||
{
|
||||
var groupList = listC.GroupBy(t => new { t.SOURCENAME });
|
||||
if (groupList.Any())
|
||||
{
|
||||
foreach (var item in groupList)
|
||||
{
|
||||
var vals = listC.Where(t => t.SOURCENAME == item.Key.SOURCENAME).OrderBy(m => m.NAME).Select(n => n.Val).ToList();
|
||||
var names = listC.Where(t => t.SOURCENAME == item.Key.SOURCENAME).OrderBy(m => m.NAME).Select(n => n.NAME).ToList();
|
||||
HomeCorrect modelC = new HomeCorrect();
|
||||
modelC.Val = string.Join(",", vals);
|
||||
modelC.SOURCENAME = item.Key.SOURCENAME;
|
||||
//modelC.DEPARTMENT_ID = item.Key.DEPARTMENT_ID;
|
||||
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key.DEPARTMENT_ID)?.NAME;
|
||||
modelC.YEAR = dtNow.Year;
|
||||
modelC.NAME = string.Join(",", names);
|
||||
listC2.Add(modelC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.ListC = listC2;
|
||||
|
||||
#region 组织合并
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 年度 各下属组织 隐患整改情况
|
||||
|
||||
List<T_BI_HOME_BSRISKREASON> listReasonYearT = BIHomeService.GetHomeCorrectYear(filter.OrgId, listDep).ToList();
|
||||
List<HomeCorrectYear> ListCYear = new List<HomeCorrectYear>();
|
||||
HomeCorrectYear modelCY = null;
|
||||
int CountYearT = listReasonYearT.Count;
|
||||
for (int i = 0; i < CountYearT; i++)
|
||||
{
|
||||
if (i == 0 || listReasonYearT[i].DEPARTMENT_ID != listReasonYearT[i - 1].DEPARTMENT_ID)
|
||||
{
|
||||
modelCY = new HomeCorrectYear();
|
||||
modelCY.DEPARTMENTNAME = listReasonYearT[i].DEPARTMENTNAME;
|
||||
modelCY.DEPARTMENT_ID = listReasonYearT[i].DEPARTMENT_ID;
|
||||
modelCY.YEAR = listReasonYearT[i].YEAR;
|
||||
}
|
||||
|
||||
// 按时整改隐患 5 超期整改隐患 10 未整改隐患 15
|
||||
if (listReasonYearT[i].SOURCEVAL == 5)
|
||||
{
|
||||
modelCY.CountIn += listReasonYearT[i].COUNT;
|
||||
}
|
||||
else if (listReasonYearT[i].SOURCEVAL == 10)
|
||||
{
|
||||
modelCY.CountOut += listReasonYearT[i].COUNT;
|
||||
}
|
||||
else if (listReasonYearT[i].SOURCEVAL == 15)
|
||||
{
|
||||
modelCY.CountNot += listReasonYearT[i].COUNT;
|
||||
}
|
||||
|
||||
if (i == CountYearT - 1 || listReasonYearT[i].DEPARTMENT_ID != listReasonYearT[i + 1].DEPARTMENT_ID)
|
||||
{
|
||||
modelCY.Count = modelCY.CountIn + modelCY.CountOut + modelCY.CountNot;
|
||||
ListCYear.Add(modelCY);
|
||||
}
|
||||
}
|
||||
|
||||
result.ListCYear = ListCYear;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 月度 6 个月 安全检查、检查类型 数量
|
||||
|
||||
//按生产单元 获取
|
||||
|
||||
//if (!string.IsNullOrEmpty(filter.Keyword))
|
||||
{
|
||||
//int MineType = int.Parse(filter.Keyword.ToString());
|
||||
//BaseFilter filterD = new BaseFilter();
|
||||
//filterD.SelectField = new List<string> { "ID", "NAME", "DEPARTMENT_TYPE", "PARENT_ID" };
|
||||
|
||||
//var listDep1MineType = GetEntities<T_FM_DEPARTMENT>(t => t.MineType.HasValue && t.MineType == MineType && t.DEPARTMENT_TYPE == 10, filterD, null);//部门就可以了 因为都相向 统计了
|
||||
if (listDep != null && listDep.Any())
|
||||
{
|
||||
List<HomeSafeCheckCountMonth> ListSafeCheckYearMonth = new List<HomeSafeCheckCountMonth>();
|
||||
int befoMonth = 12;
|
||||
List<T_BI_HOME_BSRISKREASON> ListSafeCheckYearMonthT = BIHomeService.GetHomeCheckCountMonth(filter.OrgId, listDep.ToList(), befoMonth).ToList();
|
||||
//var listCheckTypeIDT = ListSafeCheckYearMonthT.Select(e => e.SOURCEID).Distinct().ToList();
|
||||
|
||||
//var enums = GetEntity<T_FM_ENUMS>(e => e.VALUE == MineType && e.CODE == "BSMineTypeEnum");
|
||||
//if (enums != null)
|
||||
//{
|
||||
// var listTypeMine = GetEntities<MS.Domain.Entities.SK.T_SK_CHECK_TYPE>(e => e.MineType == (SKProductionUnit)MineType, null, null);
|
||||
// if (listTypeMine != null && listTypeMine.Any())
|
||||
// {
|
||||
// var listMineCheckTypeID = listTypeMine.Select(e => e.ID);
|
||||
// for (int i = 0; i < listCheckTypeIDT.Count; i++)
|
||||
// {
|
||||
// if (!listMineCheckTypeID.Contains(listCheckTypeIDT[i]))
|
||||
// {
|
||||
// listCheckTypeIDT.RemoveAt(i);
|
||||
// i--;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
var checkIds = ListSafeCheckYearMonthT.Select(t => t.SOURCEID).Distinct().ToList();
|
||||
var loginDepart = this.GetEntity<T_FM_DEPARTMENT>(t => t.ID == APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID);
|
||||
var listCheckType = GetEntities<MS.Domain.Entities.SK.T_SK_CHECK_TYPE>(e => checkIds.Contains(e.ID), null, null).ToList();
|
||||
if (loginDepart != null)
|
||||
{
|
||||
listCheckType = listCheckType.Where(t => t.PRODUCTION_UNIT_ID == loginDepart.PRODUCTION_UNIT_ID).ToList();
|
||||
}
|
||||
List<Guid> listCheckTypeID = new List<Guid>();
|
||||
List<string> listCheckTypeNAME = new List<string>();
|
||||
|
||||
//Guid IDZH = Guid.Empty;//综合检查(只有一个)
|
||||
//List<Guid> listGUID = new List<Guid>();//综合检查子集
|
||||
for (int i = 0; i < listCheckType.Count; i++)
|
||||
{
|
||||
//if (listCheckType[i].PARENT_ID.HasValue || ((IDZH != Guid.Empty && IDZH == listCheckType[i].ID) || listCheckType[i].NAME == "综合检查"))
|
||||
//{
|
||||
// if (IDZH == Guid.Empty)
|
||||
// {
|
||||
// IDZH = listCheckType[i].PARENT_ID.HasValue ? listCheckType[i].PARENT_ID.Value : listCheckType[i].ID;
|
||||
// listCheckTypeID.Add(IDZH);
|
||||
// var checkTypeP = GetEntity<MS.Domain.Entities.BS.T_BS_CHECK_TYPE>(IDZH);
|
||||
// listCheckTypeNAME.Add(checkTypeP.NAME);
|
||||
// }
|
||||
// listGUID.Add(listCheckType[i].ID);
|
||||
//}
|
||||
//else
|
||||
{
|
||||
listCheckTypeID.Add(listCheckType[i].ID);
|
||||
listCheckTypeNAME.Add(listCheckType[i].NAME);
|
||||
}
|
||||
}
|
||||
|
||||
int year = DateTime.Now.Year;
|
||||
int Month = DateTime.Now.Month;
|
||||
DateTime dtTemp = DateTime.Now;
|
||||
IEnumerable<T_BI_HOME_BSRISKREASON> listPerChearch = null;
|
||||
IEnumerable<T_BI_HOME_BSRISKREASON> listPerChearchPer = null;
|
||||
|
||||
//List<int> listListCount = null;
|
||||
for (int i = 0; i < befoMonth; i++)
|
||||
{
|
||||
dtTemp = dtNow.AddMonths(-1 * i);
|
||||
year = dtTemp.Year;
|
||||
Month = dtTemp.Month;
|
||||
listPerChearch = ListSafeCheckYearMonthT.Where(e => e.YEAR == year && e.MONTH == Month);
|
||||
HomeSafeCheckCountMonth modelper = new HomeSafeCheckCountMonth();
|
||||
modelper.Total = listPerChearch.Count();
|
||||
modelper.listSOURCENAME = listCheckTypeNAME;
|
||||
modelper.YEAR = year;
|
||||
modelper.MONTH = Month;
|
||||
List<int> listListCount = new List<int>();
|
||||
|
||||
for (int j = 0; j < listCheckTypeID.Count; j++)
|
||||
{
|
||||
//if (listCheckTypeID[j] != IDZH)
|
||||
{
|
||||
listPerChearchPer = listPerChearch.Where(e => e.YEAR == year && e.MONTH == Month && e.SOURCEID == listCheckTypeID[j]);//各个检查
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// listPerChearchPer = listPerChearch.Where(e => e.YEAR == year && e.MONTH == Month && listGUID.Contains(e.SOURCEID));//综合检查
|
||||
//}
|
||||
|
||||
if (listPerChearchPer == null || !listPerChearchPer.Any())
|
||||
{
|
||||
listListCount.Add(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
listListCount.Add(listPerChearchPer.Sum(e => e.COUNT));
|
||||
}
|
||||
}
|
||||
modelper.listListCount = listListCount;
|
||||
ListSafeCheckYearMonth.Add(modelper);
|
||||
}
|
||||
result.ListSafeCheckYearMonth = ListSafeCheckYearMonth.OrderBy(e => e.YEAR).ThenBy(e => e.MONTH).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 搜索结果 判断存入Redis中
|
||||
|
||||
//if (isRedisConfig)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// if (listHomeRedis == null)
|
||||
// listHomeRedis = new List<HomeResultMineType>();
|
||||
|
||||
// listHomeRedis.Add(new HomeResultMineType()
|
||||
// {
|
||||
// //MineType = MineType,
|
||||
// yyyyMMddHH = dtNow.ToString("yyyyMMddHH"),
|
||||
// result = result
|
||||
// });
|
||||
|
||||
// CsRedisManager.StringSet<List<HomeResultMineType>>(redisCode, listHomeRedis);
|
||||
// }
|
||||
// catch { }
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
return result;
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
/// 首页 安全检查次数统计明细(BI054HomeDetail)
|
||||
/// </summary>
|
||||
|
||||
@ -10270,18 +10270,18 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
||||
ONTIME_COUNT = group.Where(i => i.MONTH == group.Key.MONTH).Sum(m => m.ONTIME_COUNT),
|
||||
TOTAL_COUNT = group.Where(i => i.MONTH == group.Key.MONTH).Sum(m => m.TOTAL_COUNT),
|
||||
}).ToList();
|
||||
completionLists = completions.GroupBy(t => new {t.DEPARTMENT_ID,t.DEPARTMENT_NAME, t.TEAM_ID, t.TEAM_NAME, t.SHOP_DEPARTMENT_ID, t.SHOP_DEPARTMENT_NAME }).Select(group => new GroupbyDepartmentCompletion
|
||||
completionLists = completions.GroupBy(t => new {t.TEAM_ID, t.TEAM_NAME, t.SHOP_DEPARTMENT_ID, t.SHOP_DEPARTMENT_NAME }).Select(group => new GroupbyDepartmentCompletion
|
||||
{
|
||||
deptId = group.Key.DEPARTMENT_ID,
|
||||
deptName = group.Key.DEPARTMENT_NAME,
|
||||
deptId = group.Where(i => i.TEAM_ID == group.Key.TEAM_ID && i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID).FirstOrDefault().DEPARTMENT_ID,
|
||||
deptName = group.Where(i => i.TEAM_ID == group.Key.TEAM_ID && i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID).FirstOrDefault().DEPARTMENT_NAME,
|
||||
shopId = group.Key.SHOP_DEPARTMENT_ID,
|
||||
shopName = group.Key.SHOP_DEPARTMENT_NAME,
|
||||
teamId = group.Key.TEAM_ID,
|
||||
teamName = group.Key.TEAM_NAME,
|
||||
teamDoneCount = group.Where(i =>i.DEPARTMENT_ID == group.Key.DEPARTMENT_ID && i.TEAM_ID == group.Key.TEAM_ID && i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID).Sum(m => m.FINISH_COUNT),
|
||||
teamOntimeCount = group.Where(i => i.DEPARTMENT_ID == group.Key.DEPARTMENT_ID && i.TEAM_ID == group.Key.TEAM_ID && i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID).Sum(m => m.ONTIME_COUNT),
|
||||
teamUndoneCount = group.Where(i => i.DEPARTMENT_ID == group.Key.DEPARTMENT_ID && i.TEAM_ID == group.Key.TEAM_ID && i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID).Sum(m => m.WAITTING_COUNT),
|
||||
teamTotalCount = group.Where(i => i.DEPARTMENT_ID == group.Key.DEPARTMENT_ID && i.TEAM_ID == group.Key.TEAM_ID && i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID).Sum(m => m.TOTAL_COUNT),
|
||||
teamDoneCount = group.Where(i => i.TEAM_ID == group.Key.TEAM_ID && i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID).Sum(m => m.FINISH_COUNT),
|
||||
teamOntimeCount = group.Where(i => i.TEAM_ID == group.Key.TEAM_ID && i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID).Sum(m => m.ONTIME_COUNT),
|
||||
teamUndoneCount = group.Where(i => i.TEAM_ID == group.Key.TEAM_ID && i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID).Sum(m => m.WAITTING_COUNT),
|
||||
teamTotalCount = group.Where(i => i.TEAM_ID == group.Key.TEAM_ID && i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID).Sum(m => m.TOTAL_COUNT),
|
||||
}).ToList();
|
||||
}
|
||||
if (completionSorts != null && completionSorts.Any())
|
||||
@ -10305,22 +10305,30 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
||||
{
|
||||
foreach (var item in completionLists)
|
||||
{
|
||||
item.deptDoneCount = completionLists.Where(i => i.deptId == item.deptId).Sum(m => m.teamDoneCount);
|
||||
item.deptOntimeCount = completionLists.Where(i => i.deptId == item.deptId).Sum(m => m.teamOntimeCount);
|
||||
item.deptTotalCount = completionLists.Where(i => i.deptId == item.deptId).Sum(m => m.teamTotalCount);
|
||||
if (string.IsNullOrEmpty(item.shopName))
|
||||
{
|
||||
item.shopName = item.deptName;
|
||||
}
|
||||
if (string.IsNullOrEmpty(item.teamName))
|
||||
{
|
||||
item.teamName = item.shopName;
|
||||
}
|
||||
//item.deptDoneCount = completionLists.Where(i => i.deptId == item.deptId).Sum(m => m.teamDoneCount);
|
||||
//item.deptOntimeCount = completionLists.Where(i => i.deptId == item.deptId).Sum(m => m.teamOntimeCount);
|
||||
//item.deptTotalCount = completionLists.Where(i => i.deptId == item.deptId).Sum(m => m.teamTotalCount);
|
||||
item.shopDoneCount = completionLists.Where(i => i.shopId == item.shopId).Sum(m => m.teamDoneCount);
|
||||
item.shopOntimeCount = completionLists.Where(i => i.shopId == item.shopId).Sum(m => m.teamOntimeCount);
|
||||
item.shopTotalCount = completionLists.Where(i => i.shopId == item.shopId).Sum(m => m.teamTotalCount);
|
||||
if (item.deptTotalCount == 0)
|
||||
{
|
||||
item.deptDoneRate = 0;
|
||||
item.deptOverDoneRate = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.deptDoneRate = Math.Round((double)item.deptDoneCount / (double)item.deptTotalCount * 100, 2);
|
||||
item.deptOverDoneRate = Math.Round((double)item.deptOntimeCount / (double)item.deptTotalCount * 100, 2);
|
||||
}
|
||||
//if (item.deptTotalCount == 0)
|
||||
//{
|
||||
// item.deptDoneRate = 0;
|
||||
// item.deptOverDoneRate = 0;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// item.deptDoneRate = Math.Round((double)item.deptDoneCount / (double)item.deptTotalCount * 100, 2);
|
||||
// item.deptOverDoneRate = Math.Round((double)item.deptOntimeCount / (double)item.deptTotalCount * 100, 2);
|
||||
//}
|
||||
if (item.shopTotalCount == 0)
|
||||
{
|
||||
item.shopDoneRate = 0;
|
||||
@ -10342,7 +10350,7 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
||||
item.teamOverDoneRate = Math.Round((double)item.teamOntimeCount / (double)item.teamTotalCount * 100, 2);
|
||||
}
|
||||
}
|
||||
ret.retData = completionLists.OrderBy(t => t.deptName).ThenBy(t => t.shopName).ThenByDescending(m => m.teamOverDoneRate).ToList();
|
||||
ret.retData = completionLists.OrderBy(t => t.shopName).ThenByDescending(m => m.teamOverDoneRate).ToList();
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user