xiaochanghai 2 months ago
commit b0c3f0801f
  1. 15
      Tiobon.Core.Api/Controllers/Ghrp/Ghrp_PerformancePeriodController.cs
  2. 2
      Tiobon.Core.Api/Controllers/Ghrp/Ghrp_PerformancePeriodTypeController.cs
  3. 10
      Tiobon.Core.Api/Tiobon.Core.Model.xml
  4. 7
      Tiobon.Core.Api/Tiobon.Core.xml
  5. 5
      Tiobon.Core.IServices/Ghrp/IGhrp_PerformancePeriodServices.cs
  6. 20
      Tiobon.Core.Model/Base/Ghrp/Ghrp_PerformancePeriod.Dto.Base.cs
  7. 2
      Tiobon.Core.Model/Base/Ghrp/Ghrp_PerformancePeriodType.Dto.Base.cs
  8. 19
      Tiobon.Core.Model/Models/Ghrp/Ghrp_PerformancePeriod.cs
  9. 20
      Tiobon.Core.Model/View/Ghrp/Ghrp_PerformancePeriod.Dto.View.cs
  10. 2
      Tiobon.Core.Model/View/Ghrp/Ghrp_PerformancePeriodType.Dto.View.cs
  11. 11
      Tiobon.Core.Services/CommonServices.cs
  12. 159
      Tiobon.Core.Services/Ghrp/Ghrp_PerformancePeriodServices.cs

@ -1,4 +1,7 @@
namespace Tiobon.Core.Api.Controllers;
using Newtonsoft.Json.Linq;
using System.Runtime.InteropServices.JavaScript;
namespace Tiobon.Core.Api.Controllers;
/// <summary>
/// 考核期间(Controller)
@ -11,4 +14,14 @@ public class Ghrp_PerformancePeriodController : BaseController<IGhrp_Performance
public Ghrp_PerformancePeriodController(IGhrp_PerformancePeriodServices service) : base(service)
{
}
#region 批量展开
/// <summary>
/// 批量展开
/// </summary>
/// <param name="Stage">阶段</param>
/// <returns></returns>
[HttpPost, Route("BatchCreatePeriod")]
public async Task<ServiceResult> BatchCreatePeriod([FromBody] JObject jsonParam) => await _service.BatchCreatePeriod(jsonParam);
#endregion
}

@ -11,7 +11,7 @@ public class Ghrp_PerformancePeriodTypeController : BaseController<IGhrp_Perform
public Ghrp_PerformancePeriodTypeController(IGhrp_PerformancePeriodTypeServices service) : base(service)
{
}
#region 成绩
#region 阶段
/// <summary>
/// 根据阶段数 获取对应阶段名称
/// </summary>

@ -14670,6 +14670,11 @@
考核期间 (Dto.Base)
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghrp_PerformancePeriodBase.YYYY">
<summary>
年度
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghrp_PerformancePeriodBase.PeriodNo">
<summary>
期间编号
@ -32577,6 +32582,11 @@
考核期间 (Model)
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghrp_PerformancePeriod.YYYY">
<summary>
年度
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghrp_PerformancePeriod.PeriodNo">
<summary>
期间编号

@ -2197,6 +2197,13 @@
考核期间(Controller)
</summary>
</member>
<member name="M:Tiobon.Core.Api.Controllers.Ghrp_PerformancePeriodController.BatchCreatePeriod(Newtonsoft.Json.Linq.JObject)">
<summary>
批量展开
</summary>
<param name="Stage">阶段</param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghrp_PerformancePeriodTypeController">
<summary>
考核周期类别(Controller)

@ -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
/// </summary>
public interface IGhrp_PerformancePeriodServices :IBaseServices<Ghrp_PerformancePeriod, Ghrp_PerformancePeriodDto, InsertGhrp_PerformancePeriodInput, EditGhrp_PerformancePeriodInput>
{
Task<ServiceResult> BatchCreatePeriod(JObject jsonParam);
}
}

@ -25,7 +25,11 @@ namespace Tiobon.Core.Model.Models
/// </summary>
public class Ghrp_PerformancePeriodBase
{
/// <summary>
/// 年度
/// </summary>
[Display(Name = "YYYY"), Description("年度"), MaxLength(50, ErrorMessage = "年度 不能超过 50 个字符")]
public string YYYY { get; set; }
/// <summary>
/// 期间编号
/// </summary>
@ -74,37 +78,37 @@ namespace Tiobon.Core.Model.Models
/// <summary>
/// 期间开始日
/// </summary>
public DateTime? BeginDate { get; set; }
public string? BeginDate { get; set; }
/// <summary>
/// 期间结束日
/// </summary>
public DateTime? EndDate { get; set; }
public string? EndDate { get; set; }
/// <summary>
/// 员工填写开始日
/// </summary>
public DateTime? StaffBeginDate { get; set; }
public string? StaffBeginDate { get; set; }
/// <summary>
/// 员工填写结束日
/// </summary>
public DateTime? StaffEndDate { get; set; }
public string? StaffEndDate { get; set; }
/// <summary>
/// 主管填写开始日
/// </summary>
public DateTime? MGBeginDate { get; set; }
public string? MGBeginDate { get; set; }
/// <summary>
/// 主管填写结束日
/// </summary>
public DateTime? MGEndDate { get; set; }
public string? MGEndDate { get; set; }
/// <summary>
/// 人员状态基准日
/// </summary>
public DateTime? OnJobBaseDate { get; set; }
public string? OnJobBaseDate { get; set; }
/// <summary>
/// 前置期间

@ -155,6 +155,6 @@ namespace Tiobon.Core.Model.Models
/// <summary>
/// 考核阶段名称
/// </summary>
public List<string> StageItems_List { get; set; }
public List<string> StageItems_List { get; set; } = new List<string>();
}
}

@ -27,6 +27,11 @@ namespace Tiobon.Core.Model.Models
[SugarTable("Ghrp_PerformancePeriod", "Ghrp_PerformancePeriod"), Entity(TableCnName = "考核期间", TableName = "Ghrp_PerformancePeriod")]
public class Ghrp_PerformancePeriod : BasePoco
{
/// <summary>
/// 年度
/// </summary>
[Display(Name = "YYYY"), Description("年度"), MaxLength(50, ErrorMessage = "年度 不能超过 50 个字符")]
public string YYYY { get; set; }
/// <summary>
/// 期间编号
@ -76,37 +81,37 @@ namespace Tiobon.Core.Model.Models
/// <summary>
/// 期间开始日
/// </summary>
public DateTime? BeginDate { get; set; }
public string? BeginDate { get; set; }
/// <summary>
/// 期间结束日
/// </summary>
public DateTime? EndDate { get; set; }
public string? EndDate { get; set; }
/// <summary>
/// 员工填写开始日
/// </summary>
public DateTime? StaffBeginDate { get; set; }
public string? StaffBeginDate { get; set; }
/// <summary>
/// 员工填写结束日
/// </summary>
public DateTime? StaffEndDate { get; set; }
public string? StaffEndDate { get; set; }
/// <summary>
/// 主管填写开始日
/// </summary>
public DateTime? MGBeginDate { get; set; }
public string? MGBeginDate { get; set; }
/// <summary>
/// 主管填写结束日
/// </summary>
public DateTime? MGEndDate { get; set; }
public string? MGEndDate { get; set; }
/// <summary>
/// 人员状态基准日
/// </summary>
public DateTime? OnJobBaseDate { get; set; }
public string? OnJobBaseDate { get; set; }
/// <summary>
/// 前置期间

@ -13,7 +13,7 @@
*  
* SimonHsiao
*
*/
*/
namespace Tiobon.Core.Model.Models;
@ -22,13 +22,15 @@ namespace Tiobon.Core.Model.Models;
/// </summary>
public class Ghrp_PerformancePeriodDto : Ghrp_PerformancePeriod
{
/// <summary>
/// 创建信息
/// </summary>
public string CreateDataInfo { get; set; }
/// <summary>
/// 创建信息
/// </summary>
public string CreateDataInfo { get; set; }
/// <summary>
/// 修改信息
/// </summary>
public string UpdateDataInfo { get; set; }
/// <summary>
/// 修改信息
/// </summary>
public string UpdateDataInfo { get; set; }
public string PerformancePeriodTypeName { get; set; }
public string PrePerformancePeriodName { get; set; }
}

@ -36,5 +36,5 @@ public class Ghrp_PerformancePeriodTypeDto : Ghrp_PerformancePeriodType
/// <summary>
/// 考核阶段名称
/// </summary>
public List<string> StageItems_List { get; set; }
public List<string> StageItems_List { get; set; } = new List<string>();
}

@ -2437,6 +2437,17 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, 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

@ -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;
}
/// <summary>
/// 查询
/// </summary>
/// <param name="filter"></param>
/// <param name="condition"></param>
/// <param name="IsEnable"></param>
/// <returns></returns>
public override async Task<ServicePageResult<Ghrp_PerformancePeriodDto>> 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<Ghrp_PerformancePeriodType>().Where(a => a.Id==x.PerformancePeriodTypeID).Select(x=> x.PeriodTypeName).FirstAsync();
x.PrePerformancePeriodName = await Db.Queryable<Ghrp_PerformancePeriod>().Where(a => a.Id == x.PrePerformancePeriodID).Select(x => x.PeriodName).FirstAsync();
});
return result;
}
public override async Task<long> Add(InsertGhrp_PerformancePeriodInput entity)
{
if (entity.PerformancePeriodTypeID != null)
entity.PeriodType = await Db.Queryable<Ghrp_PerformancePeriodType>().Where(a => a.Id == entity.PerformancePeriodTypeID).Select(x => x.PeriodTypeNo).FirstAsync();
var result = await base.Add(entity);
return result;
}
public override async Task<bool> Update(long Id, EditGhrp_PerformancePeriodInput editModel)
{
if (editModel.PerformancePeriodTypeID != null)
editModel.PeriodType = await Db.Queryable<Ghrp_PerformancePeriodType>().Where(a => a.Id == editModel.PerformancePeriodTypeID).Select(x => x.PeriodTypeNo).FirstAsync();
var result = await base.Update(Id, editModel, null, ["Status"]);
return result;
}
/// <summary>
/// 批量生成期间
/// </summary>
/// <param name="Stage"></param>
/// <returns></returns>
public async Task<ServiceResult> BatchCreatePeriod(JObject jsonParam)
{
string PerformancePeriodTypeID = jsonParam["PerformancePeriodTypeID"]?.Value<string>() ?? ""; // 考核周期类别
if (string.IsNullOrEmpty(PerformancePeriodTypeID)) return ServiceResult.OprateSuccess("考核周期类别不能为空!");
string YYYY = jsonParam["YYYY"]?.Value<string>() ?? ""; // 展开年度
if (string.IsNullOrEmpty(YYYY)) return ServiceResult.OprateSuccess("展开年度不能为空!");
string BeginDate = jsonParam["BeginDate"]?.Value<string>() ?? ""; // 期间开始日
if (string.IsNullOrEmpty(BeginDate)) return ServiceResult.OprateSuccess("期间开始日不能为空!");
string StaffBeginDate = jsonParam["StaffBeginDate"]?.Value<string>() ?? "";// 员工填写开始日
string StaffDays = jsonParam["StaffDays"]?.Value<string>() ?? ""; // 填写天数
string MGBeginDate = jsonParam["MGBeginDate"]?.Value<string>() ?? ""; // 主管填写开始日
string MGDays = jsonParam["MGDays"]?.Value<string>() ?? ""; // 主管填写天数
string OnJobBaseType = jsonParam["OnJobBaseType"]?.Value<string>() ?? ""; // 人员状态基准日
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("批量展开成功!");
}
}
}
Loading…
Cancel
Save