@ -106,6 +106,12 @@ public class ResourceInspectPlanServiceImpl extends ServiceImpl<ResourceInspectP
returnStatus = true ;
resourceInspectPlan . setStatus ( "401" ) ;
} else {
ResourceInspectTask resourceInspectTask = new ResourceInspectTask ( ) ;
resourceInspectTask . setResourceInspectPlanBo ( planHandle . getHandle ( ) ) ;
List < ResourceInspectTask > resourceInspectTasks = resourceInspectTaskService . selectList ( resourceInspectTask ) ;
if ( ! planHandle . getScheduleType ( ) . equals ( resourceInspectPlan . getScheduleType ( ) ) & & resourceInspectTasks . size ( ) > 0 ) {
throw BusinessException . build ( "已创建任务的点检计划,不能修改排程方式!" ) ;
}
// 保留创建人员和创建时间
String createUser = planHandle . getCreateUser ( ) ;
LocalDateTime createdDateTime = planHandle . getCreatedDateTime ( ) ;
@ -209,6 +215,12 @@ public class ResourceInspectPlanServiceImpl extends ServiceImpl<ResourceInspectP
if ( inspectPlanById = = null ) {
throw BusinessException . build ( "点检计划删除失败!" ) ;
}
ResourceInspectTask resourceInspectTask = new ResourceInspectTask ( ) ;
resourceInspectTask . setResourceInspectPlanBo ( inspectPlanById . getHandle ( ) ) ;
List < ResourceInspectTask > resourceInspectTasks = resourceInspectTaskService . selectList ( resourceInspectTask ) ;
if ( resourceInspectTasks ! = null & & resourceInspectTasks . size ( ) > 0 ) {
throw BusinessException . build ( "当前计划已创建任务,不允许删除!" ) ;
}
// 设备清单表数据删除
ResourceInspectResource resourceInspectResource = new ResourceInspectResource ( ) ;
resourceInspectResource . setResourceInspectPlanBo ( handle ) ;
@ -294,6 +306,9 @@ public class ResourceInspectPlanServiceImpl extends ServiceImpl<ResourceInspectP
ResourceInspectTask equipInspectTask = setResourceInspectTask ( resourceInspectPlan , resourceInspectTask , sign ) ;
resourceInspectTaskList . add ( equipInspectTask ) ;
taskCreateDate = addTime ( frequencyUnit , frequency , taskCreateDate ) ;
if ( taskCreateDate . isAfter ( indateEnd ) ) {
break ;
}
taskNum - - ;
}
} else {
@ -307,12 +322,18 @@ public class ResourceInspectPlanServiceImpl extends ServiceImpl<ResourceInspectP
ResourceInspectTask equipInspectTask = setResourceInspectTask ( resourceInspectPlan , resourceInspectTask , sign ) ;
resourceInspectTaskList . add ( equipInspectTask ) ;
taskCreateDate = addTime ( frequencyUnit , frequency , taskCreateDate ) ;
if ( taskCreateDate . isAfter ( indateEnd ) ) {
break ;
}
}
} else {
while ( taskCreateDate . isBefore ( createdDateTime ) ) {
taskCreateDate = addTime ( frequencyUnit , frequency , taskCreateDate ) ;
}
for ( int i = 0 ; i < taskNum ; i + + ) {
if ( taskCreateDate . isAfter ( indateEnd ) ) {
break ;
}
resourceInspectTask . setTaskCreateDate ( taskCreateDate ) ;
ResourceInspectTask equipInspectTask = setResourceInspectTask ( resourceInspectPlan , resourceInspectTask , sign ) ;
resourceInspectTaskList . add ( equipInspectTask ) ;