瀏覽代碼

仓库报表

3254194295 3 年之前
父節點
當前提交
100cd69de6
共有 1 個文件被更改,包括 49 次插入10 次删除
  1. 49 10
      platform-service/src/main/java/com/platform/service/check/impl/CheckJobServiceImpl.java

+ 49 - 10
platform-service/src/main/java/com/platform/service/check/impl/CheckJobServiceImpl.java

@@ -550,18 +550,57 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
 
                 CheckJob checkJob = new CheckJob();
                 checkJob.setSbId(standard.getSbId());
+            SbInfo sbInfo = sbInfoService.getModelById(standard.getSbId());
 
                 // 有可能设备已经删除了,继续执行其他的
-                if(StringUtils.isBlank(standard.getSbId())){
-                    throw new DeniedException("设备已经被删除了,无法生成保养任务!");
-                }
-                SbInfo sbInfo = sbInfoService.getModelById(standard.getSbId());
-                if(sbInfo == null){
-                    throw new DeniedException("没有找到该设备,无法生成保养任务!");
-                }
-                if(!sbInfo.getStatus().equals(SbInfoStatusEnum.IN_USE.getValue())){
-                    throw new DeniedException("设备不在使用中,无法生成保养任务!");
-                }
+            switch (standard.getType()){
+                case 1:
+                    if(StringUtils.isBlank(standard.getSbId())){
+                        throw new DeniedException("设备已经被删除了,无法生成点检任务!");
+                    }
+
+                    if(sbInfo == null){
+                        throw new DeniedException("没有找到该设备,无法生成点检任务!");
+                    }
+                    if(!sbInfo.getStatus().equals(SbInfoStatusEnum.IN_USE.getValue())){
+                        throw new DeniedException("设备不在使用中,无法生成点检任务!");
+                    }
+                    break;
+
+                case 2:
+                    if(StringUtils.isBlank(standard.getSbId())){
+                        throw new DeniedException("设备已经被删除了,无法生成保养任务!");
+                    }
+                    if(sbInfo == null){
+                        throw new DeniedException("没有找到该设备,无法生成保养任务!");
+                    }
+                    if(!sbInfo.getStatus().equals(SbInfoStatusEnum.IN_USE.getValue())){
+                        throw new DeniedException("设备不在使用中,无法生成保养任务!");
+                    }
+                    break;
+
+                case 3:
+                    if(StringUtils.isBlank(standard.getSbId())){
+                        throw new DeniedException("设备已经被删除了,无法生成润滑任务!");
+                    }
+                    if(sbInfo == null){
+                        throw new DeniedException("没有找到该设备,无法生成润滑任务!");
+                    }
+                    if(!sbInfo.getStatus().equals(SbInfoStatusEnum.IN_USE.getValue())){
+                        throw new DeniedException("设备不在使用中,无法生成润滑任务!");
+                    }
+                    break;
+            }
+//                if(StringUtils.isBlank(standard.getSbId())){
+//                    throw new DeniedException("设备已经被删除了,无法生成保养任务!");
+//                }
+//                SbInfo sbInfo = sbInfoService.getModelById(standard.getSbId());
+//                if(sbInfo == null){
+//                    throw new DeniedException("没有找到该设备,无法生成保养任务!");
+//                }
+//                if(!sbInfo.getStatus().equals(SbInfoStatusEnum.IN_USE.getValue())){
+//                    throw new DeniedException("设备不在使用中,无法生成保养任务!");
+//                }
                 if(standard.getCheckUserType() == null){
                     if(standard.getPeriodType()< CheckPlanPeriodTypeEnum.WEEK.getValue()){
                         checkJob.setCheckUserId(sbInfo.getSaveUser());