BUG修复
This commit is contained in:
parent
67824540e3
commit
36d810252f
|
|
@ -197,7 +197,7 @@ public class PBomApi extends BaseApi {
|
|||
public ResultVO<Boolean> convertToMBom(@RequestParam("bomRowId") Long bomRowId) throws ExecutionException, InterruptedException {
|
||||
BomNewPbomParentEntity parent = bomNewPbomParentService.getById(bomRowId);
|
||||
VUtils.isTure(!parent.getMaterialNo().startsWith("31")).throwMessage("只有31开头的物料才可以发布");
|
||||
VUtils.isTure(parent.getStatus()> PBomStatusEnum.PUBLISH.getValue()).throwMessage("只有已发布的BOM才能生成MBom");
|
||||
VUtils.isTure(parent.getStatus()< PBomStatusEnum.PUBLISH.getValue()).throwMessage("只有已发布的BOM才能生成MBom");
|
||||
//
|
||||
VUtils.isTure(!parent.getFacCode().equals(EBomConstant.MAIN_FACTORY_CODE_1010)).throwMessage("只有1010工厂BOM才能进行分工厂");
|
||||
return ResultVO.success(bomNewPbomParentService.convertToMBom(bomRowId));
|
||||
|
|
|
|||
|
|
@ -681,31 +681,33 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getRowId, paramDTO.getBomRowIds()).list();
|
||||
List<String> notConvertToPbom = list.stream().filter(u -> u.getStatus() < EBomStatusEnum.PUBLISHED.getValue()).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(notConvertToPbom)).throwMessage(StrUtil.join(",", notConvertToPbom) + "未转PBom,不能发起变更");
|
||||
|
||||
List<BomNewEbomParentEntity> parentResult = new ArrayList<>();
|
||||
List<BomNewEbomChildEntity> childResult = new ArrayList<>();
|
||||
for (Long bomRowId : paramDTO.getBomRowIds()) {
|
||||
BomNewEbomParentEntity parent = this.getById(bomRowId);
|
||||
List<BomNewEbomChildEntity> child = ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, bomRowId).list();
|
||||
|
||||
BomNewEbomParentEntity newParent = new BomNewEbomParentEntity();
|
||||
BeanUtil.copyProperties(parent, newParent);
|
||||
newParent.setRowId(IdWorker.getId());
|
||||
newParent.setLastVersionIs(1);
|
||||
newParent.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(parent.getCurrentVersion()));
|
||||
newParent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_11.getValue());
|
||||
newParent.setChangeDesc(paramDTO.getChangeDesc());
|
||||
newParent.setNoticeNums(paramDTO.getNoticeNums());
|
||||
parent.setLastVersionIs(0);
|
||||
parentResult.add(newParent);
|
||||
parentResult.add(parent);
|
||||
|
||||
|
||||
for (BomNewEbomChildEntity childEnt : child) {
|
||||
BomNewEbomChildEntity newChild = new BomNewEbomChildEntity();
|
||||
BeanUtil.copyProperties(childEnt, newChild);
|
||||
newChild.setRowId(IdWorker.getId());
|
||||
newChild.setParentRowId(newParent.getRowId());
|
||||
childResult.add(newChild);
|
||||
List<BomNewEbomParentEntity> existEnt = this.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parent.getMaterialNo()).lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
|
||||
//含发布前版本则无需升级
|
||||
if(CollUtil.isEmpty(existEnt)) {
|
||||
List<BomNewEbomChildEntity> child = ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, bomRowId).list();
|
||||
BomNewEbomParentEntity newParent = new BomNewEbomParentEntity();
|
||||
BeanUtil.copyProperties(parent, newParent);
|
||||
newParent.setRowId(IdWorker.getId());
|
||||
newParent.setLastVersionIs(1);
|
||||
newParent.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(parent.getCurrentVersion()));
|
||||
newParent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_11.getValue());
|
||||
newParent.setChangeDesc(paramDTO.getChangeDesc());
|
||||
newParent.setNoticeNums(paramDTO.getNoticeNums());
|
||||
parent.setLastVersionIs(0);
|
||||
parentResult.add(newParent);
|
||||
parentResult.add(parent);
|
||||
for (BomNewEbomChildEntity childEnt : child) {
|
||||
BomNewEbomChildEntity newChild = new BomNewEbomChildEntity();
|
||||
BeanUtil.copyProperties(childEnt, newChild);
|
||||
newChild.setRowId(IdWorker.getId());
|
||||
newChild.setParentRowId(newParent.getRowId());
|
||||
childResult.add(newChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.enums.BooleanEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
|
@ -556,16 +557,16 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
VUtils.isTure(StrUtil.isBlank(params.getRuleGroupCode())).throwMessage("规则编码不能为空");
|
||||
|
||||
List<BomNewPbomParentVO> childrenVO = getAllBom(params.getBomRowId(), 0);
|
||||
List<BomNewPbomParentVO> childrenVO = getAllBom(params.getBomRowId(), 0,true);
|
||||
materialMainService.intiMaterialInfo(childrenVO, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
List<BomFactorySplitRuleEntity> relList = bomFactorySplitRuleService.lambdaQuery().eq(BomFactorySplitRuleEntity::getRuleGroupCode, params.getRuleGroupCode()).list();
|
||||
StringBuilder relPattern = new StringBuilder();
|
||||
List<BomNewPbomChildEntity> result = new ArrayList<>();
|
||||
|
||||
for (BomNewPbomParentVO child : childrenVO) {
|
||||
if (StrUtil.isNotBlank(child.getProductionFactoryCode()) && ProductionFactoryCodeInputTypeEnum.MANUAL.equalsValue(child.getProductionFactoryCodeInputType())) {
|
||||
continue;
|
||||
}
|
||||
// if (StrUtil.isNotBlank(child.getProductionFactoryCode()) && ProductionFactoryCodeInputTypeEnum.MANUAL.equalsValue(child.getProductionFactoryCodeInputType())) {
|
||||
// continue;
|
||||
// }
|
||||
for (BomFactorySplitRuleEntity role : relList) {
|
||||
Boolean match = true;
|
||||
if (StrUtil.isNotBlank(role.getMaterialCategoryCode())) {
|
||||
|
|
@ -655,8 +656,9 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
}
|
||||
|
||||
private void setSubNodeFac(BomNewPbomParentVO parentVO, List<BomNewPbomParentVO> child , String facCode){
|
||||
String zero ="1"+ StrUtil.padAfter("0", parentVO.getLevelNum().toString().split(".")[1].length(), "0");
|
||||
BigDecimal bNodeLevel = NumberUtil.add(parentVO.getLevelNumber(), new BigDecimal(1).divide(NumberUtil.div ( new BigDecimal(1) , new BigDecimal(zero))) );
|
||||
String[] numSplit = parentVO.getLevelNumber().toString().split(".");
|
||||
String zero ="1"+ StrUtil.padAfter("0", (numSplit.length>1? numSplit[1].length():0), "0");
|
||||
BigDecimal bNodeLevel = NumberUtil.add(parentVO.getLevelNumber(),(NumberUtil.div ( new BigDecimal(1) , new BigDecimal(zero))) );
|
||||
List<BomNewPbomParentVO> subNodes = child.stream().filter(u -> u.getLevelNumber().compareTo(parentVO.getLevelNumber()) > 0 && u.getLevelNumber().compareTo(bNodeLevel) < 0).collect(Collectors.toList());
|
||||
for (BomNewPbomParentVO node : subNodes) {
|
||||
node.setProductionFactoryCode(facCode);
|
||||
|
|
|
|||
Loading…
Reference in New Issue