diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/baseinfo/BaseBomInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/baseinfo/BaseBomInfoController.java index c89aac5..207208f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/baseinfo/BaseBomInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/baseinfo/BaseBomInfoController.java @@ -129,6 +129,9 @@ public class BaseBomInfoController extends BaseController @ResponseBody public AjaxResult addSave(BaseBomInfo baseBomInfo) { + BaseBomInfo pbaseBomInfo = new BaseBomInfo(); + pbaseBomInfo = baseBomInfoService.selectBaseBomInfoBymaterialName(baseBomInfo); + baseBomInfo.setpId(pbaseBomInfo.getBomId()); return toAjax(baseBomInfoService.insertBaseBomInfo(baseBomInfo)); } @@ -139,6 +142,8 @@ public class BaseBomInfoController extends BaseController public String edit(@PathVariable("objid") Long objid, ModelMap mmap) { BaseBomInfo baseBomInfo = baseBomInfoService.selectBaseBomInfoById(objid); + mmap.put("cbmaterialtypeInfo",baseMaterialtypeInfoService.selectEditBaseMaterialtypeInfoList(baseBomInfo.getMaterialTypeId())); + mmap.put("cbmaterialInfo",baseMaterialInfoService.selectEditBaseMaterialInfoList(baseBomInfo.getMaterialId())); mmap.put("baseBomInfo", baseBomInfo); return prefix + "/edit"; } @@ -158,12 +163,16 @@ public class BaseBomInfoController extends BaseController /** * 删除BOM基础信息 */ - @RequiresPermissions("baseinfo:bominfo:remove") @Log(title = "BOM基础信息", businessType = BusinessType.DELETE) - @PostMapping( "/remove") + @RequiresPermissions("system:dept:remove") + @GetMapping("/remove/{bomId}") @ResponseBody - public AjaxResult remove(String ids) + public AjaxResult remove(@PathVariable("bomId") Long bomId) { - return toAjax(baseBomInfoService.deleteBaseBomInfoByIds(ids)); + if (baseBomInfoService.selectBomCount(bomId) > 0) + { + return AjaxResult.warn("存在下级节点,不允许删除"); + } + return toAjax(baseBomInfoService.deleteBaseBomInfoById(bomId)); } } diff --git a/ruoyi-admin/src/main/resources/templates/baseinfo/bominfo/add.html b/ruoyi-admin/src/main/resources/templates/baseinfo/bominfo/add.html index 296b5cb..ad712ca 100644 --- a/ruoyi-admin/src/main/resources/templates/baseinfo/bominfo/add.html +++ b/ruoyi-admin/src/main/resources/templates/baseinfo/bominfo/add.html @@ -23,19 +23,19 @@
- +
- +
diff --git a/ruoyi-admin/src/main/resources/templates/baseinfo/bominfo/bominfo.html b/ruoyi-admin/src/main/resources/templates/baseinfo/bominfo/bominfo.html index db05f91..76b519b 100644 --- a/ruoyi-admin/src/main/resources/templates/baseinfo/bominfo/bominfo.html +++ b/ruoyi-admin/src/main/resources/templates/baseinfo/bominfo/bominfo.html @@ -10,10 +10,10 @@
    -
  • - - -
  • + + + +
  • + @@ -14,21 +16,27 @@
    - +
    - +
    - +
    - +
    +
    + +
    + +
    +
    @@ -41,6 +49,8 @@
    + + - + + + + + + + + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + +
    +
    +
    +
    +
    + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/cxselect.html b/ruoyi-admin/src/main/resources/templates/demo/form/cxselect.html index 9b2ab07..752f3e8 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/form/cxselect.html +++ b/ruoyi-admin/src/main/resources/templates/demo/form/cxselect.html @@ -1,161 +1,162 @@ - - - - - - -
    -
    -
    -
    -
    -
    多级联动下拉https://github.com/ciaoca/cxSelect
    -
    -
    -

    简单联动示例。

    -
    -
    - -
    -
    - -
    -
    -
    - -

    国内省市区联动。

    -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    - -

    自定义选项。

    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    - -
    -
    -
    -
    -
    - - - - - + + + + + + +
    +
    +
    +
    +
    +
    多级联动下拉https://github.com/ciaoca/cxSelect
    +
    +
    +

    简单联动示例。

    +
    +
    + +
    +
    + +
    +
    +
    + +

    国内省市区联动。

    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + +

    自定义选项。

    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + +
    +
    +
    +
    +
    + + + + + diff --git a/ruoyi-system/src/main/java/com/ruoyi/baseinfo/mapper/BaseBomInfoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/baseinfo/mapper/BaseBomInfoMapper.java index 3554dfe..9038804 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/baseinfo/mapper/BaseBomInfoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/baseinfo/mapper/BaseBomInfoMapper.java @@ -58,4 +58,20 @@ public interface BaseBomInfoMapper * @return 结果 */ public int deleteBaseBomInfoByIds(String[] objids); + + + /** + * 查询BOM基础信息 + * + * @param materialName BOM上级节点得物料名称 + * @return 结果 + */ + public BaseBomInfo selectBaseBomInfoBymaterialName(BaseBomInfo baseBomInfo); + /** + * 查询BOM节点数量 + * + * @param parentId 父部门ID + * @return 结果 + */ + public int selectBomCount(BaseBomInfo baseBomInfo); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/baseinfo/service/IBaseBomInfoService.java b/ruoyi-system/src/main/java/com/ruoyi/baseinfo/service/IBaseBomInfoService.java index 2a9dd62..252ddc2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/baseinfo/service/IBaseBomInfoService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/baseinfo/service/IBaseBomInfoService.java @@ -58,4 +58,20 @@ public interface IBaseBomInfoService * @return 结果 */ public int deleteBaseBomInfoById(Long objid); + + /** + * 查询BOM基础信息 + * + * @param baseBomInfo BOM上级节点得物料名称 + * @return 结果 + */ + public BaseBomInfo selectBaseBomInfoBymaterialName(BaseBomInfo baseBomInfo); + + /** + * 查询BOM节点数量 + * + * @param parentId 父部门ID + * @return 结果 + */ + public int selectBomCount(Long parentId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/baseinfo/service/impl/BaseBomInfoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/baseinfo/service/impl/BaseBomInfoServiceImpl.java index 52d2f72..d74e6c0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/baseinfo/service/impl/BaseBomInfoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/baseinfo/service/impl/BaseBomInfoServiceImpl.java @@ -2,6 +2,7 @@ package com.ruoyi.baseinfo.service.impl; import java.util.List; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.system.domain.SysDept; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.baseinfo.mapper.BaseBomInfoMapper; @@ -94,4 +95,16 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService { return baseBomInfoMapper.deleteBaseBomInfoById(objid); } + + @Override + public BaseBomInfo selectBaseBomInfoBymaterialName(BaseBomInfo baseBomInfo) { + return baseBomInfoMapper.selectBaseBomInfoBymaterialName(baseBomInfo); + } + + @Override + public int selectBomCount(Long parentId) { + BaseBomInfo baseBomInfo = new BaseBomInfo(); + baseBomInfo.setpId(parentId); + return baseBomInfoMapper.selectBomCount(baseBomInfo); + } } diff --git a/ruoyi-system/src/main/resources/mapper/baseinfo/BaseBomInfoMapper.xml b/ruoyi-system/src/main/resources/mapper/baseinfo/BaseBomInfoMapper.xml index 7e6c0e9..b7f0d5b 100644 --- a/ruoyi-system/src/main/resources/mapper/baseinfo/BaseBomInfoMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/baseinfo/BaseBomInfoMapper.xml @@ -102,4 +102,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + +