This commit is contained in:
wyw 2026-07-14 11:45:19 +08:00
commit 17f6ec84c0
10 changed files with 1617 additions and 658 deletions

View File

@ -11824,8 +11824,8 @@ namespace APT.BaseData.Services.DomainServices
noticeDetail.HIDDEN_PLACE = detail.HIDDEN_PLACE; noticeDetail.HIDDEN_PLACE = detail.HIDDEN_PLACE;
noticeDetail.RECITIFY_TIME = detail.RECITIFY_TIME; noticeDetail.RECITIFY_TIME = detail.RECITIFY_TIME;
noticeDetail.RECITIFY_USER_ID = detail.RECITIFY_USER_ID; noticeDetail.RECITIFY_USER_ID = detail.RECITIFY_USER_ID;
noticeDetail.RECTIFICATION_MEASURES = hidDescrip?.DEMAND; noticeDetail.RECTIFICATION_MEASURES = detail.REMARK;
noticeDetail.REMARK = detail.REMARK; //noticeDetail.REMARK = detail.REMARK;
noticeDetails.Add(noticeDetail); noticeDetails.Add(noticeDetail);
if (detail.Nav_ReportDetailFiles != null && detail.Nav_ReportDetailFiles.Any()) if (detail.Nav_ReportDetailFiles != null && detail.Nav_ReportDetailFiles.Any())
{ {
@ -12077,7 +12077,7 @@ namespace APT.BaseData.Services.DomainServices
record.HIDDEN_PLACE = entity.HIDDEN_PLACE; record.HIDDEN_PLACE = entity.HIDDEN_PLACE;
record.CHECK_CONTENTS_ID = entity.CHECK_CONTENTS_ID; record.CHECK_CONTENTS_ID = entity.CHECK_CONTENTS_ID;
record.CHECK_QUESTION_ID = entity.CHECK_QUESTION_ID; record.CHECK_QUESTION_ID = entity.CHECK_QUESTION_ID;
record.HIDDEN_DESCRIPTION = entity.HIDDEN_DESCRIPTION; record.HIDDEN_DESCRIPTION = entity.HIDDEN_DESCRIPTION_DETAIL;
record.HIDDEN_LEVEL = entity.HIDDEN_LEVEL; record.HIDDEN_LEVEL = entity.HIDDEN_LEVEL;
record.RECITIFY_TIME = entity.RECITIFY_TIME; record.RECITIFY_TIME = entity.RECITIFY_TIME;
record.RECITIFY_USER_ID = entity.RECITIFY_USER_ID; record.RECITIFY_USER_ID = entity.RECITIFY_USER_ID;
@ -12086,7 +12086,7 @@ namespace APT.BaseData.Services.DomainServices
record.CHECK_PERSON = user.NAME; record.CHECK_PERSON = user.NAME;
record.IMPLEMENT_USER_ID = entity.RECITIFY_USER_ID; record.IMPLEMENT_USER_ID = entity.RECITIFY_USER_ID;
record.ACCEPT_USER_ID = acceptUser?.ID; record.ACCEPT_USER_ID = acceptUser?.ID;
record.RECTIFICATION_MEASURES = entity.REMARK; record.RECTIFICATION_MEASURES = entity.RECTIFICATION_MEASURES;
record.NOTICE_CODE = entity.NOTICE_CODE; record.NOTICE_CODE = entity.NOTICE_CODE;
if (photos != null && photos.Any()) if (photos != null && photos.Any())
{ {
@ -12142,7 +12142,7 @@ namespace APT.BaseData.Services.DomainServices
record.HIDDEN_PLACE = entity.HIDDEN_PLACE; record.HIDDEN_PLACE = entity.HIDDEN_PLACE;
record.CHECK_CONTENTS_ID = entity.CHECK_CONTENTS_ID; record.CHECK_CONTENTS_ID = entity.CHECK_CONTENTS_ID;
record.CHECK_QUESTION_ID = entity.CHECK_QUESTION_ID; record.CHECK_QUESTION_ID = entity.CHECK_QUESTION_ID;
record.HIDDEN_DESCRIPTION = entity.HIDDEN_DESCRIPTION; record.HIDDEN_DESCRIPTION = entity.HIDDEN_DESCRIPTION_DETAIL;
record.HIDDEN_LEVEL = entity.HIDDEN_LEVEL; record.HIDDEN_LEVEL = entity.HIDDEN_LEVEL;
record.RECITIFY_TIME = entity.RECITIFY_TIME; record.RECITIFY_TIME = entity.RECITIFY_TIME;
record.RECITIFY_USER_ID = entity.RECITIFY_USER_ID; record.RECITIFY_USER_ID = entity.RECITIFY_USER_ID;
@ -12151,7 +12151,7 @@ namespace APT.BaseData.Services.DomainServices
record.CHECK_PERSON = user.NAME; record.CHECK_PERSON = user.NAME;
record.IMPLEMENT_USER_ID = entity.RECITIFY_USER_ID; record.IMPLEMENT_USER_ID = entity.RECITIFY_USER_ID;
record.ACCEPT_USER_ID = acceptUser?.ID; record.ACCEPT_USER_ID = acceptUser?.ID;
record.RECTIFICATION_MEASURES = entity.REMARK; record.RECTIFICATION_MEASURES = entity.RECTIFICATION_MEASURES;
record.NOTICE_CODE = entity.NOTICE_CODE; record.NOTICE_CODE = entity.NOTICE_CODE;
if (photos != null && photos.Any()) if (photos != null && photos.Any())
{ {
@ -12238,8 +12238,8 @@ namespace APT.BaseData.Services.DomainServices
noticeDetail.CHECKCONTENT = entity.CHECKCONTENT; noticeDetail.CHECKCONTENT = entity.CHECKCONTENT;
noticeDetail.CHECKPROOF = entity.CHECKPROOF; noticeDetail.CHECKPROOF = entity.CHECKPROOF;
noticeDetail.CHECKSTANDARD = entity.CHECKSTANDARD; noticeDetail.CHECKSTANDARD = entity.CHECKSTANDARD;
noticeDetail.HIDDEN_DESCRIPTION = entity.HIDDEN_DESCRIPTION; noticeDetail.HIDDEN_DESCRIPTION = entity.HIDDEN_DESCRIPTION_DETAIL;
noticeDetail.RECTIFICATION_MEASURES = hidDescrip?.DEMAND; noticeDetail.RECTIFICATION_MEASURES = entity.RECTIFICATION_MEASURES;
noticeDetail.HIDDEN_LEVEL = entity.HIDDEN_LEVEL; noticeDetail.HIDDEN_LEVEL = entity.HIDDEN_LEVEL;
noticeDetail.HIDDEN_PLACE = entity.HIDDEN_PLACE; noticeDetail.HIDDEN_PLACE = entity.HIDDEN_PLACE;
noticeDetail.RECITIFY_TIME = entity.RECITIFY_TIME; noticeDetail.RECITIFY_TIME = entity.RECITIFY_TIME;

View File

@ -260,220 +260,412 @@ namespace APT.PP.WebApi.Controllers.Api.PP
baseFilter.SelectField = new string[] { "ID", "DEPARTMENT_ID" }; baseFilter.SelectField = new string[] { "ID", "DEPARTMENT_ID" };
var teams = GetEntities<T_FM_TEAM>(t => !t.IS_DELETED && t.ENABLE_STATUS == 0, baseFilter); var teams = GetEntities<T_FM_TEAM>(t => !t.IS_DELETED && t.ENABLE_STATUS == 0, baseFilter);
baseFilter.SelectField = new string[] { "TEAM_ID", "Nav_Team.NAME", "PRE_MEETING_STATUS", "DEPARTMENT_ID", "OVERTIME", "CREATE_TIME" }; //指定字段,包括导航属性 baseFilter.SelectField = new string[] { "TEAM_ID", "Nav_Team.NAME", "PRE_MEETING_STATUS", "DEPARTMENT_ID", "OVERTIME", "CREATE_TIME" }; //指定字段,包括导航属性
var preShiftMeetingTemp = GetEntities<T_FO_PRE_SHIFT_MEETING_RECORD>(i => i.CREATE_TIME >= startTime && i.TEAM_ID != null && i.Nav_Team.IS_DELETED == false && i.IS_DELETED == false && i.DEPARTMENT_ID != null, baseFilter).ToList(); var preShiftMeetingTemp = GetEntities<T_FO_PRE_SHIFT_MEETING_RECORD>(i => i.CREATE_TIME >= startTime && i.IS_DELETED == false, baseFilter).ToList();
baseFilter.SelectField = new string[] { "CLASS_TEAM_ID", "Nav_Team.NAME", "SHIFT_STATUS", "DEPARTMENT_ID", "OVERTIME", "CREATE_TIME" }; //指定字段,包括导航属性 baseFilter.SelectField = new string[] { "CLASS_TEAM_ID", "Nav_Team.NAME", "SHIFT_STATUS", "DEPARTMENT_ID", "OVERTIME", "CREATE_TIME" }; //指定字段,包括导航属性
var currentShiftTemp = GetEntities<T_FO_CURRENT_CLASS_RECORD>(i => i.CREATE_TIME >= startTime && i.Nav_Team.IS_DELETED == false && i.CLASS_TEAM_ID != null && i.IS_DELETED == false && i.DEPARTMENT_ID != null, baseFilter).ToList(); var currentShiftTemp = GetEntities<T_FO_CURRENT_CLASS_RECORD>(i => i.CREATE_TIME >= startTime && i.IS_DELETED == false, baseFilter).ToList();
baseFilter.SelectField = new string[] { "TEAM_ID", "Nav_Team.NAME", "SHIFT_STATUS", "DEPARTMENT_ID", "OVERTIME", "CREATE_TIME" }; //指定字段,包括导航属性 baseFilter.SelectField = new string[] { "TEAM_ID", "Nav_Team.NAME", "SHIFT_STATUS", "DEPARTMENT_ID", "OVERTIME", "CREATE_TIME" }; //指定字段,包括导航属性
var changeShiftTemp = GetEntities<T_FO_CHANGE_SHIFT_RECORD>(i => i.CREATE_TIME >= startTime && i.TEAM_ID != null && i.Nav_Team.IS_DELETED == false && i.IS_DELETED == false && i.DEPARTMENT_ID != null, baseFilter).ToList(); var changeShiftTemp = GetEntities<T_FO_CHANGE_SHIFT_RECORD>(i => i.CREATE_TIME >= startTime && i.IS_DELETED == false, baseFilter).ToList();
baseFilter.SelectField = new string[] { "TEAM_ID", "Nav_Taem.NAME", "TA_STATUS", "Nav_Taem.DEPARTMENT_ID", "OVERTIME", "CREATE_TIME" }; //指定字段,包括导航属性 baseFilter.SelectField = new string[] { "TEAM_ID", "Nav_Taem.NAME", "TA_STATUS", "Nav_Taem.DEPARTMENT_ID", "OVERTIME", "CREATE_TIME" }; //指定字段,包括导航属性
var teamActivityTemp = GetEntities<T_FO_TEAM_ACTIVITY>(i => i.CREATE_TIME >= startTime && i.TEAM_ID != null && i.Nav_Taem.IS_DELETED == false && i.IS_DELETED == false && i.Nav_Taem.DEPARTMENT_ID != null, baseFilter).ToList(); var teamActivityTemp = GetEntities<T_FO_TEAM_ACTIVITY>(i => i.CREATE_TIME >= startTime && i.IS_DELETED == false, baseFilter).ToList();
for (DateTime i = startTime; i <= endTime; i = i.AddMonths(i.Month - i.Month + 1).AddDays(1 - i.Day)) for (DateTime i = startTime; i <= endTime; i = i.AddMonths(i.Month - i.Month + 1).AddDays(1 - i.Day))
{ {
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();
foreach (var item in preTemp)
{
if (item.TEAM_ID == null)
{
item.TEAM_ID = item.DEPARTMENT_ID;
}
else
{
var deparId = teams.FirstOrDefault(t => t.ID == item.TEAM_ID)?.DEPARTMENT_ID;
item.TEAM_ID = deparId;
}
}
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 }).
Select(group => new Select(group => new
{ {
group.Key, group.Key.TEAM_ID,
totalCount = group.Count(), totalCount = group.Count(),
finishCount = group.Where(i => i.PRE_MEETING_STATUS == FOPreMeetingStatusEnum.).Count(), finishCount = group.Where(i => i.PRE_MEETING_STATUS == FOPreMeetingStatusEnum.).Count(),
waitingCount = group.Where(i => i.PRE_MEETING_STATUS != FOPreMeetingStatusEnum.).Count(), waitingCount = group.Where(i => i.PRE_MEETING_STATUS != FOPreMeetingStatusEnum.).Count(),
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();
foreach (var item in preShiftMeeting) if (preShiftMeeting.Any())
{ {
var deparId = teams.FirstOrDefault(t => t.ID == item.Key.TEAM_ID)?.DEPARTMENT_ID; foreach (var item in preShiftMeeting)
var departInfo = departments.FirstOrDefault(t => t.ID == deparId); //GetDepartmentId((Guid)item.Key.DEPARTMENT_ID); {
//var deparId = teams.FirstOrDefault(t => t.ID == item.Key.TEAM_ID)?.DEPARTMENT_ID;
var departInfo = departments.FirstOrDefault(t => t.ID == item.TEAM_ID); //GetDepartmentId((Guid)item.Key.DEPARTMENT_ID);
T_FM_DEPARTMENT_COMPLETION completion = new T_FM_DEPARTMENT_COMPLETION();
completion.MONTH = i;
completion.MONTHStr = i.Year + "年" + i.Month + "月";
completion.TOTAL_COUNT = item.totalCount;
completion.WAITTING_COUNT = item.waitingCount;
completion.FINISH_COUNT = item.finishCount;
completion.ONTIME_COUNT = item.onTimeCount;
completion.OVERTIME_COUNT = item.overTimeCount;
completion.FORM_NAME = "班前会议";
completion.ORG_ID = filter.GetOrgId();
completion.START_TIME = i;
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;
//}
completion.DEPARTMENT_ID = departInfo?.PARENT_ID;
completion.DEPARTMENT_NAME = departments.FirstOrDefault(t => t.ID == completion.DEPARTMENT_ID)?.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(); T_FM_DEPARTMENT_COMPLETION completion = new T_FM_DEPARTMENT_COMPLETION();
completion.MONTH = i; completion.MONTH = i;
completion.MONTHStr = i.Year + "年" + i.Month + "月"; completion.MONTHStr = i.Year + "年" + i.Month + "月";
completion.TOTAL_COUNT = item.totalCount; completion.TOTAL_COUNT = 0;
completion.WAITTING_COUNT = item.waitingCount; completion.WAITTING_COUNT = 0;
completion.FINISH_COUNT = item.finishCount; completion.FINISH_COUNT = 0;
completion.ONTIME_COUNT = item.onTimeCount; completion.ONTIME_COUNT = 0;
completion.OVERTIME_COUNT = item.overTimeCount; completion.OVERTIME_COUNT = 0;
completion.FORM_NAME = "班前会议"; completion.FORM_NAME = "班前会议";
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)
{
completion.DEPARTMENT_ID = item.Key.TEAM_ID;
completion.DEPARTMENT_NAME = item.Key.TeamName;
}
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;
}
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 = item.Key.TEAM_ID;
completion.TEAM_NAME = item.Key.TeamName;
}
}
completions.Add(completion); 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();
foreach (var item in currentTemp)
{
if (item.CLASS_TEAM_ID == null)
{
item.CLASS_TEAM_ID = item.DEPARTMENT_ID;
}
else
{
var deparId = teams.FirstOrDefault(t => t.ID == item.CLASS_TEAM_ID)?.DEPARTMENT_ID;
item.CLASS_TEAM_ID = deparId;
}
}
var currentShift = currentTemp. var currentShift = currentTemp.
GroupBy(m => new { m.CLASS_TEAM_ID, TeamName = m.Nav_Team.NAME, m.DEPARTMENT_ID }). GroupBy(m => new { TEAM_ID = m.CLASS_TEAM_ID }).
Select(group => new Select(group => new
{ {
group.Key, group.Key.TEAM_ID,
totalCount = group.Count(), totalCount = group.Count(),
finishCount = group.Where(i => i.SHIFT_STATUS == (int)FOShiftStatusEnum. || i.SHIFT_STATUS == (int)FOShiftStatusEnum.).Count(), finishCount = group.Where(i => i.SHIFT_STATUS == (int)FOShiftStatusEnum. || i.SHIFT_STATUS == (int)FOShiftStatusEnum.).Count(),
waitingCount = group.Where(i => i.SHIFT_STATUS != (int)FOShiftStatusEnum. && i.SHIFT_STATUS == (int)FOShiftStatusEnum.).Count(), waitingCount = group.Where(i => i.SHIFT_STATUS != (int)FOShiftStatusEnum. && i.SHIFT_STATUS == (int)FOShiftStatusEnum.).Count(),
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();
foreach (var item in currentShift) if (currentShift.Any())
{ {
var deparId = teams.FirstOrDefault(t => t.ID == item.Key.CLASS_TEAM_ID)?.DEPARTMENT_ID; foreach (var item in currentShift)
var departInfo = departments.FirstOrDefault(t => t.ID == deparId); //GetDepartmentId((Guid)item.Key.DEPARTMENT_ID); {
//var deparId = teams.FirstOrDefault(t => t.ID == item.Key.CLASS_TEAM_ID)?.DEPARTMENT_ID;
var departInfo = departments.FirstOrDefault(t => t.ID == item.TEAM_ID); //GetDepartmentId((Guid)item.Key.DEPARTMENT_ID);
T_FM_DEPARTMENT_COMPLETION completion = new T_FM_DEPARTMENT_COMPLETION();
//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.MONTH = i;
completion.MONTHStr = i.Year + "年" + i.Month + "月";
//completion.TEAM_ID = item.Key.CLASS_TEAM_ID;
//completion.TEAM_NAME = item.Key.TeamName;
completion.TOTAL_COUNT = item.totalCount;
completion.WAITTING_COUNT = item.waitingCount;
completion.FINISH_COUNT = item.finishCount;
completion.ONTIME_COUNT = item.onTimeCount;
completion.OVERTIME_COUNT = item.overTimeCount;
completion.FORM_NAME = "岗位当班";
completion.ORG_ID = filter.GetOrgId();
completion.START_TIME = i;
completion.END_TIME = monthEnd;
if (departInfo != null)
{
//if (departInfo.DEPARTMENT_TYPE == 10 || departInfo.DEPARTMENT_TYPE == 5)
//{
// completion.DEPARTMENT_ID = item.Key.CLASS_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.CLASS_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;
//}
completion.DEPARTMENT_ID = departInfo?.PARENT_ID;
completion.DEPARTMENT_NAME = departments.FirstOrDefault(t => t.ID == completion.DEPARTMENT_ID)?.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(); T_FM_DEPARTMENT_COMPLETION completion = new T_FM_DEPARTMENT_COMPLETION();
//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.MONTH = i; completion.MONTH = i;
completion.MONTHStr = i.Year + "年" + i.Month + "月"; completion.MONTHStr = i.Year + "年" + i.Month + "月";
//completion.TEAM_ID = item.Key.CLASS_TEAM_ID; completion.TOTAL_COUNT = 0;
//completion.TEAM_NAME = item.Key.TeamName; completion.WAITTING_COUNT = 0;
completion.TOTAL_COUNT = item.totalCount; completion.FINISH_COUNT = 0;
completion.WAITTING_COUNT = item.waitingCount; completion.ONTIME_COUNT = 0;
completion.FINISH_COUNT = item.finishCount; completion.OVERTIME_COUNT = 0;
completion.ONTIME_COUNT = item.onTimeCount;
completion.OVERTIME_COUNT = item.overTimeCount;
completion.FORM_NAME = "岗位当班"; completion.FORM_NAME = "岗位当班";
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)
{
completion.DEPARTMENT_ID = item.Key.CLASS_TEAM_ID;
completion.DEPARTMENT_NAME = item.Key.TeamName;
}
if (departInfo.DEPARTMENT_TYPE == 15)
{
completion.DEPARTMENT_ID = departInfo?.PARENT_ID;
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
completion.SHOP_DEPARTMENT_ID = item.Key.CLASS_TEAM_ID;
completion.SHOP_DEPARTMENT_NAME = item.Key.TeamName;
}
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 = item.Key.CLASS_TEAM_ID;
completion.TEAM_NAME = item.Key.TeamName;
}
}
completions.Add(completion); 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();
foreach (var item in changeTemp)
{
if (item.TEAM_ID == null)
{
item.TEAM_ID = item.DEPARTMENT_ID;
}
else
{
var deparId = teams.FirstOrDefault(t => t.ID == item.TEAM_ID)?.DEPARTMENT_ID;
item.TEAM_ID = deparId;
}
}
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 }).
Select(group => new Select(group => new
{ {
group.Key, group.Key.TEAM_ID,
totalCount = group.Count(), totalCount = group.Count(),
finishCount = group.Where(i => i.SHIFT_STATUS == (int)FOChangeShiftStatusEnum.).Count(), finishCount = group.Where(i => i.SHIFT_STATUS == (int)FOChangeShiftStatusEnum.).Count(),
waitingCount = group.Where(i => i.SHIFT_STATUS != (int)FOChangeShiftStatusEnum.).Count(), waitingCount = group.Where(i => i.SHIFT_STATUS != (int)FOChangeShiftStatusEnum.).Count(),
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();
foreach (var item in changeShift) if (changeShift.Any())
{ {
var deparId = teams.FirstOrDefault(t => t.ID == item.Key.TEAM_ID)?.DEPARTMENT_ID; foreach (var item in changeShift)
var departInfo = departments.FirstOrDefault(t => t.ID == deparId); //GetDepartmentId((Guid)item.Key.DEPARTMENT_ID); {
var departInfo = departments.FirstOrDefault(t => t.ID == item.TEAM_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();
//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.MONTH = i;
completion.MONTHStr = i.Year + "年" + i.Month + "月";
//completion.TEAM_ID = item.Key.TEAM_ID;
//completion.TEAM_NAME = item.Key.TeamName;
completion.TOTAL_COUNT = item.totalCount;
completion.WAITTING_COUNT = item.waitingCount;
completion.FINISH_COUNT = item.finishCount;
completion.ONTIME_COUNT = item.onTimeCount;
completion.OVERTIME_COUNT = item.overTimeCount;
completion.FORM_NAME = "岗位交接班";
completion.ORG_ID = filter.GetOrgId();
completion.START_TIME = i;
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;
//}
completion.DEPARTMENT_ID = departInfo?.PARENT_ID;
completion.DEPARTMENT_NAME = departments.FirstOrDefault(t => t.ID == completion.DEPARTMENT_ID)?.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(); T_FM_DEPARTMENT_COMPLETION completion = new T_FM_DEPARTMENT_COMPLETION();
//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.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.TOTAL_COUNT = 0;
//completion.TEAM_NAME = item.Key.TeamName; completion.WAITTING_COUNT = 0;
completion.TOTAL_COUNT = item.totalCount; completion.FINISH_COUNT = 0;
completion.WAITTING_COUNT = item.waitingCount; completion.ONTIME_COUNT = 0;
completion.FINISH_COUNT = item.finishCount; completion.OVERTIME_COUNT = 0;
completion.ONTIME_COUNT = item.onTimeCount;
completion.OVERTIME_COUNT = item.overTimeCount;
completion.FORM_NAME = "岗位交接班"; completion.FORM_NAME = "岗位交接班";
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)
{
completion.DEPARTMENT_ID = item.Key.TEAM_ID;
completion.DEPARTMENT_NAME = item.Key.TeamName;
}
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;
}
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 = item.Key.TEAM_ID;
completion.TEAM_NAME = item.Key.TeamName;
}
}
completions.Add(completion); 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();
foreach (var item in teamTemp)
{
if (item.TEAM_ID == null)
{
item.TEAM_ID = item.DEPARTMENT_ID;
}
else
{
var deparId = teams.FirstOrDefault(t => t.ID == item.TEAM_ID)?.DEPARTMENT_ID;
item.TEAM_ID = deparId;
}
}
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 }).
Select(group => new Select(group => new
{ {
group.Key, group.Key.TEAM_ID,
totalCount = group.Count(), totalCount = group.Count(),
finishCount = group.Where(i => i.TA_STATUS == (int)FOTeamActivityState.).Count(), finishCount = group.Where(i => i.TA_STATUS == (int)FOTeamActivityState.).Count(),
waitingCount = group.Where(i => i.TA_STATUS != (int)FOTeamActivityState.).Count(), waitingCount = group.Where(i => i.TA_STATUS != (int)FOTeamActivityState.).Count(),
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();
foreach (var item in teamActivity) if (teamActivity.Any())
{ {
var deparId = teams.FirstOrDefault(t => t.ID == item.Key.TEAM_ID)?.DEPARTMENT_ID; foreach (var item in teamActivity)
var departInfo = departments.FirstOrDefault(t => t.ID == deparId); //GetDepartmentId((Guid)item.Key.DEPARTMENT_ID); {
//var deparId = teams.FirstOrDefault(t => t.ID == item.Key.TEAM_ID)?.DEPARTMENT_ID;
var departInfo = departments.FirstOrDefault(t => t.ID == item.TEAM_ID); //GetDepartmentId((Guid)item.Key.DEPARTMENT_ID);
T_FM_DEPARTMENT_COMPLETION completion = new T_FM_DEPARTMENT_COMPLETION();
//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.MONTH = i;
completion.MONTHStr = i.Year + "年" + i.Month + "月";
//completion.TEAM_ID = item.Key.TEAM_ID;
//completion.TEAM_NAME = item.Key.TeamName;
completion.TOTAL_COUNT = item.totalCount;
completion.WAITTING_COUNT = item.waitingCount;
completion.FINISH_COUNT = item.finishCount;
completion.ONTIME_COUNT = item.onTimeCount;
completion.OVERTIME_COUNT = item.overTimeCount;
completion.FORM_NAME = "班组安全活动记录";
completion.ORG_ID = filter.GetOrgId();
completion.START_TIME = i;
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;
//}
completion.DEPARTMENT_ID = departInfo?.PARENT_ID;
completion.DEPARTMENT_NAME = departments.FirstOrDefault(t => t.ID == completion.DEPARTMENT_ID)?.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(); T_FM_DEPARTMENT_COMPLETION completion = new T_FM_DEPARTMENT_COMPLETION();
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.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.TOTAL_COUNT = 0;
completion.TEAM_NAME = item.Key.TeamName; completion.WAITTING_COUNT = 0;
completion.TOTAL_COUNT = item.totalCount; completion.FINISH_COUNT = 0;
completion.WAITTING_COUNT = item.waitingCount; completion.ONTIME_COUNT = 0;
completion.FINISH_COUNT = item.finishCount; completion.OVERTIME_COUNT = 0;
completion.ONTIME_COUNT = item.onTimeCount;
completion.OVERTIME_COUNT = item.overTimeCount;
completion.FORM_NAME = "班组安全活动记录"; completion.FORM_NAME = "班组安全活动记录";
completion.ORG_ID = filter.GetOrgId(); completion.ORG_ID = filter.GetOrgId();
completion.START_TIME = i; completion.START_TIME = i;
@ -888,6 +1080,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,44 +1141,66 @@ 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();
foreach (var item in results) if (results.Any())
{
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)
{
//if (departInfo.DEPARTMENT_TYPE == 10 || departInfo.DEPARTMENT_TYPE == 5)
//{
// completion.DEPARTMENT_ID = item.departmetId;
// completion.DEPARTMENT_NAME = departInfo?.NAME;
//}
//if (departInfo.DEPARTMENT_TYPE == 15)
//{
// completion.DEPARTMENT_ID = departInfo?.PARENT_ID;
// completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
// completion.SHOP_DEPARTMENT_ID = item.departmetId;
// completion.SHOP_DEPARTMENT_NAME = departInfo?.NAME;
//}
//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 = item.departmetId;
// completion.TEAM_NAME = departInfo?.NAME;
//}
completion.DEPARTMENT_ID = departInfo?.PARENT_ID;
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
completion.TEAM_ID = item.departmetId;
completion.TEAM_NAME = departInfo?.NAME;
}
completions.Add(completion);
}
}
else
{ {
T_FM_WORK_TICKET_COMPLETION completion = new T_FM_WORK_TICKET_COMPLETION(); T_FM_WORK_TICKET_COMPLETION completion = new T_FM_WORK_TICKET_COMPLETION();
completion.MONTH = i; completion.MONTH = i;
completion.MONTHStr = i.Year + "年" + i.Month + "月"; completion.MONTHStr = i.Year + "年" + i.Month + "月";
completion.TOTAL_COUNT = item.totalCount; completion.TOTAL_COUNT = 0;
completion.FINISH_COUNT = item.finishCount; completion.FINISH_COUNT = 0;
completion.OVER_FINISH_COUNT = item.overFinishCount; completion.OVER_FINISH_COUNT = 0;
completion.WAITTING_COUNT = item.waitingCount; completion.WAITTING_COUNT =0;
completion.ONTIME_COUNT = item.onTimeCount; completion.ONTIME_COUNT = 0;
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;
var departInfo = departments.FirstOrDefault(t => t.ID == item.departmetId);
if (departInfo != null)
{
if (departInfo.DEPARTMENT_TYPE == 10|| departInfo.DEPARTMENT_TYPE == 5)
{
completion.DEPARTMENT_ID = item.departmetId;
completion.DEPARTMENT_NAME = departInfo?.NAME;
}
if (departInfo.DEPARTMENT_TYPE == 15)
{
completion.DEPARTMENT_ID = departInfo?.PARENT_ID;
completion.DEPARTMENT_NAME = departInfo?.Nav_Parent?.NAME;
completion.SHOP_DEPARTMENT_ID = item.departmetId;
completion.SHOP_DEPARTMENT_NAME = departInfo?.NAME;
}
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 = item.departmetId;
completion.TEAM_NAME = departInfo?.NAME;
}
}
completions.Add(completion); completions.Add(completion);
} }
} }

View File

@ -2301,8 +2301,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP
/// </summary> /// </summary>
/// <param name="pageFilter"></param> /// <param name="pageFilter"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost, Route("PremeetingSync")] [HttpPost, Route("PremeetingSyncOld")]
public JsonActionResult<bool> PremeetingSync([FromBody] KeywordFilter filter) public JsonActionResult<bool> PremeetingSyncOld([FromBody] KeywordFilter filter)
{ {
return SafeExecute<bool>(() => return SafeExecute<bool>(() =>
{ {
@ -2389,5 +2389,96 @@ namespace APT.PP.WebApi.Controllers.Api.PP
return true; return true;
}); });
} }
/// <summary>
/// 更新岗位当班,交接班,班组活动记录超时字段
/// </summary>
/// <param name="pageFilter"></param>
/// <returns></returns>
[HttpPost, Route("PremeetingSync")]
public JsonActionResult<bool> PremeetingSync([FromBody] KeywordFilter filter)
{
return SafeExecute<bool>(() =>
{
try
{
var startTime = DateTime.Now.AddMonths(-3);
var taskIds=new List<Guid>();
var curClass = this.GetEntities<T_FO_CURRENT_CLASS_RECORD>(t => t.CREATE_TIME >= startTime && t.SHIFT_STATUS == (int)FOShiftStatusEnum. && t.OVERTIME == FOISOVERTIME., filter);
var curClassIds = curClass.Select(t => t.ID).ToList();
taskIds.AddRange(curClassIds);
var changeClass = this.GetEntities<T_FO_CHANGE_SHIFT_RECORD>(t => t.CREATE_TIME >= startTime && t.SHIFT_STATUS == (int)FOChangeShiftStatusEnum. && t.OVERTIME == FOISOVERTIME., filter);
var changeClassIds = changeClass.Select(t => t.ID).ToList();
taskIds.AddRange(changeClassIds);
var actClass = this.GetEntities<T_FO_TEAM_ACTIVITY>(t => t.CREATE_TIME >= startTime && t.TA_STATUS == (int)FOTeamActivityState. && t.OVERTIME == FOISOVERTIME., filter);
var actClassIds = actClass.Select(t => t.ID).ToList();
taskIds.AddRange(actClassIds);
var tasks = this.GetEntities<T_FM_NOTIFICATION_TASK>(t => t.CREATE_TIME >= startTime && t.SOURCE_DATA_ID != null && taskIds.Contains((Guid)t.SOURCE_DATA_ID), filter);
if (curClass != null && curClass.Any())
{
foreach (var item in curClass)
{
var taskOver = tasks.FirstOrDefault(t => t.SOURCE_DATA_ID == item.ID && t.NOTICE_STATUS == 2);
if (taskOver != null)
{
item.OVERTIME = FOISOVERTIME.;
}
else
{
item.OVERTIME = FOISOVERTIME.;
}
}
}
if (changeClass != null && changeClass.Any())
{
foreach (var item in changeClass)
{
var taskOver = tasks.FirstOrDefault(t => t.SOURCE_DATA_ID == item.ID && t.NOTICE_STATUS == 2);
if (taskOver != null)
{
item.OVERTIME = FOISOVERTIME.;
}
else
{
item.OVERTIME = FOISOVERTIME.;
}
}
}
if (actClass != null && actClass.Any())
{
foreach (var item in actClass)
{
var taskOver = tasks.FirstOrDefault(t => t.SOURCE_DATA_ID == item.ID && t.NOTICE_STATUS == 2);
if (taskOver != null)
{
item.OVERTIME = FOISOVERTIME.;
}
else
{
item.OVERTIME = FOISOVERTIME.;
}
}
}
UnifiedCommit(() =>
{
if (curClass != null && curClass.Any())
BantchSaveEntityNoCommit(curClass);
if (changeClass != null && changeClass.Any())
BantchSaveEntityNoCommit(changeClass);
if (actClass != null && actClass.Any())
BantchSaveEntityNoCommit(actClass);
});
}
catch (Exception ex)
{
if (!string.IsNullOrEmpty(ex.StackTrace))
throw new Exception("错误日志:[StackTrace]" + ex.StackTrace);
else
throw new Exception("【" + HttpContext.Request.Path + "】错误日志:[Message]" + ex.Message);
}
return true;
});
}
} }
} }

View File

@ -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> { "重大风险", "较大风险", "一般风险", "低风险" };

View File

@ -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,61 +9810,154 @@ 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 if (completionSorts != null && completionSorts.Any())
{ {
shopId = group.Key.SHOP_DEPARTMENT_ID, foreach (var item in completionSorts)
shopName = group.Key.SHOP_DEPARTMENT_NAME, {
if (item.TOTAL_COUNT == 0)
{
item.FINISH_RATE = 0;
item.NORMAL_FINISH_RATE = 0;
}
else
{
item.FINISH_RATE = Math.Round((double)item.FINISH_COUNT / (double)item.TOTAL_COUNT * 100, 2);
item.NORMAL_FINISH_RATE = Math.Round((double)item.ONTIME_COUNT / (double)item.TOTAL_COUNT * 100, 2);
}
}
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 }).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, 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();
}
if (completionSorts != null && completionSorts.Any()) //completionLists = completions.Where(t => t.TEAM_ID != null).GroupBy(t => new { t.TEAM_ID, t.TEAM_NAME }).Select(group => new GroupbyDepartmentCompletion
{ //{
foreach (var item in completionSorts) // 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,
if (item.TOTAL_COUNT == 0) // teamId = group.Key.TEAM_ID,
{ // teamName = group.Key.TEAM_NAME,
item.FINISH_RATE = 0; // teamDoneCount = group.Where(i => i.TEAM_ID == group.Key.TEAM_ID).Sum(m => m.FINISH_COUNT),
item.NORMAL_FINISH_RATE = 0; // 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),
else // teamTotalCount = group.Where(i => i.TEAM_ID == group.Key.TEAM_ID).Sum(m => m.TOTAL_COUNT),
{ //}).ToList();
item.FINISH_RATE = Math.Round((double)item.FINISH_COUNT / (double)item.TOTAL_COUNT * 100, 2); //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
item.NORMAL_FINISH_RATE = Math.Round((double)item.ONTIME_COUNT / (double)item.TOTAL_COUNT * 100, 2); //{
}
} // shopId = group.FirstOrDefault(i => i.SHOP_DEPARTMENT_ID == group.Key.SHOP_DEPARTMENT_ID)?.DEPARTMENT_ID,
ret.rateData = completionSorts.OrderBy(t => t.MONTH).ToList(); // 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)
{ //{
item.shopDoneCount = completionLists.Where(i => i.shopId == item.shopId).Sum(m => m.teamDoneCount); // if (item.shopTotalCount == 0)
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.shopTotalCount == 0)
// }
// else
{ {
item.shopDoneRate = 0; item.shopDoneCount = completionLists.Where(i => i.shopId == item.shopId).Sum(m => m.teamDoneCount);
item.shopOverDoneRate = 0; 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);
else if (item.shopTotalCount == 0)
{ {
item.shopDoneRate = Math.Round((double)item.shopDoneCount / (double)item.shopTotalCount * 100, 2); item.shopDoneRate = 0;
item.shopOverDoneRate = Math.Round((double)item.shopOntimeCount / (double)item.shopTotalCount * 100, 2); item.shopOverDoneRate = 0;
} }
if (item.teamTotalCount == 0) else
{ {
item.teamDoneRate = 0; item.shopDoneRate = Math.Round((double)item.shopDoneCount / (double)item.shopTotalCount * 100, 2);
item.teamOverDoneRate = 0; item.shopOverDoneRate = Math.Round((double)item.shopOntimeCount / (double)item.shopTotalCount * 100, 2);
} }
else if (item.teamTotalCount == 0)
{ {
item.teamDoneRate = Math.Round((double)item.teamDoneCount / (double)item.teamTotalCount * 100, 2); item.teamDoneRate = 0;
item.teamOverDoneRate = Math.Round((double)item.teamOntimeCount / (double)item.teamTotalCount * 100, 2); item.teamOverDoneRate = 0;
}
else
{
item.teamDoneRate = Math.Round((double)item.teamDoneCount / (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();
@ -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,44 @@ 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), //shopDoneCount = group.Where(i => i.DEPARTMENT_ID == group.Key.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), //shopOntimeCount = group.Where(i => i.DEPARTMENT_ID == group.Key.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), //shopTotalCount = group.Where(i => i.DEPARTMENT_ID == group.Key.DEPARTMENT_ID).Sum(m => m.TOTAL_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), 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(); }).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,56 +10435,65 @@ 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))
{
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 //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; //if (string.IsNullOrEmpty(item.teamName))
item.shopOverDoneRate = 0; //{
} // item.teamName = item.shopName;
else //}
{ item.shopDoneCount = completionLists.Where(i => i.shopId == item.shopId).Sum(m => m.teamDoneCount);
item.shopDoneRate = Math.Round((double)item.shopDoneCount / (double)item.shopTotalCount * 100, 2); item.shopOntimeCount = completionLists.Where(i => i.shopId == item.shopId).Sum(m => m.teamOntimeCount);
item.shopOverDoneRate = Math.Round((double)item.shopOntimeCount / (double)item.shopTotalCount * 100, 2); item.shopTotalCount = completionLists.Where(i => i.shopId == item.shopId).Sum(m => m.teamTotalCount);
}
if (item.teamTotalCount == 0) //if (item.deptTotalCount == 0)
{ //{
item.teamDoneRate = 0; // item.deptDoneRate = 0;
item.teamOverDoneRate = 0; // item.deptOverDoneRate = 0;
} //}
else //else
{ //{
item.teamDoneRate = Math.Round((double)item.teamDoneCount / (double)item.teamTotalCount * 100, 2); // item.deptDoneRate = Math.Round((double)item.deptDoneCount / (double)item.deptTotalCount * 100, 2);
item.teamOverDoneRate = Math.Round((double)item.teamOntimeCount / (double)item.teamTotalCount * 100, 2); // item.deptOverDoneRate = Math.Round((double)item.deptOntimeCount / (double)item.deptTotalCount * 100, 2);
//}
if (item.shopTotalCount == 0)
{
item.shopDoneRate = 0;
item.shopOverDoneRate = 0;
}
else
{
item.shopDoneRate = Math.Round((double)item.shopDoneCount / (double)item.shopTotalCount * 100, 2);
item.shopOverDoneRate = Math.Round((double)item.shopOntimeCount / (double)item.shopTotalCount * 100, 2);
}
if (item.teamTotalCount == 0)
{
item.teamDoneRate = 0;
item.teamOverDoneRate = 0;
}
else
{
item.teamDoneRate = Math.Round((double)item.teamDoneCount / (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;
}); });
@ -11376,8 +11519,8 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
info.DOING = details.Count(t => t.NOTICE_STATUS == "0" && t.TASK_ENDDT >= DateTime.Now); info.DOING = details.Count(t => t.NOTICE_STATUS == "0" && t.TASK_ENDDT >= DateTime.Now);
info.UNFINISH = details.Count(t => t.NOTICE_STATUS == "0"); info.UNFINISH = details.Count(t => t.NOTICE_STATUS == "0");
info.OVER_UNFINISH = details.Count(t => t.NOTICE_STATUS == "0" && t.TASK_ENDDT < DateTime.Now); info.OVER_UNFINISH = details.Count(t => t.NOTICE_STATUS == "0" && t.TASK_ENDDT < DateTime.Now);
info.FINISH_RATE = info.TOTAL_QTY == 0 ? "0" : ((double)(info.NORMAL_FINISH + info.OVER_FINISH) / (info.TOTAL_QTY - info.DOING) * 100).ToString("0.00"); info.FINISH_RATE = info.TOTAL_QTY == 0|| (info.TOTAL_QTY - info.DOING) == 0 ? "0" : ((double)(info.NORMAL_FINISH + info.OVER_FINISH) / (info.TOTAL_QTY - info.DOING) * 100).ToString("0.00");
info.NORMAL_RATE = info.TOTAL_QTY == 0 ? "0" : ((double)info.NORMAL_FINISH / (info.TOTAL_QTY - info.DOING) * 100).ToString("0.00"); info.NORMAL_RATE = info.TOTAL_QTY == 0|| (info.TOTAL_QTY - info.DOING) == 0 ? "0" : ((double)info.NORMAL_FINISH / (info.TOTAL_QTY - info.DOING) * 100).ToString("0.00");
info.details = new List<TaskViewInfoDetail>(); info.details = new List<TaskViewInfoDetail>();
if (details != null && details.Any()) if (details != null && details.Any())
{ {

View File

@ -747,9 +747,12 @@ namespace APT.SK.WebApi.Controllers.Api
if (item2 != null && item2.DEPARTMENT_ID != null) if (item2 != null && item2.DEPARTMENT_ID != null)
{ {
var first = departs.FirstOrDefault(t => t.ID == item2.DEPARTMENT_ID); var first = departs.FirstOrDefault(t => t.ID == item2.DEPARTMENT_ID);
var level = Enum.GetName(typeof(FMDepartmentType), first.DEPARTMENT_TYPE); if (first != null)
levelStr.Add(level); {
departIds.Add(first.ID); var level = Enum.GetName(typeof(FMDepartmentType), first?.DEPARTMENT_TYPE);
levelStr.Add(level);
departIds.Add(first.ID);
}
} }
} }
} }

View File

@ -44,7 +44,7 @@ namespace APT.SK.WebApi.Controllers.Api
entity.ApplyDepartmentName = this.GetEntity<T_FM_DEPARTMENT>(t => t.ID == departId).NAME; entity.ApplyDepartmentName = this.GetEntity<T_FM_DEPARTMENT>(t => t.ID == departId).NAME;
entity.ApplyPostName = this.GetEntity<T_FM_USER>(t => t.ID == userId, "Nav_Person.Nav_Post")?.Nav_Person?.Nav_Post?.NAME; entity.ApplyPostName = this.GetEntity<T_FM_USER>(t => t.ID == userId, "Nav_Person.Nav_Post")?.Nav_Person?.Nav_Post?.NAME;
T_FM_NOTIFICATION_TASK finishNotice = null; T_FM_NOTIFICATION_TASK finishNotice = null;
if (entity.STATUS != PFStandardStatus.Draft) if (entity.STATUS != PFStandardStatus.Draft && entity.STATUS != PFStandardStatus.Rejected)
{ {
var taskId = entity.TaskID; var taskId = entity.TaskID;
if (taskId == Guid.Empty) if (taskId == Guid.Empty)
@ -87,6 +87,9 @@ namespace APT.SK.WebApi.Controllers.Api
} }
} }
entity.STATUS = PFStandardStatus.Approving; entity.STATUS = PFStandardStatus.Approving;
entity.Nav_RectifyRecord = null;
entity.Nav_ApplyUser = null;
entity.Nav_ApplyDepartment = null;
//取审批流水码 //取审批流水码
var sysFilter = new SystemCodeFilter(); var sysFilter = new SystemCodeFilter();
sysFilter.CodeType = (int)PFCodeRuleType.; sysFilter.CodeType = (int)PFCodeRuleType.;

View File

@ -622,7 +622,7 @@ namespace APT.SK.WebApi.Controllers.Api
record.HIDDEN_PLACE = detail.HIDDEN_PLACE; record.HIDDEN_PLACE = detail.HIDDEN_PLACE;
record.HIDDEN_DESCRIPTION = detail.HIDDEN_DESCRIPTION; record.HIDDEN_DESCRIPTION = detail.HIDDEN_DESCRIPTION;
record.HIDDEN_LEVEL = detail.HIDDEN_LEVEL; record.HIDDEN_LEVEL = detail.HIDDEN_LEVEL;
record.RECTIFICATION_MEASURES = detail.REMARK; record.RECTIFICATION_MEASURES = detail.RECTIFICATION_MEASURES;
record.RECITIFY_TIME = detail.RECITIFY_TIME; record.RECITIFY_TIME = detail.RECITIFY_TIME;
record.RECITIFY_USER_ID = detail.RECITIFY_USER_ID; record.RECITIFY_USER_ID = detail.RECITIFY_USER_ID;
record.ACCEPT_USER_ID = detail.ACCEPT_USER_ID; record.ACCEPT_USER_ID = detail.ACCEPT_USER_ID;

View File

@ -306,7 +306,7 @@ namespace APT.SK.WebApi.Controllers.Api
detail.CHECKCONTENT = item.CHECKCONTENT; detail.CHECKCONTENT = item.CHECKCONTENT;
detail.CHECKPROOF = item.CHECKPROOF; detail.CHECKPROOF = item.CHECKPROOF;
detail.CHECKSTANDARD = item.CHECKSTANDARD; detail.CHECKSTANDARD = item.CHECKSTANDARD;
detail.HIDDEN_DESCRIPTION = string.IsNullOrEmpty(item.HIDDEN_DESCRIPTION) ? item.Nav_Question?.DESCREPTION : item.HIDDEN_DESCRIPTION; detail.HIDDEN_DESCRIPTION = item.HIDDEN_DESCRIPTION;
detail.HIDDEN_LEVEL = item.HIDDEN_LEVEL; detail.HIDDEN_LEVEL = item.HIDDEN_LEVEL;
detail.HIDDEN_PLACE = item.HIDDEN_PLACE; detail.HIDDEN_PLACE = item.HIDDEN_PLACE;
detail.MARK = item.MARK; detail.MARK = item.MARK;
@ -501,7 +501,7 @@ namespace APT.SK.WebApi.Controllers.Api
detail.CHECKCONTENT = item.CHECKCONTENT; detail.CHECKCONTENT = item.CHECKCONTENT;
detail.CHECKPROOF = item.CHECKPROOF; detail.CHECKPROOF = item.CHECKPROOF;
detail.CHECKSTANDARD = item.CHECKSTANDARD; detail.CHECKSTANDARD = item.CHECKSTANDARD;
detail.HIDDEN_DESCRIPTION = string.IsNullOrEmpty(item.HIDDEN_DESCRIPTION) ? item.Nav_Question?.DESCREPTION : item.HIDDEN_DESCRIPTION; detail.HIDDEN_DESCRIPTION = item.HIDDEN_DESCRIPTION;
detail.HIDDEN_LEVEL = item.HIDDEN_LEVEL; detail.HIDDEN_LEVEL = item.HIDDEN_LEVEL;
detail.HIDDEN_PLACE = item.HIDDEN_PLACE; detail.HIDDEN_PLACE = item.HIDDEN_PLACE;
detail.MARK = item.MARK; detail.MARK = item.MARK;
@ -652,7 +652,7 @@ namespace APT.SK.WebApi.Controllers.Api
detail.CHECKCONTENT = item.CHECKCONTENT; detail.CHECKCONTENT = item.CHECKCONTENT;
detail.CHECKPROOF = item.CHECKPROOF; detail.CHECKPROOF = item.CHECKPROOF;
detail.CHECKSTANDARD = item.CHECKSTANDARD; detail.CHECKSTANDARD = item.CHECKSTANDARD;
detail.HIDDEN_DESCRIPTION = string.IsNullOrEmpty(item.HIDDEN_DESCRIPTION) ? item.Nav_Question?.DESCREPTION : item.HIDDEN_DESCRIPTION; detail.HIDDEN_DESCRIPTION = item.HIDDEN_DESCRIPTION;
detail.HIDDEN_LEVEL = item.HIDDEN_LEVEL; detail.HIDDEN_LEVEL = item.HIDDEN_LEVEL;
detail.HIDDEN_PLACE = item.HIDDEN_PLACE; detail.HIDDEN_PLACE = item.HIDDEN_PLACE;
detail.MARK = item.MARK; detail.MARK = item.MARK;