Merge remote-tracking branch 'origin/master-checkVirtualPackage-lhj0920' into test
This commit is contained in:
commit
071b3bee71
|
|
@ -175,10 +175,9 @@ public class EbomApi extends BaseApi {
|
|||
VUtils.isTure(CollUtil.isEmpty(paramDto.getBomRowIds())).throwMessage("请选择要转换的物料");
|
||||
VUtils.isTure(CollUtil.isEmpty(paramDto.getFacCodes())).throwMessage("请选择要转换的工厂");
|
||||
VUtils.isTure(Objects.isNull(paramDto.getConvertMode())).throwMessage("转换模式不能为空");
|
||||
bomNewEbomParentService.convertToPBom(paramDto);
|
||||
|
||||
//导入到sap
|
||||
List<OperationErrorMsgVO> errorMsgVOS = new ArrayList<>();
|
||||
errorMsgVOS.addAll(bomNewEbomParentService.convertToPBom(paramDto));
|
||||
paramDto.getBomRowIds().forEach(rootRowId -> {
|
||||
BomNewEbomExportToSAP exportToSAP = new BomNewEbomExportToSAP();
|
||||
errorMsgVOS.addAll(exportToSAP.export(rootRowId));
|
||||
|
|
@ -187,6 +186,7 @@ public class EbomApi extends BaseApi {
|
|||
return ResultVO.success(errorMsgVOS);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("convertToPBomForFormalEBom")
|
||||
@ApiOperation("EBom正式版转PBom")
|
||||
@LogRecord(success = "转PBom:物料编码:{{#CToPbom.materialNo}} 版本:{{#CToPbom.currentVersion}},操作结果:{{#_ret}}",
|
||||
|
|
@ -195,9 +195,9 @@ public class EbomApi extends BaseApi {
|
|||
VUtils.isTure(CollUtil.isEmpty(paramDto.getBomRowIds())).throwMessage("请选择要转换的物料");
|
||||
VUtils.isTure(CollUtil.isEmpty(paramDto.getFacCodes())).throwMessage("请选择要转换的工厂");
|
||||
VUtils.isTure(Objects.isNull(paramDto.getConvertMode())).throwMessage("转换模式不能为空");
|
||||
bomNewEbomParentService.convertToPBomForFormalEBom(paramDto);
|
||||
|
||||
return ResultVO.success(Collections.emptyList());
|
||||
|
||||
return ResultVO.success(bomNewEbomParentService.convertToPBomForFormalEBom(paramDto));
|
||||
}
|
||||
|
||||
@PostMapping("upgradeChanges")
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import com.nflg.product.bomnew.util.*;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -964,7 +965,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
* @param paramDto
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void convertToPBom(EBomToPBomParamDTO paramDto) throws ExecutionException, InterruptedException {
|
||||
public List<OperationErrorMsgVO> convertToPBom(EBomToPBomParamDTO paramDto) throws ExecutionException, InterruptedException {
|
||||
List<OperationErrorMsgVO> rList = Lists.newArrayList();
|
||||
//31 码 须有虚拟包
|
||||
List<BomNewEbomParentEntity> parents = this.getBaseMapper().selectBatchIds(paramDto.getBomRowIds());
|
||||
|
||||
|
|
@ -1004,12 +1006,27 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
.filter(c -> pbomParent.stream().map(BomNewPbomParentEntity::getRowId).collect(Collectors.toList()).contains(c.getParentRowId()))
|
||||
.collect(Collectors.toList());
|
||||
eBomToPBom.getPBomChildResult().removeAll(pbomChild);
|
||||
if(!pbomParent.isEmpty()){
|
||||
//3、删掉ebom 父级的数据
|
||||
List<Long> ebomParentIdList = pbomParent.stream().map(BomNewPbomParentEntity::getSourceRowId).collect(Collectors.toList());
|
||||
this.delBatch(ebomParentIdList);
|
||||
//4、删掉ebom 子级的数据
|
||||
ebomChildService.remove(Wrappers.<BomNewEbomChildEntity>lambdaQuery().in(BomNewEbomChildEntity::getParentRowId,ebomParentIdList));
|
||||
//仅删除PBOM 保留EBOM的数据
|
||||
// if(!pbomParent.isEmpty()){
|
||||
// //3、删掉ebom 父级的数据
|
||||
// List<Long> ebomParentIdList = pbomParent.stream().map(BomNewPbomParentEntity::getSourceRowId).collect(Collectors.toList());
|
||||
// this.delBatch(ebomParentIdList);
|
||||
// //4、删掉ebom 子级的数据
|
||||
// ebomChildService.remove(Wrappers.<BomNewEbomChildEntity>lambdaQuery().in(BomNewEbomChildEntity::getParentRowId,ebomParentIdList));
|
||||
// }
|
||||
//3、判断parent下是否有子级,如果没有的话,把parent给删除了 物料****因下级全部是F项,仅保存EBOM,未生成PBOM数据
|
||||
List<BomNewPbomParentEntity> emptyChildParentList = eBomToPBom.getPBomParentResult().stream()
|
||||
.filter(p -> !eBomToPBom.getPBomChildResult().stream().map(BomNewPbomChildEntity::getParentRowId).collect(Collectors.toList()).contains(p.getRowId()) )
|
||||
.collect(Collectors.toList());
|
||||
if(!emptyChildParentList.isEmpty()){
|
||||
rList = emptyChildParentList.stream().map(BomNewPbomParentEntity::getMaterialNo).distinct()
|
||||
.map(m -> {
|
||||
OperationErrorMsgVO oem = new OperationErrorMsgVO();
|
||||
oem.setPrimaryKey(m);
|
||||
oem.msg = String.format("物料%s因下级全部是F项,仅保存EBOM,未生成PBOM数据",m);
|
||||
return oem;
|
||||
}).collect(Collectors.toList());
|
||||
eBomToPBom.getPBomParentResult().removeAll(emptyChildParentList);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1092,6 +1109,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
// SpringUtil.getBean(BomNewEbomParentFormalService.class).copyEbomFormal(bomRowId);
|
||||
}
|
||||
return rList;
|
||||
}
|
||||
|
||||
public void delBatch(List<Long> rowIds){
|
||||
|
|
@ -1106,7 +1124,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
* @throws InterruptedException
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void convertToPBomForFormalEBom(EBomToPBomParamDTO paramDto) throws ExecutionException, InterruptedException {
|
||||
public List<OperationErrorMsgVO> convertToPBomForFormalEBom(EBomToPBomParamDTO paramDto) throws ExecutionException, InterruptedException {
|
||||
List<OperationErrorMsgVO> rList = Lists.newArrayList();
|
||||
//31 码 须有虚拟包
|
||||
List<BomNewEbomParentEntity> parents = this.getBaseMapper().selectBatchIds(paramDto.getBomRowIds());
|
||||
|
||||
|
|
@ -1149,6 +1168,34 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
u.setUserRootIs(1);
|
||||
});
|
||||
}
|
||||
//【电控系统】 发货包优化 删除 【直发】【制作】、下的物料 by 10002327 240914
|
||||
if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) {
|
||||
//1、删掉pbom 父级的数据
|
||||
List<BomNewPbomParentEntity> pbomParent = eBomToPBom.getPBomParentResult().stream().filter(p -> (p.getMaterialDesc().contains("电控系统") && p.getMaterialDesc().contains("直发")) ||
|
||||
(p.getMaterialDesc().contains("电控系统") && p.getMaterialDesc().contains("制作"))).collect(Collectors.toList());
|
||||
eBomToPBom.getPBomParentResult().removeAll(pbomParent);
|
||||
//2、删掉pbom 子级的数据
|
||||
List<BomNewPbomChildEntity> pbomChild = eBomToPBom.getPBomChildResult().stream()
|
||||
.filter(c -> pbomParent.stream().map(BomNewPbomParentEntity::getRowId).collect(Collectors.toList()).contains(c.getParentRowId()))
|
||||
.collect(Collectors.toList());
|
||||
eBomToPBom.getPBomChildResult().removeAll(pbomChild);
|
||||
//3、判断parent下是否有子级,如果没有的话,把parent给删除了 物料****因下级全部是F项,仅保存EBOM,未生成PBOM数据
|
||||
List<BomNewPbomParentEntity> emptyChildParentList = eBomToPBom.getPBomParentResult().stream()
|
||||
.filter(p -> !eBomToPBom.getPBomChildResult().stream().map(BomNewPbomChildEntity::getParentRowId).collect(Collectors.toList()).contains(p.getRowId()) )
|
||||
.collect(Collectors.toList());
|
||||
if(!emptyChildParentList.isEmpty()){
|
||||
rList = emptyChildParentList.stream().map(BomNewPbomParentEntity::getMaterialNo).distinct()
|
||||
.map(m -> {
|
||||
OperationErrorMsgVO oem = new OperationErrorMsgVO();
|
||||
oem.setPrimaryKey(m);
|
||||
oem.msg = String.format("物料%s因下级全部是F项,仅保存EBOM,未生成PBOM数据",m);
|
||||
return oem;
|
||||
}).collect(Collectors.toList());
|
||||
eBomToPBom.getPBomParentResult().removeAll(emptyChildParentList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) {
|
||||
pBomParentService.saveOrUpdateBatch(eBomToPBom.getPBomParentResult());
|
||||
|
|
@ -1158,6 +1205,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
|
||||
}
|
||||
}
|
||||
return rList;
|
||||
}
|
||||
|
||||
public List<OperationErrorMsgVO> importToSAP(Long rootBomRowId) {
|
||||
|
|
|
|||
|
|
@ -5,14 +5,18 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.TypeUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.product.bomnew.constant.MateiralStateEnum;
|
||||
import com.nflg.product.bomnew.constant.MaterialGetEnum;
|
||||
import com.nflg.product.bomnew.constant.OriginalConstant;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewPbomParentMapper;
|
||||
import com.nflg.product.bomnew.mapper.master.MaterialMainMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.MaterialMateVO;
|
||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
|
|
@ -22,6 +26,7 @@ import org.springframework.stereotype.Service;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
|
|
@ -65,8 +70,21 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
|||
*/
|
||||
public <T extends BaseMaterialVO > void checkMaterialFreeze(List<T> data){
|
||||
intiMaterialState(data);
|
||||
|
||||
List<String> freeZeMaterialNos = data.stream().filter(u -> MateiralStateEnum.FREEZE.equalsValue(u.getMaterialState())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(freeZeMaterialNos)).throwMessage("以下物料被冻结:"+StrUtil.join(",", freeZeMaterialNos));
|
||||
String errMsg = "以下物料被冻结:"+StrUtil.join(",", freeZeMaterialNos);
|
||||
//BomNewPbomParentVO 如果是 pbmo发布的话 提示【父级物料BOM 中的物料冻结】 by 10002327 0924
|
||||
if(CollUtil.isNotEmpty(freeZeMaterialNos) && data.get(0) instanceof BomNewPbomParentVO){
|
||||
List<BomNewPbomParentVO> pList = data.stream().filter(d -> freeZeMaterialNos.contains(d.getMaterialNo()))
|
||||
.map(m -> Convert.convert(BomNewPbomParentVO.class,m)).collect(Collectors.toList());
|
||||
Set<Long> parentIdSet = pList.stream().map(BomNewPbomParentVO::getParentRowId).collect(Collectors.toSet());
|
||||
List<BomNewPbomParentEntity> parentEntityList = SpringUtil.getBean(BomNewPbomParentService.class).listByIds(parentIdSet);
|
||||
Map<Long,String> parentMap = parentEntityList.stream().collect(Collectors.toMap(BomNewPbomParentEntity::getRowId,BomNewPbomParentEntity::getMaterialNo));
|
||||
errMsg = pList.stream().map(p -> String.format("%d、父级物料%s下的%s被冻结了",pList.indexOf(p) + 1
|
||||
,parentMap.getOrDefault(p.getParentRowId(),""),p.getMaterialNo()))
|
||||
.collect(Collectors.joining(","));
|
||||
}
|
||||
VUtils.isTure(CollUtil.isNotEmpty(freeZeMaterialNos)).throwMessage(errMsg);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue