|
|
@ -206,6 +206,7 @@ public class ResourceRepairTaskServiceImpl extends ServiceImpl<ResourceRepairTas
|
|
|
|
String status = resourceRepairTask.getStatus();
|
|
|
|
String status = resourceRepairTask.getStatus();
|
|
|
|
String handle = resourceRepairTask.getHandle();
|
|
|
|
String handle = resourceRepairTask.getHandle();
|
|
|
|
String user = CommonMethods.getUser();
|
|
|
|
String user = CommonMethods.getUser();
|
|
|
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
ResourceRepairTask repairTask = resourceRepairTaskService.getById(handle);
|
|
|
|
ResourceRepairTask repairTask = resourceRepairTaskService.getById(handle);
|
|
|
|
String site = repairTask.getSite();
|
|
|
|
String site = repairTask.getSite();
|
|
|
|
switch (status){
|
|
|
|
switch (status){
|
|
|
@ -215,12 +216,12 @@ public class ResourceRepairTaskServiceImpl extends ServiceImpl<ResourceRepairTas
|
|
|
|
spare.setCreateUser(user);
|
|
|
|
spare.setCreateUser(user);
|
|
|
|
spare.setHandle(HandleEnum.RESOURCE_INSPECT_TASK_SPARE.getHandle(site,UUID.randomUUID().toString()));
|
|
|
|
spare.setHandle(HandleEnum.RESOURCE_INSPECT_TASK_SPARE.getHandle(site,UUID.randomUUID().toString()));
|
|
|
|
spare.setResourceInspectTaskBo(handle);
|
|
|
|
spare.setResourceInspectTaskBo(handle);
|
|
|
|
spare.setCreatedDateTime(LocalDateTime.now());
|
|
|
|
spare.setCreatedDateTime(now);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resourceInspectTaskSpareService.saveBatch(spareList);
|
|
|
|
resourceInspectTaskSpareService.saveBatch(spareList);
|
|
|
|
repairTask.setSpareList(spareList);
|
|
|
|
repairTask.setSpareList(spareList);
|
|
|
|
// 完成时间、维修人员
|
|
|
|
// 完成时间、维修人员
|
|
|
|
repairTask.setActualCompleteDate(LocalDateTime.now());
|
|
|
|
repairTask.setActualCompleteDate(now);
|
|
|
|
String repairUsers = resourceRepairTask.getRepairUsers();
|
|
|
|
String repairUsers = resourceRepairTask.getRepairUsers();
|
|
|
|
String[] split = repairUsers.split(",");
|
|
|
|
String[] split = repairUsers.split(",");
|
|
|
|
for (int i = 0; i < split.length; i++) {
|
|
|
|
for (int i = 0; i < split.length; i++) {
|
|
|
@ -251,16 +252,31 @@ public class ResourceRepairTaskServiceImpl extends ServiceImpl<ResourceRepairTas
|
|
|
|
ResourceInspectTask resourceInspectTask = new ResourceInspectTask();
|
|
|
|
ResourceInspectTask resourceInspectTask = new ResourceInspectTask();
|
|
|
|
resourceInspectTask.setSite(site);
|
|
|
|
resourceInspectTask.setSite(site);
|
|
|
|
resourceInspectTask.setCategory(Constants.INSPECTION_TYPE_DM);
|
|
|
|
resourceInspectTask.setCategory(Constants.INSPECTION_TYPE_DM);
|
|
|
|
LocalDate now = LocalDate.now();
|
|
|
|
LocalDate toDay = LocalDate.now();
|
|
|
|
LocalDateTime startDate = LocalDateTime.parse(now + "T00:00:00");
|
|
|
|
LocalDateTime startDate = LocalDateTime.parse(toDay + "T00:00:00");
|
|
|
|
LocalDateTime endDate = LocalDateTime.parse(now.plusDays(1) + "T00:00:00");
|
|
|
|
LocalDateTime endDate = LocalDateTime.parse(toDay.plusDays(1) + "T00:00:00");
|
|
|
|
resourceInspectTask.setPlanStartDate(startDate);
|
|
|
|
resourceInspectTask.setPlanStartDate(startDate);
|
|
|
|
resourceInspectTask.setPlanCompleteDate(endDate);
|
|
|
|
resourceInspectTask.setPlanCompleteDate(endDate);
|
|
|
|
resourceInspectTask.setResrce(resourceRepairTask.getResourceNo());
|
|
|
|
resourceInspectTask.setResrce(resourceRepairTask.getResourceNo());
|
|
|
|
List<ResourceInspectTask> inspectTaskList = resourceInspectTaskMapper.getInspectTaskListByCondition(resourceInspectTask);
|
|
|
|
List<ResourceInspectTask> inspectTaskList = resourceInspectTaskMapper.getInspectTaskListByCondition(resourceInspectTask);
|
|
|
|
for (ResourceInspectTask inspectTask:inspectTaskList) {
|
|
|
|
for (ResourceInspectTask inspectTask:inspectTaskList) {
|
|
|
|
|
|
|
|
// 查询到点检结果为NG的设备,创建新的当日点检任务
|
|
|
|
if (Constants.RSESULT_NG.equals(inspectTask.getResult())){
|
|
|
|
if (Constants.RSESULT_NG.equals(inspectTask.getResult())){
|
|
|
|
resourceInspectPlanService.autoCreateTaskByResourceInspectTask(inspectTask);
|
|
|
|
String taskNo = inspectTask.getTaskNo();
|
|
|
|
|
|
|
|
String taskStr = taskNo+now;
|
|
|
|
|
|
|
|
inspectTask.setTaskNo(taskStr);
|
|
|
|
|
|
|
|
inspectTask.setHandle(HandleEnum.RESOURCE_INSPECT_TASK.getHandle(site,taskStr));
|
|
|
|
|
|
|
|
inspectTask.setResult("");
|
|
|
|
|
|
|
|
inspectTask.setActualCompleteDate(null);
|
|
|
|
|
|
|
|
inspectTask.setExecutor("");
|
|
|
|
|
|
|
|
inspectTask.setCreatedDateTime(now);
|
|
|
|
|
|
|
|
inspectTask.setTaskCreateDate(now);
|
|
|
|
|
|
|
|
inspectTask.setPlanStartDate(now);
|
|
|
|
|
|
|
|
inspectTask.setActualStartDate(null);
|
|
|
|
|
|
|
|
inspectTask.setStatus(Constants.INSPECTION_TASK_STATUS_NEW);
|
|
|
|
|
|
|
|
inspectTask.setModifyUser(null);
|
|
|
|
|
|
|
|
inspectTask.setModifiedDateTime(null);
|
|
|
|
|
|
|
|
resourceInspectTaskMapper.insert(inspectTask);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -269,7 +285,7 @@ public class ResourceRepairTaskServiceImpl extends ServiceImpl<ResourceRepairTas
|
|
|
|
// 取消代码、取消描述、取消时间、取消人员
|
|
|
|
// 取消代码、取消描述、取消时间、取消人员
|
|
|
|
repairTask.setCancelCode(resourceRepairTask.getCancelCode());
|
|
|
|
repairTask.setCancelCode(resourceRepairTask.getCancelCode());
|
|
|
|
repairTask.setCancelDescription(resourceRepairTask.getCancelDescription());
|
|
|
|
repairTask.setCancelDescription(resourceRepairTask.getCancelDescription());
|
|
|
|
repairTask.setCancelDate(LocalDateTime.now());
|
|
|
|
repairTask.setCancelDate(now);
|
|
|
|
repairTask.setCancelUser(user);
|
|
|
|
repairTask.setCancelUser(user);
|
|
|
|
NwaUser userByUserName = nwaUserService.findUserByUserName(user);
|
|
|
|
NwaUser userByUserName = nwaUserService.findUserByUserName(user);
|
|
|
|
repairTask.setCancelUserName(userByUserName.getFullName());
|
|
|
|
repairTask.setCancelUserName(userByUserName.getFullName());
|
|
|
@ -278,13 +294,13 @@ public class ResourceRepairTaskServiceImpl extends ServiceImpl<ResourceRepairTas
|
|
|
|
if (repairTask.getWaitStartDate() != null){
|
|
|
|
if (repairTask.getWaitStartDate() != null){
|
|
|
|
throw BusinessException.build("已有等待记录,不能再次进入等待状态!!!");
|
|
|
|
throw BusinessException.build("已有等待记录,不能再次进入等待状态!!!");
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
repairTask.setWaitStartDate(LocalDateTime.now());
|
|
|
|
repairTask.setWaitStartDate(now);
|
|
|
|
repairTask.setWaitDescription(resourceRepairTask.getWaitDescription());
|
|
|
|
repairTask.setWaitDescription(resourceRepairTask.getWaitDescription());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "501":
|
|
|
|
case "501":
|
|
|
|
// 结束时间、等待时长
|
|
|
|
// 结束时间、等待时长
|
|
|
|
repairTask.setWaitEndDate(LocalDateTime.now());
|
|
|
|
repairTask.setWaitEndDate(now);
|
|
|
|
Duration betweenTime = Duration.between(repairTask.getWaitStartDate(), repairTask.getWaitEndDate());
|
|
|
|
Duration betweenTime = Duration.between(repairTask.getWaitStartDate(), repairTask.getWaitEndDate());
|
|
|
|
Long waitMinutes = betweenTime.toMinutes();
|
|
|
|
Long waitMinutes = betweenTime.toMinutes();
|
|
|
|
double waitHours = waitMinutes.doubleValue()/60.00;
|
|
|
|
double waitHours = waitMinutes.doubleValue()/60.00;
|
|
|
@ -294,7 +310,7 @@ public class ResourceRepairTaskServiceImpl extends ServiceImpl<ResourceRepairTas
|
|
|
|
// 状态、修改人、修改时间
|
|
|
|
// 状态、修改人、修改时间
|
|
|
|
repairTask.setStatus(status);
|
|
|
|
repairTask.setStatus(status);
|
|
|
|
repairTask.setModifyUser(user);
|
|
|
|
repairTask.setModifyUser(user);
|
|
|
|
repairTask.setModifiedDateTime(LocalDateTime.now());
|
|
|
|
repairTask.setModifiedDateTime(now);
|
|
|
|
resourceRepairTaskService.saveOrUpdate(repairTask);
|
|
|
|
resourceRepairTaskService.saveOrUpdate(repairTask);
|
|
|
|
return repairTask;
|
|
|
|
return repairTask;
|
|
|
|
}
|
|
|
|
}
|
|
|
|