Merge branch 'master' of http://121.41.2.71:3000/wyw/mh_jy_safe
This commit is contained in:
commit
0ee8b65789
@ -1,39 +1,40 @@
|
|||||||
using APT.BaseData.Domain.Entities.FM;
|
using APT.BaseData.Domain.Entities;
|
||||||
|
using APT.BaseData.Domain.Entities.FM;
|
||||||
|
using APT.BaseData.Domain.Entities.OP;
|
||||||
using APT.BaseData.Domain.Enums;
|
using APT.BaseData.Domain.Enums;
|
||||||
using APT.BaseData.Domain.Entities;
|
using APT.BaseData.Domain.Enums.PF;
|
||||||
using APT.BaseData.Domain.IServices;
|
using APT.BaseData.Domain.IServices;
|
||||||
|
using APT.BaseData.Domain.IServices.FM;
|
||||||
|
using APT.Infrastructure.Api;
|
||||||
using APT.Infrastructure.Core;
|
using APT.Infrastructure.Core;
|
||||||
|
using APT.Migrations;
|
||||||
|
using APT.MS.Domain.Entities.BI;
|
||||||
|
using APT.MS.Domain.Entities.BS;
|
||||||
using APT.MS.Domain.Entities.FO;
|
using APT.MS.Domain.Entities.FO;
|
||||||
|
using APT.MS.Domain.Entities.HM;
|
||||||
|
using APT.MS.Domain.Entities.SC.PT;
|
||||||
|
using APT.MS.Domain.Entities.SE;
|
||||||
|
using APT.MS.Domain.Enums;
|
||||||
using APT.Utility;
|
using APT.Utility;
|
||||||
|
using APT.WebApi.Models;
|
||||||
|
using Castle.Core.Internal;
|
||||||
|
using Google.Protobuf.Collections;
|
||||||
|
using ICSharpCode.SharpZipLib.Core;
|
||||||
|
using InfluxData.Net.InfluxDb.Enums;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using MySqlX.XDevAPI.Common;
|
||||||
|
using NPOI.SS.Formula.Functions;
|
||||||
|
using NPOI.Util;
|
||||||
|
using Org.BouncyCastle.Utilities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using APT.BaseData.Domain.IServices.FM;
|
|
||||||
using APT.MS.Domain.Entities.HM;
|
|
||||||
using APT.MS.Domain.Enums;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using APT.MS.Domain.Entities.BS;
|
using System.Linq;
|
||||||
using APT.MS.Domain.Entities.SC.PT;
|
|
||||||
using Castle.Core.Internal;
|
|
||||||
using ICSharpCode.SharpZipLib.Core;
|
|
||||||
using APT.MS.Domain.Entities.SE;
|
|
||||||
using APT.BaseData.Domain.Enums.PF;
|
|
||||||
using APT.MS.Domain.Entities.BI;
|
|
||||||
using Google.Protobuf.Collections;
|
|
||||||
using InfluxData.Net.InfluxDb.Enums;
|
|
||||||
using NPOI.Util;
|
|
||||||
using APT.BaseData.Domain.Entities.OP;
|
|
||||||
using APT.Migrations;
|
|
||||||
using APT.Infrastructure.Api;
|
|
||||||
using Org.BouncyCastle.Utilities;
|
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using MySqlX.XDevAPI.Common;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NPOI.SS.Formula.Functions;
|
using static NPOI.HSSF.Util.HSSFColor;
|
||||||
using APT.WebApi.Models;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
||||||
|
|
||||||
namespace APT.PP.WebApi.Controllers.Api.PP
|
namespace APT.PP.WebApi.Controllers.Api.PP
|
||||||
{
|
{
|
||||||
@ -2767,7 +2768,100 @@ namespace APT.PP.WebApi.Controllers.Api.PP
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 每天更新人员及班组管理表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pageFilter"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost, Route("UpdateTeamInfoSync")]
|
||||||
|
public JsonActionResult<bool> UpdateTeamInfoSync([FromBody] KeywordFilter filter)
|
||||||
|
{
|
||||||
|
return SafeExecute<bool>(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var teamLists = new List<T_FM_TEAM>();
|
||||||
|
var teamPersonLists = new List<T_FM_TEAM_PERSON>();
|
||||||
|
var teamPersonIds = new List<Guid>();
|
||||||
|
var departs = this.GetEntities<T_FM_DEPARTMENT>(t => t.ENABLE_STATUS == 0 && t.CATEGORY == FMCATEGORY.ACTURE && t.DEPARTMENT_TYPE == (int)FMDepartmentType.Class,new BaseFilter(filter.OrgId));
|
||||||
|
var departIds = departs.Select(t => t.ID).ToList();
|
||||||
|
var teams = this.GetEntities<T_FM_TEAM>(t => t.ENABLE_STATUS == 0, new BaseFilter(filter.OrgId));
|
||||||
|
var teamPersons = this.GetEntities< T_FM_TEAM_PERSON> (t =>true, new BaseFilter(filter.OrgId));
|
||||||
|
var users = this.GetEntities<T_FM_USER>(t => t.ENABLE_STATUS == 0 && t.DEPARTMENT_ID != null && departIds.Contains((Guid)t.DEPARTMENT_ID),new BaseFilter(filter.OrgId));
|
||||||
|
if (departIds != null && departIds.Any())
|
||||||
|
{
|
||||||
|
foreach (var item in departIds)
|
||||||
|
{
|
||||||
|
var departInfo = departs.FirstOrDefault(t => t.ID == item);
|
||||||
|
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 teamInfo = teams.FirstOrDefault(t => t.DEPARTMENT_ID == item);
|
||||||
|
if (teamInfo == null)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
teamLists.Add(team);
|
||||||
|
if (persons != null && persons.Any())
|
||||||
|
{
|
||||||
|
foreach (var per in persons)
|
||||||
|
{
|
||||||
|
T_FM_TEAM_PERSON person = new T_FM_TEAM_PERSON();
|
||||||
|
person.ORG_ID = filter.OrgId;
|
||||||
|
person.TEAM_ID = team.ID;
|
||||||
|
person.PERSON_ID = (Guid)per.PERSON_ID;
|
||||||
|
teamPersonLists.Add(person);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
teamInfo.CHARGE_PERSON_ID = userInfo?.PERSON_ID;
|
||||||
|
teamLists.Add(teamInfo);
|
||||||
|
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 deletePersonIds = users.Where(t => personIds.Contains((Guid)t.PERSON_ID) && t.DEPARTMENT_ID != teamInfo.DEPARTMENT_ID).Select(m=>m.PERSON_ID).ToList();
|
||||||
|
teamPersonIds = teamPersons.Where(t => deletePersonIds.Contains(t.PERSON_ID)).Select(m => m.ID).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UnifiedCommit(() =>
|
||||||
|
{
|
||||||
|
if (teamLists != null && teamLists.Any())
|
||||||
|
BantchSaveEntityNoCommit(teamLists);
|
||||||
|
if (teamPersonLists != null && teamPersonLists.Any())
|
||||||
|
BantchSaveEntityNoCommit(teamPersonLists);
|
||||||
|
if (teamPersonIds != null && teamPersonIds.Any())
|
||||||
|
BantchDeleteEntityNoCommit<T_FM_TEAM_PERSON>(teamPersonIds);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RiskInfo
|
public class RiskInfo
|
||||||
|
|||||||
@ -5559,6 +5559,7 @@ namespace APT.PP.WebApi.Controllers.Api
|
|||||||
}
|
}
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
|
bool send = true;
|
||||||
var setTime = setList.FirstOrDefault(t => t.PRODUCTION_UNIT_ID == item.PRODUCTION_UNIT_ID && t.CHECK_CYCLE == item.Cycle);
|
var setTime = setList.FirstOrDefault(t => t.PRODUCTION_UNIT_ID == item.PRODUCTION_UNIT_ID && t.CHECK_CYCLE == item.Cycle);
|
||||||
//判断是否重复触发
|
//判断是否重复触发
|
||||||
var exist = noticeExsiss.FirstOrDefault(t => t.APPLY_USER_ID == userInfo.ID && t.DEPARTMENT_TYPE == item.DepartType && t.CHECK_TYPE_ID == item.CheckTypeId && t.PLANCHECKFREQUENCY == item.Cycle && t.CREATE_TIME.Value.Date == dt.Date);
|
var exist = noticeExsiss.FirstOrDefault(t => t.APPLY_USER_ID == userInfo.ID && t.DEPARTMENT_TYPE == item.DepartType && t.CHECK_TYPE_ID == item.CheckTypeId && t.PLANCHECKFREQUENCY == item.Cycle && t.CREATE_TIME.Value.Date == dt.Date);
|
||||||
@ -5571,10 +5572,17 @@ namespace APT.PP.WebApi.Controllers.Api
|
|||||||
if (sche != null)
|
if (sche != null)
|
||||||
{
|
{
|
||||||
var startTime = sche.START_TIME.AddHours(-1.5);
|
var startTime = sche.START_TIME.AddHours(-1.5);
|
||||||
exist = noticeExsiss.FirstOrDefault(t => t.APPLY_USER_ID == userInfo.ID && t.DEPARTMENT_TYPE == item.DepartType && t.CHECK_TYPE_ID == item.CheckTypeId && t.PLANCHECKFREQUENCY == item.Cycle && t.CREATE_TIME > startTime && (t.CREATE_TIME.Value.Date == dt.Date || t.CREATE_TIME.Value.Date == dt.AddDays(-1).Date));
|
if (sche.START_TIME.Date != sche.END_TIME.Date)
|
||||||
|
{
|
||||||
|
exist = noticeExsiss.FirstOrDefault(t => t.APPLY_DEPARTMENT_ID == userInfo.DEPARTMENT_ID && t.DEPARTMENT_TYPE == item.DepartType && t.CHECK_TYPE_ID == item.CheckTypeId && t.PLANCHECKFREQUENCY == item.Cycle && t.CREATE_TIME >= startTime && (t.CREATE_TIME.Value.Date == sche.START_TIME.Date || t.CREATE_TIME.Value.Date == sche.START_TIME.Date.AddDays(-1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
send = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((exist == null && item.CheckPost == "班组负责人") || (exist == null && item.CheckPost != "班组负责人" && setTime != null && dt.Hour == setTime.CHECKTIME.Value.Hour))
|
if ((send && exist == null && item.CheckPost == "班组负责人") || (send && exist == null && item.CheckPost != "班组负责人" && setTime != null && dt.Hour == setTime.CHECKTIME.Value.Hour))
|
||||||
{
|
{
|
||||||
T_SK_SECURITY_INSPECTION_NOTICE safeNotice = new T_SK_SECURITY_INSPECTION_NOTICE();
|
T_SK_SECURITY_INSPECTION_NOTICE safeNotice = new T_SK_SECURITY_INSPECTION_NOTICE();
|
||||||
safeNotice.ORG_ID = filter.OrgId;
|
safeNotice.ORG_ID = filter.OrgId;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using APT.Infrastructure.Core;
|
using APT.BaseData.Domain.Entities;
|
||||||
|
using APT.Infrastructure.Core;
|
||||||
using APT.MS.Domain.Entities.HM;
|
using APT.MS.Domain.Entities.HM;
|
||||||
using APT.MS.Domain.Entities.SK;
|
using APT.MS.Domain.Entities.SK;
|
||||||
using APT.MS.Domain.Enums;
|
using APT.MS.Domain.Enums;
|
||||||
@ -6,8 +7,8 @@ using APT.Utility;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq.Expressions;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
|
||||||
namespace APT.SK.WebApi.Controllers.Api
|
namespace APT.SK.WebApi.Controllers.Api
|
||||||
{
|
{
|
||||||
@ -86,5 +87,33 @@ namespace APT.SK.WebApi.Controllers.Api
|
|||||||
result.IsSuccessful = info.IsSuccessful;
|
result.IsSuccessful = info.IsSuccessful;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 根据主键删除数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">主键ID</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet, Route("SKDelete")]
|
||||||
|
public JsonActionResult<bool> SKDelete(string id)
|
||||||
|
{
|
||||||
|
return SafeExecute(() =>
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(id))
|
||||||
|
this.ThrowError("060010");
|
||||||
|
var area = this.GetEntity<T_SK_RISK_AREA>(id);
|
||||||
|
var areas = new List<T_SK_RISK_AREA>();
|
||||||
|
if (area != null)
|
||||||
|
{
|
||||||
|
area.IS_DELETED = true;
|
||||||
|
areas.Add(area);
|
||||||
|
}
|
||||||
|
UnifiedCommit(() =>
|
||||||
|
{
|
||||||
|
if (area != null)
|
||||||
|
this.BantchUpdateEntity_noneBase(areas);
|
||||||
|
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user