跑批优化
This commit is contained in:
parent
a22d98fb8a
commit
8a4b6fad00
@ -950,20 +950,20 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
}).ToList();
|
||||
foreach (var item in results)
|
||||
{
|
||||
T_FM_WORK_TICKET_COMPLETION completion = new T_FM_WORK_TICKET_COMPLETION();
|
||||
completion.MONTH = i;
|
||||
completion.MONTHStr = i.Year + "年" + i.Month + "月";
|
||||
completion.TOTAL_COUNT = item.totalCount;
|
||||
completion.FINISH_COUNT = item.finishCount;
|
||||
completion.OVER_FINISH_COUNT = item.overFinishCount;
|
||||
completion.WAITTING_COUNT = item.waitingCount;
|
||||
completion.ONTIME_COUNT = item.onTimeCount;
|
||||
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)
|
||||
{
|
||||
T_FM_WORK_TICKET_COMPLETION completion = new T_FM_WORK_TICKET_COMPLETION();
|
||||
completion.MONTH = i;
|
||||
completion.MONTHStr = i.Year + "年" + i.Month + "月";
|
||||
completion.TOTAL_COUNT = item.totalCount;
|
||||
completion.FINISH_COUNT = item.finishCount;
|
||||
completion.OVER_FINISH_COUNT = item.overFinishCount;
|
||||
completion.WAITTING_COUNT = item.waitingCount;
|
||||
completion.ONTIME_COUNT = item.onTimeCount;
|
||||
completion.ORG_ID = filter.GetOrgId();
|
||||
completion.START_TIME = i;
|
||||
completion.END_TIME = monthEnd;
|
||||
{
|
||||
if (departInfo.DEPARTMENT_TYPE == 10|| departInfo.DEPARTMENT_TYPE == 5)
|
||||
{
|
||||
completion.DEPARTMENT_ID = item.departmetId;
|
||||
@ -984,9 +984,9 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
||||
completion.SHOP_DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
||||
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");
|
||||
//检查清单
|
||||
|
||||
@ -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