|
|
|
@ -35,6 +35,14 @@ namespace Tiobon.Core.Services |
|
|
|
|
|
|
|
|
|
result.result.DT_TableDataT1.ForEach(async x => |
|
|
|
|
{ |
|
|
|
|
x.BeginDate = string.IsNullOrEmpty(x.BeginDate)?"":Convert.ToDateTime(x.BeginDate).ToString("yyyy-MM-dd"); |
|
|
|
|
x.EndDate = string.IsNullOrEmpty(x.EndDate) ? "" : Convert.ToDateTime(x.EndDate).ToString("yyyy-MM-dd"); |
|
|
|
|
x.StaffBeginDate = string.IsNullOrEmpty(x.StaffBeginDate) ? "" : Convert.ToDateTime(x.StaffBeginDate).ToString("yyyy-MM-dd"); |
|
|
|
|
x.StaffEndDate = string.IsNullOrEmpty(x.StaffEndDate) ? "" : Convert.ToDateTime(x.StaffEndDate).ToString("yyyy-MM-dd"); |
|
|
|
|
x.MGBeginDate = string.IsNullOrEmpty(x.MGBeginDate) ? "" : Convert.ToDateTime(x.MGBeginDate).ToString("yyyy-MM-dd"); |
|
|
|
|
x.MGEndDate = string.IsNullOrEmpty(x.MGEndDate) ? "" : Convert.ToDateTime(x.MGEndDate).ToString("yyyy-MM-dd"); |
|
|
|
|
x.OnJobBaseDate = string.IsNullOrEmpty(x.OnJobBaseDate) ? "" : Convert.ToDateTime(x.OnJobBaseDate).ToString("yyyy-MM-dd"); |
|
|
|
|
|
|
|
|
|
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(); |
|
|
|
@ -94,6 +102,8 @@ namespace Tiobon.Core.Services |
|
|
|
|
Declare @MGDays int = '{MGDays}' |
|
|
|
|
if @MGDays = 0 set @MGDays = null |
|
|
|
|
Declare @OnJobBaseType nvarchar(100) ='{OnJobBaseType}' |
|
|
|
|
|
|
|
|
|
Declare @GUID nvarchar(100) = NEWID(); |
|
|
|
|
;with PerformancePeriod as( |
|
|
|
|
select top 999 ROW_NUMBER() over(order by PeriodTypeNo,b.Nums,c.SortNo) SortNo, |
|
|
|
|
@YYYY YYYY, |
|
|
|
@ -157,7 +167,7 @@ namespace Tiobon.Core.Services |
|
|
|
|
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) |
|
|
|
|
IsEnable,CreateBy,CreateTime,CreateProg,Reverse1) |
|
|
|
|
select SortNo, |
|
|
|
|
ISNULL((select MAX(Id) from Ghrp_PerformancePeriod), 1000000000000000000 ) |
|
|
|
|
+SortNo, |
|
|
|
@ -169,10 +179,20 @@ namespace Tiobon.Core.Services |
|
|
|
|
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 |
|
|
|
|
1 IsEnable,1 CreateBy,GETDATE() CreateTime,'/api/Ghrp_PerformancePeriod/BatchCreatePeriod' CreateProg,@GUID |
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
update a |
|
|
|
|
set PrePerformancePeriodID = (select Id from Ghrp_PerformancePeriod |
|
|
|
|
where IsEnable=1 and YYYY=a.YYYY |
|
|
|
|
and PerformancePeriodTypeID=a.PerformancePeriodTypeID |
|
|
|
|
and SortNo = a.SortNo-1 |
|
|
|
|
and Reverse1=@GUID |
|
|
|
|
) |
|
|
|
|
from Ghrp_PerformancePeriod a |
|
|
|
|
where Reverse1=@GUID |
|
|
|
|
";
|
|
|
|
|
await Db.Ado.ExecuteCommandAsync(sql); |
|
|
|
|
return ServiceResult.OprateSuccess("批量展开成功!"); |
|
|
|
|