基础信息-BOM

highway
A0010407 1 year ago
parent c5f16b8e68
commit 1f7113fc99

@ -42,9 +42,7 @@ public class BaseBomController extends BaseController {
@GetMapping("/list")
public TableDataInfo list(BaseBom baseBom) {
startPage();
BaseBomComponent baseBomComponent = new BaseBomComponent();
List<BaseBomComponent> list = new ArrayList<>();
List<BaseBomComponent> baseBoms = baseBomService.selectBaseBomComponentList(baseBomComponent);
List<BaseBom> baseBoms = baseBomService.selectBaseBomList(baseBom);
return getDataTable(baseBoms);
}

@ -63,4 +63,6 @@ public interface BaseBomComponentMapper {
List<String> selectBomCodeList(BaseBomComponent baseBomComponent);
//查询BaseBomComponent表中的product_code
List<String> selectProductCodeList(BaseBomComponent baseBomComponent);
//查询全部
List<BaseBomComponent> selectAllBaseBomComponentList(BaseBomComponent baseBomComponent);
}

@ -27,7 +27,7 @@ public interface IBaseBomService {
*/
public List<BaseBom> selectBaseBomList(BaseBom baseBom);
//public List<BaseBom> selectBaseBomList(BaseBom baseBom, BaseBomComponent baseBomComponent, List<BaseBomComponent> list);
public List<BaseBomComponent> selectBaseBomComponentList(BaseBomComponent baseBomComponent);
// public List<BaseBomComponent> selectBaseBomComponentList(BaseBomComponent baseBomComponent);
/**
* BOM

@ -1,6 +1,9 @@
package com.op.wms.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -30,17 +33,6 @@ public class BaseBomComponentServiceImpl implements IBaseBomComponentService {
return baseBomComponentMapper.selectBaseBomComponentById(id);
}
/**
* BOM
*
* @param baseBomComponent BOM
* @return BOM
*/
@Override
public List<BaseBomComponent> selectBaseBomComponentList(BaseBomComponent baseBomComponent) {
return baseBomComponentMapper.selectBaseBomComponentList(baseBomComponent);
}
/**
* BOM
*
@ -86,4 +78,51 @@ public class BaseBomComponentServiceImpl implements IBaseBomComponentService {
public int deleteBaseBomComponentById(Long id) {
return baseBomComponentMapper.deleteBaseBomComponentById(id);
}
/**
*
* @param baseBomComponent
* @return
*/
@Override
@DS("#header.poolName")
public List<BaseBomComponent> selectBaseBomComponentList(BaseBomComponent baseBomComponent){
List<BaseBomComponent> trees = new ArrayList<>();//新创建
List<BaseBomComponent> baseBomComponentList = baseBomComponentMapper.selectBaseBomComponentList(baseBomComponent);//查询baseBomComponent
List<String> filterBaseBomComponentList = baseBomComponentMapper.selectBomCodeList(baseBomComponent);//查询BomCodeList
List<String> filterCumcList = baseBomComponentMapper.selectProductCodeList(baseBomComponent);//查询BomCodeList
//查询cumc 是否存在于product_code
for (BaseBomComponent tree : baseBomComponentList) {
//找出父节点
boolean bool1 = filterBaseBomComponentList.contains(tree.getBomCode());//查询父节点是否在bom表中
boolean bool2 = filterCumcList.contains(tree.getCumc());//查询节点是否是父节点
// if (bool1 && bool2) {
if (bool1) {
// 调用递归方法填充子节点列表
trees.add(findChildren(tree,baseBomComponentList));//找到孩子节点
}
}
return trees;
}
/**
*
* @param baseBomComponent
* @param baseBomComponentList List
* @return
*/
public BaseBomComponent findChildren(BaseBomComponent baseBomComponent, List<BaseBomComponent> baseBomComponentList) {
//父 Cumc 子Component
for (BaseBomComponent node : baseBomComponentList) {
if (baseBomComponent.getComponent().equals(node.getCumc())) {
if (baseBomComponent.getChildren() == null) {
baseBomComponent.setChildren(new ArrayList<>());
}
// 递归调用自身
baseBomComponent.getChildren().add(findChildren(node, baseBomComponentList));
}
}
return baseBomComponent;
}
}

@ -143,49 +143,4 @@ public class BaseBomServiceImpl implements IBaseBomService {
// return node;
// }
/**
*
* @param baseBomComponent
* @return
*/
@Override
@DS("#header.poolName")
public List<BaseBomComponent> selectBaseBomComponentList(BaseBomComponent baseBomComponent){
List<BaseBomComponent> trees = new ArrayList<>();//新创建
List<BaseBomComponent> baseBomComponentList = baseBomComponentMapper.selectBaseBomComponentList(baseBomComponent);//查询baseBomComponent
List<String> filterBaseBomComponentList = baseBomComponentMapper.selectBomCodeList(baseBomComponent);//查询BomCodeList
List<String> filterCumcList = baseBomComponentMapper.selectProductCodeList(baseBomComponent);//查询BomCodeList
//查询cumc 是否存在于product_code
for (BaseBomComponent tree : baseBomComponentList) {
//找出父节点
boolean bool1 = filterBaseBomComponentList.contains(tree.getBomCode());//查询父节点是否在bom表中
boolean bool2 = filterCumcList.contains(tree.getCumc());//查询节点是否是父节点
if (bool1 && bool2) {
// 调用递归方法填充子节点列表
trees.add(findChildren(tree,baseBomComponentList));//找到孩子节点
}
}
return trees;
}
/**
*
* @param baseBomComponent
* @param baseBomComponentList List
* @return
*/
public BaseBomComponent findChildren(BaseBomComponent baseBomComponent, List<BaseBomComponent> baseBomComponentList) {
//父 Cumc 子Component
for (BaseBomComponent node : baseBomComponentList) {
if (baseBomComponent.getComponent().equals(node.getCumc())) {
if (baseBomComponent.getChildren() == null) {
baseBomComponent.setChildren(new ArrayList<>());
}
// 递归调用自身
baseBomComponent.getChildren().add(findChildren(node, baseBomComponentList));
}
}
return baseBomComponent;
}
}

@ -14,12 +14,12 @@ spring:
nacos:
discovery:
namespace: lanju-op
group: zxl
group: jgy
# 服务注册地址
server-addr: 140.249.53.142:8848
config:
namespace: lanju-op
group: zxl
group: jgy
#命名空间
#group: local
# 配置中心地址

@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
</where>
</select>
<select id="selectBaseBomComponentById" parameterType="Long" resultMap="BaseBomComponentResult">
<include refid="selectBaseBomComponentVo"/>
where handle = #{handle}

Loading…
Cancel
Save