Merge branch 'feature/DM/nflg-bom' of http://112.74.186.154:3000/nflj/nflg_project into feature/DM/nflg-bom
This commit is contained in:
commit
0494e98972
|
|
@ -9,12 +9,16 @@ import nflg.product.common.vo.ResultVO;
|
|||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpInputMessage;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author 曹鹏飞
|
||||
|
|
@ -35,13 +39,16 @@ public class LoggingRequestBodyAdvice implements RequestBodyAdvice {
|
|||
|
||||
@Override
|
||||
public HttpInputMessage beforeBodyRead(HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) {
|
||||
return httpInputMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterBodyRead(Object o, HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) {
|
||||
try {
|
||||
log.info("请求参数: {}", JsonUtil.toJson(o));
|
||||
String contentType = httpInputMessage.getHeaders().getFirst("Content-Type");
|
||||
if (StrUtil.containsIgnoreCase(contentType, "multipart")) {
|
||||
return httpInputMessage;
|
||||
}
|
||||
String bodyContent;
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(httpInputMessage.getBody(), StandardCharsets.UTF_8))) {
|
||||
bodyContent = reader.lines().collect(Collectors.joining());
|
||||
log.info("请求参数: {}", bodyContent);
|
||||
}
|
||||
log.info("请求头: {}", JsonUtil.toJson(httpInputMessage.getHeaders()));
|
||||
String token = httpInputMessage.getHeaders().getFirst("Authorization");
|
||||
if (StrUtil.isNotBlank(token)) {
|
||||
|
|
@ -50,9 +57,29 @@ public class LoggingRequestBodyAdvice implements RequestBodyAdvice {
|
|||
log.info("请求用户: {}", JsonUtil.toJson(result.getData()));
|
||||
}
|
||||
}
|
||||
if (StrUtil.isBlank(bodyContent)) {
|
||||
return httpInputMessage;
|
||||
} else {
|
||||
return new HttpInputMessage() {
|
||||
@Override
|
||||
public InputStream getBody() throws IOException {
|
||||
return new ByteArrayInputStream(bodyContent.getBytes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpHeaders getHeaders() {
|
||||
return httpInputMessage.getHeaders();
|
||||
}
|
||||
};
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("读取请求体出错", ex);
|
||||
log.error("读取请求数据出错", ex);
|
||||
return httpInputMessage;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterBodyRead(Object o, HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) {
|
||||
return o;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.product.bomnew.advice;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.nflg.product.bomnew.util.JsonUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -32,7 +33,10 @@ public class LoggingResponseBodyAdvice implements ResponseBodyAdvice<Object> {
|
|||
@Override
|
||||
public Object beforeBodyWrite(Object o, MethodParameter methodParameter, MediaType mediaType, Class<? extends HttpMessageConverter<?>> aClass, ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse) {
|
||||
try {
|
||||
log.info("响应数据: {}", JsonUtil.toJson(o));
|
||||
String contentType = serverHttpResponse.getHeaders().getFirst("Content-Type");
|
||||
if (!StrUtil.containsIgnoreCase(contentType, "octet-stream")) {
|
||||
log.info("响应数据: {}", JsonUtil.toJson(o));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("读取响应数据出错", ex);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomVirtualPackageCompositionEntity;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* t_bom_new_ebom_virtual_package_composition 表数据库访问层
|
||||
*
|
||||
|
|
@ -14,4 +17,6 @@ import org.apache.ibatis.annotations.Param;
|
|||
public interface BomNewEbomVirtualPackageCompositionMapper extends BaseMapper<BomNewEbomVirtualPackageCompositionEntity> {
|
||||
|
||||
void delByVnoAndParentNo(@Param("virtualPackageMaterialNo")String virtualPackageMaterialNo, @Param("parentMaterialNo")String parentMaterialNo);
|
||||
|
||||
void batchDelByVMaterialNos(@Param("virtualMaterialNos") Collection<String> virtualMaterialNos);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.mzt.logapi.context.LogRecordContext;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
|
|
@ -678,7 +679,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
* @param bomRowId bom行ID
|
||||
*/
|
||||
public void initBomException(Long bomRowId) throws ExecutionException, InterruptedException {
|
||||
CheckEBomException checkEBomException = new CheckEBomException(bomRowId);
|
||||
CheckEBomException checkEBomException = new CheckEBomException(bomRowId, null);
|
||||
checkEBomException.initException();
|
||||
|
||||
//保存异常
|
||||
|
|
@ -686,7 +687,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
|
||||
public void initBomException(Long bomRowId, List<Integer> ignoreCheckException) throws ExecutionException, InterruptedException {
|
||||
CheckEBomException checkEBomException = new CheckEBomException(bomRowId);
|
||||
CheckEBomException checkEBomException = new CheckEBomException(bomRowId, null);
|
||||
checkEBomException.initException(ignoreCheckException);
|
||||
|
||||
//保存异常
|
||||
|
|
@ -731,7 +732,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
* 检查 并保存异常信息
|
||||
*/
|
||||
public void checkAndSaveEBomException(Long bomRowId) throws ExecutionException, InterruptedException {
|
||||
CheckEBomException checkEBomException = new CheckEBomException(bomRowId);
|
||||
CheckEBomException checkEBomException = new CheckEBomException(bomRowId, null);
|
||||
checkEBomException.initException();
|
||||
|
||||
//保存异常
|
||||
|
|
@ -756,7 +757,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
*/
|
||||
public void batchCheckAndSaveEBomException(List<Long> bomRowIds) {
|
||||
for (Long bomRowId : bomRowIds) {
|
||||
CheckEBomException checkEBomException = new CheckEBomException(bomRowId);
|
||||
CheckEBomException checkEBomException = new CheckEBomException(bomRowId, null);
|
||||
checkEBomException.initException();
|
||||
|
||||
//保存异常
|
||||
|
|
@ -765,6 +766,14 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
}
|
||||
|
||||
public void checkAndSaveEBomException(Long bomRowId, Long childRowId) {
|
||||
CheckEBomException checkEBomException = new CheckEBomException(bomRowId, childRowId);
|
||||
checkEBomException.initException();
|
||||
|
||||
//保存异常
|
||||
saveException(checkEBomException);
|
||||
}
|
||||
|
||||
public void checkAndInitVirtualPackageEnum(VirtualPackageParamDto paramDto, BomNewEbomParentEntity root) {
|
||||
if (root.getVirtrualPackageEnum() <= 0) {
|
||||
if (root.getMaterialNo().startsWith("31")) {
|
||||
|
|
@ -904,6 +913,13 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
|
||||
}
|
||||
|
||||
//记录虚拟包组成
|
||||
if(CollUtil.isNotEmpty(eBomToPBom.getVirtualPackageCompositionResult())){
|
||||
Set<String> vMaterialNos = eBomToPBom.getVirtualPackageCompositionResult().stream().map(u -> u.getVirtualPackageMaterialNo()).collect(Collectors.toSet());
|
||||
virtualPackageCompositionService.getBaseMapper().batchDelByVMaterialNos(vMaterialNos);
|
||||
virtualPackageCompositionService.saveBatch(eBomToPBom.getVirtualPackageCompositionResult());
|
||||
}
|
||||
|
||||
//删除EBOM中和正式表BOM一致的数据
|
||||
List<BomNewEbomParentVO> delEBomParents = bomTree.stream().filter(u -> u.getHasChangeState().equals(1)).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(delEBomParents)){
|
||||
|
|
@ -937,7 +953,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
if (CollUtil.isNotEmpty(bomRowIds)) {
|
||||
this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), bomRowIds);
|
||||
//将历史已发布版-转移到正式历史表
|
||||
eBomToFormal(bomRowIds, bomTree.stream().filter(u ->!EBomStatusEnum.PUBLISHED.equalsValue(u.getStatus()) && u.getBomRowId() > 0).collect(Collectors.toList()) );
|
||||
eBomToFormal(bomRowIds, bomTree.stream().filter(u ->!u.getHasChangeState().equals(1) && !EBomStatusEnum.PUBLISHED.equalsValue(u.getStatus()) && u.getBomRowId() > 0).collect(Collectors.toList()) );
|
||||
}
|
||||
//子级记录-bom版本
|
||||
List<BomNewEbomChildEntity> bomChildren = new ArrayList<>();
|
||||
|
|
@ -2381,7 +2397,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
BomExceptionQuery bom = query.get(index);
|
||||
BomExceptionVO vo = new BomExceptionVO();
|
||||
if (index == 0) {
|
||||
batchCheckAndSaveEBomException(Collections.singletonList(bom.getBomRowId()));
|
||||
checkAndSaveEBomException(bom.getBomRowId(), bom.getRowId());
|
||||
|
||||
BomNewEbomParentEntity parent = getById(bom.getBomRowId());
|
||||
vo.setMaterialNo(parent.getMaterialNo());
|
||||
|
|
|
|||
|
|
@ -9,9 +9,11 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.Sets;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.bomnew.constant.*;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.service.BomNewEbomChildService;
|
||||
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
||||
import com.nflg.product.bomnew.service.MaterialMainService;
|
||||
import com.nflg.product.bomnew.util.*;
|
||||
|
|
@ -52,7 +54,7 @@ public class CheckEBomException {
|
|||
}
|
||||
|
||||
|
||||
public CheckEBomException(Long bomRowId) {
|
||||
public CheckEBomException(Long bomRowId, Long childRowId) {
|
||||
|
||||
allBomDetail = SpringUtil.getBean(BomNewEbomParentService.class).getBomTree(bomRowId, true);
|
||||
//只检查待复核和自己的
|
||||
|
|
@ -65,6 +67,13 @@ public class CheckEBomException {
|
|||
convert.setBomRowId(convert.getRowId());
|
||||
convert.setParentRowId(0L);
|
||||
convert.setLevelNumber(BigDecimal.ZERO);
|
||||
if (Objects.nonNull(childRowId) && childRowId > 0) {
|
||||
BomNewEbomChildEntity c = SpringUtil.getBean(BomNewEbomChildService.class).getById(childRowId);
|
||||
if (Objects.nonNull(c)) {
|
||||
convert.setProjectType(c.getProjectType());
|
||||
convert.setNum(c.getNum());
|
||||
}
|
||||
}
|
||||
allBomDetail.add(convert);
|
||||
checkWaring=true;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ package com.nflg.product.bomnew.service.domain.EBom;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.excel.enums.BooleanEnum;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.bomnew.constant.*;
|
||||
|
|
@ -26,6 +28,7 @@ import java.math.BigDecimal;
|
|||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public abstract class EBomToPbomBase {
|
||||
|
||||
|
|
@ -42,6 +45,8 @@ public abstract class EBomToPbomBase {
|
|||
|
||||
protected List<BomNewEbomParentVO> result = new ArrayList<>();
|
||||
|
||||
protected BomNewEbomVirtualPackageCompositionService virtualPackageCompositionService=SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class);
|
||||
|
||||
|
||||
@Getter
|
||||
protected List<BomNewPbomParentEntity> pBomParentResult = new ArrayList<>();
|
||||
|
|
@ -163,6 +168,7 @@ public abstract class EBomToPbomBase {
|
|||
SpringUtil.getBean(BomNewPbomChildService.class).getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldParent.getRowId()));
|
||||
oldParent.setCurrentVersion(parentVo.getCurrentVersion());
|
||||
oldParent.setSourceRowId(parentVo.getRowId());
|
||||
oldParent.setCreatedTime(LocalDateTime.now());
|
||||
this.pBomParentResult.add(oldParent);
|
||||
return oldParent;
|
||||
}
|
||||
|
|
@ -174,7 +180,7 @@ public abstract class EBomToPbomBase {
|
|||
return null;
|
||||
|
||||
} else { //pbom-处于正式表
|
||||
String bomVersion= VersionUtil.compare(parentVo.getCurrentVersion(),oldParent.getCurrentVersion())>=0?parentVo.getCurrentVersion():VersionUtil.getNextVersion(oldParent.getCurrentVersion());
|
||||
String bomVersion= VersionUtil.compare(parentVo.getCurrentVersion(),oldParent.getCurrentVersion())>0?parentVo.getCurrentVersion():VersionUtil.getNextVersion(oldParent.getCurrentVersion());
|
||||
return buildParentEntity(parentVo, facCode, oldParent,bomVersion);
|
||||
}
|
||||
|
||||
|
|
@ -192,6 +198,7 @@ public abstract class EBomToPbomBase {
|
|||
pBomParent.setTechnologyUserCode(SessionUtil.getUserCode());
|
||||
pBomParent.setTechnologyUserName(SessionUtil.getRealName());
|
||||
pBomParent.setDeptRowId(SessionUtil.getDepartRowId());
|
||||
pBomParent.setCreatedTime(LocalDateTime.now());
|
||||
//版本=EBom版本
|
||||
pBomParent.setCurrentVersion(bomVersion);
|
||||
pBomParent.setEditStatus(PBomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||
|
|
@ -227,10 +234,6 @@ public abstract class EBomToPbomBase {
|
|||
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
||||
result.add(vo);
|
||||
}
|
||||
//当没找到直发包时,丢弃
|
||||
// else {
|
||||
// // buildUpgradeChange(vo);
|
||||
// }
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getProjectType()) && vo.getProjectType().equals(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getProductTypeKey())) {
|
||||
|
|
@ -242,9 +245,6 @@ public abstract class EBomToPbomBase {
|
|||
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
||||
result.add(vo);
|
||||
}
|
||||
// else { //当没找到直发包时,丢弃
|
||||
// // buildUpgradeChange(vo);
|
||||
// }
|
||||
continue;
|
||||
}
|
||||
result.add(vo);
|
||||
|
|
@ -332,36 +332,38 @@ public abstract class EBomToPbomBase {
|
|||
private void liftingLayerSummary(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo) {
|
||||
BigDecimal sum = vo.getNum();
|
||||
String parentLevelNo = BomLevelUtil.getParentLevelNo(vo.getLevelNo());
|
||||
List<BigDecimal> parentFullPathNum = new ArrayList<>();
|
||||
|
||||
while (parentLevelNo.length() >= lastVirtualPackage.getLevelNo().length()) {
|
||||
String pNo = parentLevelNo;
|
||||
List<BomNewEbomParentVO> parentList = allBomDetail.stream().filter(u -> u.getLevelNo().equals(pNo)).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(parentList)) {
|
||||
sum = NumberUtil.mul(sum, parentList.get(0).getNum());
|
||||
parentFullPathNum.add(parentList.get(0).getNum());
|
||||
|
||||
//构建虚拟包组成
|
||||
buildVirtualPackageComposition(lastVirtualPackage, vo);
|
||||
}
|
||||
// else {
|
||||
// parentFullPathNum.add(parentList.get(0).getNum());
|
||||
// }
|
||||
parentLevelNo = BomLevelUtil.getParentLevelNo(parentLevelNo);
|
||||
|
||||
}
|
||||
vo.setNum(sum);
|
||||
//构建虚拟包组成
|
||||
buildVirtualPackageComposition(lastVirtualPackage, vo, parentFullPathNum);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void buildVirtualPackageComposition(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo, List<BigDecimal> parentFullPathNum) {
|
||||
/**
|
||||
* 构建虚拟包组成
|
||||
* @param lastVirtualPackage
|
||||
* @param vo
|
||||
*/
|
||||
private void buildVirtualPackageComposition(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo) {
|
||||
|
||||
BomNewEbomVirtualPackageCompositionEntity packageCompositionEntity = new BomNewEbomVirtualPackageCompositionEntity();
|
||||
packageCompositionEntity.setRowId(IdWorker.getId());
|
||||
packageCompositionEntity.setVirtualPackageMaterialNo(lastVirtualPackage.getMaterialNo());
|
||||
List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId())).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级");
|
||||
packageCompositionEntity.setParentMaterialNo(voParent.get(0).getMaterialNo());
|
||||
packageCompositionEntity.setChildMaterialNo(vo.getMaterialNo());
|
||||
packageCompositionEntity.setParentFullPathNum(StrUtil.join(",", parentFullPathNum));
|
||||
packageCompositionEntity.setNum(vo.getNum());
|
||||
packageCompositionEntity.setProjectType(vo.getProjectType());
|
||||
packageCompositionEntity.setUnitWeight(vo.getUnitWeight());
|
||||
packageCompositionEntity.setTotalWeight(vo.getTotalWeight());
|
||||
|
|
@ -369,6 +371,46 @@ public abstract class EBomToPbomBase {
|
|||
this.virtualPackageCompositionResult.add(packageCompositionEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 变更影响
|
||||
*/
|
||||
protected void changeImpact(){
|
||||
Set<String> vmaterialNo = allBomDetail.stream().filter(u -> VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.equalsValue(u.getVirtualPartType()) || VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.equalsValue(u.getVirtualPartType())).map(u -> u.getMaterialNo()).collect(Collectors.toSet());
|
||||
List<BomNewEbomParentVO> firstParent = allBomDetail.stream().filter(u -> u.getParentRowId().equals(parent.getRowId())).collect(Collectors.toList());
|
||||
for (BomNewEbomParentVO vo : firstParent) {
|
||||
changeImpactDo(vo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void changeImpactDo(BomNewEbomParentVO parentVO){
|
||||
List<BomNewEbomParentVO> subVos = allBomDetail.stream().filter(u -> u.getLevelNumber().compareTo(parentVO.getLevelNumber()) >= 0 && u.getLevelNumber().compareTo(NumberUtil.add(parentVO.getLevelNumber(), BigDecimal.valueOf(0.01))) < 0)
|
||||
.sorted(Comparator.comparing(BomNewEbomParentVO::getLevelNumber)).collect(Collectors.toList());
|
||||
for (BomNewEbomParentVO vo : subVos) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private Boolean compareVirtualPackage(BomNewEbomParentVO vo) {
|
||||
List<BomNewEbomVirtualPackageCompositionEntity> impactVm = virtualPackageCompositionService.lambdaQuery().eq(BomNewEbomVirtualPackageCompositionEntity::getParentMaterialNo, vo.getMaterialNo()).list();
|
||||
if(CollUtil.isNotEmpty(impactVm)){
|
||||
List<BomNewEbomParentVO> childList = allBomDetail.stream().filter(u -> u.getParentRowId().equals(vo.getBomRowId())).collect(Collectors.toList());
|
||||
Map<String, BomNewEbomVirtualPackageCompositionEntity> impactVmMp = impactVm.stream().collect(Collectors.toMap(v -> v.getChildMaterialNo(), v -> v, (v1, v2) -> v1));
|
||||
//对比F项
|
||||
List<BomNewEbomVirtualPackageCompositionEntity> impactVmF = impactVm.stream().filter(u -> VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getProductTypeKey().equals(u.getProjectType())).collect(Collectors.toList());
|
||||
|
||||
List<BomNewEbomParentVO> childListF = childList.stream().filter(u -> VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getProductTypeKey().equals(u.getProjectType())).collect(Collectors.toList());
|
||||
if(impactVmF.size()!=impactVmF.size()){
|
||||
return true;
|
||||
}
|
||||
for (BomNewEbomParentVO child : childList) {
|
||||
// if(impactVmMp.containsKey());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getParentMaterialNo(Long parentRowId) {
|
||||
List<BomNewEbomParentVO> collect = allBomDetail.stream().filter(u -> u.getBomRowId().equals(parentRowId)).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
|
|
@ -527,6 +569,16 @@ public abstract class EBomToPbomBase {
|
|||
parentBom.setCurrentVersion(VersionUtil.getNextVersion(oldEBom.getCurrentVersion()));
|
||||
parentBom.setHasChangeState(2);
|
||||
}
|
||||
|
||||
//如子级都为F 项父级也不转
|
||||
Set<String> projectSet = newParentChild.stream().map(u -> u.getProjectType().toUpperCase()).collect(Collectors.toSet());
|
||||
if(CollUtil.isNotEmpty(projectSet)){
|
||||
if(!VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getProductTypeKey().equals(parentBom.getVirtualPartType()) && !VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getProductTypeKey().equals(parentBom.getVirtualPartType()) &&
|
||||
(ImmutableSet.of("F").equals(projectSet) || ImmutableSet.of("F","Z").equals(projectSet)|| ImmutableSet.of("Z").equals(projectSet))){
|
||||
parentBom.setNoConvertToPBomIs(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -526,7 +526,7 @@
|
|||
a.`virtrual_package_enum`, a.`exception_status`, a.`virtual_package_is`, a.`source_row_id`,
|
||||
a.`devise_user_code`, a.`devise_name`, a.`created_by`, a.`created_time`, a.`created_job`, a.`audit_time`,
|
||||
a.`audit_user_name`, a.`release_time`, a.`release_user_name`, a.`revert_time`, a.`revert_user_name`,
|
||||
a.`expire_end_time`, a.`convert_to_ebom_time`, a.`remark`, a.`dept_name`,`dept_row_id`, a.`level_num`,
|
||||
a.`expire_end_time`, a.`convert_to_ebom_time`, a.`remark`, a.`dept_name`,a.`dept_row_id`, a.`level_num`,
|
||||
a.`change_desc`, a.`notice_nums`, a.`modify_time`, a.`sap_state`, a.`sap_time`
|
||||
from t_bom_new_ebom_parent a
|
||||
left join t_bom_new_ebom_parent_formal b on a.row_id = b.row_id
|
||||
|
|
|
|||
|
|
@ -27,4 +27,12 @@
|
|||
where virtual_package_material_no=#{virtualPackageMaterialNo}
|
||||
and parent_material_no=#{parentMaterialNo}
|
||||
</delete>
|
||||
|
||||
<delete id="batchDelByVMaterialNos">
|
||||
delete from t_bom_new_ebom_virtual_package_composition
|
||||
where virtual_package_material_no in
|
||||
<foreach collection="virtualMaterialNos" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.product.base.core.exception;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
|
|
@ -124,8 +125,11 @@ public class BaseGlobalExceptionHandle {
|
|||
@ResponseBody
|
||||
public ResultVO<String> handleRuntimeExceptionException(RuntimeException e) {
|
||||
log.error(e.getMessage(),e);
|
||||
//throw new NflgBusinessException(STATE.Error, "系统错误,请联系管理员");
|
||||
return ResultVO.error("系统错误,请联系管理员");
|
||||
if (StrUtil.isNotBlank(e.getMessage()) && e.getMessage().contains("Deadlock")) {
|
||||
return ResultVO.error("操作失败,请重试");
|
||||
} else {
|
||||
return ResultVO.error("系统错误,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = BadSqlGrammarException.class)
|
||||
|
|
@ -164,4 +168,12 @@ public class BaseGlobalExceptionHandle {
|
|||
//return ResultVO.error(e.getState(), e.getMessage());
|
||||
return ResultVO.error(e.getState(), e.getMessage(), e.getData());
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = InvalidFormatException.class)
|
||||
@ResponseBody
|
||||
public ResultVO handleInvalidFormatException(ErrorMsgException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
//return ResultVO.error(e.getState(), e.getMessage());
|
||||
return ResultVO.error(STATE.ParamErr, "数据格式错误,请修改后再提交: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue