change - 判断可下计划生产BOM

master
yinq 11 months ago
parent 36cbbad249
commit 463dd3ae85

@ -56,7 +56,7 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
@Override @Override
public List<BaseBomInfo> selectBaseBomInfoList(BaseBomInfo baseBomInfo) { public List<BaseBomInfo> selectBaseBomInfoList(BaseBomInfo baseBomInfo) {
List<BaseBomInfo> baseBomInfos = new ArrayList<>(); List<BaseBomInfo> baseBomInfos = new ArrayList<>();
//测试查看全部BOM关系 //测试查看全部BOM关系 baseBomInfo.getAncestors()为成品
if (StringUtils.isNotEmpty(baseBomInfo.getAncestors()) && baseBomInfo.getAncestors().equals("0")) { if (StringUtils.isNotEmpty(baseBomInfo.getAncestors()) && baseBomInfo.getAncestors().equals("0")) {
baseBomInfos = baseBomInfoMapper.selectBaseBomInfoList(new BaseBomInfo()); baseBomInfos = baseBomInfoMapper.selectBaseBomInfoList(new BaseBomInfo());
return baseBomInfos; return baseBomInfos;
@ -64,8 +64,14 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
//筛选子集BOM //筛选子集BOM
if (StringUtils.isNotEmpty(baseBomInfo.getAncestors())) { if (StringUtils.isNotEmpty(baseBomInfo.getAncestors())) {
baseBomInfos = baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo); BaseBomInfo bomInfo = new BaseBomInfo();
return baseBomInfos; 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 //筛选成品BOM
@ -77,6 +83,24 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
return cpBomInfos; 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 * BOM
* *
@ -263,16 +287,19 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
OrderBomInfo selectBomInfo = new OrderBomInfo(); OrderBomInfo selectBomInfo = new OrderBomInfo();
selectBomInfo.setParentId(boxBomInfo.getMaterialCode()); selectBomInfo.setParentId(boxBomInfo.getMaterialCode());
List<OrderBomInfo> bomInfoList = orderBomInfoService.selectOrderBomInfoList(selectBomInfo); List<OrderBomInfo> bomInfoList = orderBomInfoService.selectOrderBomInfoList(selectBomInfo);
/* Boolean isYZXTFlag = false; // 判断BOM是否含有预装箱体 boolean isYZXTFlag = false; // 判断BOM是否含有预装箱体
for (OrderBomInfo orderBomInfo : bomInfoList) { for (OrderBomInfo orderBomInfo : bomInfoList) {
if (orderBomInfo.getMaterialName().contains("预装箱体")){ if (orderBomInfo.getMaterialName().contains("预装箱体")) {
isYZXTFlag = true;//此BOM有预装箱体 isYZXTFlag = true;//此BOM有预装箱体
//围板 //预装箱体围板
if (orderBomInfo.getMaterialType().equals(MaterialConstants.COAMING_MATERIAL_TYPE)) { if (orderBomInfo.getMaterialType().equals(MaterialConstants.COAMING_MATERIAL_TYPE)) {
this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.COAMING_MATERIAL_TYPE); this.saveBaseBomInfoByMaterialType(orderBomInfo, MaterialConstants.COAMING_MATERIAL_TYPE);
} }
} }
}*/ }
//没有预装箱体执行以下操作
if (!isYZXTFlag) {
for (OrderBomInfo orderBomInfo : bomInfoList) { for (OrderBomInfo orderBomInfo : bomInfoList) {
orderBomInfo.setAncestors(boxBomInfo.getAncestors()); orderBomInfo.setAncestors(boxBomInfo.getAncestors());
//内胆 //内胆
@ -286,6 +313,8 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
} }
} }
}
//获取围板产品BOM信息 //获取围板产品BOM信息
BaseBomInfo selectWBomInfo = new BaseBomInfo(); BaseBomInfo selectWBomInfo = new BaseBomInfo();
selectWBomInfo.setMaterialType(MaterialConstants.COAMING_MATERIAL_TYPE); selectWBomInfo.setMaterialType(MaterialConstants.COAMING_MATERIAL_TYPE);
@ -294,6 +323,19 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
OrderBomInfo selectBomInfo = new OrderBomInfo(); OrderBomInfo selectBomInfo = new OrderBomInfo();
selectBomInfo.setParentId(boxBomInfo.getMaterialCode()); selectBomInfo.setParentId(boxBomInfo.getMaterialCode());
List<OrderBomInfo> bomInfoList = orderBomInfoService.selectOrderBomInfoList(selectBomInfo); List<OrderBomInfo> bomInfoList = orderBomInfoService.selectOrderBomInfoList(selectBomInfo);
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);
}
}
} else {
for (OrderBomInfo orderBomInfo : bomInfoList) { for (OrderBomInfo orderBomInfo : bomInfoList) {
orderBomInfo.setAncestors(boxBomInfo.getAncestors()); orderBomInfo.setAncestors(boxBomInfo.getAncestors());
//前板 //前板
@ -306,6 +348,7 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
} }
} }
} }
}
return null; return null;
} }

Loading…
Cancel
Save