1020分工厂
This commit is contained in:
parent
36d810252f
commit
b3b9a85b5f
|
|
@ -699,7 +699,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
||||||
List<String> noProductionFactoryCodeList = allChild.stream().filter(u -> StrUtil.isBlank(u.getProductionFactoryCode())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
List<String> noProductionFactoryCodeList = allChild.stream().filter(u -> StrUtil.isBlank(u.getProductionFactoryCode())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||||
VUtils.isTure(CollUtil.isNotEmpty(noProductionFactoryCodeList)).throwMessage(StrUtil.join(",", noProductionFactoryCodeList) + "物料暂未分工厂,请分完工厂再进行发布");
|
VUtils.isTure(CollUtil.isNotEmpty(noProductionFactoryCodeList)).throwMessage(StrUtil.join(",", noProductionFactoryCodeList) + "物料暂未分工厂,请分完工厂再进行发布");
|
||||||
ConvertToMBom convertToMBom = new ConvertToMBom(rootParent, allChild);
|
ConvertToMBom convertToMBom = new ConvertToMBom(rootParent, allChild);
|
||||||
convertToMBom.convertToMBom();
|
convertToMBom.convertToMBom(true,true);
|
||||||
if (CollUtil.isNotEmpty(convertToMBom.getMBomParentResult())) {
|
if (CollUtil.isNotEmpty(convertToMBom.getMBomParentResult())) {
|
||||||
mBomParentService.saveOrUpdateBatch(convertToMBom.getMBomParentResult());
|
mBomParentService.saveOrUpdateBatch(convertToMBom.getMBomParentResult());
|
||||||
}
|
}
|
||||||
|
|
@ -720,6 +720,39 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MBOM退回后,重新发布调用
|
||||||
|
* @param bomRowId
|
||||||
|
* @return
|
||||||
|
* @throws ExecutionException
|
||||||
|
* @throws InterruptedException
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean convertToMBomFor1020(Long bomRowId) throws ExecutionException, InterruptedException {
|
||||||
|
|
||||||
|
BomNewPbomParentEntity rootParent = this.getById(bomRowId);
|
||||||
|
List<BomNewPbomParentVO> allChild = getAllBom(bomRowId, 0);
|
||||||
|
|
||||||
|
if (StrUtil.isBlank(rootParent.getOrderNo())) {
|
||||||
|
String orderNo = crmService.getOrderNo(rootParent.getMaterialNo());
|
||||||
|
rootParent.setOrderNo(orderNo);
|
||||||
|
}
|
||||||
|
VUtils.isTure(StrUtil.isBlank(rootParent.getOrderNo())).throwMessage("没有获取到订单号");
|
||||||
|
|
||||||
|
List<String> noProductionFactoryCodeList = allChild.stream().filter(u -> StrUtil.isBlank(u.getProductionFactoryCode())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||||
|
VUtils.isTure(CollUtil.isNotEmpty(noProductionFactoryCodeList)).throwMessage(StrUtil.join(",", noProductionFactoryCodeList) + "物料暂未分工厂,请分完工厂再进行发布");
|
||||||
|
ConvertToMBom convertToMBom = new ConvertToMBom(rootParent, allChild);
|
||||||
|
convertToMBom.convertToMBom(false,true);
|
||||||
|
if (CollUtil.isNotEmpty(convertToMBom.getMBomParentResult())) {
|
||||||
|
mBomParentService.saveOrUpdateBatch(convertToMBom.getMBomParentResult());
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(convertToMBom.getMBomDetailResult())) {
|
||||||
|
mBomDetailService.saveOrUpdateBatch(convertToMBom.getMBomDetailResult());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布Pbom
|
* 发布Pbom
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,17 @@ import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.alibaba.excel.enums.BooleanEnum;
|
import com.alibaba.excel.enums.BooleanEnum;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
import com.nflg.product.bomnew.constant.EBomConstant;
|
import com.nflg.product.bomnew.constant.EBomConstant;
|
||||||
|
import com.nflg.product.bomnew.constant.MBomConstantEnum;
|
||||||
import com.nflg.product.bomnew.constant.ProductionFactoryCodeInputTypeEnum;
|
import com.nflg.product.bomnew.constant.ProductionFactoryCodeInputTypeEnum;
|
||||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewMbomDetailEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewMbomDetailEntity;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewMbomParentEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewMbomParentEntity;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||||
|
import com.nflg.product.bomnew.service.BomNewMbomDetailService;
|
||||||
import com.nflg.product.bomnew.service.BomNewMbomParentService;
|
import com.nflg.product.bomnew.service.BomNewMbomParentService;
|
||||||
import com.nflg.product.bomnew.service.BomNewPbomParentService;
|
import com.nflg.product.bomnew.service.BomNewPbomParentService;
|
||||||
import com.nflg.product.bomnew.util.CTreePBomUtils;
|
import com.nflg.product.bomnew.util.CTreePBomUtils;
|
||||||
|
|
@ -68,12 +71,16 @@ public class ConvertToMBom {
|
||||||
/**
|
/**
|
||||||
* 转换MBom
|
* 转换MBom
|
||||||
*/
|
*/
|
||||||
public void convertToMBom() {
|
public void convertToMBom(Boolean convert1010 ,Boolean convert1020) {
|
||||||
//handler1010();
|
//handler1010();
|
||||||
handler1020();
|
if(convert1020) {
|
||||||
|
handler1020();
|
||||||
|
buildMBom(EBomConstant.XIAN_TAO_FACTORY_CODE_1020);
|
||||||
|
}
|
||||||
|
if(convert1010) {
|
||||||
|
buildMBom(EBomConstant.MAIN_FACTORY_CODE_1010);
|
||||||
|
}
|
||||||
|
|
||||||
buildMBom(EBomConstant.MAIN_FACTORY_CODE_1010);
|
|
||||||
buildMBom(EBomConstant.XIAN_TAO_FACTORY_CODE_1020);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -87,9 +94,17 @@ public class ConvertToMBom {
|
||||||
BomNewMbomParentEntity oldParent = SpringUtil.getBean(BomNewMbomParentService.class).lambdaQuery().eq(BomNewMbomParentEntity::getMaterialNo, parent.getMaterialNo())
|
BomNewMbomParentEntity oldParent = SpringUtil.getBean(BomNewMbomParentService.class).lambdaQuery().eq(BomNewMbomParentEntity::getMaterialNo, parent.getMaterialNo())
|
||||||
.eq(BomNewMbomParentEntity::getLastVersionIs, 1).eq(BomNewMbomParentEntity::getFacCode, facCode).one();
|
.eq(BomNewMbomParentEntity::getLastVersionIs, 1).eq(BomNewMbomParentEntity::getFacCode, facCode).one();
|
||||||
if (Objects.nonNull(oldParent)) {
|
if (Objects.nonNull(oldParent)) {
|
||||||
mBomParent.setCurrentVersion(VersionUtil.getNextVersion(oldParent.getCurrentVersion()));
|
if(MBomConstantEnum.MBomStatusEnum.PUB_SAP.equalsValue(oldParent.getStatus()) ) {
|
||||||
oldParent.setLastVersionIs(0);
|
|
||||||
this.mBomParentResult.add(oldParent);
|
mBomParent.setCurrentVersion(VersionUtil.getNextVersion(oldParent.getCurrentVersion()));
|
||||||
|
oldParent.setLastVersionIs(0);
|
||||||
|
this.mBomParentResult.add(oldParent);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SpringUtil.getBean(BomNewMbomDetailService.class).getBaseMapper().deleteByMap(ImmutableMap.of("bom_row_id", oldParent.getRowId()));
|
||||||
|
SpringUtil.getBean(BomNewMbomParentService.class).getBaseMapper().deleteById(oldParent.getRowId());
|
||||||
|
mBomParent.setCurrentVersion(oldParent.getCurrentVersion());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mBomParent.setCurrentVersion(VersionUtil.getNextVersion(""));
|
mBomParent.setCurrentVersion(VersionUtil.getNextVersion(""));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue