wangming пре 11 месеци
родитељ
комит
478b2bac59

+ 7 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxInsideInspectionService.java

@@ -34,6 +34,13 @@ public interface ZhcxInsideInspectionService extends IService<ZhcxInsideInspecti
      */
     void updateInspection(InsideInspectionUpdateRequest req);
 
+    /**
+     * 删除报验单
+     *
+     * @param req
+     */
+    void del(InsideInspectionOperRequest req);
+
     /**
      * 暂存-保存
      *

+ 57 - 3
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxInsideInspectionServiceImpl.java

@@ -11,6 +11,7 @@ import cn.hutool.core.util.ZipUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.rongwei.bscommon.sys.service.*;
@@ -131,6 +132,10 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         if(ObjectUtil.isEmpty(req.getOperType()) || "updateInspection".equals(req.getOperType())) {
             ZhcxInsideInspectionDo inspection = this.getById(req.getId());//报验单
 
+            if(ObjectUtil.isNull(inspection)) {
+                throw new CustomException("此单据不存在!");
+            }
+
             //只有待报验状态才能修改
             if(!"20".equals(inspection.getInspectionstatus()) && !"10".equals(inspection.getInspectionstatus())) {
                 throw new CustomException("只有待报验状态才能修改");
@@ -178,6 +183,42 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         }
     }
 
+    /**
+     * 删除报验单
+     *
+     * @param req
+     */
+    @Override
+    public void del(InsideInspectionOperRequest req) {
+        ZhcxInsideInspectionDo inspection = this.getById(req.getId());//报验单
+
+        if(ObjectUtil.isNull(inspection)) {
+            throw new CustomException("此单据不存在!");
+        }
+
+        if(!"10".equals(inspection.getInspectionstatus())) {
+            throw new CustomException("只有未提交状态才能删除,请刷新页面确实单据状态");
+        }
+
+        //主表数据
+        removeById(req.getId());
+
+        //派单数据
+        final LambdaUpdateWrapper<ZhcxInsideInspectionDispatchDo> updateDispatchWrapper = Wrappers.lambdaUpdate();
+        updateDispatchWrapper.eq(ZhcxInsideInspectionDispatchDo::getInsideid, req.getId());
+        dispatchService.remove(updateDispatchWrapper);
+
+        //核心检验指标
+        final LambdaUpdateWrapper<ZhcxInsideInspectionCoreIndicatorsDo> updateIndicatorWrapper = Wrappers.lambdaUpdate();
+        updateIndicatorWrapper.eq(ZhcxInsideInspectionCoreIndicatorsDo::getInsideid, req.getId());
+        insideInspectionCoreIndicatorsService.remove(updateIndicatorWrapper);
+
+        //日志
+        final LambdaUpdateWrapper<ZhcxInsideInspectionOperLogDo> updateLogWrapper = Wrappers.lambdaUpdate();
+        updateLogWrapper.eq(ZhcxInsideInspectionOperLogDo::getInsideid, req.getId());
+        operLogService.remove(updateLogWrapper);
+    }
+
     /**
      * 暂存-保存
      *
@@ -227,9 +268,13 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
 
         ZhcxInsideInspectionDo inspection = this.getById(req.getId());//报验单
 
+        if(ObjectUtil.isNull(inspection)) {
+            throw new CustomException("此单据不存在!");
+        }
+
         //非未提交状态不能暂存
         if(!"10".equals(inspection.getInspectionstatus())) {
-            throw new CustomException("此单据已提交,不能暂存");
+            throw new CustomException("此单据已提交,不能暂存");
         }
 
         //生成记录
@@ -1640,8 +1685,17 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
         boolean match = inOper.getOperUser().getRoleDos().stream().anyMatch(item -> "role095".equals(item.getCode()) || "role080".equals(item.getCode()));
 
         //非站长主任,只能自己派单给自己
-        if(!match && inOper.getOperUser().getId().equals(dto.getSupervisionId())) {
-            match = true;
+        if(!match) {
+            if(inOper.getOperUser().getId().equals(dto.getSupervisionId())) {
+                match = true;
+            } else {
+                match = false;
+            }
+
+            //报验单中检验员与派单中检验员不一致
+            if(!inOper.getInspection().getCheckerid().equals(dto.getSupervisionId())) {
+                match = false;
+            }
         }
 
         if(!match) {

+ 13 - 0
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxInsideInspectionController.java

@@ -49,6 +49,19 @@ public class ZhcxInsideInspectionController {
         return R.ok();
     }
 
+    /**
+     * 删除
+     *
+     * @param req
+     * @return
+     */
+    @ApiOperation("删除")
+    @PostMapping("/del")
+    public R del(@RequestBody InsideInspectionOperRequest req){
+        service.del(req);
+        return R.ok();
+    }
+
     /**
      * 派单
      *