lyh
2025-02-14 f2f8241dd52ef12ec109f6f4f0f13042055338ac
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java
@@ -76,6 +76,8 @@
    private IProcessionDepartmentService processionDepartmentService;
    @Autowired
    private IMdcProductionService mdcProductionService;
    @Autowired
    private IDocRelativeService iDocRelativeService;
    @Override
    @Transactional(rollbackFor = {Exception.class})
@@ -236,6 +238,11 @@
        if(processStreams != null && !processStreams.isEmpty())
            ExceptionCast.cast(ProductInfoCode.PRODUCT_PROCESS_EXIST);
        boolean b = productPermissionService.deleteByProductId(id);
        //验证是否存在文档
        List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type","1").eq("attribution_id",id));
        if (!docRelativeList.isEmpty()){
            ExceptionCast.cast(ProductInfoCode.PRODUCT_DOC_EXIST);
        }
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        b = productDepartmentService.deleteByProductId(id);
@@ -247,18 +254,6 @@
        b = permissionStreamService.deleteDepartPermsByProductId(id);
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        b = docInfoService.deleteByProductId(id);
        if(!b)
            ExceptionCast.cast(CommonCode.FAIL);
        //添加日志
        NcLogInfo ncLogInfo = new NcLogInfo();
        //模块
        ncLogInfo.setModuleInfo("产品结构树");
        //类型
        ncLogInfo.setOperateType(4);
        //日志内容
        ncLogInfo.setLogContent("产品名称:"+productInfo.getProductName());
        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
        return super.removeById(id);
    }
@@ -1926,4 +1921,27 @@
        return ProductTreeWrapper.loadTree(productInfoList, componentExtList, partsInfos,processStreams,workSteps);
    }
    @Override
    public boolean deleteProductTree(String id, Integer type){
        switch (type) {
            //产品
            case 1:
                return deleteProductInfo(id);
            //部门
            case 2:
                return componentInfoService.deleteComponentInfo(id);
            //零件
            case 3:
                return partsInfoService.deletePartsInfo(id);
            //工序
            case 5:
                return processStreamService.deleteProcessStream(id);
            //工步
            case 6:
                return workStepService.deleteWorkStep(id);
            default:
        }
        return false;
    }
}