基础信息-BOM

highway
A0010407 2 years ago
parent c5f16b8e68
commit 1f7113fc99

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

@ -63,4 +63,6 @@ public interface BaseBomComponentMapper {
List<String> selectBomCodeList(BaseBomComponent baseBomComponent); List<String> selectBomCodeList(BaseBomComponent baseBomComponent);
//查询BaseBomComponent表中的product_code //查询BaseBomComponent表中的product_code
List<String> selectProductCodeList(BaseBomComponent baseBomComponent); 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);
//public List<BaseBom> selectBaseBomList(BaseBom baseBom, BaseBomComponent baseBomComponent, List<BaseBomComponent> list); //public List<BaseBom> selectBaseBomList(BaseBom baseBom, BaseBomComponent baseBomComponent, List<BaseBomComponent> list);
public List<BaseBomComponent> selectBaseBomComponentList(BaseBomComponent baseBomComponent); // public List<BaseBomComponent> selectBaseBomComponentList(BaseBomComponent baseBomComponent);
/** /**
* BOM * BOM

@ -1,6 +1,9 @@
package com.op.wms.service.impl; package com.op.wms.service.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -30,17 +33,6 @@ public class BaseBomComponentServiceImpl implements IBaseBomComponentService {
return baseBomComponentMapper.selectBaseBomComponentById(id); return baseBomComponentMapper.selectBaseBomComponentById(id);
} }
/**
* BOM
*
* @param baseBomComponent BOM
* @return BOM
*/
@Override
public List<BaseBomComponent> selectBaseBomComponentList(BaseBomComponent baseBomComponent) {
return baseBomComponentMapper.selectBaseBomComponentList(baseBomComponent);
}
/** /**
* BOM * BOM
* *
@ -86,4 +78,51 @@ public class BaseBomComponentServiceImpl implements IBaseBomComponentService {
public int deleteBaseBomComponentById(Long id) { public int deleteBaseBomComponentById(Long id) {
return baseBomComponentMapper.deleteBaseBomComponentById(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; // 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: nacos:
discovery: discovery:
namespace: lanju-op namespace: lanju-op
group: zxl group: jgy
# 服务注册地址 # 服务注册地址
server-addr: 140.249.53.142:8848 server-addr: 140.249.53.142:8848
config: config:
namespace: lanju-op namespace: lanju-op
group: zxl group: jgy
#命名空间 #命名空间
#group: local #group: local
# 配置中心地址 # 配置中心地址

Loading…
Cancel
Save