1
This commit is contained in:
parent
de2ce97034
commit
d4d40a225d
@ -1,24 +1,24 @@
|
|||||||
using APT.Infrastructure.Core;
|
using APT.BaseData.Domain.ApiModel;
|
||||||
using APT.BaseData.Domain.Entities.FM;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using APT.BaseData.Domain.IServices.FM;
|
|
||||||
|
|
||||||
using APT.Utility;
|
|
||||||
using APT.BaseData.Domain.Entities.BD;
|
using APT.BaseData.Domain.Entities.BD;
|
||||||
using System.Linq;
|
using APT.BaseData.Domain.Entities.FM;
|
||||||
using APT.BaseData.Domain.Enums;
|
using APT.BaseData.Domain.Enums;
|
||||||
using System;
|
|
||||||
using System.Linq.Expressions;
|
|
||||||
using APT.BaseData.Services.Services.FM;
|
|
||||||
using APT.BaseData.Domain.IServices;
|
|
||||||
using APT.BaseData.Services.DomainServices;
|
|
||||||
using NPOI.Util;
|
|
||||||
using Google.Protobuf.WellKnownTypes;
|
|
||||||
using APT.BaseData.Domain.ApiModel;
|
|
||||||
using NPOI.SS.Formula.Functions;
|
|
||||||
using APT.MS.Domain.Entities.PF;
|
|
||||||
using APT.BaseData.Domain.Enums.PF;
|
using APT.BaseData.Domain.Enums.PF;
|
||||||
|
using APT.BaseData.Domain.IServices;
|
||||||
|
using APT.BaseData.Domain.IServices.FM;
|
||||||
|
using APT.BaseData.Services.DomainServices;
|
||||||
|
using APT.BaseData.Services.Services.FM;
|
||||||
|
using APT.Infrastructure.Core;
|
||||||
|
using APT.MS.Domain.Entities.PF;
|
||||||
|
using APT.Utility;
|
||||||
|
using Google.Protobuf.WellKnownTypes;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using NPOI.SS.Formula.Functions;
|
||||||
|
using NPOI.Util;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
|
||||||
namespace APT.FM.WebApi.Controllers.Api.FM
|
namespace APT.FM.WebApi.Controllers.Api.FM
|
||||||
{
|
{
|
||||||
@ -384,17 +384,19 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
{
|
{
|
||||||
//var safeUser = entity==null?null:entity.Nav_SafeUser;
|
//var safeUser = entity==null?null:entity.Nav_SafeUser;
|
||||||
//entity.Nav_SafeUser = null;
|
//entity.Nav_SafeUser = null;
|
||||||
T_FM_TEAM teamInfo = null;
|
T_FM_TEAM addTeamInfo = null;
|
||||||
|
T_FM_TEAM updateTeamInfo = null;
|
||||||
|
var teamInfos = new List<T_FM_TEAM>();
|
||||||
if (entity.DEPARTMENT_TYPE == (int)FMDepartmentType.Class)
|
if (entity.DEPARTMENT_TYPE == (int)FMDepartmentType.Class)
|
||||||
{
|
{
|
||||||
teamInfo = this.GetEntity<T_FM_TEAM>(t => t.DEPARTMENT_ID == entity.ID);
|
var teamInfo = this.GetEntity<T_FM_TEAM>(t => t.DEPARTMENT_ID == entity.ID);
|
||||||
if (teamInfo == null)
|
if (teamInfo == null)
|
||||||
{
|
{
|
||||||
teamInfo = new T_FM_TEAM()
|
addTeamInfo = new T_FM_TEAM()
|
||||||
{
|
{
|
||||||
NAME = entity.NAME,
|
NAME = entity.NAME,
|
||||||
DEPARTMENT_ID = entity.ID,
|
DEPARTMENT_ID = entity.ID,
|
||||||
//CHARGE_PERSON_ID = user.PERSON_ID,
|
//CHARGE_PERSON_ID = entity.USER_ID,
|
||||||
ORG_ID = entity.ORG_ID,
|
ORG_ID = entity.ORG_ID,
|
||||||
ID = Guid.NewGuid(),
|
ID = Guid.NewGuid(),
|
||||||
};
|
};
|
||||||
@ -404,14 +406,10 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
teamInfo.NAME = entity.NAME;
|
teamInfo.NAME = entity.NAME;
|
||||||
teamInfo.DEPARTMENT_ID = entity.ID;
|
teamInfo.DEPARTMENT_ID = entity.ID;
|
||||||
//teamInfo.CHARGE_PERSON_ID = entity.USER_ID;
|
//teamInfo.CHARGE_PERSON_ID = entity.USER_ID;
|
||||||
|
updateTeamInfo = teamInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (entity.USER_ID != null)
|
|
||||||
{
|
|
||||||
var user = this.GetEntity<T_FM_USER>(t => t.ID == entity.USER_ID);
|
|
||||||
if (teamInfo != null)
|
|
||||||
teamInfo.CHARGE_PERSON_ID = user.PERSON_ID;
|
|
||||||
}
|
|
||||||
//List<T_FM_DEPARTMENT_PRODUCTION_UNIT> productionUnit = null;
|
//List<T_FM_DEPARTMENT_PRODUCTION_UNIT> productionUnit = null;
|
||||||
entity.Nav_ProdutionUnit = null;
|
entity.Nav_ProdutionUnit = null;
|
||||||
//if (productionUnit != null && productionUnit.Any())
|
//if (productionUnit != null && productionUnit.Any())
|
||||||
@ -424,8 +422,10 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
//}
|
//}
|
||||||
var unitList = new List<T_FM_DEPARTMENT_PRODUCTION_UNIT>();
|
var unitList = new List<T_FM_DEPARTMENT_PRODUCTION_UNIT>();
|
||||||
var userUnitList = new List<T_FM_USER_PRODUCTION_UNIT>();
|
var userUnitList = new List<T_FM_USER_PRODUCTION_UNIT>();
|
||||||
var departmentList = new List<T_FM_DEPARTMENT>();
|
var departUpdateList = new List<T_FM_DEPARTMENT>();
|
||||||
var userList = new List<T_FM_USER>();
|
var entityUpdateList = new List<T_FM_DEPARTMENT>();
|
||||||
|
var userUpdateList = new List<T_FM_USER>();
|
||||||
|
var userList = this.GetEntities<T_FM_USER>(t => t.ENABLE_STATUS == 0, new BaseFilter(entity.ORG_ID), "Nav_ProdutionUnit").ToList();
|
||||||
var deleteDepartIds = new List<Guid>();
|
var deleteDepartIds = new List<Guid>();
|
||||||
var deleteUserIds = new List<Guid>();
|
var deleteUserIds = new List<Guid>();
|
||||||
if (entity.PRODUCTION_UNIT_ID != null)
|
if (entity.PRODUCTION_UNIT_ID != null)
|
||||||
@ -435,14 +435,17 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
//查所有下级部门组织
|
//查所有下级部门组织
|
||||||
List<Guid> departmentId = new List<Guid>();
|
List<Guid> departmentId = new List<Guid>();
|
||||||
departmentId.Add(entity.ID);
|
departmentId.Add(entity.ID);
|
||||||
List<Guid> departmentIds = new List<Guid>() { entity.ID };
|
List<Guid> departmentIds = new List<Guid>();
|
||||||
var orgId = APT.Infrastructure.Api.AppContext.CurrentSession.OrgId.Value;
|
var orgId = APT.Infrastructure.Api.AppContext.CurrentSession.OrgId.Value;
|
||||||
DepartmentService.GetDepartmentIds(orgId, departmentId, ref departmentIds);
|
DepartmentService.GetDepartmentIds(orgId, departmentId, ref departmentIds);
|
||||||
departmentList = this.GetEntities<T_FM_DEPARTMENT>(t => departmentIds.Contains(t.ID) && t.ENABLE_STATUS == 0, new BaseFilter(orgId), "Nav_ProdutionUnit").ToList();
|
var departmentList = this.GetEntities<T_FM_DEPARTMENT>(t => departmentIds.Contains(t.ID) && t.ENABLE_STATUS == 0, new BaseFilter(orgId), "Nav_ProdutionUnit").ToList();
|
||||||
departmentList.ForEach(t =>
|
foreach (var t in departmentList)
|
||||||
{
|
{
|
||||||
|
t.ENABLE_STATUS = entity.ENABLE_STATUS;
|
||||||
|
t.IS_DELETED = entity.IS_DELETED;
|
||||||
t.MineType = entity.MineType;
|
t.MineType = entity.MineType;
|
||||||
t.PRODUCTION_UNIT_ID = entity.PRODUCTION_UNIT_ID;
|
t.PRODUCTION_UNIT_ID = entity.PRODUCTION_UNIT_ID;
|
||||||
|
departUpdateList.Add(t);
|
||||||
T_FM_DEPARTMENT_PRODUCTION_UNIT unit = new T_FM_DEPARTMENT_PRODUCTION_UNIT();
|
T_FM_DEPARTMENT_PRODUCTION_UNIT unit = new T_FM_DEPARTMENT_PRODUCTION_UNIT();
|
||||||
unit.ORG_ID = t.ORG_ID; unit.DEPARTMENT_ID = t.ID; //unit.ENUMS_ID = enumList?.ID;
|
unit.ORG_ID = t.ORG_ID; unit.DEPARTMENT_ID = t.ID; //unit.ENUMS_ID = enumList?.ID;
|
||||||
unit.Nav_Enums = null; unit.DEPART_UNIT_ID = entity.PRODUCTION_UNIT_ID;
|
unit.Nav_Enums = null; unit.DEPART_UNIT_ID = entity.PRODUCTION_UNIT_ID;
|
||||||
@ -452,10 +455,10 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
var ids = t.Nav_ProdutionUnit.Select(t => t.ID).ToList();
|
var ids = t.Nav_ProdutionUnit.Select(t => t.ID).ToList();
|
||||||
deleteDepartIds.AddRange(ids);
|
deleteDepartIds.AddRange(ids);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
//departmentList.ForEach(t => t.MineType = entity.MineType);
|
//departmentList.ForEach(t => t.MineType = entity.MineType);
|
||||||
userList = this.GetEntities<T_FM_USER>(t => departmentIds.Contains(t.DEPARTMENT_ID.Value) && t.ENABLE_STATUS == 0, new BaseFilter(orgId), "Nav_ProdutionUnit").ToList();
|
var userListTemp = userList.Where(t => t.DEPARTMENT_ID!=null && departmentIds.Contains(t.DEPARTMENT_ID.Value)).ToList();
|
||||||
userList.ForEach(t =>
|
userListTemp.ForEach(t =>
|
||||||
{
|
{
|
||||||
//var enumValues = new List<string>();
|
//var enumValues = new List<string>();
|
||||||
//productionUnit.ForEach(t1 =>
|
//productionUnit.ForEach(t1 =>
|
||||||
@ -468,6 +471,7 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
// enumValues.Add(value);
|
// enumValues.Add(value);
|
||||||
//});
|
//});
|
||||||
//t.MineType = string.Join(",", enumValues);
|
//t.MineType = string.Join(",", enumValues);
|
||||||
|
userUpdateList.Add(t);
|
||||||
T_FM_USER_PRODUCTION_UNIT unit = new T_FM_USER_PRODUCTION_UNIT();
|
T_FM_USER_PRODUCTION_UNIT unit = new T_FM_USER_PRODUCTION_UNIT();
|
||||||
unit.ORG_ID = t.ORG_ID; unit.USER_ID = t.ID; //unit.ENUMS_ID = enumList?.ID;
|
unit.ORG_ID = t.ORG_ID; unit.USER_ID = t.ID; //unit.ENUMS_ID = enumList?.ID;
|
||||||
unit.Nav_Enums = null; unit.PRODUCTION_UNIT_ID = entity.PRODUCTION_UNIT_ID;
|
unit.Nav_Enums = null; unit.PRODUCTION_UNIT_ID = entity.PRODUCTION_UNIT_ID;
|
||||||
@ -479,42 +483,58 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (entity.USER_ID != null)
|
||||||
|
{
|
||||||
|
var user = userList.FirstOrDefault(t => t.ID == entity.USER_ID);
|
||||||
|
if (addTeamInfo != null)
|
||||||
|
addTeamInfo.CHARGE_PERSON_ID = user.PERSON_ID;
|
||||||
|
if (updateTeamInfo != null)
|
||||||
|
updateTeamInfo.CHARGE_PERSON_ID = user.PERSON_ID;
|
||||||
|
}
|
||||||
if (entity.ENABLE_STATUS == 1)
|
if (entity.ENABLE_STATUS == 1)
|
||||||
{
|
{
|
||||||
entity.IS_DELETED = true;
|
entity.IS_DELETED = true;
|
||||||
if (teamInfo != null)
|
if (updateTeamInfo != null)
|
||||||
{
|
{
|
||||||
teamInfo.ENABLE_STATUS = 1;
|
updateTeamInfo.ENABLE_STATUS = 1;
|
||||||
teamInfo.IS_DELETED = true;
|
updateTeamInfo.IS_DELETED = true;
|
||||||
}
|
teamInfos.Add(updateTeamInfo);
|
||||||
foreach (var item in unitList.Where(m => m.DEPARTMENT_ID == entity.ID))
|
|
||||||
{
|
|
||||||
item.IS_DELETED = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
entityUpdateList.Add(entity);
|
||||||
|
foreach (var item in departUpdateList)
|
||||||
|
{
|
||||||
|
item.Nav_User = null; item.Nav_ProdutionUnit = null; item.Nav_Unit = null; item.Nav_Parent = null; item.Nav_DepartmentUser = null;
|
||||||
|
}
|
||||||
|
foreach (var item in entityUpdateList)
|
||||||
|
{
|
||||||
|
item.Nav_User = null; item.Nav_ProdutionUnit = null; item.Nav_Unit = null; item.Nav_Parent = null;item.Nav_DepartmentUser = null;
|
||||||
|
}
|
||||||
this.UnifiedCommit(() =>
|
this.UnifiedCommit(() =>
|
||||||
{
|
{
|
||||||
//BantchUpdateEntity_noneBase
|
//BantchUpdateEntity_noneBase
|
||||||
//if (safeUser != null && safeUser.Any())
|
//if (safeUser != null && safeUser.Any())
|
||||||
// this.BantchSaveEntityNoCommit(safeUser);
|
// this.BantchSaveEntityNoCommit(safeUser);
|
||||||
if (teamInfo != null)
|
if (addTeamInfo != null)
|
||||||
this.UpdateEntityNoCommit(teamInfo);
|
this.UpdateEntityNoCommit(addTeamInfo);
|
||||||
//if (productionUnit != null && productionUnit.Any())
|
|
||||||
// this.BantchSaveEntityNoCommit(productionUnit);
|
|
||||||
if (deleteDepartIds != null && deleteDepartIds.Any())
|
if (deleteDepartIds != null && deleteDepartIds.Any())
|
||||||
this.BantchDeleteEntityNoCommit<T_FM_DEPARTMENT_PRODUCTION_UNIT>(deleteDepartIds);
|
this.BantchDeleteEntityNoCommit<T_FM_DEPARTMENT_PRODUCTION_UNIT>(deleteDepartIds);
|
||||||
if (deleteUserIds != null && deleteUserIds.Any())
|
if (deleteUserIds != null && deleteUserIds.Any())
|
||||||
this.BantchDeleteEntityNoCommit<T_FM_USER_PRODUCTION_UNIT>(deleteUserIds);
|
this.BantchDeleteEntityNoCommit<T_FM_USER_PRODUCTION_UNIT>(deleteUserIds);
|
||||||
if (departmentList != null && departmentList.Any())
|
if (userUpdateList != null && userUpdateList.Any())
|
||||||
this.BantchSaveEntityNoCommit(departmentList);
|
this.BantchSaveEntityNoCommit(userUpdateList);
|
||||||
if (userList != null && userList.Any())
|
|
||||||
this.BantchSaveEntityNoCommit(userList);
|
|
||||||
if (unitList != null && unitList.Any())
|
if (unitList != null && unitList.Any())
|
||||||
this.BantchSaveEntityNoCommit(unitList);
|
this.BantchSaveEntityNoCommit(unitList);
|
||||||
if (userUnitList != null && userUnitList.Any())
|
if (userUnitList != null && userUnitList.Any())
|
||||||
this.BantchSaveEntityNoCommit(userUnitList);
|
this.BantchSaveEntityNoCommit(userUnitList);
|
||||||
if (entity != null)
|
if (departUpdateList != null && departUpdateList.Any())
|
||||||
this.UpdateEntityNoCommit(entity);
|
this.BantchUpdateEntity_noneBase(departUpdateList);
|
||||||
|
if (teamInfos != null && teamInfos.Any())
|
||||||
|
this.BantchUpdateEntity_noneBase(teamInfos);
|
||||||
|
if (entityUpdateList != null && entityUpdateList.Any())
|
||||||
|
this.BantchUpdateEntity_noneBase(entityUpdateList);
|
||||||
|
//if (entity != null)
|
||||||
|
// this.UpdateEntityNoCommit(entity);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2780,9 +2780,12 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var teamLists = new List<T_FM_TEAM>();
|
var departLists = new List<T_FM_DEPARTMENT>();
|
||||||
var teamPersonLists = new List<T_FM_TEAM_PERSON>();
|
var teamAddLists = new List<T_FM_TEAM>();
|
||||||
var teamPersonIds = new List<Guid>();
|
var teamUpdateLists = new List<T_FM_TEAM>();
|
||||||
|
var teamPersonAddLists = new List<T_FM_TEAM_PERSON>();
|
||||||
|
var teamPersonUpdateLists = new List<T_FM_TEAM_PERSON>();
|
||||||
|
var deleteTeamPersonIds = new List<Guid>();
|
||||||
var departs = this.GetEntities_noneBase<T_FM_DEPARTMENT>(t => t.DEPARTMENT_TYPE == (int)FMDepartmentType.Class);
|
var departs = this.GetEntities_noneBase<T_FM_DEPARTMENT>(t => t.DEPARTMENT_TYPE == (int)FMDepartmentType.Class);
|
||||||
var departIds = departs.Select(t => t.ID).ToList();
|
var departIds = departs.Select(t => t.ID).ToList();
|
||||||
var teams = this.GetEntities_noneBase<T_FM_TEAM>(t => true);
|
var teams = this.GetEntities_noneBase<T_FM_TEAM>(t => true);
|
||||||
@ -2796,78 +2799,83 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
var userInfo = users.FirstOrDefault(t => t.ID == departInfo?.USER_ID);
|
var userInfo = users.FirstOrDefault(t => t.ID == departInfo?.USER_ID);
|
||||||
var persons = users.Where(t => t.DEPARTMENT_ID == item && t.PERSON_ID != null).ToList();
|
var persons = users.Where(t => t.DEPARTMENT_ID == item && t.PERSON_ID != null).ToList();
|
||||||
var teamInfo = teams.FirstOrDefault(t => t.DEPARTMENT_ID == item);
|
var teamInfo = teams.FirstOrDefault(t => t.DEPARTMENT_ID == item);
|
||||||
if (teamInfo == null)
|
if (teamInfo == null)
|
||||||
|
{
|
||||||
|
if (departInfo.IS_DELETED == false)
|
||||||
{
|
{
|
||||||
if (departInfo.IS_DELETED == false)
|
T_FM_TEAM team = new T_FM_TEAM();
|
||||||
|
team.ORG_ID = filter.OrgId;
|
||||||
|
team.CHARGE_PERSON_ID = userInfo?.PERSON_ID;
|
||||||
|
team.NAME = departInfo.NAME;
|
||||||
|
team.ENABLE_STATUS = 0;
|
||||||
|
team.DEPARTMENT_ID = item;
|
||||||
|
team.ENABLE_STATUS = departInfo.ENABLE_STATUS;
|
||||||
|
team.IS_DELETED = departInfo.IS_DELETED;
|
||||||
|
teamAddLists.Add(team);
|
||||||
|
if (persons != null && persons.Any())
|
||||||
{
|
{
|
||||||
T_FM_TEAM team = new T_FM_TEAM();
|
foreach (var per in persons)
|
||||||
team.ORG_ID = filter.OrgId;
|
{
|
||||||
team.CHARGE_PERSON_ID = userInfo?.PERSON_ID;
|
T_FM_TEAM_PERSON person = new T_FM_TEAM_PERSON();
|
||||||
team.NAME = departInfo.NAME;
|
person.ORG_ID = filter.OrgId;
|
||||||
team.ENABLE_STATUS = 0;
|
person.TEAM_ID = team.ID;
|
||||||
team.DEPARTMENT_ID = item;
|
person.PERSON_ID = (Guid)per.PERSON_ID;
|
||||||
team.ENABLE_STATUS = departInfo.ENABLE_STATUS;
|
person.IS_DELETED = departInfo.IS_DELETED;
|
||||||
team.IS_DELETED = departInfo.IS_DELETED;
|
teamPersonAddLists.Add(person);
|
||||||
teamLists.Add(team);
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
teamInfo.CHARGE_PERSON_ID = userInfo?.PERSON_ID;
|
||||||
|
if (departInfo.IS_DELETED == true || departInfo.ENABLE_STATUS == 1)
|
||||||
|
{
|
||||||
|
departInfo.IS_DELETED = true;
|
||||||
|
departInfo.ENABLE_STATUS = 1;
|
||||||
|
departLists.Add(departInfo);
|
||||||
|
teamInfo.ENABLE_STATUS = 1;
|
||||||
|
teamInfo.IS_DELETED = true;
|
||||||
|
teamUpdateLists.Add(teamInfo);
|
||||||
|
foreach (var item1 in teamPersons.Where(t => t.TEAM_ID == teamInfo.ID))
|
||||||
|
{
|
||||||
|
item1.IS_DELETED = true;
|
||||||
|
teamPersonUpdateLists.Add(item1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var teamPersonIds = teamPersons.Where(t => t.TEAM_ID == teamInfo.ID).Select(m => m.ID).ToList();
|
||||||
|
deleteTeamPersonIds.AddRange(teamPersonIds);
|
||||||
if (persons != null && persons.Any())
|
if (persons != null && persons.Any())
|
||||||
{
|
{
|
||||||
foreach (var per in persons)
|
foreach (var per in persons)
|
||||||
{
|
{
|
||||||
T_FM_TEAM_PERSON person = new T_FM_TEAM_PERSON();
|
T_FM_TEAM_PERSON person = new T_FM_TEAM_PERSON();
|
||||||
person.ORG_ID = filter.OrgId;
|
person.ORG_ID = filter.OrgId;
|
||||||
person.TEAM_ID = team.ID;
|
person.TEAM_ID = teamInfo.ID;
|
||||||
person.PERSON_ID = (Guid)per.PERSON_ID;
|
person.PERSON_ID = (Guid)per.PERSON_ID;
|
||||||
person.IS_DELETED = departInfo.IS_DELETED;
|
teamPersonAddLists.Add(person);
|
||||||
teamPersonLists.Add(person);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
teamInfo.CHARGE_PERSON_ID = userInfo?.PERSON_ID;
|
|
||||||
teamInfo.ENABLE_STATUS = departInfo.ENABLE_STATUS;
|
|
||||||
teamInfo.IS_DELETED = departInfo.IS_DELETED;
|
|
||||||
teamLists.Add(teamInfo);
|
|
||||||
if (teamInfo.IS_DELETED == true)
|
|
||||||
{
|
|
||||||
foreach (var item1 in teamPersons.Where(t => t.TEAM_ID == teamInfo.ID))
|
|
||||||
{
|
|
||||||
item1.IS_DELETED = true;
|
|
||||||
teamPersonLists.Add(item1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var personIds = teamPersons.Where(t => t.TEAM_ID == teamInfo.ID).Select(m => m.PERSON_ID).ToList();
|
|
||||||
if (persons != null && persons.Any())
|
|
||||||
{
|
|
||||||
foreach (var per in persons)
|
|
||||||
{
|
|
||||||
if (!personIds.Contains((Guid)per.PERSON_ID))
|
|
||||||
{
|
|
||||||
T_FM_TEAM_PERSON person = new T_FM_TEAM_PERSON();
|
|
||||||
person.ORG_ID = filter.OrgId;
|
|
||||||
person.TEAM_ID = teamInfo.ID;
|
|
||||||
person.PERSON_ID = (Guid)per.PERSON_ID;
|
|
||||||
teamPersonLists.Add(person);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var deletePersonId = teamPersonLists.Select(t => t.PERSON_ID).ToList();
|
|
||||||
teamPersonIds = teamPersons.Where(t => personIds.Contains(t.PERSON_ID) && t.TEAM_ID != teamInfo.ID).Select(m => m.ID).ToList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UnifiedCommit(() =>
|
UnifiedCommit(() =>
|
||||||
{
|
{
|
||||||
if (teamPersonLists != null && teamPersonLists.Any())
|
if (deleteTeamPersonIds != null && deleteTeamPersonIds.Any())
|
||||||
BantchUpdateEntity_noneBase(teamPersonLists);
|
BantchDeleteEntityNoCommit<T_FM_TEAM_PERSON>(deleteTeamPersonIds);
|
||||||
if (teamLists != null && teamLists.Any())
|
if (teamAddLists != null && teamAddLists.Any())
|
||||||
BantchUpdateEntity_noneBase(teamLists);
|
BantchSaveEntityNoCommit(teamAddLists);
|
||||||
if (teamPersonIds != null && teamPersonIds.Any())
|
if (teamPersonAddLists != null && teamPersonAddLists.Any())
|
||||||
BantchDeleteEntityNoCommit<T_FM_TEAM_PERSON>(teamPersonIds);
|
BantchSaveEntityNoCommit(teamPersonAddLists);
|
||||||
|
if (teamPersonUpdateLists != null && teamPersonUpdateLists.Any())
|
||||||
|
BantchUpdateEntity_noneBase(teamPersonUpdateLists);
|
||||||
|
if (teamUpdateLists != null && teamUpdateLists.Any())
|
||||||
|
BantchUpdateEntity_noneBase(teamUpdateLists);
|
||||||
|
if (departLists != null && departLists.Any())
|
||||||
|
BantchUpdateEntity_noneBase(departLists);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user