|
|
|
@ -56,7 +56,7 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
|
|
|
|
|
@Override
|
|
|
|
|
public List<BaseBomInfo> selectBaseBomInfoList(BaseBomInfo baseBomInfo) {
|
|
|
|
|
List<BaseBomInfo> baseBomInfos = new ArrayList<>();
|
|
|
|
|
//测试查看全部BOM关系
|
|
|
|
|
//测试查看全部BOM关系 baseBomInfo.getAncestors()为成品
|
|
|
|
|
if (StringUtils.isNotEmpty(baseBomInfo.getAncestors()) && baseBomInfo.getAncestors().equals("0")) {
|
|
|
|
|
baseBomInfos = baseBomInfoMapper.selectBaseBomInfoList(new BaseBomInfo());
|
|
|
|
|
return baseBomInfos;
|
|
|
|
@ -64,8 +64,14 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
|
|
|
|
|
|
|
|
|
|
//筛选子集BOM
|
|
|
|
|
if (StringUtils.isNotEmpty(baseBomInfo.getAncestors())) {
|
|
|
|
|
baseBomInfos = baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo);
|
|
|
|
|
return baseBomInfos;
|
|
|
|
|
BaseBomInfo bomInfo = new BaseBomInfo();
|
|
|
|
|
bomInfo.setMaterialCode(baseBomInfo.getAncestors());
|
|
|
|
|
List<BaseBomInfo> bomInfos = baseBomInfoMapper.selectBaseBomInfoList(bomInfo);
|
|
|
|
|
List<BaseBomInfo> result = new ArrayList<>(bomInfos);
|
|
|
|
|
if (bomInfos.size() > 0){
|
|
|
|
|
getAllBomRecursion(bomInfos.get(0), result);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//筛选成品BOM
|
|
|
|
@ -77,6 +83,24 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
|
|
|
|
|
return cpBomInfos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 递归筛选子集BOM
|
|
|
|
|
* @param currentBom
|
|
|
|
|
* @param result
|
|
|
|
|
*/
|
|
|
|
|
private void getAllBomRecursion(BaseBomInfo currentBom, List<BaseBomInfo> result) {
|
|
|
|
|
BaseBomInfo baseBomInfo = new BaseBomInfo();
|
|
|
|
|
baseBomInfo.setParentId(currentBom.getMaterialCode());
|
|
|
|
|
List<BaseBomInfo> baseBomInfos = baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo);
|
|
|
|
|
if (baseBomInfos.size() > 0){
|
|
|
|
|
result.addAll(baseBomInfos);
|
|
|
|
|
for (BaseBomInfo bomInfo : baseBomInfos) {
|
|
|
|
|
getAllBomRecursion(bomInfo, result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断生产BOM是否可下计划到工位
|
|
|
|
|
*
|
|
|
|
@ -263,27 +287,32 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
|
|
|
|
|
OrderBomInfo selectBomInfo = new OrderBomInfo();
|
|
|
|
|
selectBomInfo.setParentId(boxBomInfo.getMaterialCode());
|
|
|
|
|
List<OrderBomInfo> bomInfoList = orderBomInfoService.selectOrderBomInfoList(selectBomInfo);
|
|
|
|
|
/* Boolean isYZXTFlag = false; // 判断BOM是否含有预装箱体
|
|
|
|
|
boolean isYZXTFlag = false; // 判断BOM是否含有预装箱体
|
|
|
|
|
for (OrderBomInfo orderBomInfo : bomInfoList) {
|
|
|
|
|
if (orderBomInfo.getMaterialName().contains("预装箱体")){
|
|
|
|
|
if (orderBomInfo.getMaterialName().contains("预装箱体")) {
|
|
|
|
|
isYZXTFlag = true;//此BOM有预装箱体
|
|
|
|
|
//围板
|
|
|
|
|
//预装箱体围板
|
|
|
|
|
if (orderBomInfo.getMaterialType().equals(MaterialConstants.COAMING_MATERIAL_TYPE)) {
|
|
|
|
|
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.COAMING_MATERIAL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
for (OrderBomInfo orderBomInfo : bomInfoList) {
|
|
|
|
|
orderBomInfo.setAncestors(boxBomInfo.getAncestors());
|
|
|
|
|
//内胆
|
|
|
|
|
if (orderBomInfo.getMaterialType().equals(MaterialConstants.LINER_MATERIAL_TYPE)) {
|
|
|
|
|
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.LINER_MATERIAL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
//围板
|
|
|
|
|
if (orderBomInfo.getMaterialType().equals(MaterialConstants.COAMING_MATERIAL_TYPE)) {
|
|
|
|
|
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.COAMING_MATERIAL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//没有预装箱体执行以下操作
|
|
|
|
|
if (!isYZXTFlag) {
|
|
|
|
|
for (OrderBomInfo orderBomInfo : bomInfoList) {
|
|
|
|
|
orderBomInfo.setAncestors(boxBomInfo.getAncestors());
|
|
|
|
|
//内胆
|
|
|
|
|
if (orderBomInfo.getMaterialType().equals(MaterialConstants.LINER_MATERIAL_TYPE)) {
|
|
|
|
|
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.LINER_MATERIAL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
//围板
|
|
|
|
|
if (orderBomInfo.getMaterialType().equals(MaterialConstants.COAMING_MATERIAL_TYPE)) {
|
|
|
|
|
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.COAMING_MATERIAL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取围板产品BOM信息
|
|
|
|
@ -294,15 +323,29 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
|
|
|
|
|
OrderBomInfo selectBomInfo = new OrderBomInfo();
|
|
|
|
|
selectBomInfo.setParentId(boxBomInfo.getMaterialCode());
|
|
|
|
|
List<OrderBomInfo> bomInfoList = orderBomInfoService.selectOrderBomInfoList(selectBomInfo);
|
|
|
|
|
for (OrderBomInfo orderBomInfo : bomInfoList) {
|
|
|
|
|
orderBomInfo.setAncestors(boxBomInfo.getAncestors());
|
|
|
|
|
//前板
|
|
|
|
|
if (orderBomInfo.getMaterialType().equals(MaterialConstants.FORMER_MATERIAL_TYPE)) {
|
|
|
|
|
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.FORMER_MATERIAL_TYPE);
|
|
|
|
|
if (boxBomInfo.getMaterialName().contains("预装箱体")) {
|
|
|
|
|
for (OrderBomInfo orderBomInfo : bomInfoList) {
|
|
|
|
|
orderBomInfo.setAncestors(boxBomInfo.getAncestors());
|
|
|
|
|
//围板
|
|
|
|
|
if (orderBomInfo.getMaterialType().equals(MaterialConstants.COAMING_MATERIAL_TYPE)) {
|
|
|
|
|
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.COAMING_MATERIAL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
//内胆
|
|
|
|
|
if (orderBomInfo.getMaterialType().equals(MaterialConstants.LINER_MATERIAL_TYPE)) {
|
|
|
|
|
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.LINER_MATERIAL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//后板
|
|
|
|
|
if (orderBomInfo.getMaterialType().equals(MaterialConstants.AFTER_MATERIAL_TYPE)) {
|
|
|
|
|
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.AFTER_MATERIAL_TYPE);
|
|
|
|
|
} else {
|
|
|
|
|
for (OrderBomInfo orderBomInfo : bomInfoList) {
|
|
|
|
|
orderBomInfo.setAncestors(boxBomInfo.getAncestors());
|
|
|
|
|
//前板
|
|
|
|
|
if (orderBomInfo.getMaterialType().equals(MaterialConstants.FORMER_MATERIAL_TYPE)) {
|
|
|
|
|
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.FORMER_MATERIAL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
//后板
|
|
|
|
|
if (orderBomInfo.getMaterialType().equals(MaterialConstants.AFTER_MATERIAL_TYPE)) {
|
|
|
|
|
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.AFTER_MATERIAL_TYPE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|