|
|
|
|
@ -132,7 +132,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
data.addAll(childs);
|
|
|
|
|
materialMainService.intiMaterialInfo(data, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
|
|
|
|
for (BomNewEbomParentVO vi : childs) {
|
|
|
|
|
if (StrUtil.isBlank(vi.getCurrentVersion()) && MaterialshouldBomExistUtil.checkShouldBomExist(vi)) {
|
|
|
|
|
if (StrUtil.isBlank(vi.getCurrentVersion()) && MaterialshouldBomExistUtil.checkShouldBomExist(vi)) {
|
|
|
|
|
vi.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -429,7 +429,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
for (Long bomRowId : bomRowIds) {
|
|
|
|
|
List<BomNewEbomParentVO> data = getBomTree(bomRowId);
|
|
|
|
|
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, this.getById(bomRowId));
|
|
|
|
|
LogRecordContext.putVariable("bom",parent);
|
|
|
|
|
LogRecordContext.putVariable("bom", parent);
|
|
|
|
|
//初始化物料信息
|
|
|
|
|
materialMainService.intiMaterialInfo(data);
|
|
|
|
|
productTypeInitDo(parent, data);
|
|
|
|
|
@ -613,7 +613,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
List<BomNewEbomParentVO> list = getChild(root.getRowId());
|
|
|
|
|
List<BomNewEbomParentVO> makeList = list.stream().filter(u -> VirtualPackageTypeEnum.MAKING_PACKAGE.equalsValue(u.getVirtualPartType())).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(makeList)) {
|
|
|
|
|
Integer virtualPartTypeEnum = VirtualPackageTypeEnum.MAKING_PACKAGE.getValue() | VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue();
|
|
|
|
|
Integer virtualPartTypeEnum = VirtualPackageTypeEnum.MAKING_PACKAGE.getValue() | VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue();
|
|
|
|
|
List<BomNewEbomChildEntity> preList = ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, makeList.get(0).getBomRowId())
|
|
|
|
|
.eq(BomNewEbomChildEntity::getVirtualPartType, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()).list();
|
|
|
|
|
if (CollUtil.isNotEmpty(preList)) {
|
|
|
|
|
@ -636,14 +636,14 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
* @param paramDto
|
|
|
|
|
*/
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void generateVirtualPackage(VirtualPackageParamDto paramDto) {
|
|
|
|
|
public void generateVirtualPackage(VirtualPackageParamDto paramDto) {
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BomNewEbomParentEntity root = this.getById(paramDto.getBomRowId());
|
|
|
|
|
LogRecordContext.putVariable("bom",root);
|
|
|
|
|
LogRecordContext.putVariable("bom", root);
|
|
|
|
|
//初始化虚拟包-判断枚举(不是手工生成虚拟包的情况)
|
|
|
|
|
checkAndInitVirtualPackageEnum(paramDto,root);
|
|
|
|
|
checkAndInitVirtualPackageEnum(paramDto, root);
|
|
|
|
|
Boolean flag = true;
|
|
|
|
|
for (Integer f : paramDto.getVirtualPackageValue()) {
|
|
|
|
|
flag = flag & ((root.getVirtrualPackageEnum() & f) == f);
|
|
|
|
|
@ -704,6 +704,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
if (CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())) {
|
|
|
|
|
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
|
|
|
|
|
}
|
|
|
|
|
//标记跟节点
|
|
|
|
|
upRootMark(parent);
|
|
|
|
|
if (CollUtil.isNotEmpty(eBomToPBom.getVirtualPackageCompositionResult())) {
|
|
|
|
|
//先删除
|
|
|
|
|
Set<String> delSet = eBomToPBom.getVirtualPackageCompositionResult().stream().map(u -> StrUtil.join("-", u.getVirtualPackageMaterialNo(), u.getParentMaterialNo())).collect(Collectors.toSet());
|
|
|
|
|
@ -738,14 +740,14 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), bomRowIds);
|
|
|
|
|
}
|
|
|
|
|
//子级记录-bom版本
|
|
|
|
|
List<BomNewEbomChildEntity> bomChildren=new ArrayList<>();
|
|
|
|
|
bomTree.forEach(k->{
|
|
|
|
|
BomNewEbomChildEntity entChild=new BomNewEbomChildEntity();
|
|
|
|
|
List<BomNewEbomChildEntity> bomChildren = new ArrayList<>();
|
|
|
|
|
bomTree.forEach(k -> {
|
|
|
|
|
BomNewEbomChildEntity entChild = new BomNewEbomChildEntity();
|
|
|
|
|
entChild.setRowId(k.getRowId());
|
|
|
|
|
entChild.setBomVersionRowId(k.getBomRowId());
|
|
|
|
|
bomChildren.add(entChild);
|
|
|
|
|
});
|
|
|
|
|
if(CollUtil.isNotEmpty(bomChildren)) {
|
|
|
|
|
if (CollUtil.isNotEmpty(bomChildren)) {
|
|
|
|
|
ebomChildService.updateBatchById(bomChildren);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -754,6 +756,18 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void upRootMark(BomNewEbomParentVO parent){
|
|
|
|
|
Integer rootIs = this.getBaseMapper().checkIsRoot(parent.getMaterialNo());
|
|
|
|
|
Integer userRootIs=this.getBaseMapper().checkIsUserRoot(parent.getMaterialNo(),parent.getCreatedBy());
|
|
|
|
|
BomNewEbomParentEntity ebomParent=new BomNewEbomParentEntity();
|
|
|
|
|
ebomParent.setRowId(parent.getRowId());
|
|
|
|
|
ebomParent.setRootIs(rootIs>0?0:1);
|
|
|
|
|
ebomParent.setUserRootIs(userRootIs>0?0:1);
|
|
|
|
|
this.updateById(ebomParent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 发起变更
|
|
|
|
|
*
|
|
|
|
|
@ -764,36 +778,42 @@ 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<String> materialNos = list.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
|
|
|
|
List<BomNewEbomParentEntity> existEnt = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos).lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
|
|
|
|
|
Set<String> existMaterialNos = existEnt.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
|
|
|
|
|
VUtils.isTure(CollUtil.isNotEmpty(existMaterialNos)).throwMessage(StrUtil.join(",", existMaterialNos, "存在发布前版本。"));
|
|
|
|
|
|
|
|
|
|
List<BomNewEbomParentEntity> parentResult = new ArrayList<>();
|
|
|
|
|
List<BomNewEbomChildEntity> childResult = new ArrayList<>();
|
|
|
|
|
for (Long bomRowId : paramDTO.getBomRowIds()) {
|
|
|
|
|
BomNewEbomParentEntity parent = this.getById(bomRowId);
|
|
|
|
|
LogRecordContext.putVariable("bom",parent);
|
|
|
|
|
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());
|
|
|
|
|
newParent.setStatus(EBomStatusEnum.WAIT_CHECK.getValue());
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
LogRecordContext.putVariable("bom", parent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
newParent.setStatus(EBomStatusEnum.WAIT_CHECK.getValue());
|
|
|
|
|
newParent.setRootIs(1);
|
|
|
|
|
newParent.setUserRootIs(1);
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(parentResult)) {
|
|
|
|
|
@ -1047,7 +1067,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
VUtils.isTure(true).throwMessage("下级BOM无法进行退回");
|
|
|
|
|
}
|
|
|
|
|
Set<String> materialNoAndVersion = bomNewEbomParentEntityList.stream().map(u -> StrUtil.join("-", u.getMaterialNo(), u.getCurrentVersion())).collect(Collectors.toSet());
|
|
|
|
|
LogRecordContext.putVariable("log",materialNoAndVersion);
|
|
|
|
|
LogRecordContext.putVariable("log", materialNoAndVersion);
|
|
|
|
|
|
|
|
|
|
if (rowIds.size() != bomNewEbomParentEntityList.size()) {
|
|
|
|
|
|
|
|
|
|
@ -1154,7 +1174,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
VUtils.isTure(true).throwMessage("下级BOM无法进行复核");
|
|
|
|
|
}
|
|
|
|
|
Set<String> materialNoAndVersion = bomNewEbomParentEntityList.stream().map(u -> StrUtil.join("-", u.getMaterialNo(), u.getCurrentVersion())).collect(Collectors.toSet());
|
|
|
|
|
LogRecordContext.putVariable("log",materialNoAndVersion);
|
|
|
|
|
LogRecordContext.putVariable("log", materialNoAndVersion);
|
|
|
|
|
|
|
|
|
|
if (rowIds.size() != bomNewEbomParentEntityList.size()) {
|
|
|
|
|
VUtils.isTure(true).throwMessage("数据中包含有下级BOM无法进行复核");
|
|
|
|
|
@ -1274,7 +1294,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parentVO.setBomRowId(parentVO.getRowId());
|
|
|
|
|
parentVO.setParentRowId(0l);
|
|
|
|
|
parentVO.setProjectType(projectType);
|
|
|
|
|
@ -1282,8 +1301,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
materialMainService.intiMaterialInfo(ImmutableList.of(parentVO), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// materialMainService.intiMaterialInfo(ImmutableList.of(parentVO));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1405,7 +1422,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
public Boolean deleteBom(Long bomRowId) throws ExecutionException, InterruptedException {
|
|
|
|
|
|
|
|
|
|
BomNewEbomParentEntity parentEntity = this.getBaseMapper().selectById(bomRowId);
|
|
|
|
|
LogRecordContext.putVariable("bom",parentEntity);
|
|
|
|
|
LogRecordContext.putVariable("bom", parentEntity);
|
|
|
|
|
|
|
|
|
|
VUtils.isTure(Objects.isNull(parentEntity)).throwMessage("该节点不存在,请检查参数是否正确");
|
|
|
|
|
|
|
|
|
|
@ -1441,28 +1458,29 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 2. 只有含有BOM的物料才可以打“超级物料的”标签,如果不存在下级BOM时,不可以打标。
|
|
|
|
|
* 3. 需求:编辑页面需要添加一个是否为超级物料的选项,属于一个打标签的功能
|
|
|
|
|
* 2. 只有含有BOM的物料才可以打“超级物料的”标签,如果不存在下级BOM时,不可以打标。
|
|
|
|
|
* 3. 需求:编辑页面需要添加一个是否为超级物料的选项,属于一个打标签的功能
|
|
|
|
|
*
|
|
|
|
|
* @param datas
|
|
|
|
|
*/
|
|
|
|
|
private void superMaterialStatus( List<BomNewEbomParentVO> datas){
|
|
|
|
|
private void superMaterialStatus(List<BomNewEbomParentVO> datas) {
|
|
|
|
|
|
|
|
|
|
List<BomNewEbomParentVO> superTagList=datas.stream().filter(item-> item.getSuperMaterialStatus()!=null
|
|
|
|
|
// && item.getSuperMaterialStatus().equals(EBomSuperMaterialStatusEnum.SUPER_MATERIAL_1.getValue())
|
|
|
|
|
&& item.getBomRowId()!=null && item.getBomRowId().longValue()>0
|
|
|
|
|
List<BomNewEbomParentVO> superTagList = datas.stream().filter(item -> item.getSuperMaterialStatus() != null
|
|
|
|
|
// && item.getSuperMaterialStatus().equals(EBomSuperMaterialStatusEnum.SUPER_MATERIAL_1.getValue())
|
|
|
|
|
&& item.getBomRowId() != null && item.getBomRowId().longValue() > 0
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<BomNewEbomParentEntity> updateList=new ArrayList<>();
|
|
|
|
|
for (BomNewEbomParentVO vo:superTagList){
|
|
|
|
|
BomNewEbomParentEntity entity=new BomNewEbomParentEntity();
|
|
|
|
|
List<BomNewEbomParentEntity> updateList = new ArrayList<>();
|
|
|
|
|
for (BomNewEbomParentVO vo : superTagList) {
|
|
|
|
|
BomNewEbomParentEntity entity = new BomNewEbomParentEntity();
|
|
|
|
|
entity.setRowId(vo.getBomRowId());
|
|
|
|
|
entity.setSuperMaterialStatus(vo.getSuperMaterialStatus());
|
|
|
|
|
updateList.add(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(updateList)){
|
|
|
|
|
this.updateBatchById(updateList);
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(updateList)) {
|
|
|
|
|
this.updateBatchById(updateList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -1748,11 +1766,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void createOrder(){
|
|
|
|
|
BomNewEbomParentEntity ent=new BomNewEbomParentEntity();
|
|
|
|
|
public void createOrder() {
|
|
|
|
|
BomNewEbomParentEntity ent = new BomNewEbomParentEntity();
|
|
|
|
|
ent.setDrawingNo("testDrawingNo");
|
|
|
|
|
ent.setCurrentVersion("V001");
|
|
|
|
|
LogRecordContext.putVariable("bom",ent);
|
|
|
|
|
LogRecordContext.putVariable("bom", ent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|