1、ebom-转pBOM
This commit is contained in:
parent
626fe44ce6
commit
a01778112d
|
|
@ -23,10 +23,7 @@ import com.nflg.product.base.core.exception.NflgBusinessException;
|
|||
import com.nflg.product.bomnew.constant.*;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewEbomParentMapper;
|
||||
import com.nflg.product.bomnew.pojo.dto.*;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomMaterialUseEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.*;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
|
|
@ -47,6 +44,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Struct;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
|
@ -836,6 +834,16 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
VUtils.isTure(parents.stream().anyMatch(u -> u.getMaterialNo().startsWith("31") && u.getVirtrualPackageEnum() <= 0))
|
||||
.throwMessage("31码须有虚拟包");
|
||||
//检查该版本是否已转换过该工厂的Pbom
|
||||
for (BomNewEbomParentEntity parent : parents){
|
||||
List<BomNewPbomParentEntity> list = pBomParentService.lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, parent.getMaterialNo()).eq(BomNewPbomParentEntity::getCurrentVersion, parent.getCurrentVersion())
|
||||
.select(BomNewPbomParentEntity::getFacCode).list();
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
Set<String> dbExistsFac = list.stream().map(u -> u.getFacCode()).collect(Collectors.toSet());
|
||||
Set<String> checkResultFac = Sets.intersection(dbExistsFac, new HashSet<>(paramDto.getFacCodes()));
|
||||
VUtils.isTure(CollUtil.isNotEmpty(checkResultFac)).throwMessage("物料:"+parent.getMaterialNo()+"已经转换过"+ StrUtil.join(",", checkResultFac)+"工厂");
|
||||
}
|
||||
}
|
||||
|
||||
for (Long bomRowId : paramDto.getBomRowIds()) {
|
||||
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, this.getById(bomRowId));
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public class EBomToPBom {
|
|||
//buildPBomParent(parent, facCode);
|
||||
for (BomNewEbomParentVO vo : parentList) {
|
||||
String hasConvertKey=StrUtil.join("-",facCode,vo.getBomRowId());
|
||||
if(hasConvert.contains(hasConvertKey)){
|
||||
if(hasConvert.contains(hasConvertKey) || PBomStatusEnum.PUBLISH.equalsValue(vo.getStatus()) ){
|
||||
continue;
|
||||
}
|
||||
hasConvert.add(hasConvertKey);
|
||||
|
|
@ -164,6 +164,7 @@ public class EBomToPBom {
|
|||
} else {
|
||||
BomNewPbomParentEntity pBomParent = new BomNewPbomParentEntity();
|
||||
BeanUtil.copyProperties(parentVo, pBomParent);
|
||||
pBomParent.setSourceRowId(parentVo.getBomRowId());
|
||||
pBomParent.setRowId(IdWorker.getId());
|
||||
pBomParent.setStatus(PBomStatusEnum.WAIT_PUBLISH.getValue());
|
||||
pBomParent.setLastVersionIs(1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue