Просмотр исходного кода

更新抽检模块操作功能

oyq28 3 лет назад
Родитель
Сommit
467ab3577c

+ 8 - 4
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/InspectionController.java

@@ -90,9 +90,10 @@ public class InspectionController extends SuperController<InspectionService, Lon
                 //在当前零件加工工序之后
                 wrapper.le(BomProcedure::getSort, sort);
             }
-            Long existProcedureId = baseService.getOne(new LbqWrapper<Inspection>().eq(Inspection::getWorkpieceId,workPiece.getId())).getProcedureId();
-            if(null!= existProcedureId){
-                wrapper.ne(BomProcedure::getId, existProcedureId);
+            Inspection inspection = baseService.getOne(new LbqWrapper<Inspection>().eq(Inspection::getWorkpieceId,workPiece.getId()));
+            //排除已经提交抽检的工序
+            if(null!= inspection && null!=inspection.getProcedureId()){
+                wrapper.ne(BomProcedure::getId, inspection.getProcedureId());
             }
         }
 
@@ -108,6 +109,9 @@ public class InspectionController extends SuperController<InspectionService, Lon
     @PostMapping("/save")
     public R<Inspection> save(@RequestBody InspectionSaveDTO model) {
         Inspection inspection = BeanUtil.toBean(model, Inspection.class);
-        return baseService.save(inspection)? success(inspection) : success(null);
+        if(baseService.check(model)) {
+            return baseService.save(inspection) ? success(inspection) : fail("新增失败");
+        }
+        return fail("新增条件判断失败");
     }
 }