首页图表
This commit is contained in:
parent
1cc6f0ed82
commit
77496f7125
@ -272,7 +272,7 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
var monthEnd = Convert.ToDateTime(i.AddMonths(i.Month - i.Month + 1).AddDays(1 - i.Day - 1).ToString().Replace("0:00:00", "23:59:59"));
|
var monthEnd = Convert.ToDateTime(i.AddMonths(i.Month - i.Month + 1).AddDays(1 - i.Day - 1).ToString().Replace("0:00:00", "23:59:59"));
|
||||||
var preTemp = preShiftMeetingTemp.Where(t => t.CREATE_TIME >= i && t.CREATE_TIME <= monthEnd).ToList();
|
var preTemp = preShiftMeetingTemp.Where(t => t.CREATE_TIME >= i && t.CREATE_TIME <= monthEnd).ToList();
|
||||||
var preShiftMeeting = preTemp.
|
var preShiftMeeting = preTemp.
|
||||||
GroupBy(m => new { m.TEAM_ID, TeamName = m.Nav_Team.NAME, m.DEPARTMENT_ID }).
|
GroupBy(m => new { m.TEAM_ID, TeamName = m.Nav_Team.NAME }).
|
||||||
Select(group => new
|
Select(group => new
|
||||||
{
|
{
|
||||||
group.Key,
|
group.Key,
|
||||||
@ -282,6 +282,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
onTimeCount = group.Where(i => i.PRE_MEETING_STATUS == FOPreMeetingStatusEnum.归档 && i.OVERTIME == FOISOVERTIME.超时).Count(),
|
onTimeCount = group.Where(i => i.PRE_MEETING_STATUS == FOPreMeetingStatusEnum.归档 && i.OVERTIME == FOISOVERTIME.超时).Count(),
|
||||||
overTimeCount = group.Where(i => i.PRE_MEETING_STATUS == FOPreMeetingStatusEnum.归档 && i.OVERTIME == FOISOVERTIME.超时).Count()
|
overTimeCount = group.Where(i => i.PRE_MEETING_STATUS == FOPreMeetingStatusEnum.归档 && i.OVERTIME == FOISOVERTIME.超时).Count()
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
if (preShiftMeeting.Any())
|
||||||
|
{
|
||||||
foreach (var item in preShiftMeeting)
|
foreach (var item in preShiftMeeting)
|
||||||
{
|
{
|
||||||
var deparId = teams.FirstOrDefault(t => t.ID == item.Key.TEAM_ID)?.DEPARTMENT_ID;
|
var deparId = teams.FirstOrDefault(t => t.ID == item.Key.TEAM_ID)?.DEPARTMENT_ID;
|
||||||
@ -300,10 +302,14 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
completion.END_TIME = monthEnd;
|
completion.END_TIME = monthEnd;
|
||||||
if (departInfo != null)
|
if (departInfo != null)
|
||||||
{
|
{
|
||||||
if (departInfo.DEPARTMENT_TYPE == 10)
|
if (departInfo.DEPARTMENT_TYPE == 10 || departInfo.DEPARTMENT_TYPE == 5)
|
||||||
{
|
{
|
||||||
completion.DEPARTMENT_ID = item.Key.TEAM_ID;
|
completion.DEPARTMENT_ID = item.Key.TEAM_ID;
|
||||||
completion.DEPARTMENT_NAME = item.Key.TeamName;
|
completion.DEPARTMENT_NAME = item.Key.TeamName;
|
||||||
|
completion.SHOP_DEPARTMENT_ID = null;
|
||||||
|
completion.SHOP_DEPARTMENT_NAME = null;
|
||||||
|
completion.TEAM_ID = null;
|
||||||
|
completion.TEAM_NAME = null;
|
||||||
}
|
}
|
||||||
if (departInfo.DEPARTMENT_TYPE == 15)
|
if (departInfo.DEPARTMENT_TYPE == 15)
|
||||||
{
|
{
|
||||||
@ -311,6 +317,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
||||||
completion.SHOP_DEPARTMENT_ID = item.Key.TEAM_ID;
|
completion.SHOP_DEPARTMENT_ID = item.Key.TEAM_ID;
|
||||||
completion.SHOP_DEPARTMENT_NAME = item.Key.TeamName;
|
completion.SHOP_DEPARTMENT_NAME = item.Key.TeamName;
|
||||||
|
completion.TEAM_ID = null;
|
||||||
|
completion.TEAM_NAME = null;
|
||||||
}
|
}
|
||||||
if (departInfo.DEPARTMENT_TYPE == 20)
|
if (departInfo.DEPARTMENT_TYPE == 20)
|
||||||
{
|
{
|
||||||
@ -318,15 +326,33 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.Nav_Parent?.NAME;
|
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.Nav_Parent?.NAME;
|
||||||
completion.SHOP_DEPARTMENT_ID = departInfo?.PARENT_ID;
|
completion.SHOP_DEPARTMENT_ID = departInfo?.PARENT_ID;
|
||||||
completion.SHOP_DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
completion.SHOP_DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
||||||
completion.TEAM_ID = item.Key.TEAM_ID;
|
completion.TEAM_ID = departInfo.ID;
|
||||||
completion.TEAM_NAME = item.Key.TeamName;
|
completion.TEAM_NAME = departInfo.NAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
completions.Add(completion);
|
completions.Add(completion);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
T_FM_DEPARTMENT_COMPLETION completion = new T_FM_DEPARTMENT_COMPLETION();
|
||||||
|
completion.MONTH = i;
|
||||||
|
completion.MONTHStr = i.Year + "年" + i.Month + "月";
|
||||||
|
completion.TOTAL_COUNT = 0;
|
||||||
|
completion.WAITTING_COUNT = 0;
|
||||||
|
completion.FINISH_COUNT = 0;
|
||||||
|
completion.ONTIME_COUNT = 0;
|
||||||
|
completion.OVERTIME_COUNT = 0;
|
||||||
|
completion.FORM_NAME = "班前会议";
|
||||||
|
completion.ORG_ID = filter.GetOrgId();
|
||||||
|
completion.START_TIME = i;
|
||||||
|
completion.END_TIME = monthEnd;
|
||||||
|
completions.Add(completion);
|
||||||
|
}
|
||||||
var currentTemp = currentShiftTemp.Where(t => t.CREATE_TIME >= i && t.CREATE_TIME <= monthEnd).ToList();
|
var currentTemp = currentShiftTemp.Where(t => t.CREATE_TIME >= i && t.CREATE_TIME <= monthEnd).ToList();
|
||||||
var currentShift = currentTemp.
|
var currentShift = currentTemp.
|
||||||
GroupBy(m => new { m.CLASS_TEAM_ID, TeamName = m.Nav_Team.NAME, m.DEPARTMENT_ID }).
|
GroupBy(m => new { m.CLASS_TEAM_ID, TeamName = m.Nav_Team.NAME }).
|
||||||
Select(group => new
|
Select(group => new
|
||||||
{
|
{
|
||||||
group.Key,
|
group.Key,
|
||||||
@ -336,6 +362,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
onTimeCount = group.Where(i => (i.SHIFT_STATUS == (int)FOShiftStatusEnum.归档 || i.SHIFT_STATUS == (int)FOShiftStatusEnum.审批归档) && i.OVERTIME == FOISOVERTIME.未超时).Count(),
|
onTimeCount = group.Where(i => (i.SHIFT_STATUS == (int)FOShiftStatusEnum.归档 || i.SHIFT_STATUS == (int)FOShiftStatusEnum.审批归档) && i.OVERTIME == FOISOVERTIME.未超时).Count(),
|
||||||
overTimeCount = group.Where(i => (i.SHIFT_STATUS == (int)FOShiftStatusEnum.归档 || i.SHIFT_STATUS == (int)FOShiftStatusEnum.审批归档) && i.OVERTIME == FOISOVERTIME.超时).Count()
|
overTimeCount = group.Where(i => (i.SHIFT_STATUS == (int)FOShiftStatusEnum.归档 || i.SHIFT_STATUS == (int)FOShiftStatusEnum.审批归档) && i.OVERTIME == FOISOVERTIME.超时).Count()
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
if (currentShift.Any())
|
||||||
|
{
|
||||||
foreach (var item in currentShift)
|
foreach (var item in currentShift)
|
||||||
{
|
{
|
||||||
var deparId = teams.FirstOrDefault(t => t.ID == item.Key.CLASS_TEAM_ID)?.DEPARTMENT_ID;
|
var deparId = teams.FirstOrDefault(t => t.ID == item.Key.CLASS_TEAM_ID)?.DEPARTMENT_ID;
|
||||||
@ -360,10 +388,14 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
completion.END_TIME = monthEnd;
|
completion.END_TIME = monthEnd;
|
||||||
if (departInfo != null)
|
if (departInfo != null)
|
||||||
{
|
{
|
||||||
if (departInfo.DEPARTMENT_TYPE == 10)
|
if (departInfo.DEPARTMENT_TYPE == 10 || departInfo.DEPARTMENT_TYPE == 5)
|
||||||
{
|
{
|
||||||
completion.DEPARTMENT_ID = item.Key.CLASS_TEAM_ID;
|
completion.DEPARTMENT_ID = item.Key.CLASS_TEAM_ID;
|
||||||
completion.DEPARTMENT_NAME = item.Key.TeamName;
|
completion.DEPARTMENT_NAME = item.Key.TeamName;
|
||||||
|
completion.SHOP_DEPARTMENT_ID = null;
|
||||||
|
completion.SHOP_DEPARTMENT_NAME = null;
|
||||||
|
completion.TEAM_ID = null;
|
||||||
|
completion.TEAM_NAME = null;
|
||||||
}
|
}
|
||||||
if (departInfo.DEPARTMENT_TYPE == 15)
|
if (departInfo.DEPARTMENT_TYPE == 15)
|
||||||
{
|
{
|
||||||
@ -371,6 +403,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
||||||
completion.SHOP_DEPARTMENT_ID = item.Key.CLASS_TEAM_ID;
|
completion.SHOP_DEPARTMENT_ID = item.Key.CLASS_TEAM_ID;
|
||||||
completion.SHOP_DEPARTMENT_NAME = item.Key.TeamName;
|
completion.SHOP_DEPARTMENT_NAME = item.Key.TeamName;
|
||||||
|
completion.TEAM_ID = null;
|
||||||
|
completion.TEAM_NAME = null;
|
||||||
}
|
}
|
||||||
if (departInfo.DEPARTMENT_TYPE == 20)
|
if (departInfo.DEPARTMENT_TYPE == 20)
|
||||||
{
|
{
|
||||||
@ -378,15 +412,33 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.Nav_Parent?.NAME;
|
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.Nav_Parent?.NAME;
|
||||||
completion.SHOP_DEPARTMENT_ID = departInfo?.PARENT_ID;
|
completion.SHOP_DEPARTMENT_ID = departInfo?.PARENT_ID;
|
||||||
completion.SHOP_DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
completion.SHOP_DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
||||||
completion.TEAM_ID = item.Key.CLASS_TEAM_ID;
|
completion.TEAM_ID = departInfo.ID;
|
||||||
completion.TEAM_NAME = item.Key.TeamName;
|
completion.TEAM_NAME = departInfo.NAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
completions.Add(completion);
|
completions.Add(completion);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
T_FM_DEPARTMENT_COMPLETION completion = new T_FM_DEPARTMENT_COMPLETION();
|
||||||
|
completion.MONTH = i;
|
||||||
|
completion.MONTHStr = i.Year + "年" + i.Month + "月";
|
||||||
|
completion.TOTAL_COUNT = 0;
|
||||||
|
completion.WAITTING_COUNT = 0;
|
||||||
|
completion.FINISH_COUNT = 0;
|
||||||
|
completion.ONTIME_COUNT = 0;
|
||||||
|
completion.OVERTIME_COUNT = 0;
|
||||||
|
completion.FORM_NAME = "岗位当班";
|
||||||
|
completion.ORG_ID = filter.GetOrgId();
|
||||||
|
completion.START_TIME = i;
|
||||||
|
completion.END_TIME = monthEnd;
|
||||||
|
completions.Add(completion);
|
||||||
|
}
|
||||||
var changeTemp = changeShiftTemp.Where(t => t.CREATE_TIME >= i && t.CREATE_TIME <= monthEnd).ToList();
|
var changeTemp = changeShiftTemp.Where(t => t.CREATE_TIME >= i && t.CREATE_TIME <= monthEnd).ToList();
|
||||||
var changeShift = changeTemp.
|
var changeShift = changeTemp.
|
||||||
GroupBy(m => new { m.TEAM_ID, TeamName = m.Nav_Team.NAME, m.DEPARTMENT_ID }).
|
GroupBy(m => new { m.TEAM_ID, TeamName = m.Nav_Team.NAME }).
|
||||||
Select(group => new
|
Select(group => new
|
||||||
{
|
{
|
||||||
group.Key,
|
group.Key,
|
||||||
@ -396,6 +448,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
onTimeCount = group.Where(i => i.SHIFT_STATUS == (int)FOChangeShiftStatusEnum.归档 && i.OVERTIME == FOISOVERTIME.未超时).Count(),
|
onTimeCount = group.Where(i => i.SHIFT_STATUS == (int)FOChangeShiftStatusEnum.归档 && i.OVERTIME == FOISOVERTIME.未超时).Count(),
|
||||||
overTimeCount = group.Where(i => i.SHIFT_STATUS == (int)FOChangeShiftStatusEnum.归档 && i.OVERTIME == FOISOVERTIME.超时).Count()
|
overTimeCount = group.Where(i => i.SHIFT_STATUS == (int)FOChangeShiftStatusEnum.归档 && i.OVERTIME == FOISOVERTIME.超时).Count()
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
if (changeShift.Any())
|
||||||
|
{
|
||||||
foreach (var item in changeShift)
|
foreach (var item in changeShift)
|
||||||
{
|
{
|
||||||
var deparId = teams.FirstOrDefault(t => t.ID == item.Key.TEAM_ID)?.DEPARTMENT_ID;
|
var deparId = teams.FirstOrDefault(t => t.ID == item.Key.TEAM_ID)?.DEPARTMENT_ID;
|
||||||
@ -420,10 +474,14 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
completion.END_TIME = monthEnd;
|
completion.END_TIME = monthEnd;
|
||||||
if (departInfo != null)
|
if (departInfo != null)
|
||||||
{
|
{
|
||||||
if (departInfo.DEPARTMENT_TYPE == 10)
|
if (departInfo.DEPARTMENT_TYPE == 10 || departInfo.DEPARTMENT_TYPE == 5)
|
||||||
{
|
{
|
||||||
completion.DEPARTMENT_ID = item.Key.TEAM_ID;
|
completion.DEPARTMENT_ID = item.Key.TEAM_ID;
|
||||||
completion.DEPARTMENT_NAME = item.Key.TeamName;
|
completion.DEPARTMENT_NAME = item.Key.TeamName;
|
||||||
|
completion.SHOP_DEPARTMENT_ID = null;
|
||||||
|
completion.SHOP_DEPARTMENT_NAME = null;
|
||||||
|
completion.TEAM_ID = null;
|
||||||
|
completion.TEAM_NAME = null;
|
||||||
}
|
}
|
||||||
if (departInfo.DEPARTMENT_TYPE == 15)
|
if (departInfo.DEPARTMENT_TYPE == 15)
|
||||||
{
|
{
|
||||||
@ -431,6 +489,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
||||||
completion.SHOP_DEPARTMENT_ID = item.Key.TEAM_ID;
|
completion.SHOP_DEPARTMENT_ID = item.Key.TEAM_ID;
|
||||||
completion.SHOP_DEPARTMENT_NAME = item.Key.TeamName;
|
completion.SHOP_DEPARTMENT_NAME = item.Key.TeamName;
|
||||||
|
completion.TEAM_ID = null;
|
||||||
|
completion.TEAM_NAME = null;
|
||||||
}
|
}
|
||||||
if (departInfo.DEPARTMENT_TYPE == 20)
|
if (departInfo.DEPARTMENT_TYPE == 20)
|
||||||
{
|
{
|
||||||
@ -438,15 +498,34 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.Nav_Parent?.NAME;
|
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.Nav_Parent?.NAME;
|
||||||
completion.SHOP_DEPARTMENT_ID = departInfo?.PARENT_ID;
|
completion.SHOP_DEPARTMENT_ID = departInfo?.PARENT_ID;
|
||||||
completion.SHOP_DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
completion.SHOP_DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
||||||
completion.TEAM_ID = item.Key.TEAM_ID;
|
completion.TEAM_ID = departInfo.ID;
|
||||||
completion.TEAM_NAME = item.Key.TeamName;
|
completion.TEAM_NAME = departInfo.NAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
completions.Add(completion);
|
completions.Add(completion);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
T_FM_DEPARTMENT_COMPLETION completion = new T_FM_DEPARTMENT_COMPLETION();
|
||||||
|
completion.MONTH = i;
|
||||||
|
completion.MONTHStr = i.Year + "年" + i.Month + "月";
|
||||||
|
completion.TOTAL_COUNT = 0;
|
||||||
|
completion.WAITTING_COUNT = 0;
|
||||||
|
completion.FINISH_COUNT = 0;
|
||||||
|
completion.ONTIME_COUNT = 0;
|
||||||
|
completion.OVERTIME_COUNT = 0;
|
||||||
|
completion.FORM_NAME = "岗位交接班";
|
||||||
|
completion.ORG_ID = filter.GetOrgId();
|
||||||
|
completion.START_TIME = i;
|
||||||
|
completion.END_TIME = monthEnd;
|
||||||
|
completions.Add(completion);
|
||||||
|
}
|
||||||
|
|
||||||
var teamTemp = teamActivityTemp.Where(t => t.CREATE_TIME >= i && t.CREATE_TIME <= monthEnd).ToList();
|
var teamTemp = teamActivityTemp.Where(t => t.CREATE_TIME >= i && t.CREATE_TIME <= monthEnd).ToList();
|
||||||
var teamActivity = teamTemp.
|
var teamActivity = teamTemp.
|
||||||
GroupBy(m => new { m.TEAM_ID, TeamName = m.Nav_Taem.NAME, m.Nav_Taem.DEPARTMENT_ID }).
|
GroupBy(m => new { m.TEAM_ID, TeamName = m.Nav_Taem.NAME }).
|
||||||
Select(group => new
|
Select(group => new
|
||||||
{
|
{
|
||||||
group.Key,
|
group.Key,
|
||||||
@ -456,19 +535,21 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
onTimeCount = group.Where(i => i.TA_STATUS == (int)FOTeamActivityState.已归档 && i.OVERTIME == FOISOVERTIME.未超时).Count(),
|
onTimeCount = group.Where(i => i.TA_STATUS == (int)FOTeamActivityState.已归档 && i.OVERTIME == FOISOVERTIME.未超时).Count(),
|
||||||
overTimeCount = group.Where(i => i.TA_STATUS == (int)FOTeamActivityState.已归档 && i.OVERTIME == FOISOVERTIME.超时).Count()
|
overTimeCount = group.Where(i => i.TA_STATUS == (int)FOTeamActivityState.已归档 && i.OVERTIME == FOISOVERTIME.超时).Count()
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
if (teamActivity.Any())
|
||||||
|
{
|
||||||
foreach (var item in teamActivity)
|
foreach (var item in teamActivity)
|
||||||
{
|
{
|
||||||
var deparId = teams.FirstOrDefault(t => t.ID == item.Key.TEAM_ID)?.DEPARTMENT_ID;
|
var deparId = teams.FirstOrDefault(t => t.ID == item.Key.TEAM_ID)?.DEPARTMENT_ID;
|
||||||
var departInfo = departments.FirstOrDefault(t => t.ID == deparId); //GetDepartmentId((Guid)item.Key.DEPARTMENT_ID);
|
var departInfo = departments.FirstOrDefault(t => t.ID == deparId); //GetDepartmentId((Guid)item.Key.DEPARTMENT_ID);
|
||||||
T_FM_DEPARTMENT_COMPLETION completion = new T_FM_DEPARTMENT_COMPLETION();
|
T_FM_DEPARTMENT_COMPLETION completion = new T_FM_DEPARTMENT_COMPLETION();
|
||||||
completion.DEPARTMENT_ID = departInfo?.Nav_Parent?.PARENT_ID;
|
//completion.DEPARTMENT_ID = departInfo?.Nav_Parent?.PARENT_ID;
|
||||||
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.Nav_Parent?.NAME;
|
//completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.Nav_Parent?.NAME;
|
||||||
completion.SHOP_DEPARTMENT_ID = departInfo?.PARENT_ID;
|
//completion.SHOP_DEPARTMENT_ID = departInfo?.PARENT_ID;
|
||||||
completion.SHOP_DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
//completion.SHOP_DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
||||||
completion.MONTH = i;
|
completion.MONTH = i;
|
||||||
completion.MONTHStr = i.Year + "年" + i.Month + "月";
|
completion.MONTHStr = i.Year + "年" + i.Month + "月";
|
||||||
completion.TEAM_ID = item.Key.TEAM_ID;
|
//completion.TEAM_ID = item.Key.TEAM_ID;
|
||||||
completion.TEAM_NAME = item.Key.TeamName;
|
//completion.TEAM_NAME = item.Key.TeamName;
|
||||||
completion.TOTAL_COUNT = item.totalCount;
|
completion.TOTAL_COUNT = item.totalCount;
|
||||||
completion.WAITTING_COUNT = item.waitingCount;
|
completion.WAITTING_COUNT = item.waitingCount;
|
||||||
completion.FINISH_COUNT = item.finishCount;
|
completion.FINISH_COUNT = item.finishCount;
|
||||||
@ -478,6 +559,53 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
completion.ORG_ID = filter.GetOrgId();
|
completion.ORG_ID = filter.GetOrgId();
|
||||||
completion.START_TIME = i;
|
completion.START_TIME = i;
|
||||||
completion.END_TIME = monthEnd;
|
completion.END_TIME = monthEnd;
|
||||||
|
if (departInfo != null)
|
||||||
|
{
|
||||||
|
if (departInfo.DEPARTMENT_TYPE == 10 || departInfo.DEPARTMENT_TYPE == 5)
|
||||||
|
{
|
||||||
|
completion.DEPARTMENT_ID = item.Key.TEAM_ID;
|
||||||
|
completion.DEPARTMENT_NAME = item.Key.TeamName;
|
||||||
|
completion.SHOP_DEPARTMENT_ID = null;
|
||||||
|
completion.SHOP_DEPARTMENT_NAME = null;
|
||||||
|
completion.TEAM_ID = null;
|
||||||
|
completion.TEAM_NAME = null;
|
||||||
|
}
|
||||||
|
if (departInfo.DEPARTMENT_TYPE == 15)
|
||||||
|
{
|
||||||
|
completion.DEPARTMENT_ID = departInfo?.PARENT_ID;
|
||||||
|
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
||||||
|
completion.SHOP_DEPARTMENT_ID = item.Key.TEAM_ID;
|
||||||
|
completion.SHOP_DEPARTMENT_NAME = item.Key.TeamName;
|
||||||
|
completion.TEAM_ID = null;
|
||||||
|
completion.TEAM_NAME = null;
|
||||||
|
}
|
||||||
|
if (departInfo.DEPARTMENT_TYPE == 20)
|
||||||
|
{
|
||||||
|
completion.DEPARTMENT_ID = departInfo?.Nav_Parent?.PARENT_ID;
|
||||||
|
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.Nav_Parent?.NAME;
|
||||||
|
completion.SHOP_DEPARTMENT_ID = departInfo?.PARENT_ID;
|
||||||
|
completion.SHOP_DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
|
||||||
|
completion.TEAM_ID = departInfo.ID;
|
||||||
|
completion.TEAM_NAME = departInfo.NAME;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
completions.Add(completion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
T_FM_DEPARTMENT_COMPLETION completion = new T_FM_DEPARTMENT_COMPLETION();
|
||||||
|
completion.MONTH = i;
|
||||||
|
completion.MONTHStr = i.Year + "年" + i.Month + "月";
|
||||||
|
completion.TOTAL_COUNT = 0;
|
||||||
|
completion.WAITTING_COUNT = 0;
|
||||||
|
completion.FINISH_COUNT = 0;
|
||||||
|
completion.ONTIME_COUNT = 0;
|
||||||
|
completion.OVERTIME_COUNT = 0;
|
||||||
|
completion.FORM_NAME = "班组安全活动记录";
|
||||||
|
completion.ORG_ID = filter.GetOrgId();
|
||||||
|
completion.START_TIME = i;
|
||||||
|
completion.END_TIME = monthEnd;
|
||||||
completions.Add(completion);
|
completions.Add(completion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -888,6 +1016,7 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
|
|
||||||
List<T_FM_WORK_TICKET_COMPLETION> completions = new List<T_FM_WORK_TICKET_COMPLETION>();
|
List<T_FM_WORK_TICKET_COMPLETION> completions = new List<T_FM_WORK_TICKET_COMPLETION>();
|
||||||
BaseFilter baseFilter = new BaseFilter(filter.GetOrgId());
|
BaseFilter baseFilter = new BaseFilter(filter.GetOrgId());
|
||||||
|
baseFilter.IgnoreDataRule = true;
|
||||||
var startTime = Convert.ToDateTime(DateTime.Now.AddMonths(-11).Year + "-" + DateTime.Now.AddMonths(-11).Month + "-01 00:00:00");
|
var startTime = Convert.ToDateTime(DateTime.Now.AddMonths(-11).Year + "-" + DateTime.Now.AddMonths(-11).Month + "-01 00:00:00");
|
||||||
var endTime = Convert.ToDateTime(DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + " 23:59:59");
|
var endTime = Convert.ToDateTime(DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + " 23:59:59");
|
||||||
baseFilter.SelectField = new string[] { "ID", "NAME", "DEPARTMENT_TYPE", "Nav_Parent.NAME", "Nav_Parent.Nav_Parent", "PARENT_ID" };
|
baseFilter.SelectField = new string[] { "ID", "NAME", "DEPARTMENT_TYPE", "Nav_Parent.NAME", "Nav_Parent.Nav_Parent", "PARENT_ID" };
|
||||||
@ -948,6 +1077,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
onTimeCount = group.Where(i => i.IS_OVERTIME == 0 && i.IS_PUBLISH == 5).Count(),
|
onTimeCount = group.Where(i => i.IS_OVERTIME == 0 && i.IS_PUBLISH == 5).Count(),
|
||||||
overFinishCount = group.Where(i => i.IS_OVERTIME == 1 && i.IS_PUBLISH == 5).Count()
|
overFinishCount = group.Where(i => i.IS_OVERTIME == 1 && i.IS_PUBLISH == 5).Count()
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
if (results.Any())
|
||||||
|
{
|
||||||
foreach (var item in results)
|
foreach (var item in results)
|
||||||
{
|
{
|
||||||
T_FM_WORK_TICKET_COMPLETION completion = new T_FM_WORK_TICKET_COMPLETION();
|
T_FM_WORK_TICKET_COMPLETION completion = new T_FM_WORK_TICKET_COMPLETION();
|
||||||
@ -989,6 +1120,22 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
completions.Add(completion);
|
completions.Add(completion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
T_FM_WORK_TICKET_COMPLETION completion = new T_FM_WORK_TICKET_COMPLETION();
|
||||||
|
completion.MONTH = i;
|
||||||
|
completion.MONTHStr = i.Year + "年" + i.Month + "月";
|
||||||
|
completion.TOTAL_COUNT = 0;
|
||||||
|
completion.FINISH_COUNT = 0;
|
||||||
|
completion.OVER_FINISH_COUNT = 0;
|
||||||
|
completion.WAITTING_COUNT =0;
|
||||||
|
completion.ONTIME_COUNT = 0;
|
||||||
|
completion.ORG_ID = filter.GetOrgId();
|
||||||
|
completion.START_TIME = i;
|
||||||
|
completion.END_TIME = monthEnd;
|
||||||
|
completions.Add(completion);
|
||||||
|
}
|
||||||
|
}
|
||||||
this.UnifiedCommit(() =>
|
this.UnifiedCommit(() =>
|
||||||
{
|
{
|
||||||
if (completions.Any() && completions.Count > 0)
|
if (completions.Any() && completions.Count > 0)
|
||||||
|
|||||||
@ -759,13 +759,22 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
riskFilter.SelectField = new string[] { "EVALUATE_LEVEL", "CREATE_TIME", "PRODUCTION_UNIT_ID", "TYPE_ID", "AREA_ID", "ID" };
|
riskFilter.SelectField = new string[] { "EVALUATE_LEVEL", "CREATE_TIME", "PRODUCTION_UNIT_ID", "TYPE_ID", "AREA_ID", "ID" };
|
||||||
IEnumerable<T_SK_ENTERPRISE_LIBRARY> allrisk = null;
|
IEnumerable<T_SK_ENTERPRISE_LIBRARY> allrisk = null;
|
||||||
allrisk = GetEntities<T_SK_ENTERPRISE_LIBRARY>(t => t.ENABLE_STATUS == 0 && t.PRODUCTION_UNIT_ID != null, riskFilter);
|
allrisk = GetEntities<T_SK_ENTERPRISE_LIBRARY>(t => t.ENABLE_STATUS == 0 && t.PRODUCTION_UNIT_ID != null, riskFilter);
|
||||||
|
var libTempIds = allrisk.Select(t => t.ID);
|
||||||
|
var details = GetEntities<T_SK_ENTERPRISE_LIBRARY_DETAIL>(t => libTempIds.Contains(t.ENTERPRISE_LIBRARY_ID), new BaseFilter(filter.GetOrgId()));
|
||||||
|
//var departs = GetEntities<T_SK_ENTERPRISE_LIBRARY_DEPART>(t => libIds.Contains(t.ENTERPRISE_LIBRARY_ID), new BaseFilter(filter.GetOrgId()));
|
||||||
|
//var depIds = departs.Select(t=>t.DEPARTMENT_ID).Distinct();
|
||||||
|
var libDetailIds = allrisk.Select(t => t.ID);
|
||||||
|
var detailContents = GetEntities<T_SK_ENTERPRISE_LIBRARY_DETAIL_CONTENT>(t => libDetailIds.Contains(t.ENTERPRISE_LIBRARY_DETAIL_ID), new BaseFilter(filter.GetOrgId()));
|
||||||
|
var libDetailContentIds = detailContents.Select(t => t.ID);
|
||||||
|
var detailContentChecks = GetEntities<T_SK_ENTERPRISE_LIBRARY_DETAIL_CONTENT_DEPART>(t => libDetailContentIds.Contains(t.ENTERPRISE_LIBRARY_DETAIL_CONTENT_ID), new BaseFilter(filter.GetOrgId()));
|
||||||
|
var checkIds = detailContentChecks.Select(t => t.CHECK_TYPE_ID).Distinct();
|
||||||
var hazardFilter = new BaseFilter(filter.GetOrgId());
|
var hazardFilter = new BaseFilter(filter.GetOrgId());
|
||||||
riskPerformanceData riskPerformanceData = new riskPerformanceData();
|
riskPerformanceData riskPerformanceData = new riskPerformanceData();
|
||||||
List<dateCountModel> item3s = new List<dateCountModel>();
|
List<dateCountModel> item3s = new List<dateCountModel>();
|
||||||
var distinctType = GetEntities<T_SK_RISK_TYPE>(t => t.IS_DELETED == false, new BaseFilter(filter.GetOrgId()));
|
var distinctType = GetEntities<T_SK_RISK_TYPE>(t => checkIds.Contains(t.ID), new BaseFilter(filter.GetOrgId()));
|
||||||
var departments = GetEntities<T_FM_DEPARTMENT>(t => t.ENABLE_STATUS == 0, new BaseFilter(filter.GetOrgId()));
|
var departments = GetEntities<T_FM_DEPARTMENT>(t => t.ENABLE_STATUS == 0, new BaseFilter(filter.GetOrgId()));
|
||||||
var distinctArea = GetEntities<T_SK_RISK_AREA>(t => t.IS_DELETED == false, new BaseFilter(filter.GetOrgId()));
|
var distinctArea = GetEntities<T_SK_RISK_AREA>(t => t.IS_DELETED == false, new BaseFilter(filter.GetOrgId()));
|
||||||
var distinctTeamDepartment = GetEntities<T_FM_DEPARTMENT>(t => t.DEPARTMENT_TYPE == 20, new BaseFilter(filter.GetOrgId()));
|
var distinctTeamDepartment = departments.Where(t => t.DEPARTMENT_TYPE == 20);
|
||||||
#region 1
|
#region 1
|
||||||
PerformanceModel CHARTFXDJ1 = new PerformanceModel();
|
PerformanceModel CHARTFXDJ1 = new PerformanceModel();
|
||||||
CHARTFXDJ1.NAME = new List<string> { "重大风险", "较大风险", "一般风险", "低风险" };
|
CHARTFXDJ1.NAME = new List<string> { "重大风险", "较大风险", "一般风险", "低风险" };
|
||||||
|
|||||||
@ -9,11 +9,14 @@ using APT.MS.Domain.Entities.BI;
|
|||||||
using APT.MS.Domain.Entities.HM;
|
using APT.MS.Domain.Entities.HM;
|
||||||
using APT.MS.Domain.Entities.SC.BI;
|
using APT.MS.Domain.Entities.SC.BI;
|
||||||
using APT.MS.Domain.Entities.SK;
|
using APT.MS.Domain.Entities.SK;
|
||||||
|
using APT.MS.Domain.Enums;
|
||||||
using APT.MS.Domain.Enums.SK;
|
using APT.MS.Domain.Enums.SK;
|
||||||
using APT.SC.WebApi.Controllers.Api.BIController;
|
using APT.SC.WebApi.Controllers.Api.BIController;
|
||||||
using APT.Utility;
|
using APT.Utility;
|
||||||
using log4net.Core;
|
using log4net.Core;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using NPOI.POIFS.Properties;
|
||||||
|
using NPOI.SS.Formula.Functions;
|
||||||
using Org.BouncyCastle.Utilities;
|
using Org.BouncyCastle.Utilities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -1514,7 +1517,8 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
var checkIds = hiddens.Select(t => t.CHECK_TYPE_ID).Distinct().ToList();
|
var checkNotices = GetEntities<T_SK_SECURITY_INSPECTION_NOTICE>(e => e.APPLY_DEPARTMENT_ID.HasValue && e.CREATE_TIME.HasValue && e.CREATE_TIME.Value.Year == dtNow.Year && e.Nav_CheckType!=null && !e.Nav_CheckType.NAME.Contains("岗位排查"), newFilter);
|
||||||
|
var checkIds = checkNotices.Select(t => t.CHECK_TYPE_ID).Distinct().ToList();
|
||||||
//var loginDepart = this.GetEntity<T_FM_DEPARTMENT>(t => t.ID == APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID);
|
//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, "Nav_ProductionUnit").ToList();
|
var listCheckType = GetEntities<MS.Domain.Entities.SK.T_SK_CHECK_TYPE>(e => checkIds.Contains(e.ID), null, "Nav_ProductionUnit").ToList();
|
||||||
//if (loginDepart != null)
|
//if (loginDepart != null)
|
||||||
@ -1562,7 +1566,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
{
|
{
|
||||||
monthEnd = dtNow;
|
monthEnd = dtNow;
|
||||||
}
|
}
|
||||||
var listPerChearch = hiddens.Where(t => t.CREATE_TIME >= monthStart && t.CREATE_TIME <= monthEnd);
|
var listPerChearch = checkNotices.Where(t => t.CREATE_TIME >= monthStart && t.CREATE_TIME <= monthEnd);
|
||||||
HomeSafeCheckCountMonth modelper = new HomeSafeCheckCountMonth();
|
HomeSafeCheckCountMonth modelper = new HomeSafeCheckCountMonth();
|
||||||
modelper.Total = listPerChearch.Count();
|
modelper.Total = listPerChearch.Count();
|
||||||
modelper.listSOURCENAME = listCheckTypeNAME;
|
modelper.listSOURCENAME = listCheckTypeNAME;
|
||||||
@ -2160,7 +2164,6 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
|
|
||||||
//BSCorrectType
|
//BSCorrectType
|
||||||
List<EnumsResult> enums = DataHelper.GetEnum("BSCorrectType");
|
List<EnumsResult> enums = DataHelper.GetEnum("BSCorrectType");
|
||||||
|
|
||||||
List<string> listName = new List<string>();
|
List<string> listName = new List<string>();
|
||||||
List<int> listVal = new List<int>();
|
List<int> listVal = new List<int>();
|
||||||
foreach (var item in enums)
|
foreach (var item in enums)
|
||||||
@ -2342,15 +2345,15 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
var newFilter = new BaseFilter(orgId);
|
var newFilter = new BaseFilter(orgId);
|
||||||
newFilter.IgnoreDataRule = true;
|
newFilter.IgnoreDataRule = true;
|
||||||
var startTime = dtNow.AddMonths(-11);
|
var startTime = dtNow.AddMonths(-11);
|
||||||
var hiddens = GetEntities<T_SK_HIDDEN_DANGER_RECTIFY_RECORD>(e => e.APPLY_DEPARTMENT_ID.HasValue && e.CREATE_TIME.HasValue && e.CREATE_TIME >= startTime, newFilter);
|
var checkNotices = GetEntities<T_SK_SECURITY_INSPECTION_NOTICE>(e => e.APPLY_DEPARTMENT_ID.HasValue && e.CREATE_TIME.HasValue && e.CREATE_TIME >= startTime && e.Nav_CheckType!=null && !e.Nav_CheckType.NAME.Contains("岗位排查"), newFilter);
|
||||||
|
var noticeIds = checkNotices.Select(t => t.ID).ToList();
|
||||||
|
var checkRecords = GetEntities<T_SK_SECURITY_INSPECTION_RECORD>(e => e.SECURITY_INSPECTION_NOTICE_ID.HasValue && noticeIds.Contains((Guid)e.SECURITY_INSPECTION_NOTICE_ID), newFilter);
|
||||||
var currentTime = Convert.ToDateTime(startTime.Year + "-" + startTime.Month + "-01 00:00:00");
|
var currentTime = Convert.ToDateTime(startTime.Year + "-" + startTime.Month + "-01 00:00:00");
|
||||||
List<HomeSafeCheckCountMonth> ListSafeCheckYearMonth = new List<HomeSafeCheckCountMonth>();
|
List<HomeSafeCheckCountMonth> ListSafeCheckYearMonth = new List<HomeSafeCheckCountMonth>();
|
||||||
//int befoMonth = 11;//计算 12 个月 就是提前 11个月
|
//int befoMonth = 11;//计算 12 个月 就是提前 11个月
|
||||||
//List<T_BI_HOME_BSRISKREASON> ListSafeCheckYearMonthT = BIHomeService.GetHomeCheckCountMonth(filter.OrgId, listDep1MineType.ToList(), befoMonth).ToList();
|
//List<T_BI_HOME_BSRISKREASON> ListSafeCheckYearMonthT = BIHomeService.GetHomeCheckCountMonth(filter.OrgId, listDep1MineType.ToList(), befoMonth).ToList();
|
||||||
|
|
||||||
var listCheckTypeIDT = hiddens.Select(e => e.CHECK_TYPE_ID).Distinct().ToList();
|
var listCheckTypeIDT = checkNotices.Select(e => e.CHECK_TYPE_ID).Distinct().ToList();
|
||||||
//if (enums == null)
|
//if (enums == null)
|
||||||
//{
|
//{
|
||||||
// enums = GetEntity<T_FM_ENUMS>(e => e.VALUE == MineType && e.CODE == "BSMineTypeEnum");
|
// enums = GetEntity<T_FM_ENUMS>(e => e.VALUE == MineType && e.CODE == "BSMineTypeEnum");
|
||||||
@ -2421,7 +2424,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
{
|
{
|
||||||
monthEnd = dtNow;
|
monthEnd = dtNow;
|
||||||
}
|
}
|
||||||
var listPerChearch = hiddens.Where(t => t.CREATE_TIME >= monthStart && t.CREATE_TIME <= monthEnd);
|
var listPerChearch = checkNotices.Where(t => t.CREATE_TIME >= monthStart && t.CREATE_TIME <= monthEnd);
|
||||||
HomeSafeCheckCountMonth modelper = new HomeSafeCheckCountMonth();
|
HomeSafeCheckCountMonth modelper = new HomeSafeCheckCountMonth();
|
||||||
modelper.Total = listPerChearch.Count();
|
modelper.Total = listPerChearch.Count();
|
||||||
modelper.listSOURCENAME = listCheckTypeNAME;
|
modelper.listSOURCENAME = listCheckTypeNAME;
|
||||||
@ -2461,65 +2464,41 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
|
|
||||||
List<DetailSafeCheckCountDepartment> listCheckDepCountCJ = new List<DetailSafeCheckCountDepartment>();
|
List<DetailSafeCheckCountDepartment> listCheckDepCountCJ = new List<DetailSafeCheckCountDepartment>();
|
||||||
List<DetailSafeCheckCountDepartment> listCheckDepCountBZ = new List<DetailSafeCheckCountDepartment>();
|
List<DetailSafeCheckCountDepartment> listCheckDepCountBZ = new List<DetailSafeCheckCountDepartment>();
|
||||||
List<string> listName = new List<string>() { "按时整改隐患", "超期整改隐患", "未整改隐患", "隐患整改率" };
|
List<string> listName = new List<string>() { "计划检查次数", "实际检查次数" };
|
||||||
List<int> listCheckTypeCount = null;
|
List<int> listCheckTypeCount = null;
|
||||||
DetailSafeCheckCountDepartment modelCountDep = null;
|
DetailSafeCheckCountDepartment modelCountDep = null;
|
||||||
int checkTypeCount = listCheckTypeID.Count;
|
int checkTypeCount = listCheckTypeID.Count;
|
||||||
foreach (var item in listDepCJ)
|
foreach (var item in listDepCJ)
|
||||||
|
{
|
||||||
|
var parentIds = listDepBZ.Where(e => e.PARENT_ID.HasValue && e.PARENT_ID.Value == item.ID).Select(t => t.ID).ToList();
|
||||||
|
var alls = checkNotices.Where(t => t.APPLY_DEPARTMENT_ID == item.ID || parentIds.Contains((Guid)t.APPLY_DEPARTMENT_ID)).ToList();
|
||||||
|
if (alls.Count() > 0)
|
||||||
{
|
{
|
||||||
modelCountDep = new DetailSafeCheckCountDepartment();
|
modelCountDep = new DetailSafeCheckCountDepartment();
|
||||||
modelCountDep.listName = listName;
|
modelCountDep.listName = listName;
|
||||||
modelCountDep.PARENT_ID = item.PARENT_ID.Value;
|
modelCountDep.PARENT_ID = item.PARENT_ID.Value;
|
||||||
modelCountDep.Department_ID = item.ID;
|
modelCountDep.Department_ID = item.ID;
|
||||||
modelCountDep.NUM = item.NUM;
|
modelCountDep.NUM = item.NUM;
|
||||||
modelCountDep.RowCount = listDepBZ.Where(e => e.PARENT_ID.HasValue && e.PARENT_ID.Value == item.ID).Count();
|
//modelCountDep.RowCount = listDepBZ.Where(e => e.PARENT_ID.HasValue && e.PARENT_ID.Value == item.ID).Count();
|
||||||
modelCountDep.DepartmentName = item.NAME;
|
modelCountDep.DepartmentName = item.NAME;
|
||||||
modelCountDep.DepartmentType = item.DEPARTMENT_TYPE;
|
modelCountDep.DepartmentType = item.DEPARTMENT_TYPE;
|
||||||
listCheckTypeCount = new List<int>();
|
listCheckTypeCount = new List<int>();
|
||||||
var alls = hiddens.Where(t => t.APPLY_DEPARTMENT_ID == item.ID);
|
|
||||||
var onTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE <= t.RECITIFY_TIME);
|
|
||||||
if (onTimes.Any())
|
|
||||||
{
|
|
||||||
listCheckTypeCount.Add(onTimes.Count());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
listCheckTypeCount.Add(0);
|
|
||||||
}
|
|
||||||
var overTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE > t.RECITIFY_TIME);
|
|
||||||
if (overTimes.Any())
|
|
||||||
{
|
|
||||||
listCheckTypeCount.Add(overTimes.Count());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
listCheckTypeCount.Add(0);
|
|
||||||
}
|
|
||||||
var noTimes = alls.Where(t => t.STATUS != BaseData.Domain.Enums.PF.PFStandardStatus.Archived);
|
|
||||||
if (noTimes.Any())
|
|
||||||
{
|
|
||||||
listCheckTypeCount.Add(noTimes.Count());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
listCheckTypeCount.Add(0);
|
|
||||||
}
|
|
||||||
if (alls.Any())
|
|
||||||
{
|
|
||||||
var val = onTimes.Count() + overTimes.Count();
|
|
||||||
var count = alls.Count();
|
var count = alls.Count();
|
||||||
var rate = count == 0 ? 0 : (int)(100.00 * val / count);
|
listCheckTypeCount.Add(count);
|
||||||
listCheckTypeCount.Add(rate);
|
var ids = alls.Select(t => t.ID).ToList();
|
||||||
}
|
var countAct = checkRecords.Count(t => ids.Contains((Guid)t.SECURITY_INSPECTION_NOTICE_ID));
|
||||||
else
|
listCheckTypeCount.Add(countAct);
|
||||||
{
|
|
||||||
listCheckTypeCount.Add(100);
|
|
||||||
}
|
|
||||||
modelCountDep.listCount = listCheckTypeCount;
|
modelCountDep.listCount = listCheckTypeCount;
|
||||||
listCheckDepCountCJ.Add(modelCountDep);
|
listCheckDepCountCJ.Add(modelCountDep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var item in listDepBZ)
|
foreach (var item in listDepBZ)
|
||||||
|
{
|
||||||
|
var alls = checkNotices.Where(t => t.APPLY_DEPARTMENT_ID == item.ID).ToList();
|
||||||
|
var count = alls.Count();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
modelCountDep = new DetailSafeCheckCountDepartment();
|
modelCountDep = new DetailSafeCheckCountDepartment();
|
||||||
modelCountDep.listName = listName;
|
modelCountDep.listName = listName;
|
||||||
@ -2530,53 +2509,20 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
modelCountDep.DepartmentName = item.NAME;
|
modelCountDep.DepartmentName = item.NAME;
|
||||||
modelCountDep.DepartmentType = item.DEPARTMENT_TYPE;
|
modelCountDep.DepartmentType = item.DEPARTMENT_TYPE;
|
||||||
listCheckTypeCount = new List<int>();
|
listCheckTypeCount = new List<int>();
|
||||||
var alls = hiddens.Where(t => t.APPLY_DEPARTMENT_ID == item.ID);
|
listCheckTypeCount.Add(count);
|
||||||
var onTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE <= t.RECITIFY_TIME);
|
var ids = alls.Select(t => t.ID).ToList();
|
||||||
if (onTimes.Any())
|
var countAct = checkRecords.Count(t => ids.Contains((Guid)t.SECURITY_INSPECTION_NOTICE_ID));
|
||||||
{
|
listCheckTypeCount.Add(countAct);
|
||||||
listCheckTypeCount.Add(onTimes.Count());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
listCheckTypeCount.Add(0);
|
|
||||||
}
|
|
||||||
var overTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE > t.RECITIFY_TIME);
|
|
||||||
if (overTimes.Any())
|
|
||||||
{
|
|
||||||
listCheckTypeCount.Add(overTimes.Count());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
listCheckTypeCount.Add(0);
|
|
||||||
}
|
|
||||||
var noTimes = alls.Where(t => t.STATUS != BaseData.Domain.Enums.PF.PFStandardStatus.Archived);
|
|
||||||
if (noTimes.Any())
|
|
||||||
{
|
|
||||||
listCheckTypeCount.Add(noTimes.Count());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
listCheckTypeCount.Add(0);
|
|
||||||
}
|
|
||||||
if (alls.Any())
|
|
||||||
{
|
|
||||||
var val = onTimes.Count() + overTimes.Count();
|
|
||||||
var count = alls.Count();
|
|
||||||
var rate = count == 0 ? 0 : (int)(100.00 * val / count);
|
|
||||||
listCheckTypeCount.Add(rate);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
listCheckTypeCount.Add(100);
|
|
||||||
}
|
|
||||||
modelCountDep.listCount = listCheckTypeCount;
|
modelCountDep.listCount = listCheckTypeCount;
|
||||||
listCheckDepCountBZ.Add(modelCountDep);
|
listCheckDepCountBZ.Add(modelCountDep);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//result.ListSafeCheckCountDepartmentBZ = listCheckDepCountBZ;
|
//result.ListSafeCheckCountDepartmentBZ = listCheckDepCountBZ;
|
||||||
foreach (var item in listCheckDepCountCJ)
|
foreach (var item in listCheckDepCountCJ)
|
||||||
{
|
{
|
||||||
item.listChild = listCheckDepCountBZ.Where(e => e.PARENT_ID == item.Department_ID).OrderBy(e => e.NUM).ToList();
|
item.listChild = listCheckDepCountBZ.Where(e => e.PARENT_ID == item.Department_ID).OrderBy(e => e.NUM).ToList();
|
||||||
|
item.RowCount = item.listChild.Count();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -2825,17 +2771,22 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
int Percent = 3;//第4项 是辈分比
|
int Percent = 3;//第4项 是辈分比
|
||||||
int All = 0;
|
int All = 0;
|
||||||
foreach (var item in listDepCJ)
|
foreach (var item in listDepCJ)
|
||||||
|
{
|
||||||
|
var classIds = listDepBZ.Where(e => e.PARENT_ID.HasValue && e.PARENT_ID.Value == item.ID).Select(t => t.ID);
|
||||||
|
var alls = hiddens.Where(t => t.APPLY_DEPARTMENT_ID == item.ID || classIds.Contains((Guid)t.APPLY_DEPARTMENT_ID));
|
||||||
|
if (alls.Count() > 0)
|
||||||
{
|
{
|
||||||
modelCountDep = new DetailSafeCheckCountDepartment();
|
modelCountDep = new DetailSafeCheckCountDepartment();
|
||||||
modelCountDep.listName = listName;
|
modelCountDep.listName = listName;
|
||||||
modelCountDep.PARENT_ID = item.PARENT_ID.Value;
|
modelCountDep.PARENT_ID = item.PARENT_ID.Value;
|
||||||
modelCountDep.Department_ID = item.ID;
|
modelCountDep.Department_ID = item.ID;
|
||||||
modelCountDep.NUM = item.NUM;
|
modelCountDep.NUM = item.NUM;
|
||||||
modelCountDep.RowCount = listDepBZ.Where(e => e.PARENT_ID.HasValue && e.PARENT_ID.Value == item.ID).Count();
|
//modelCountDep.RowCount = listDepBZ.Where(e => e.PARENT_ID.HasValue && e.PARENT_ID.Value == item.ID).Count();
|
||||||
modelCountDep.DepartmentName = item.NAME;
|
modelCountDep.DepartmentName = item.NAME;
|
||||||
modelCountDep.DepartmentType = item.DEPARTMENT_TYPE;
|
modelCountDep.DepartmentType = item.DEPARTMENT_TYPE;
|
||||||
listCheckTypeCount = new List<int>();
|
listCheckTypeCount = new List<int>();
|
||||||
var alls = hiddens.Where(t => t.APPLY_DEPARTMENT_ID == item.ID);
|
|
||||||
|
modelCountDep.TotalCount = alls.Count();
|
||||||
var onTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE <= t.RECITIFY_TIME);
|
var onTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE <= t.RECITIFY_TIME);
|
||||||
if (onTimes.Any())
|
if (onTimes.Any())
|
||||||
{
|
{
|
||||||
@ -2845,6 +2796,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
{
|
{
|
||||||
listCheckTypeCount.Add(0);
|
listCheckTypeCount.Add(0);
|
||||||
}
|
}
|
||||||
|
modelCountDep.OnCount = onTimes.Count();
|
||||||
var overTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE > t.RECITIFY_TIME);
|
var overTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE > t.RECITIFY_TIME);
|
||||||
if (overTimes.Any())
|
if (overTimes.Any())
|
||||||
{
|
{
|
||||||
@ -2854,6 +2806,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
{
|
{
|
||||||
listCheckTypeCount.Add(0);
|
listCheckTypeCount.Add(0);
|
||||||
}
|
}
|
||||||
|
modelCountDep.OverCount = overTimes.Count();
|
||||||
var noTimes = alls.Where(t => t.STATUS != BaseData.Domain.Enums.PF.PFStandardStatus.Archived);
|
var noTimes = alls.Where(t => t.STATUS != BaseData.Domain.Enums.PF.PFStandardStatus.Archived);
|
||||||
if (noTimes.Any())
|
if (noTimes.Any())
|
||||||
{
|
{
|
||||||
@ -2863,6 +2816,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
{
|
{
|
||||||
listCheckTypeCount.Add(0);
|
listCheckTypeCount.Add(0);
|
||||||
}
|
}
|
||||||
|
modelCountDep.NoCount = noTimes.Count();
|
||||||
if (alls.Any())
|
if (alls.Any())
|
||||||
{
|
{
|
||||||
var val = onTimes.Count() + overTimes.Count();
|
var val = onTimes.Count() + overTimes.Count();
|
||||||
@ -2878,7 +2832,14 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
listCheckDepCountCJ.Add(modelCountDep);
|
listCheckDepCountCJ.Add(modelCountDep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//listCheckDepCountCJ = listCheckDepCountCJ.Where(t => t.TotalCount != 0).ToList();
|
||||||
|
var departIds = listCheckDepCountCJ.Select(t => t.Department_ID).Distinct().ToList();
|
||||||
|
listDepBZ = listDepBZ.Where(t => t.PARENT_ID != null && departIds.Contains((Guid)t.PARENT_ID)).ToList();
|
||||||
foreach (var item in listDepBZ)
|
foreach (var item in listDepBZ)
|
||||||
|
{
|
||||||
|
var alls = hiddens.Where(t => t.APPLY_DEPARTMENT_ID == item.ID);
|
||||||
|
if (alls.Count() > 0)
|
||||||
{
|
{
|
||||||
modelCountDep = new DetailSafeCheckCountDepartment();
|
modelCountDep = new DetailSafeCheckCountDepartment();
|
||||||
modelCountDep.listName = listName;
|
modelCountDep.listName = listName;
|
||||||
@ -2889,7 +2850,8 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
modelCountDep.DepartmentName = item.NAME;
|
modelCountDep.DepartmentName = item.NAME;
|
||||||
modelCountDep.DepartmentType = item.DEPARTMENT_TYPE;
|
modelCountDep.DepartmentType = item.DEPARTMENT_TYPE;
|
||||||
listCheckTypeCount = new List<int>();
|
listCheckTypeCount = new List<int>();
|
||||||
var alls = hiddens.Where(t => t.APPLY_DEPARTMENT_ID == item.ID);
|
|
||||||
|
modelCountDep.TotalCount = alls.Count();
|
||||||
var onTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE <= t.RECITIFY_TIME);
|
var onTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE <= t.RECITIFY_TIME);
|
||||||
if (onTimes.Any())
|
if (onTimes.Any())
|
||||||
{
|
{
|
||||||
@ -2899,6 +2861,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
{
|
{
|
||||||
listCheckTypeCount.Add(0);
|
listCheckTypeCount.Add(0);
|
||||||
}
|
}
|
||||||
|
modelCountDep.OnCount = onTimes.Count();
|
||||||
var overTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE > t.RECITIFY_TIME);
|
var overTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE > t.RECITIFY_TIME);
|
||||||
if (overTimes.Any())
|
if (overTimes.Any())
|
||||||
{
|
{
|
||||||
@ -2908,6 +2871,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
{
|
{
|
||||||
listCheckTypeCount.Add(0);
|
listCheckTypeCount.Add(0);
|
||||||
}
|
}
|
||||||
|
modelCountDep.OverCount = overTimes.Count();
|
||||||
var noTimes = alls.Where(t => t.STATUS != BaseData.Domain.Enums.PF.PFStandardStatus.Archived);
|
var noTimes = alls.Where(t => t.STATUS != BaseData.Domain.Enums.PF.PFStandardStatus.Archived);
|
||||||
if (noTimes.Any())
|
if (noTimes.Any())
|
||||||
{
|
{
|
||||||
@ -2917,6 +2881,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
{
|
{
|
||||||
listCheckTypeCount.Add(0);
|
listCheckTypeCount.Add(0);
|
||||||
}
|
}
|
||||||
|
modelCountDep.NoCount = noTimes.Count();
|
||||||
if (alls.Any())
|
if (alls.Any())
|
||||||
{
|
{
|
||||||
var val = onTimes.Count() + overTimes.Count();
|
var val = onTimes.Count() + overTimes.Count();
|
||||||
@ -2931,10 +2896,23 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
modelCountDep.listCount = listCheckTypeCount;
|
modelCountDep.listCount = listCheckTypeCount;
|
||||||
listCheckDepCountBZ.Add(modelCountDep);
|
listCheckDepCountBZ.Add(modelCountDep);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//listCheckDepCountBZ = listCheckDepCountBZ.Where(t => t.TotalCount != 0).ToList();
|
||||||
foreach (var item in listCheckDepCountCJ)
|
foreach (var item in listCheckDepCountCJ)
|
||||||
{
|
{
|
||||||
item.listChild = listCheckDepCountBZ.Where(e => e.PARENT_ID == item.Department_ID).OrderBy(e => e.NUM).ToList();
|
item.listChild = listCheckDepCountBZ.Where(e => e.PARENT_ID == item.Department_ID).OrderBy(e => e.NUM).ToList();
|
||||||
|
item.listCount = new List<int>();
|
||||||
|
var onTime = item.listChild.Sum(t => t.OnCount) + item.OnCount;
|
||||||
|
item.listCount.Add(onTime);
|
||||||
|
var overTime = item.listChild.Sum(t => t.OverCount) + item.OverCount;
|
||||||
|
item.listCount.Add(overTime);
|
||||||
|
var noTime = item.listChild.Sum(t => t.NoCount) + item.NoCount;
|
||||||
|
item.listCount.Add(noTime);
|
||||||
|
var val = onTime + overTime;
|
||||||
|
var count = item.TotalCount;
|
||||||
|
var rate = count == 0 ? 0 : (int)(10000.00 * val / count);
|
||||||
|
item.listCount.Add(rate);
|
||||||
|
item.RowCount = item.listChild.Count();
|
||||||
}
|
}
|
||||||
|
|
||||||
//result.ListSafeCheckYearMonth = listCheckDepCountCJ;
|
//result.ListSafeCheckYearMonth = listCheckDepCountCJ;
|
||||||
@ -3351,7 +3329,22 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
/// 父项
|
/// 父项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DetailSafeCheckCountDepartment Parent { get; set; }
|
public DetailSafeCheckCountDepartment Parent { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 总数
|
||||||
|
/// </summary>
|
||||||
|
public int TotalCount { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 总数
|
||||||
|
/// </summary>
|
||||||
|
public int OnCount { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 总数
|
||||||
|
/// </summary>
|
||||||
|
public int OverCount { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 总数
|
||||||
|
/// </summary>
|
||||||
|
public int NoCount { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -27,6 +27,7 @@ using APT.MS.Domain.Entities.SC.SC;
|
|||||||
using APT.MS.Domain.Entities.SE;
|
using APT.MS.Domain.Entities.SE;
|
||||||
using APT.MS.Domain.Enums;
|
using APT.MS.Domain.Enums;
|
||||||
using APT.MS.Domain.Enums.SK;
|
using APT.MS.Domain.Enums.SK;
|
||||||
|
using APT.SC.WebApi.Controllers.Api.BI;
|
||||||
using APT.Utility;
|
using APT.Utility;
|
||||||
using Castle.Core.Internal;
|
using Castle.Core.Internal;
|
||||||
using ICSharpCode.SharpZipLib.Core;
|
using ICSharpCode.SharpZipLib.Core;
|
||||||
@ -123,6 +124,7 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
|||||||
public int shopOntimeCount { get; set; }
|
public int shopOntimeCount { get; set; }
|
||||||
public double shopDoneRate { get; set; }
|
public double shopDoneRate { get; set; }
|
||||||
public double shopOverDoneRate { get; set; }
|
public double shopOverDoneRate { get; set; }
|
||||||
|
public int shopUndoneCount { get; set; }
|
||||||
public Guid? teamId { get; set; }
|
public Guid? teamId { get; set; }
|
||||||
public string teamName { get; set; }
|
public string teamName { get; set; }
|
||||||
public int teamTotalCount { get; set; }
|
public int teamTotalCount { get; set; }
|
||||||
@ -9689,9 +9691,10 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
|||||||
departmentIds = departmentInfo.Select(t => t.ID).ToList();
|
departmentIds = departmentInfo.Select(t => t.ID).ToList();
|
||||||
BaseFilter baseFilter = new BaseFilter(orgId);
|
BaseFilter baseFilter = new BaseFilter(orgId);
|
||||||
baseFilter.SelectField = new string[] { "ID", "DEPARTMENT_ID" };
|
baseFilter.SelectField = new string[] { "ID", "DEPARTMENT_ID" };
|
||||||
var teams = GetEntities<T_FM_TEAM>(t => !t.IS_DELETED && departmentIds.Contains(t.DEPARTMENT_ID.Value), baseFilter);
|
//var teams = GetEntities<T_FM_TEAM>(t => !t.IS_DELETED && departmentIds.Contains(t.DEPARTMENT_ID.Value), baseFilter);
|
||||||
var teamIds = teams.Select(t => t.ID);
|
//var teamIds = teams.Select(t => t.ID);
|
||||||
var completions = GetEntities<T_FM_DEPARTMENT_COMPLETION>(t => !t.IS_DELETED, new BaseFilter(orgId)).ToList();
|
var completions = GetEntities<T_FM_DEPARTMENT_COMPLETION>(t => !t.IS_DELETED, new BaseFilter(orgId)).ToList();
|
||||||
|
//var teamIds = completions.Select(t => t.TEAM_ID);
|
||||||
if (!string.IsNullOrEmpty(filter.Parameter2))
|
if (!string.IsNullOrEmpty(filter.Parameter2))
|
||||||
{
|
{
|
||||||
DateTime startTime = Convert.ToDateTime(filter.Parameter2);
|
DateTime startTime = Convert.ToDateTime(filter.Parameter2);
|
||||||
@ -9702,9 +9705,9 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
|||||||
DateTime endTime = Convert.ToDateTime(filter.Parameter3);
|
DateTime endTime = Convert.ToDateTime(filter.Parameter3);
|
||||||
completions = completions.Where(t => t.MONTH <= endTime).ToList();
|
completions = completions.Where(t => t.MONTH <= endTime).ToList();
|
||||||
}
|
}
|
||||||
if (teamIds != null && teamIds.Any())
|
//if (teamIds != null && teamIds.Any())
|
||||||
{
|
{
|
||||||
completionLists = completions.Where(m => m.TEAM_ID != null && teamIds.Contains(m.TEAM_ID.Value)).GroupBy(t => new { t.TEAM_ID, t.TEAM_NAME }).Select(group => new GroupbyDepartmentId
|
completionLists = completions.Where(m => m.TEAM_ID != null).GroupBy(t => new { t.TEAM_ID, t.TEAM_NAME }).Select(group => new GroupbyDepartmentId
|
||||||
{
|
{
|
||||||
departmentId = group.Key.TEAM_ID,
|
departmentId = group.Key.TEAM_ID,
|
||||||
departmentName = group.Key.TEAM_NAME,
|
departmentName = group.Key.TEAM_NAME,
|
||||||
@ -9774,16 +9777,29 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
|||||||
//if (string.IsNullOrEmpty(filter.Keyword))
|
//if (string.IsNullOrEmpty(filter.Keyword))
|
||||||
// return ret;
|
// return ret;
|
||||||
//var departmentInfo = this.GetEntities<T_FM_DEPARTMENT>(t => t.PRODUCTION_UNIT_ID == Guid.Parse(filter.Keyword.ToString()), new BaseFilter(orgId));
|
//var departmentInfo = this.GetEntities<T_FM_DEPARTMENT>(t => t.PRODUCTION_UNIT_ID == Guid.Parse(filter.Keyword.ToString()), new BaseFilter(orgId));
|
||||||
var departmentInfo = this.GetEntities<T_FM_DEPARTMENT>(t => t.ENABLE_STATUS == 0 && t.CATEGORY == FMCATEGORY.ACTURE, new BaseFilter(orgId));
|
var completions = GetEntities<T_FM_DEPARTMENT_COMPLETION>(t => !t.IS_DELETED, new BaseFilter(orgId)).ToList();
|
||||||
|
var deptIds = completions.Where(t => t.DEPARTMENT_ID != null).Select(t => (Guid)t.DEPARTMENT_ID).Distinct().ToList();
|
||||||
|
departmentIds.AddRange(deptIds);
|
||||||
|
var shopIds = completions.Where(t => t.SHOP_DEPARTMENT_ID != null).Select(t => (Guid)t.SHOP_DEPARTMENT_ID).Distinct().ToList();
|
||||||
|
departmentIds.AddRange(shopIds);
|
||||||
|
var classIds = completions.Where(t => t.TEAM_ID != null).Select(t => (Guid)t.TEAM_ID).Distinct().ToList();
|
||||||
|
departmentIds.AddRange(classIds);
|
||||||
|
var departmentInfo = this.GetEntities<T_FM_DEPARTMENT>(t => t.ENABLE_STATUS == 0 && t.CATEGORY == FMCATEGORY.ACTURE, new BaseFilter(orgId), "Nav_Parent");
|
||||||
|
if (departmentIds != null && departmentIds.Any())
|
||||||
|
{
|
||||||
|
departmentInfo = departmentInfo.Where(t => departmentIds.Contains(t.ID)).ToList();
|
||||||
|
}
|
||||||
if (departmentInfo == null || !departmentInfo.Any())
|
if (departmentInfo == null || !departmentInfo.Any())
|
||||||
return ret;
|
return ret;
|
||||||
else
|
else
|
||||||
departmentIds = departmentInfo.Select(t => t.ID).ToList();
|
departmentIds = departmentInfo.Select(t => t.ID).Distinct().ToList();
|
||||||
BaseFilter baseFilter = new BaseFilter(orgId);
|
List<T_FM_DEPARTMENT> listDepBM = new List<T_FM_DEPARTMENT>();
|
||||||
baseFilter.SelectField = new string[] { "ID", "DEPARTMENT_ID" };
|
List<T_FM_DEPARTMENT> listDepCJ = new List<T_FM_DEPARTMENT>();
|
||||||
var teams = GetEntities<T_FM_TEAM>(t => !t.IS_DELETED && departmentIds.Contains(t.DEPARTMENT_ID.Value), baseFilter);
|
List<T_FM_DEPARTMENT> listDepBZ = new List<T_FM_DEPARTMENT>();
|
||||||
var teamIds = teams.Select(t => t.ID);
|
listDepBM = departmentInfo.Where(e => e.DEPARTMENT_TYPE == 10).OrderBy(e => e.NUM).ToList();
|
||||||
var completions = GetEntities<T_FM_DEPARTMENT_COMPLETION>(t => !t.IS_DELETED && t.TEAM_ID != null && teamIds.Contains(t.TEAM_ID.Value), new BaseFilter(orgId)).ToList();
|
listDepCJ = departmentInfo.Where(e => e.DEPARTMENT_TYPE == 15).OrderBy(e => e.NUM).ToList();
|
||||||
|
listDepBZ = departmentInfo.Where(e => e.DEPARTMENT_TYPE == 20).OrderBy(e => e.NUM).ToList();
|
||||||
|
//var completions = GetEntities<T_FM_DEPARTMENT_COMPLETION>(t => !t.IS_DELETED && t.TEAM_ID != null && teamIds.Contains(t.TEAM_ID.Value), new BaseFilter(orgId)).ToList();
|
||||||
if (completions != null && completions.Any())
|
if (completions != null && completions.Any())
|
||||||
{
|
{
|
||||||
completionSorts = completions.GroupBy(t => new { t.MONTH, t.MONTHStr }).Select(group => new T_FM_DEPARTMENT_COMPLETION
|
completionSorts = completions.GroupBy(t => new { t.MONTH, t.MONTHStr }).Select(group => new T_FM_DEPARTMENT_COMPLETION
|
||||||
@ -9794,18 +9810,6 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
|||||||
ONTIME_COUNT = group.Where(i => i.MONTH == group.Key.MONTH).Sum(m => m.ONTIME_COUNT),
|
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),
|
TOTAL_COUNT = group.Where(i => i.MONTH == group.Key.MONTH).Sum(m => m.TOTAL_COUNT),
|
||||||
}).ToList();
|
}).ToList();
|
||||||
completionLists = completions.GroupBy(t => new { t.TEAM_ID, t.TEAM_NAME, t.SHOP_DEPARTMENT_ID, t.SHOP_DEPARTMENT_NAME }).Select(group => new GroupbyDepartmentCompletion
|
|
||||||
{
|
|
||||||
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.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())
|
if (completionSorts != null && completionSorts.Any())
|
||||||
{
|
{
|
||||||
foreach (var item in completionSorts)
|
foreach (var item in completionSorts)
|
||||||
@ -9823,9 +9827,113 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
|||||||
}
|
}
|
||||||
ret.rateData = completionSorts.OrderBy(t => t.MONTH).ToList();
|
ret.rateData = completionSorts.OrderBy(t => t.MONTH).ToList();
|
||||||
}
|
}
|
||||||
|
completionLists = completions.Where(t=>t.TEAM_ID!=null).GroupBy(t => new { t.TEAM_ID, t.TEAM_NAME, t.SHOP_DEPARTMENT_ID, t.SHOP_DEPARTMENT_NAME }).Select(group => new GroupbyDepartmentCompletion
|
||||||
|
{
|
||||||
|
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.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();
|
||||||
|
|
||||||
|
//completionLists = completions.Where(t => t.TEAM_ID != null).GroupBy(t => new { t.TEAM_ID, t.TEAM_NAME }).Select(group => new GroupbyDepartmentCompletion
|
||||||
|
//{
|
||||||
|
// shopId = group.FirstOrDefault(i => i.TEAM_ID == group.Key.TEAM_ID)?.DEPARTMENT_ID,
|
||||||
|
// shopName = group.FirstOrDefault(i => i.TEAM_ID == group.Key.TEAM_ID)?.DEPARTMENT_NAME,
|
||||||
|
// teamId = group.Key.TEAM_ID,
|
||||||
|
// teamName = group.Key.TEAM_NAME,
|
||||||
|
// teamDoneCount = group.Where(i => i.TEAM_ID == group.Key.TEAM_ID).Sum(m => m.FINISH_COUNT),
|
||||||
|
// teamOntimeCount = group.Where(i => i.TEAM_ID == group.Key.TEAM_ID).Sum(m => m.ONTIME_COUNT),
|
||||||
|
// teamUndoneCount = group.Where(i => i.TEAM_ID == group.Key.TEAM_ID).Sum(m => m.WAITTING_COUNT),
|
||||||
|
// teamTotalCount = group.Where(i => i.TEAM_ID == group.Key.TEAM_ID).Sum(m => m.TOTAL_COUNT),
|
||||||
|
//}).ToList();
|
||||||
|
//var shopCompletionLists = completions.Where(t => t.SHOP_DEPARTMENT_ID != null).GroupBy(t => new { t.SHOP_DEPARTMENT_ID, t.SHOP_DEPARTMENT_NAME }).Select(group => new GroupbyDepartmentCompletion
|
||||||
|
//{
|
||||||
|
|
||||||
|
// shopId = group.FirstOrDefault(i => i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID)?.DEPARTMENT_ID,
|
||||||
|
// shopName = group.FirstOrDefault(i => i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID)?.DEPARTMENT_NAME,
|
||||||
|
// teamId = group.Key.SHOP_DEPARTMENT_ID,
|
||||||
|
// teamName = group.Key.SHOP_DEPARTMENT_NAME,
|
||||||
|
// teamDoneCount = group.Where(i => i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID && i.TEAM_ID == null).Sum(m => m.FINISH_COUNT),
|
||||||
|
// teamOntimeCount = group.Where(i => i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID && i.TEAM_ID == null).Sum(m => m.ONTIME_COUNT),
|
||||||
|
// teamUndoneCount = group.Where(i => i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID && i.TEAM_ID == null).Sum(m => m.WAITTING_COUNT),
|
||||||
|
// teamTotalCount = group.Where(i => i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID && i.TEAM_ID == null).Sum(m => m.TOTAL_COUNT),
|
||||||
|
//}).ToList();
|
||||||
|
//completionLists.AddRange(shopCompletionLists);
|
||||||
|
//var deptCompletionLists = completions.Where(t => t.DEPARTMENT_ID != null).GroupBy(t => new { t.DEPARTMENT_ID, t.DEPARTMENT_NAME }).Select(group => new GroupbyDepartmentCompletion
|
||||||
|
//{
|
||||||
|
// shopId = group.Key.DEPARTMENT_ID,
|
||||||
|
// shopName = group.Key.DEPARTMENT_NAME,
|
||||||
|
// teamId = group.Key.DEPARTMENT_ID,
|
||||||
|
// teamName = group.Key.DEPARTMENT_NAME,
|
||||||
|
// shopDoneCount = group.Where(i => i.DEPARTMENT_ID == group.Key.DEPARTMENT_ID).Sum(m => m.FINISH_COUNT),
|
||||||
|
// shopOntimeCount = group.Where(i => i.DEPARTMENT_ID == group.Key.DEPARTMENT_ID).Sum(m => m.ONTIME_COUNT),
|
||||||
|
// shopTotalCount = group.Where(i => i.DEPARTMENT_ID == group.Key.DEPARTMENT_ID).Sum(m => m.TOTAL_COUNT),
|
||||||
|
//}).ToList();
|
||||||
|
//completionLists.AddRange(deptCompletionLists);
|
||||||
|
//foreach (var item in listDepBM)
|
||||||
|
//{
|
||||||
|
// var modelCountDep = new GroupbyDepartmentCompletion();
|
||||||
|
// modelCountDep.shopId = item.ID;
|
||||||
|
// modelCountDep.shopName = item.NAME;
|
||||||
|
// modelCountDep.teamId = item.ID;
|
||||||
|
// modelCountDep.teamName = item.NAME;
|
||||||
|
// modelCountDep.shopDoneCount = completions.Where(e => (e.DEPARTMENT_ID.HasValue && e.DEPARTMENT_ID.Value == item.ID) || (e.SHOP_DEPARTMENT_ID.HasValue && e.SHOP_DEPARTMENT_ID == item.ID)).Sum(m=>m.FINISH_COUNT);
|
||||||
|
// modelCountDep.shopOntimeCount = completions.Where(e => (e.DEPARTMENT_ID.HasValue && e.DEPARTMENT_ID.Value == item.ID) ||(e.SHOP_DEPARTMENT_ID.HasValue && e.SHOP_DEPARTMENT_ID == item.ID)).Sum(m => m.FINISH_COUNT);
|
||||||
|
// modelCountDep.shopTotalCount = completions.Where(e => (e.DEPARTMENT_ID.HasValue && e.DEPARTMENT_ID.Value == item.ID) || (e.SHOP_DEPARTMENT_ID.HasValue && e.SHOP_DEPARTMENT_ID == item.ID)).Sum(m => m.TOTAL_COUNT);
|
||||||
|
// if (modelCountDep.shopTotalCount != 0)
|
||||||
|
// {
|
||||||
|
// completionLists.Add(modelCountDep);
|
||||||
|
// }
|
||||||
|
// completionLists.Add(modelCountDep);
|
||||||
|
// var cjIds = departmentInfo.Where(e => e.PARENT_ID.HasValue && e.PARENT_ID.Value == item.ID).Select(t => t.ID).ToList();
|
||||||
|
// var tempbzIds = departmentInfo.Where(e => e.PARENT_ID.HasValue && cjIds.Contains(e.PARENT_ID.Value)).Select(t => t.ID).ToList();
|
||||||
|
// cjIds.AddRange(tempbzIds);
|
||||||
|
// if (cjIds.Distinct().Any())
|
||||||
|
// {
|
||||||
|
// foreach (var item2 in cjIds)
|
||||||
|
// {
|
||||||
|
// var first = departmentInfo.FirstOrDefault(t => t.ID == item2);
|
||||||
|
// var modelCountDepChild = new GroupbyDepartmentCompletion();
|
||||||
|
// modelCountDepChild.shopId = item.ID;
|
||||||
|
// modelCountDepChild.shopName = item.NAME;
|
||||||
|
// modelCountDepChild.teamId = item2;
|
||||||
|
// modelCountDepChild.teamName = first?.NAME;
|
||||||
|
// if (first.DEPARTMENT_TYPE == 15)
|
||||||
|
// {
|
||||||
|
// modelCountDepChild.teamDoneCount = completions.Where(e => e.SHOP_DEPARTMENT_ID.HasValue && e.SHOP_DEPARTMENT_ID.Value == item2).Sum(m => m.FINISH_COUNT);
|
||||||
|
// modelCountDepChild.teamOntimeCount = completions.Where(e => e.SHOP_DEPARTMENT_ID.HasValue && e.SHOP_DEPARTMENT_ID.Value == item2).Sum(m => m.FINISH_COUNT);
|
||||||
|
// modelCountDepChild.teamTotalCount = completions.Where(e => e.SHOP_DEPARTMENT_ID.HasValue && e.SHOP_DEPARTMENT_ID.Value == item2).Sum(m => m.TOTAL_COUNT);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// modelCountDepChild.teamDoneCount = completions.Where(e => e.TEAM_ID.HasValue && e.TEAM_ID.Value == item2).Sum(m => m.FINISH_COUNT);
|
||||||
|
// modelCountDepChild.teamOntimeCount = completions.Where(e => e.TEAM_ID.HasValue && e.TEAM_ID.Value == item2).Sum(m => m.FINISH_COUNT);
|
||||||
|
// modelCountDepChild.teamTotalCount = completions.Where(e => e.TEAM_ID.HasValue && e.TEAM_ID.Value == item2).Sum(m => m.TOTAL_COUNT);
|
||||||
|
|
||||||
|
// }
|
||||||
|
// if (modelCountDepChild.teamTotalCount != 0)
|
||||||
|
// {
|
||||||
|
// completionLists.Add(modelCountDepChild);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//}
|
||||||
|
|
||||||
if (completionLists != null && completionLists.Any())
|
if (completionLists != null && completionLists.Any())
|
||||||
{
|
{
|
||||||
foreach (var item in completionLists)
|
foreach (var item in completionLists)
|
||||||
|
//{
|
||||||
|
// if (item.shopTotalCount == 0)
|
||||||
|
// {
|
||||||
|
|
||||||
|
|
||||||
|
// }
|
||||||
|
// else
|
||||||
{
|
{
|
||||||
item.shopDoneCount = completionLists.Where(i => i.shopId == item.shopId).Sum(m => m.teamDoneCount);
|
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.shopOntimeCount = completionLists.Where(i => i.shopId == item.shopId).Sum(m => m.teamOntimeCount);
|
||||||
@ -9851,6 +9959,7 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
|||||||
item.teamOverDoneRate = Math.Round((double)item.teamOntimeCount / (double)item.teamTotalCount * 100, 2);
|
item.teamOverDoneRate = Math.Round((double)item.teamOntimeCount / (double)item.teamTotalCount * 100, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ret.retData = completionLists.OrderBy(t => t.shopName).ThenByDescending(m => m.teamOverDoneRate).ToList();
|
ret.retData = completionLists.OrderBy(t => t.shopName).ThenByDescending(m => m.teamOverDoneRate).ToList();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -10033,11 +10142,11 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
|||||||
var completions = GetEntities<T_FM_WORK_TICKET_COMPLETION>(t => !t.IS_DELETED, new BaseFilter(orgId)).ToList();
|
var completions = GetEntities<T_FM_WORK_TICKET_COMPLETION>(t => !t.IS_DELETED, new BaseFilter(orgId)).ToList();
|
||||||
var deptIds = completions.Where(t => t.DEPARTMENT_ID != null).Select(t => (Guid)t.DEPARTMENT_ID).ToList();
|
var deptIds = completions.Where(t => t.DEPARTMENT_ID != null).Select(t => (Guid)t.DEPARTMENT_ID).ToList();
|
||||||
departmentIds.AddRange(deptIds);
|
departmentIds.AddRange(deptIds);
|
||||||
var shopIds = completions.Where(t => t.SHOP_DEPARTMENT_ID != null).Select(t => (Guid)t.SHOP_DEPARTMENT_ID).ToList();
|
//var shopIds = completions.Where(t => t.SHOP_DEPARTMENT_ID != null).Select(t => (Guid)t.SHOP_DEPARTMENT_ID).ToList();
|
||||||
departmentIds.AddRange(shopIds);
|
//departmentIds.AddRange(shopIds);
|
||||||
var classIds = completions.Where(t => t.TEAM_ID != null).Select(t => (Guid)t.TEAM_ID).ToList();
|
//var classIds = completions.Where(t => t.TEAM_ID != null).Select(t => (Guid)t.TEAM_ID).ToList();
|
||||||
departmentIds.AddRange(classIds);
|
//departmentIds.AddRange(classIds);
|
||||||
var departmentInfo = this.GetEntities<T_FM_DEPARTMENT>(t => t.ENABLE_STATUS == 0 && t.CATEGORY == FMCATEGORY.ACTURE, new BaseFilter(orgId));
|
var departmentInfo = this.GetEntities<T_FM_DEPARTMENT>(t => t.ENABLE_STATUS == 0 && ((t.DEPARTMENT_STATUS == 2 && t.DEPARTMENT_TYPE==5)||t.DEPARTMENT_TYPE==10) && t.CATEGORY == FMCATEGORY.ACTURE, new BaseFilter(orgId));
|
||||||
if (departmentIds != null && departmentIds.Any())
|
if (departmentIds != null && departmentIds.Any())
|
||||||
{
|
{
|
||||||
//departmentInfo = departmentInfo.Where(t => t.PRODUCTION_UNIT_ID == loginDepart.PRODUCTION_UNIT_ID).ToList();
|
//departmentInfo = departmentInfo.Where(t => t.PRODUCTION_UNIT_ID == loginDepart.PRODUCTION_UNIT_ID).ToList();
|
||||||
@ -10270,19 +10379,41 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
|||||||
ONTIME_COUNT = group.Where(i => i.MONTH == group.Key.MONTH).Sum(m => m.ONTIME_COUNT),
|
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),
|
TOTAL_COUNT = group.Where(i => i.MONTH == group.Key.MONTH).Sum(m => m.TOTAL_COUNT),
|
||||||
}).ToList();
|
}).ToList();
|
||||||
completionLists = completions.GroupBy(t => new {t.TEAM_ID, t.TEAM_NAME, t.SHOP_DEPARTMENT_ID, t.SHOP_DEPARTMENT_NAME }).Select(group => new GroupbyDepartmentCompletion
|
completionLists = completions.Where(t=>t.TEAM_ID!=null).GroupBy(t => new {t.TEAM_ID, t.TEAM_NAME}).Select(group => new GroupbyDepartmentCompletion
|
||||||
{
|
{
|
||||||
deptId = group.Where(i => i.TEAM_ID == group.Key.TEAM_ID && i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID).FirstOrDefault().DEPARTMENT_ID,
|
shopId = group.FirstOrDefault(i => i.TEAM_ID == group.Key.TEAM_ID)?.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,
|
shopName = group.FirstOrDefault(i => i.TEAM_ID == group.Key.TEAM_ID)?.DEPARTMENT_NAME,
|
||||||
shopId = group.Key.SHOP_DEPARTMENT_ID,
|
|
||||||
shopName = group.Key.SHOP_DEPARTMENT_NAME,
|
|
||||||
teamId = group.Key.TEAM_ID,
|
teamId = group.Key.TEAM_ID,
|
||||||
teamName = group.Key.TEAM_NAME,
|
teamName = group.Key.TEAM_NAME,
|
||||||
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),
|
teamDoneCount = group.Where(i => i.TEAM_ID == group.Key.TEAM_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),
|
teamOntimeCount = group.Where(i => i.TEAM_ID == group.Key.TEAM_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),
|
teamUndoneCount = group.Where(i => i.TEAM_ID == group.Key.TEAM_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),
|
teamTotalCount = group.Where(i => i.TEAM_ID == group.Key.TEAM_ID).Sum(m => m.TOTAL_COUNT),
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
var shopCompletionLists = completions.Where(t => t.SHOP_DEPARTMENT_ID != null).GroupBy(t => new {t.SHOP_DEPARTMENT_ID, t.SHOP_DEPARTMENT_NAME }).Select(group => new GroupbyDepartmentCompletion
|
||||||
|
{
|
||||||
|
|
||||||
|
shopId = group.FirstOrDefault(i => i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID)?.DEPARTMENT_ID,
|
||||||
|
shopName = group.FirstOrDefault(i => i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID)?.DEPARTMENT_NAME,
|
||||||
|
teamId = group.Key.SHOP_DEPARTMENT_ID,
|
||||||
|
teamName = group.Key.SHOP_DEPARTMENT_NAME,
|
||||||
|
teamDoneCount = group.Where(i => i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID && i.TEAM_ID == null).Sum(m => m.FINISH_COUNT),
|
||||||
|
teamOntimeCount = group.Where(i => i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID && i.TEAM_ID == null).Sum(m => m.ONTIME_COUNT),
|
||||||
|
teamUndoneCount = group.Where(i => i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID && i.TEAM_ID == null).Sum(m => m.WAITTING_COUNT),
|
||||||
|
teamTotalCount = group.Where(i => i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID && i.TEAM_ID == null).Sum(m => m.TOTAL_COUNT),
|
||||||
|
}).ToList();
|
||||||
|
completionLists.AddRange(shopCompletionLists);
|
||||||
|
var deptCompletionLists = completions.Where(t => t.DEPARTMENT_ID != null).GroupBy(t => new { t.DEPARTMENT_ID, t.DEPARTMENT_NAME}).Select(group => new GroupbyDepartmentCompletion
|
||||||
|
{
|
||||||
|
shopId = group.Key.DEPARTMENT_ID,
|
||||||
|
shopName = group.Key.DEPARTMENT_NAME,
|
||||||
|
teamId = group.Key.DEPARTMENT_ID,
|
||||||
|
teamName = group.Key.DEPARTMENT_NAME,
|
||||||
|
shopDoneCount = group.Where(i => i.DEPARTMENT_ID == group.Key.DEPARTMENT_ID).Sum(m => m.FINISH_COUNT),
|
||||||
|
shopOntimeCount = group.Where(i => i.DEPARTMENT_ID == group.Key.DEPARTMENT_ID).Sum(m => m.ONTIME_COUNT),
|
||||||
|
shopTotalCount = group.Where(i => i.DEPARTMENT_ID == group.Key.DEPARTMENT_ID).Sum(m => m.TOTAL_COUNT),
|
||||||
|
}).ToList();
|
||||||
|
completionLists.AddRange(deptCompletionLists);
|
||||||
}
|
}
|
||||||
if (completionSorts != null && completionSorts.Any())
|
if (completionSorts != null && completionSorts.Any())
|
||||||
{
|
{
|
||||||
@ -10301,24 +10432,30 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
|||||||
}
|
}
|
||||||
ret.rateData = completionSorts.OrderBy(t => t.MONTH).ToList();
|
ret.rateData = completionSorts.OrderBy(t => t.MONTH).ToList();
|
||||||
}
|
}
|
||||||
|
List<GroupbyDepartmentCompletion> result = new List<GroupbyDepartmentCompletion>();
|
||||||
if (completionLists != null && completionLists.Any())
|
if (completionLists != null && completionLists.Any())
|
||||||
{
|
{
|
||||||
foreach (var item in completionLists)
|
foreach (var item in completionLists)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(item.shopName))
|
if (string.IsNullOrEmpty(item.teamName) ||(item.teamName == item.shopName && item.teamTotalCount == 0))
|
||||||
{
|
{
|
||||||
item.shopName = item.deptName;
|
|
||||||
|
// item.teamId = item.shopId;
|
||||||
|
// item.teamName = item.shopName;
|
||||||
|
// item.teamDoneCount = completionLists.Where(i => i.shopId == item.shopId && i.teamId == null).Sum(m => m.shopDoneCount);
|
||||||
|
// item.teamOntimeCount = completionLists.Where(i => i.shopId == item.shopId && i.teamId == null).Sum(m => m.shopOntimeCount);
|
||||||
|
// item.teamTotalCount = completionLists.Where(i => i.shopId == item.shopId && i.teamId == null).Sum(m => m.shopTotalCount);
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(item.teamName))
|
else
|
||||||
{
|
{
|
||||||
item.teamName = item.shopName;
|
//if (string.IsNullOrEmpty(item.teamName))
|
||||||
}
|
//{
|
||||||
//item.deptDoneCount = completionLists.Where(i => i.deptId == item.deptId).Sum(m => m.teamDoneCount);
|
// item.teamName = item.shopName;
|
||||||
//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.shopDoneCount);
|
||||||
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.shopOntimeCount);
|
||||||
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.shopTotalCount);
|
||||||
item.shopTotalCount = completionLists.Where(i => i.shopId == item.shopId).Sum(m => m.teamTotalCount);
|
|
||||||
//if (item.deptTotalCount == 0)
|
//if (item.deptTotalCount == 0)
|
||||||
//{
|
//{
|
||||||
// item.deptDoneRate = 0;
|
// item.deptDoneRate = 0;
|
||||||
@ -10349,8 +10486,11 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
|||||||
item.teamDoneRate = Math.Round((double)item.teamDoneCount / (double)item.teamTotalCount * 100, 2);
|
item.teamDoneRate = Math.Round((double)item.teamDoneCount / (double)item.teamTotalCount * 100, 2);
|
||||||
item.teamOverDoneRate = Math.Round((double)item.teamOntimeCount / (double)item.teamTotalCount * 100, 2);
|
item.teamOverDoneRate = Math.Round((double)item.teamOntimeCount / (double)item.teamTotalCount * 100, 2);
|
||||||
}
|
}
|
||||||
|
result.Add(item);
|
||||||
}
|
}
|
||||||
ret.retData = completionLists.OrderBy(t => t.shopName).ThenByDescending(m => m.teamOverDoneRate).ToList();
|
|
||||||
|
}
|
||||||
|
ret.retData = result.OrderBy(t => t.shopName).ThenByDescending(m => m.teamOverDoneRate).ToList();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user