优化
This commit is contained in:
parent
bbbf534056
commit
7de38274ad
@ -530,7 +530,7 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
{
|
{
|
||||||
return SafeExecute<bool>(() =>
|
return SafeExecute<bool>(() =>
|
||||||
{
|
{
|
||||||
//var allUsers = this.GetEntities<T_FM_USER>(t => t.IS_DELETED == false, null, "Nav_ApproveRole");
|
var allUsers = this.GetEntities<T_FM_USER>(t => t.IS_DELETED == false, null, "Nav_ApproveRole");
|
||||||
var isAdd = this.GetEntity<T_FM_USER>(entity.ID.ToString(), "Nav_ApproveRole", "Nav_BelongRoles");
|
var isAdd = this.GetEntity<T_FM_USER>(entity.ID.ToString(), "Nav_ApproveRole", "Nav_BelongRoles");
|
||||||
string dbRuleStr = string.Empty;
|
string dbRuleStr = string.Empty;
|
||||||
var userList = new List<T_FM_USER>();
|
var userList = new List<T_FM_USER>();
|
||||||
@ -793,25 +793,28 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
if (isExist != null)
|
if (isExist != null)
|
||||||
this.ThrowError("070001");
|
this.ThrowError("070001");
|
||||||
}
|
}
|
||||||
//删除旧的排班,在新的排班里面加入
|
var oldUser = allUsers.FirstOrDefault(t => t.ID == entity.ID);
|
||||||
deleteDepartScheIds = this.GetEntities<T_FM_DEPARTMENT_SCHEDULING_DETAIL>(t =>t.Nav_DepartmentScheduling!=null && t.Nav_DepartmentScheduling.DATE_TIME >= DateTime.Now.Date && t.Nav_DepartmentScheduling.START_TIME >= DateTime.Now && t.PERSON_ID == entity.PERSON_ID,new BaseFilter(entity.ORG_ID)).Select(m => m.ID).ToList();
|
if (oldUser != null && oldUser.DEPARTMENT_ID != entity.DEPARTMENT_ID)
|
||||||
if (departScheIds != null && departScheIds.Any())
|
|
||||||
{
|
{
|
||||||
var departScheDetailTemps = this.GetEntities<T_FM_DEPARTMENT_SCHEDULING_DETAIL>(t => departScheIds.Contains(t.DEPARTMENT_SCHEDULING_ID) && t.PERSON_ID == entity.PERSON_ID, new BaseFilter(entity.ORG_ID)).ToList();
|
//删除旧的排班,在新的排班里面加入
|
||||||
foreach (var id in departScheIds)
|
deleteDepartScheIds = this.GetEntities<T_FM_DEPARTMENT_SCHEDULING_DETAIL>(t => t.Nav_DepartmentScheduling != null && t.Nav_DepartmentScheduling.DATE_TIME >= DateTime.Now.Date && t.Nav_DepartmentScheduling.START_TIME >= DateTime.Now && t.PERSON_ID == entity.PERSON_ID, new BaseFilter(entity.ORG_ID)).Select(m => m.ID).ToList();
|
||||||
|
if (departScheIds != null && departScheIds.Any())
|
||||||
{
|
{
|
||||||
var detail = departScheDetailTemps.FirstOrDefault(t => t.DEPARTMENT_SCHEDULING_ID == id);
|
var departScheDetailTemps = this.GetEntities<T_FM_DEPARTMENT_SCHEDULING_DETAIL>(t => departScheIds.Contains(t.DEPARTMENT_SCHEDULING_ID) && t.PERSON_ID == entity.PERSON_ID, new BaseFilter(entity.ORG_ID)).ToList();
|
||||||
if (detail == null)
|
foreach (var id in departScheIds)
|
||||||
{
|
{
|
||||||
T_FM_DEPARTMENT_SCHEDULING_DETAIL de = new T_FM_DEPARTMENT_SCHEDULING_DETAIL();
|
var detail = departScheDetailTemps.FirstOrDefault(t => t.DEPARTMENT_SCHEDULING_ID == id);
|
||||||
de.ORG_ID = entity.ORG_ID;
|
if (detail == null)
|
||||||
de.DEPARTMENT_SCHEDULING_ID = id;
|
{
|
||||||
de.PERSON_ID = entity.PERSON_ID.Value;
|
T_FM_DEPARTMENT_SCHEDULING_DETAIL de = new T_FM_DEPARTMENT_SCHEDULING_DETAIL();
|
||||||
departScheDetails.Add(de);
|
de.ORG_ID = entity.ORG_ID;
|
||||||
|
de.DEPARTMENT_SCHEDULING_ID = id;
|
||||||
|
de.PERSON_ID = entity.PERSON_ID.Value;
|
||||||
|
departScheDetails.Add(de);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (entity.APPROVE_ROLE_ID != null)
|
if (entity.APPROVE_ROLE_ID != null)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user