diff --git a/Tiobon.Core.Api/Controllers/Ghrp/Ghrp_PerformancePeriodController.cs b/Tiobon.Core.Api/Controllers/Ghrp/Ghrp_PerformancePeriodController.cs
index ea2d38b9..ffd729bf 100644
--- a/Tiobon.Core.Api/Controllers/Ghrp/Ghrp_PerformancePeriodController.cs
+++ b/Tiobon.Core.Api/Controllers/Ghrp/Ghrp_PerformancePeriodController.cs
@@ -1,4 +1,7 @@
-namespace Tiobon.Core.Api.Controllers;
+using Newtonsoft.Json.Linq;
+using System.Runtime.InteropServices.JavaScript;
+
+namespace Tiobon.Core.Api.Controllers;
///
/// 考核期间(Controller)
@@ -11,4 +14,14 @@ public class Ghrp_PerformancePeriodController : BaseController
+ /// 批量展开
+ ///
+ /// 阶段
+ ///
+ [HttpPost, Route("BatchCreatePeriod")]
+ public async Task BatchCreatePeriod([FromBody] JObject jsonParam) => await _service.BatchCreatePeriod(jsonParam);
+ #endregion
+
}
\ No newline at end of file
diff --git a/Tiobon.Core.Api/Controllers/Ghrp/Ghrp_PerformancePeriodTypeController.cs b/Tiobon.Core.Api/Controllers/Ghrp/Ghrp_PerformancePeriodTypeController.cs
index b8f75a8c..32ce7c16 100644
--- a/Tiobon.Core.Api/Controllers/Ghrp/Ghrp_PerformancePeriodTypeController.cs
+++ b/Tiobon.Core.Api/Controllers/Ghrp/Ghrp_PerformancePeriodTypeController.cs
@@ -11,7 +11,7 @@ public class Ghrp_PerformancePeriodTypeController : BaseController
/// 根据阶段数 获取对应阶段名称
///
diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml
index 8bbc3afd..eba1369c 100644
--- a/Tiobon.Core.Api/Tiobon.Core.Model.xml
+++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml
@@ -14470,6 +14470,11 @@
考核期间 (Dto.Base)
+
+
+ 年度
+
+
期间编号
@@ -32157,6 +32162,11 @@
考核期间 (Model)
+
+
+ 年度
+
+
期间编号
diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml
index 57c194c5..ac5d478c 100644
--- a/Tiobon.Core.Api/Tiobon.Core.xml
+++ b/Tiobon.Core.Api/Tiobon.Core.xml
@@ -2180,6 +2180,13 @@
考核期间(Controller)
+
+
+ 批量展开
+
+ 阶段
+
+
考核周期类别(Controller)
diff --git a/Tiobon.Core.IServices/Ghrp/IGhrp_PerformancePeriodServices.cs b/Tiobon.Core.IServices/Ghrp/IGhrp_PerformancePeriodServices.cs
index 0a48f30d..16569d20 100644
--- a/Tiobon.Core.IServices/Ghrp/IGhrp_PerformancePeriodServices.cs
+++ b/Tiobon.Core.IServices/Ghrp/IGhrp_PerformancePeriodServices.cs
@@ -1,4 +1,6 @@
-using Tiobon.Core.IServices.BASE;
+using Newtonsoft.Json.Linq;
+using Tiobon.Core.IServices.BASE;
+using Tiobon.Core.Model;
using Tiobon.Core.Model.Models;
namespace Tiobon.Core.IServices
@@ -8,5 +10,6 @@ namespace Tiobon.Core.IServices
///
public interface IGhrp_PerformancePeriodServices :IBaseServices
{
+ Task BatchCreatePeriod(JObject jsonParam);
}
}
\ No newline at end of file
diff --git a/Tiobon.Core.Model/Base/Ghrp/Ghrp_PerformancePeriod.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghrp/Ghrp_PerformancePeriod.Dto.Base.cs
index 0a46644c..f441ce53 100644
--- a/Tiobon.Core.Model/Base/Ghrp/Ghrp_PerformancePeriod.Dto.Base.cs
+++ b/Tiobon.Core.Model/Base/Ghrp/Ghrp_PerformancePeriod.Dto.Base.cs
@@ -25,7 +25,11 @@ namespace Tiobon.Core.Model.Models
///
public class Ghrp_PerformancePeriodBase
{
-
+ ///
+ /// 年度
+ ///
+ [Display(Name = "YYYY"), Description("年度"), MaxLength(50, ErrorMessage = "年度 不能超过 50 个字符")]
+ public string YYYY { get; set; }
///
/// 期间编号
///
@@ -74,37 +78,37 @@ namespace Tiobon.Core.Model.Models
///
/// 期间开始日
///
- public DateTime? BeginDate { get; set; }
+ public string? BeginDate { get; set; }
///
/// 期间结束日
///
- public DateTime? EndDate { get; set; }
+ public string? EndDate { get; set; }
///
/// 员工填写开始日
///
- public DateTime? StaffBeginDate { get; set; }
+ public string? StaffBeginDate { get; set; }
///
/// 员工填写结束日
///
- public DateTime? StaffEndDate { get; set; }
+ public string? StaffEndDate { get; set; }
///
/// 主管填写开始日
///
- public DateTime? MGBeginDate { get; set; }
+ public string? MGBeginDate { get; set; }
///
/// 主管填写结束日
///
- public DateTime? MGEndDate { get; set; }
+ public string? MGEndDate { get; set; }
///
/// 人员状态基准日
///
- public DateTime? OnJobBaseDate { get; set; }
+ public string? OnJobBaseDate { get; set; }
///
/// 前置期间
diff --git a/Tiobon.Core.Model/Base/Ghrp/Ghrp_PerformancePeriodType.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghrp/Ghrp_PerformancePeriodType.Dto.Base.cs
index f114ae93..f1f739b5 100644
--- a/Tiobon.Core.Model/Base/Ghrp/Ghrp_PerformancePeriodType.Dto.Base.cs
+++ b/Tiobon.Core.Model/Base/Ghrp/Ghrp_PerformancePeriodType.Dto.Base.cs
@@ -155,6 +155,6 @@ namespace Tiobon.Core.Model.Models
///
/// 考核阶段名称
///
- public List StageItems_List { get; set; }
+ public List StageItems_List { get; set; } = new List();
}
}
diff --git a/Tiobon.Core.Model/Models/Ghrp/Ghrp_PerformancePeriod.cs b/Tiobon.Core.Model/Models/Ghrp/Ghrp_PerformancePeriod.cs
index 13a2bd20..3c600f95 100644
--- a/Tiobon.Core.Model/Models/Ghrp/Ghrp_PerformancePeriod.cs
+++ b/Tiobon.Core.Model/Models/Ghrp/Ghrp_PerformancePeriod.cs
@@ -27,6 +27,11 @@ namespace Tiobon.Core.Model.Models
[SugarTable("Ghrp_PerformancePeriod", "Ghrp_PerformancePeriod"), Entity(TableCnName = "考核期间", TableName = "Ghrp_PerformancePeriod")]
public class Ghrp_PerformancePeriod : BasePoco
{
+ ///
+ /// 年度
+ ///
+ [Display(Name = "YYYY"), Description("年度"), MaxLength(50, ErrorMessage = "年度 不能超过 50 个字符")]
+ public string YYYY { get; set; }
///
/// 期间编号
@@ -76,37 +81,37 @@ namespace Tiobon.Core.Model.Models
///
/// 期间开始日
///
- public DateTime? BeginDate { get; set; }
+ public string? BeginDate { get; set; }
///
/// 期间结束日
///
- public DateTime? EndDate { get; set; }
+ public string? EndDate { get; set; }
///
/// 员工填写开始日
///
- public DateTime? StaffBeginDate { get; set; }
+ public string? StaffBeginDate { get; set; }
///
/// 员工填写结束日
///
- public DateTime? StaffEndDate { get; set; }
+ public string? StaffEndDate { get; set; }
///
/// 主管填写开始日
///
- public DateTime? MGBeginDate { get; set; }
+ public string? MGBeginDate { get; set; }
///
/// 主管填写结束日
///
- public DateTime? MGEndDate { get; set; }
+ public string? MGEndDate { get; set; }
///
/// 人员状态基准日
///
- public DateTime? OnJobBaseDate { get; set; }
+ public string? OnJobBaseDate { get; set; }
///
/// 前置期间
diff --git a/Tiobon.Core.Model/View/Ghrp/Ghrp_PerformancePeriod.Dto.View.cs b/Tiobon.Core.Model/View/Ghrp/Ghrp_PerformancePeriod.Dto.View.cs
index 6219065e..3149a0ca 100644
--- a/Tiobon.Core.Model/View/Ghrp/Ghrp_PerformancePeriod.Dto.View.cs
+++ b/Tiobon.Core.Model/View/Ghrp/Ghrp_PerformancePeriod.Dto.View.cs
@@ -13,7 +13,7 @@
*│ 此技术信息为本公司机密信息,未经本公司书面同意禁止向第三方披露. │
*│ 作者:SimonHsiao │
*└──────────────────────────────────┘
-*/
+*/
namespace Tiobon.Core.Model.Models;
@@ -22,13 +22,15 @@ namespace Tiobon.Core.Model.Models;
///
public class Ghrp_PerformancePeriodDto : Ghrp_PerformancePeriod
{
-///
-/// 创建信息
-///
-public string CreateDataInfo { get; set; }
+ ///
+ /// 创建信息
+ ///
+ public string CreateDataInfo { get; set; }
-///
-/// 修改信息
-///
-public string UpdateDataInfo { get; set; }
+ ///
+ /// 修改信息
+ ///
+ public string UpdateDataInfo { get; set; }
+ public string PerformancePeriodTypeName { get; set; }
+ public string PrePerformancePeriodName { get; set; }
}
diff --git a/Tiobon.Core.Model/View/Ghrp/Ghrp_PerformancePeriodType.Dto.View.cs b/Tiobon.Core.Model/View/Ghrp/Ghrp_PerformancePeriodType.Dto.View.cs
index 70956702..f90a6a4f 100644
--- a/Tiobon.Core.Model/View/Ghrp/Ghrp_PerformancePeriodType.Dto.View.cs
+++ b/Tiobon.Core.Model/View/Ghrp/Ghrp_PerformancePeriodType.Dto.View.cs
@@ -36,5 +36,5 @@ public class Ghrp_PerformancePeriodTypeDto : Ghrp_PerformancePeriodType
///
/// 考核阶段名称
///
- public List StageItems_List { get; set; }
+ public List StageItems_List { get; set; } = new List();
}
diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs
index 3655727f..8fad5e22 100644
--- a/Tiobon.Core.Services/CommonServices.cs
+++ b/Tiobon.Core.Services/CommonServices.cs
@@ -2437,6 +2437,17 @@ public partial class CommonServices : BaseServices>, ICommon
result.DT_Procedure.ExportExcel = result.DT_Procedure.EditProcedure.Replace("QueryGroupForm", "ExportGroupExcel");
break;
+ case "F_PerformancePeriod":
+ result.JM_PageControlT1.Toolbar.Insert(0, new Toolbar()
+ {
+ display = true,
+ fnKey = "TBD1YN",
+ fnTitle = "考核期间展开",
+ fnType = "table",
+ icon = "ghr-publish",
+ position = "left"
+ });
+ break;
}
#endregion
diff --git a/Tiobon.Core.Services/Ghrp/Ghrp_PerformancePeriodServices.cs b/Tiobon.Core.Services/Ghrp/Ghrp_PerformancePeriodServices.cs
index 4799db9a..292bc279 100644
--- a/Tiobon.Core.Services/Ghrp/Ghrp_PerformancePeriodServices.cs
+++ b/Tiobon.Core.Services/Ghrp/Ghrp_PerformancePeriodServices.cs
@@ -4,6 +4,8 @@ using Tiobon.Core.Model.Models;
using Tiobon.Core.Services.BASE;
using Tiobon.Core.IRepository.Base;
using Tiobon.Core.Common.Caches;
+using Tiobon.Core.Common.DB.Dapper.Extensions;
+using Microsoft.EntityFrameworkCore.SqlServer.Query.Internal;
namespace Tiobon.Core.Services
{
@@ -19,5 +21,162 @@ namespace Tiobon.Core.Services
base.BaseDal = dal;
base._caching = caching;
}
+ ///
+ /// 查询
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override async Task> QueryFilterPage(QueryBody filter, string condition, bool? IsEnable = true)
+ {
+
+ var result = await base.QueryFilterPage(filter, condition, IsEnable);
+
+ result.result.DT_TableDataT1.ForEach(async x =>
+ {
+ x.Stage = await GetParaLabel("PerformanceStage", x.Stage);
+ x.StageItem = await GetParaLabel("PerformanceStageItem", x.StageItem);
+ x.PerformancePeriodTypeName = await Db.Queryable().Where(a => a.Id==x.PerformancePeriodTypeID).Select(x=> x.PeriodTypeName).FirstAsync();
+ x.PrePerformancePeriodName = await Db.Queryable().Where(a => a.Id == x.PrePerformancePeriodID).Select(x => x.PeriodName).FirstAsync();
+ });
+
+ return result;
+ }
+
+ public override async Task Add(InsertGhrp_PerformancePeriodInput entity)
+ {
+ if (entity.PerformancePeriodTypeID != null)
+ entity.PeriodType = await Db.Queryable().Where(a => a.Id == entity.PerformancePeriodTypeID).Select(x => x.PeriodTypeNo).FirstAsync();
+ var result = await base.Add(entity);
+
+ return result;
+ }
+
+ public override async Task Update(long Id, EditGhrp_PerformancePeriodInput editModel)
+ {
+ if (editModel.PerformancePeriodTypeID != null)
+ editModel.PeriodType = await Db.Queryable().Where(a => a.Id == editModel.PerformancePeriodTypeID).Select(x => x.PeriodTypeNo).FirstAsync();
+
+ var result = await base.Update(Id, editModel, null, ["Status"]);
+ return result;
+ }
+
+ ///
+ /// 批量生成期间
+ ///
+ ///
+ ///
+ public async Task BatchCreatePeriod(JObject jsonParam)
+ {
+ string PerformancePeriodTypeID = jsonParam["PerformancePeriodTypeID"]?.Value() ?? ""; // 考核周期类别
+ if (string.IsNullOrEmpty(PerformancePeriodTypeID)) return ServiceResult.OprateSuccess("考核周期类别不能为空!");
+ string YYYY = jsonParam["YYYY"]?.Value() ?? ""; // 展开年度
+ if (string.IsNullOrEmpty(YYYY)) return ServiceResult.OprateSuccess("展开年度不能为空!");
+ string BeginDate = jsonParam["BeginDate"]?.Value() ?? ""; // 期间开始日
+ if (string.IsNullOrEmpty(BeginDate)) return ServiceResult.OprateSuccess("期间开始日不能为空!");
+ string StaffBeginDate = jsonParam["StaffBeginDate"]?.Value() ?? "";// 员工填写开始日
+ string StaffDays = jsonParam["StaffDays"]?.Value() ?? ""; // 填写天数
+ string MGBeginDate = jsonParam["MGBeginDate"]?.Value() ?? ""; // 主管填写开始日
+ string MGDays = jsonParam["MGDays"]?.Value() ?? ""; // 主管填写天数
+ string OnJobBaseType = jsonParam["OnJobBaseType"]?.Value() ?? ""; // 人员状态基准日
+ if (string.IsNullOrEmpty(OnJobBaseType)) return ServiceResult.OprateSuccess("人员状态基准日不能为空!");
+ string sql = @$"
+ Declare @PerformancePeriodTypeID nvarchar(100) = '{PerformancePeriodTypeID}';
+ Declare @YYYY nvarchar(100) = '{YYYY}'
+ Declare @BeginDate nvarchar(100) = '{BeginDate}'
+ Declare @StaffBeginDate nvarchar(100) = '{StaffBeginDate}'
+ if @StaffBeginDate = '' set @StaffBeginDate = null
+ Declare @StaffDays int = '{StaffDays}'
+ if @StaffDays = 0 set @StaffDays = null
+ Declare @MGBeginDate nvarchar(100)='{MGBeginDate}'
+ if @MGBeginDate = '' set @MGBeginDate = null
+ Declare @MGDays int = '{MGDays}'
+ if @MGDays = 0 set @MGDays = null
+ Declare @OnJobBaseType nvarchar(100) ='{OnJobBaseType}'
+ ;with PerformancePeriod as(
+ select top 999 ROW_NUMBER() over(order by PeriodTypeNo,b.Nums,c.SortNo) SortNo,
+ @YYYY YYYY,
+ PeriodTypeNo+@YYYY+'-'+CONVERT(nvarchar(10),Nums)+c.ParaDetailNo PeriodNo,
+ PeriodTypeNo+@YYYY+'-'+CONVERT(nvarchar(10),Nums)+c.ParaDetailNo PeriodName,
+ Id PerformancePeriodTypeID,
+ PeriodTypeNo,
+ Stage,
+ ParaDetailNo StageItem,
+ b.Nums ,
+ 1 IsUsing,
+ DATEADD(MONTH,(Nums-1)*case when a.PeriodTypeNo = 'Year' then 12
+ when a.PeriodTypeNo = 'HalfYear' then 6
+ when a.PeriodTypeNo = 'Month' then 1
+ when a.PeriodTypeNo = 'Quarter' then 3
+ else 12 end
+ ,@BeginDate) BeginDate,
+ DATEADD(MONTH,Nums*case when a.PeriodTypeNo = 'Year' then 12
+ when a.PeriodTypeNo = 'HalfYear' then 6
+ when a.PeriodTypeNo = 'Month' then 1
+ when a.PeriodTypeNo = 'Quarter' then 3
+ else 12 end ,@BeginDate)-1 EndDate,
+ DATEADD(MONTH,(Nums-1)*case when a.PeriodTypeNo = 'Year' then 12
+ when a.PeriodTypeNo = 'HalfYear' then 6
+ when a.PeriodTypeNo = 'Month' then 1
+ when a.PeriodTypeNo = 'Quarter' then 3
+ else 12 end
+ ,@StaffBeginDate) StaffBeginDate,
+ DATEADD(MONTH,(Nums-1)*case when a.PeriodTypeNo = 'Year' then 12
+ when a.PeriodTypeNo = 'HalfYear' then 6
+ when a.PeriodTypeNo = 'Month' then 1
+ when a.PeriodTypeNo = 'Quarter' then 3
+ else 12 end
+ ,@StaffBeginDate)+@StaffDays StaffEndDate,
+ DATEADD(MONTH,(Nums-1)*case when a.PeriodTypeNo = 'Year' then 12
+ when a.PeriodTypeNo = 'HalfYear' then 6
+ when a.PeriodTypeNo = 'Month' then 1
+ when a.PeriodTypeNo = 'Quarter' then 3
+ else 12 end
+ ,@MGBeginDate) MGBeginDate,
+ DATEADD(MONTH,(Nums-1)*case when a.PeriodTypeNo = 'Year' then 12
+ when a.PeriodTypeNo = 'HalfYear' then 6
+ when a.PeriodTypeNo = 'Month' then 1
+ when a.PeriodTypeNo = 'Quarter' then 3
+ else 12 end
+ ,@MGBeginDate)+@MGDays MGEndDate
+ from Ghrp_PerformancePeriodType a,(select CONVERT(int,value) Nums from dbo.Fs1_GHR30_SplitString('1,2,3,4,5,6,7,8,9,10,11,12',',')) b
+ ,Ghrs_ParaDetail c
+ where a.IsEnable = 1
+ and c.ParaMasterNo = 'PerformanceStageItem' and c.ParaTypeNo = 'Performance'
+ and c.ParaDetailNo In (select value from openjson(a.StageItems))
+ and a.Id = @PerformancePeriodTypeID
+ and b.Nums <= case when a.PeriodTypeNo = 'Year' then 1
+ when a.PeriodTypeNo = 'HalfYear' then 2
+ when a.PeriodTypeNo = 'Month' then 12
+ when a.PeriodTypeNo = 'Quarter' then 4
+ else 1
+ end
+ order by b.Nums,c.SortNo
+ )
+ insert into Ghrp_PerformancePeriod
+ (SortNo,ID,YYYY,PeriodNo,PeriodName,PerformancePeriodTypeID,PeriodType,Stage,StageItem,PeriodNum,IsUsing,
+ BeginDate,EndDate,StaffBeginDate,StaffEndDate,MGBeginDate,MGEndDate,OnJobBaseDate,PrePerformancePeriodID,RemarkSz,
+ IsEnable,CreateBy,CreateTime,CreateProg)
+ select SortNo,
+ ISNULL((select MAX(Id) from Ghrp_PerformancePeriod), 1000000000000000000 )
+ +SortNo,
+ YYYY,PeriodNo,PeriodName,PerformancePeriodTypeID,PeriodTypeNo,Stage,StageItem,Nums,IsUsing,
+ BeginDate,EndDate,
+ dbo.FS_MinDate(dbo.FS_MaxDate(ISNULL(StaffBeginDate,BeginDate),BeginDate),EndDate) StaffBeginDate,
+ dbo.FS_MinDate(ISNULL(StaffEndDate,EndDate),EndDate) StaffEndDate,
+ dbo.FS_MinDate(dbo.FS_MaxDate(ISNULL(MGBeginDate,BeginDate),BeginDate),EndDate) MGBeginDate,
+ dbo.FS_MinDate(ISNULL(MGEndDate,EndDate),EndDate) MGEndDate,
+ case when ISNULL(@OnJobBaseType,'') = 'Begin' then BeginDate else EndDate end OnJobBaseDate,
+ NULL PrePerformancePeriodID,'' RemarkSz,
+ 1 IsEnable,1 CreateBy,GETDATE() CreateTime,'/api/Ghrp_PerformancePeriod/BatchCreatePeriod' CreateProg
+ from PerformancePeriod a
+ where Not Exists(select 1 from Ghrp_PerformancePeriod where IsEnable=1 and YYYY= a.YYYY and PerformancePeriodTypeID=a.PerformancePeriodTypeID and PeriodNo=a.PeriodNo)
+ order by SortNo
+ ";
+ await Db.Ado.ExecuteCommandAsync(sql);
+ return ServiceResult.OprateSuccess("批量展开成功!");
+ }
+
}
}
\ No newline at end of file