Compare commits

..

No commits in common. "a98e39fd28c6c6ed6fd9ccd08a4a6d072c8fee67" and "cadd709e06fb1fd9caa81defca0e03194fd07e17" have entirely different histories.

10 changed files with 12 additions and 262144 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace APT.Data.Migrations.Migrations
{
public partial class wyw2025110701 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "PLANDETAILID",
table: "T_SE_TRAIN_NOTIFY",
type: "uniqueidentifier",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PLANDETAILID",
table: "T_SE_TRAIN_NOTIFY");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,48 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace APT.Data.Migrations.Migrations
{
public partial class wyw2025110702 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<Guid>(
name: "DEPARTMENT_ID",
table: "T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "uniqueidentifier",
oldNullable: true);
migrationBuilder.AlterColumn<decimal>(
name: "CLASSHOUR",
table: "T_SE_TRAIN_PLAN_DETAIL",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<Guid>(
name: "DEPARTMENT_ID",
table: "T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT",
type: "uniqueidentifier",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uniqueidentifier");
migrationBuilder.AlterColumn<int>(
name: "CLASSHOUR",
table: "T_SE_TRAIN_PLAN_DETAIL",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
}
}
}

View File

@ -73510,9 +73510,6 @@ namespace APT.Data.Migrations.Migrations
b.Property<Guid?>("ORIGINAL_NOTIFY_ID") b.Property<Guid?>("ORIGINAL_NOTIFY_ID")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<Guid?>("PLANDETAILID")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("RECORD_USER_ID") b.Property<Guid?>("RECORD_USER_ID")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@ -73857,8 +73854,8 @@ namespace APT.Data.Migrations.Migrations
b.Property<int>("CHECKTYPE") b.Property<int>("CHECKTYPE")
.HasColumnType("int"); .HasColumnType("int");
b.Property<decimal>("CLASSHOUR") b.Property<int>("CLASSHOUR")
.HasColumnType("decimal(18,2)"); .HasColumnType("int");
b.Property<Guid?>("CREATER_ID") b.Property<Guid?>("CREATER_ID")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@ -73957,7 +73954,7 @@ namespace APT.Data.Migrations.Migrations
b.Property<DateTime?>("CREATE_TIME") b.Property<DateTime?>("CREATE_TIME")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("DEPARTMENT_ID") b.Property<Guid?>("DEPARTMENT_ID")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<int>("ENTITY_ORG_TPYE") b.Property<int>("ENTITY_ORG_TPYE")
@ -123124,8 +123121,7 @@ namespace APT.Data.Migrations.Migrations
b.HasOne("APT.BaseData.Domain.Entities.FM.T_FM_DEPARTMENT", "Nav_Department") b.HasOne("APT.BaseData.Domain.Entities.FM.T_FM_DEPARTMENT", "Nav_Department")
.WithMany() .WithMany()
.HasForeignKey("DEPARTMENT_ID") .HasForeignKey("DEPARTMENT_ID")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.HasOne("APT.Infrastructure.Core.T_FM_ORGANIZATION", "Nav_Org") b.HasOne("APT.Infrastructure.Core.T_FM_ORGANIZATION", "Nav_Org")
.WithMany() .WithMany()

View File

@ -246,10 +246,5 @@ namespace APT.MS.Domain.Entities.SE
/// </summary> /// </summary>
[Description("导航: 培训对象")] [Description("导航: 培训对象")]
public T_FM_DEPARTMENT Nav_TrainDepartment { get; set; } public T_FM_DEPARTMENT Nav_TrainDepartment { get; set; }
/// <summary>
/// 培训计划明细ID
/// </summary>
public Guid? PLANDETAILID { get; set; }
} }
} }

View File

@ -104,7 +104,7 @@ namespace APT.MS.Domain.Entities.SE
/// </summary> /// </summary>
[Description("培训学时")] [Description("培训学时")]
[FormFieldEdit] [FormFieldEdit]
public decimal CLASSHOUR { get; set; } public int CLASSHOUR { get; set; }
/// <summary> /// <summary>
/// 触发方式 直接培训 分解培训 /// 触发方式 直接培训 分解培训

View File

@ -31,7 +31,7 @@ namespace APT.MS.Domain.Entities.SE
[Description("培训组织")] [Description("培训组织")]
[FormFieldEdit] [FormFieldEdit]
[DataFieldForeignKey("Nav_Department")] [DataFieldForeignKey("Nav_Department")]
public Guid DEPARTMENT_ID { get; set; } public Guid? DEPARTMENT_ID { get; set; }
/// <summary> /// <summary>
/// 导航: 责任部门 /// 导航: 责任部门
/// </summary> /// </summary>

View File

@ -90,8 +90,6 @@ namespace APT.PP.WebApi.Controllers.Api.PP
FinishYearTrainPlan(filter, dtNow, config); FinishYearTrainPlan(filter, dtNow, config);
//培训通知 //培训通知
CheckYearTrainPlan(filter, dtNow); CheckYearTrainPlan(filter, dtNow);
//培训通知 wyw
TrainPlan(filter, dtNow);
//换证培训触发 //换证培训触发
CreateRenewalTrain(filter, dtNow); CreateRenewalTrain(filter, dtNow);
#endregion #endregion
@ -101,23 +99,6 @@ namespace APT.PP.WebApi.Controllers.Api.PP
//通知安环部负责人安全生产法律法规更新与融入 //通知安环部负责人安全生产法律法规更新与融入
NoticeLRLawIntegrateUpdate(filter, dtNow); NoticeLRLawIntegrateUpdate(filter, dtNow);
#endregion #endregion
if (!string.IsNullOrEmpty(filter.Parameter1))
{
//去除参数
var task = GetEntity<T_FM_SYNC_TASK>(filter.Keyword);
if (task != null)
{
//不能新增去年的
task.CURR_TASK_START_TIME = DateTime.Now;//上次同步结束时间
task.UPDATE_SUCCES_TIME = DateTime.Now;//上次同步结束时间
task.SYNC_PARAM = "";//清空参数
UnifiedCommit(() =>
{
UpdateEntityNoCommit(task);
});
}
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -1423,12 +1404,16 @@ namespace APT.PP.WebApi.Controllers.Api.PP
} }
public void CheckYearTrainPlan(KeywordFilter filter, DateTime dtNow) public void CheckYearTrainPlan(KeywordFilter filter, DateTime dtNow)
{ {
//select top 100 * from T_SE_DEP_TRAIN_PLAN order by CREATE_TIME desc
// select top 100 * from T_SE_DEP_TRAIN_PLAN order by CREATE_TIME desc
//select top 100 * from T_SE_DEP_TRAIN_PLAN_DETAIL where DEP_TRAIN_PLAN_ID in ('AC8AAFBB-67FA-FB92-F522-89D7697F1C68', '65511754-9515-6320-30FB-17768F095635') order by MOON desc //select top 100 * from T_SE_DEP_TRAIN_PLAN_DETAIL where DEP_TRAIN_PLAN_ID in ('AC8AAFBB-67FA-FB92-F522-89D7697F1C68', '65511754-9515-6320-30FB-17768F095635') order by MOON desc
//select top 100 * from T_SE_YEAR_TRAIN_PLAN order by CREATE_TIME desc //select top 100 * from T_SE_YEAR_TRAIN_PLAN order by CREATE_TIME desc
//select top 100 * from T_SE_YEAR_TRAIN_PLAN_DETAIL where YEAR_TRAIN_PLAN_ID in ('BF736F5B-7FB8-4A8F-8511-957F0D5CC585') order by MOON desc //select top 100 * from T_SE_YEAR_TRAIN_PLAN_DETAIL where YEAR_TRAIN_PLAN_ID in ('BF736F5B-7FB8-4A8F-8511-957F0D5CC585') order by MOON desc
//培训月份1日倒退7天触发待办给责任人制定培训通知 //培训月份1日倒退7天触发待办给责任人制定培训通知
//var dt = DateTime.Now; //var dt = DateTime.Now;
//if (filter.Parameter1 != null) //if (filter.Parameter1 != null)
@ -1883,228 +1868,5 @@ namespace APT.PP.WebApi.Controllers.Api.PP
return true; return true;
}); });
} }
/// <summary>
/// 培训计划
/// </summary>
/// <param name="filter"></param>
/// <param name="dtNow"></param>
public void TrainPlan(KeywordFilter filter, DateTime dtNow)
{
DateTime dtMax = dtNow.Date.AddDays(1).AddSeconds(-1);
DateTime dtMin = dtNow.Date;
List<T_SE_TRAIN_PLAN_DETAIL> listRAdd = new List<T_SE_TRAIN_PLAN_DETAIL>();
try
{
// STATUS 触发默认0 单审批完成 10 触发了_20 审阅中_21_部分完成了 所有单子归档了_30
var listDetailRun = GetEntities<T_SE_TRAIN_PLAN_DETAIL>(e => e.STATUS == PFStandardStatus.Sign && e.DEPARTMENT_ID.HasValue && dtMin <= e.DATE_TRAIN.Date && e.DATE_TRAIN.Date <= dtMax, null);
if (listDetailRun == null || listDetailRun.Count() < 1)
{
return;
}
var listDetailID = listDetailRun.Select(e => e.ID);
var listNotice = GetEntities<T_SE_TRAIN_NOTIFY>(e => e.CREATE_TIME.HasValue && e.PLANDETAILID.HasValue && listDetailID.Contains(e.ID), null);
List<T_SE_TRAIN_NOTIFY> trainNotifys = new List<T_SE_TRAIN_NOTIFY>();
List<T_SE_TRAIN_NOTIFY_PERSONS> listNotifyPerson = new List<T_SE_TRAIN_NOTIFY_PERSONS>();
T_SE_TRAIN_NOTIFY modelCheck = null;
foreach (var item in listDetailRun)
{
modelCheck = listNotice.FirstOrDefault(e => e.PLANDETAILID.Value == item.ID);
if (modelCheck == null || modelCheck.ID == Guid.Empty)
{
listRAdd.Add(item);
}
}
if (listRAdd.Count < 1)
{
return;
}
listDetailID = listRAdd.Select(e => e.ID);
var listDetailDep = GetEntities<T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT>(e => listDetailID.Contains(e.PLAN_DETAIL_ID), null);
var listDepID = listDetailDep.Select(e => e.DEPARTMENT_ID).Distinct();
var listDep = GetEntities<T_FM_DEPARTMENT>(e => listDepID.Contains(e.ID), null, "Nav_User").ToList();
//所有参加培训的人员
var listUsers = GetEntities<T_FM_USER>(e => e.ENABLE_STATUS == 0 && e.DEPARTMENT_ID.HasValue && listDepID.Contains(e.DEPARTMENT_ID.Value), null, "Nav_Person.Nav_Post", "Nav_Department");
//培训组织 获取对应安全员 或者负责人 接收培训通知
var listDepGetNotice = listRAdd.Select(e => e.DEPARTMENT_ID.Value);
var approveRole = GetEntities<T_PF_APPROVAL_ROLE>(e => !e.IS_DELETED && e.NAME.Contains("安全员"), null);
var RroleID = approveRole.Select(e => e.ID);
//安全员
var listUserGet = GetEntities<T_FM_USER>(e => e.APPROVE_ROLE_ID.HasValue && RroleID.Contains(e.APPROVE_ROLE_ID.Value), null);
T_SE_TRAIN_NOTIFY modelNotify = null;
IEnumerable<T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT> listDetailDepPer = null;
IEnumerable<T_FM_USER> listUserPer = null;
T_FM_USER modelDetailPer = null;
T_FM_DEPARTMENT modelDep = null;
int Index = 0;
Guid? LAUNCH_USER_ID = Guid.Empty;
var allSendUserIds = new List<Guid>();
var allSendUserNames = new List<string>();
var allSendUserTitles = new List<string>();
var allSendDataIds = new List<Guid>();
var alltoDayNotifyTitles = new List<string>();
foreach (var item in listRAdd)
{
modelDetailPer = listUserGet.FirstOrDefault(e => e.DEPARTMENT_ID.Value == item.DEPARTMENT_ID.Value);
if (modelDetailPer == null)
{
modelDetailPer = listDep.FirstOrDefault(e => e.ID == item.DEPARTMENT_ID.Value)?.Nav_User;
}
if (modelDetailPer == null)
continue; //找不到人 接收培训通知的人
item.STATUS = PFStandardStatus.Approving;
item.MODIFY_TIME = dtNow;
modelDep = listDep.FirstOrDefault(e => e.ID == item.DEPARTMENT_ID);
if (modelDep == null)
{
modelDep = GetEntity<T_FM_DEPARTMENT>(e => e.ID == item.DEPARTMENT_ID);
listDep.Add(modelDep);
}
listDetailDepPer = listDetailDep.Where(e => e.PLAN_DETAIL_ID == item.ID);
if (listDetailDepPer == null)
{
//没有选择被培训组织 给培训组织 对应的安全员 或负责人 添加一个培训通知
//不用默认添加培训人员
modelNotify = GetNotify(dtNow, Index, modelDetailPer.ID, FMDepartmentType.Department, item.TYPE_ID, item);//培训组织对应的层级
allSendUserTitles.Add("制定培训通知-" + modelNotify.NAME);
allSendDataIds.Add(modelNotify.ID);
allSendUserIds.Add(modelDetailPer.ID);
allSendUserNames.Add(modelDetailPer.NAME);
alltoDayNotifyTitles.Add("根据需要将《" + modelNotify.NAME + "》培训通知盖章上传!");
Index++;
}
else
{
foreach (var itemD in listDetailDepPer)
{
modelDep = listDep.FirstOrDefault(e => e.ID == itemD.DEPARTMENT_ID);
if (modelDep == null)
{
modelDep = listDep.FirstOrDefault(e => e.ID == item.DEPARTMENT_ID);
if (modelDep == null)
{
modelDep = GetEntity<T_FM_DEPARTMENT>(e => e.ID == item.DEPARTMENT_ID);
listDep.Add(modelDep);
}
}
//有选择培训组织 给培训组织添加多个通知
//默认 添加 培训人
modelNotify = GetNotify(dtNow, Index, modelDetailPer.ID, (FMDepartmentType)modelDep.DEPARTMENT_TYPE, item.TYPE_ID, item);
allSendUserTitles.Add("制定培训通知-" + modelDep.NAME + "-" + modelNotify.NAME);
allSendDataIds.Add(modelNotify.ID);
allSendUserIds.Add(modelDetailPer.ID);
allSendUserNames.Add(modelDetailPer.NAME);
alltoDayNotifyTitles.Add("根据需要将《" + modelNotify.NAME + "》培训通知盖章上传!");
listUserPer = listUsers.Where(e => e.DEPARTMENT_ID.Value == itemD.DEPARTMENT_ID);
if (listUserPer != null && listUserPer.Count() > 0)
{
foreach (var itemDU in listUserPer)
{
listNotifyPerson.Add(new T_SE_TRAIN_NOTIFY_PERSONS()
{
ID = Guid.NewGuid(),
ORG_ID = item.ORG_ID,
USER_ID = itemDU.ID,
NOTIFY_ID = modelNotify.ID,
CREATE_TIME = dtNow,
DEPARTMENT_NAME = itemDU.Nav_Department.NAME,
POST_NAME = itemDU.Nav_Person.Nav_Post.NAME
});
}
}
trainNotifys.Add(modelNotify);
Index++;
}
}
}
if (trainNotifys != null && trainNotifys.Count > 0)
{
var TASK_ENDDT = NotificationTaskService.GetTaskEndTime(FMTASKTYPE.DefaultLong, trainNotifys[0].ORG_ID.Value, dtNow, null, null);
var sendNotices = NotificationTaskService.InsertUserNoticeTaskModels(allSendUserTitles, allSendDataIds, filter.GetOrgId(), allSendUserIds, allSendUserNames, DateTime.Now, TASK_ENDDT, (int)FMFormTypeEnum., "SE014");
sendNotices.AddRange(NotificationTaskService.InsertUserNoticeTaskModels(alltoDayNotifyTitles, allSendDataIds, filter.GetOrgId(), allSendUserIds, allSendUserNames, DateTime.Now, TASK_ENDDT, (int)FMNoticeTypeEnum., "PF135"));
UnifiedCommit(() =>
{
if (trainNotifys != null && trainNotifys.Any())
BantchAddEntityNoCommit(trainNotifys);
if (listNotifyPerson != null && listNotifyPerson.Any())//计划状态更新
BantchAddEntityNoCommit(listNotifyPerson);
if (sendNotices != null && sendNotices.Any())
BantchAddEntityNoCommit(sendNotices);
if (listRAdd != null && listRAdd.Any())//计划状态更新
BantchSaveEntityNoCommit(listRAdd);
});
}
}
catch (Exception ex)
{
}
try
{
if (listRAdd != null && listRAdd.Count > 0)
{
var PlanID = listRAdd.Select(e => e.PLAN_ID);
var listPlan = GetEntities<T_SE_TRAIN_PLAN>(e => PlanID.Contains(e.ID), null, "Nav_ListPlanDetail");
if (listPlan != null && listPlan.Any())
{
foreach (var item in listPlan)
{
item.PERSENT = (decimal)Math.Round(100.0 * item.Nav_ListPlanDetail.Where(e => e.STATUS == PFStandardStatus.Approving).Count() / item.Nav_ListPlanDetail.Count(), 2);
}
UnifiedCommit(() =>
{
BantchSaveEntityNoCommit(listRAdd);
});
}
}
}
catch (Exception ex)
{
}
}
/// <summary>
/// 组装培训通知单
/// </summary>
/// <param name="dtNow"></param>
/// <param name="Index"></param>
/// <param name="LAUNCH_USER_ID"></param>
/// <param name="item"></param>
/// <returns></returns>
public T_SE_TRAIN_NOTIFY GetNotify(DateTime dtNow, int Index, Guid? LAUNCH_USER_ID, FMDepartmentType LEVEL, Guid? TRAIN_TYPE, T_SE_TRAIN_PLAN_DETAIL item)
{
T_SE_TRAIN_NOTIFY modelNotify = new T_SE_TRAIN_NOTIFY();
modelNotify.ID = Guid.NewGuid();
modelNotify.LAUNCH_TIME = dtNow;
modelNotify.ORG_ID = item.ORG_ID;
modelNotify.CODE = DateTime.Now.ToString("yyyyMMddHHmmss") + Index.ToString();
modelNotify.STATUS = SETrainNotifyStatus.稿;
modelNotify.NAME = item.NAME;
modelNotify.CREATE_NOTIFY_RECORD = true;
modelNotify.TRAIN_TYPE = TRAIN_TYPE;
modelNotify.LEVEL = LEVEL;
modelNotify.HOURS = item.CLASSHOUR;//培训学时
modelNotify.CREATE_TIME = dtNow;
modelNotify.LAUNCH_USER_ID = LAUNCH_USER_ID;
modelNotify.LAUNCH_DEPARTMENT_ID = item.DEPARTMENT_ID;
modelNotify.CREATER_ID = modelNotify.LAUNCH_USER_ID;
modelNotify.PLANDETAILID = item.ID;
return modelNotify;
}
} }
} }

View File

@ -93,8 +93,6 @@ namespace APT.SC.WebApi.Controllers.Api.SE
} }
item.Nav_ListDetailDepartment = null; item.Nav_ListDetailDepartment = null;
item.Nav_Department = null; item.Nav_Department = null;
if (item.STATUS == PFStandardStatus.Sign && (entity.STATUS == PFStandardStatus.Draft || entity.STATUS == PFStandardStatus.Sign))
item.STATUS = PFStandardStatus.Draft;//默认初始值
} }
} }
if (ListDetailDepartment != null && ListDetailDepartment.Any()) if (ListDetailDepartment != null && ListDetailDepartment.Any())
@ -266,7 +264,7 @@ namespace APT.SC.WebApi.Controllers.Api.SE
string NAME = string.Empty; string NAME = string.Empty;
if (entity.LAUNCH_USER_ID.HasValue) if (entity.LAUNCH_USER_ID.HasValue)
{ {
NAME = GetEntity<T_FM_USER>(entity.LAUNCH_USER_ID.Value)?.NAME; NAME= GetEntity<T_FM_USER>(entity.LAUNCH_USER_ID.Value)?.NAME;
} }
entity.STATUS = PFStandardStatus.Rejected; entity.STATUS = PFStandardStatus.Rejected;