Merge branch 'feature/DM/nflg-bom-transition' of http://112.74.186.154:3000/nflj/nflg_project into feature/DM/nflg-bom-transition
This commit is contained in:
commit
b7a23a1caa
|
|
@ -1,11 +1,7 @@
|
||||||
package com.nflg.product.bomnew.advice;
|
package com.nflg.product.bomnew.advice;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.nflg.product.bomnew.util.JsonUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import nflg.product.common.constant.STATE;
|
|
||||||
import nflg.product.common.util.JwtUtil;
|
|
||||||
import nflg.product.common.vo.ResultVO;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||||
import org.springframework.core.MethodParameter;
|
import org.springframework.core.MethodParameter;
|
||||||
|
|
@ -49,14 +45,6 @@ public class LoggingRequestBodyAdvice implements RequestBodyAdvice {
|
||||||
bodyContent = reader.lines().collect(Collectors.joining());
|
bodyContent = reader.lines().collect(Collectors.joining());
|
||||||
log.info("请求参数: {}", bodyContent);
|
log.info("请求参数: {}", bodyContent);
|
||||||
}
|
}
|
||||||
log.info("请求头: {}", JsonUtil.toJson(httpInputMessage.getHeaders()));
|
|
||||||
String token = httpInputMessage.getHeaders().getFirst("Authorization");
|
|
||||||
if (StrUtil.isNotBlank(token)) {
|
|
||||||
ResultVO result = JwtUtil.parse(token);
|
|
||||||
if (result.getState().equals(STATE.Success.getState())) {
|
|
||||||
log.info("请求用户: {}", JsonUtil.toJson(result.getData()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (StrUtil.isBlank(bodyContent)) {
|
if (StrUtil.isBlank(bodyContent)) {
|
||||||
return httpInputMessage;
|
return httpInputMessage;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -517,13 +517,13 @@ public class EbomApi extends BaseApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查下级是否存在Q项
|
* 检查下级的项目类型
|
||||||
* @param bomRowIds bomRowIds
|
* @param bomRowIds bomRowIds
|
||||||
* @return 检查结果
|
* @return 检查结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("checkQ")
|
@PostMapping("checkProjectType")
|
||||||
@ApiOperation("检查下级是否存在Q项")
|
@ApiOperation("检查下级的项目类型")
|
||||||
public ResultVO<List<CheckBomQVO>> checkQ(@Valid @RequestBody @NotEmpty List<Long> bomRowIds) {
|
public ResultVO<List<CheckBomProjectTypeVO>> checkProjectType(@Valid @RequestBody @NotEmpty List<Long> bomRowIds) {
|
||||||
return ResultVO.success(bomNewEbomParentService.checkQ(bomRowIds));
|
return ResultVO.success(bomNewEbomParentService.checkProjectType(bomRowIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,10 +69,10 @@ public class EbomV2Api extends BaseApi {
|
||||||
result = originalParentV2Service.pullFromCadAndToEBom(parents);
|
result = originalParentV2Service.pullFromCadAndToEBom(parents);
|
||||||
|
|
||||||
//跟新EBom 根节点
|
//跟新EBom 根节点
|
||||||
ebomParentService.getBaseMapper().updateRootState();
|
// ebomParentService.getBaseMapper().updateRootState();
|
||||||
ebomParentService.getBaseMapper().updateRootForWaitReview();
|
// ebomParentService.getBaseMapper().updateRootForWaitReview();
|
||||||
|
|
||||||
ebomParentService.resetAllBomExist(parents.stream().map(BomOriginalCadParentEntity::getMaterialNo).collect(Collectors.toSet()));
|
// ebomParentService.resetAllBomExist(parents.stream().map(BomOriginalCadParentEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
VUtils.isTure(true).throwMessage("转换失败:" + e.getMessage());
|
VUtils.isTure(true).throwMessage("转换失败:" + e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,8 @@ public enum EBomExceptionStatusEnum implements ValueEnum<Integer> {
|
||||||
EXCEPT_NO_13(13, "项目类型需要用户确认") ,
|
EXCEPT_NO_13(13, "项目类型需要用户确认") ,
|
||||||
EXCEPT_NO_14(14, "黄色警告(下级节点存在异常)"),
|
EXCEPT_NO_14(14, "黄色警告(下级节点存在异常)"),
|
||||||
EXCEPT_NO_15(15, "物料名称不一致"),
|
EXCEPT_NO_15(15, "物料名称不一致"),
|
||||||
EXCEPT_NO_16(16, "物料单位不一致");
|
EXCEPT_NO_16(16, "物料单位不一致"),
|
||||||
|
EXCEPT_NO_17(17, "项目赋值异常(当父级物料的项目类型为Q时,子级中的物料的项目类型不能全部为F");
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
private final String description;
|
private final String description;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,8 @@ public enum EBomSourceEnum implements ValueEnum<Integer> {
|
||||||
FROM_BOM(1, "原始BOM转换"),
|
FROM_BOM(1, "原始BOM转换"),
|
||||||
FROM_EXCE(2, "EXCE导入"),
|
FROM_EXCE(2, "EXCE导入"),
|
||||||
FROM_MDM(3, "MDM创建"),
|
FROM_MDM(3, "MDM创建"),
|
||||||
FROM_SAP(4, "从SAP导入");
|
FROM_SAP(4, "从SAP导入"),
|
||||||
|
FROM_CHANGE(5, "变更");
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
private final String description;
|
private final String description;
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ import java.io.Serializable;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@ApiModel(value = "com-nflg-product-bomnew-pojo-original-vo-CheckBomQVO")
|
@ApiModel(value = "com-nflg-product-bomnew-pojo-original-vo-CheckBomProjectTypeVO")
|
||||||
public class CheckBomQVO implements Serializable {
|
public class CheckBomProjectTypeVO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bom行id
|
* bom行id
|
||||||
|
|
@ -26,5 +26,11 @@ public class CheckBomQVO implements Serializable {
|
||||||
* 下级是否存在Q项
|
* 下级是否存在Q项
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "下级是否存在Q项")
|
@ApiModelProperty(value = "下级是否存在Q项")
|
||||||
private Boolean exists;
|
private Boolean existsQ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下级是否全是F项
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "下级是否全是F项")
|
||||||
|
private Boolean allIsF;
|
||||||
}
|
}
|
||||||
|
|
@ -25,6 +25,7 @@ import com.nflg.product.bomnew.util.VersionUtil;
|
||||||
import nflg.product.common.constant.STATE;
|
import nflg.product.common.constant.STATE;
|
||||||
import nflg.product.common.dto.LoginUserInfoDTO;
|
import nflg.product.common.dto.LoginUserInfoDTO;
|
||||||
import nflg.product.common.vo.ResultVO;
|
import nflg.product.common.vo.ResultVO;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
|
|
@ -562,18 +563,7 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String buildDrawingNo(String drawingNo, String materialName, VirtualPackageTypeEnum type, boolean is1020Factory) {
|
public static String buildDrawingNo(String drawingNo, String materialName, VirtualPackageTypeEnum type, boolean is1020Factory) {
|
||||||
return StrUtil.format("({})({}{})({})", drawingNo, materialName, is1020Factory ? "仙桃" : "", type.getConMaterialName());
|
return StrUtil.format("({})({}{})({})", drawingNo, StringUtils.deleteWhitespace(materialName), is1020Factory ? "仙桃" : "", type.getConMaterialName());
|
||||||
}
|
|
||||||
|
|
||||||
private String getMaterialNoForAdd(BomNewEbomChildEntity c) {
|
|
||||||
AddVirtrualMaterialDTO ent = new AddVirtrualMaterialDTO();
|
|
||||||
ent.setKey(c.getRowId().toString());
|
|
||||||
ent.setDrawingNo(c.getDrawingNo());
|
|
||||||
ent.setMaterialName(c.getMaterialName());
|
|
||||||
ent.setMaterialDesc(c.getMaterialDesc());
|
|
||||||
ent.setMaterialCategoryCode(c.getMaterialCategoryCode());
|
|
||||||
Map<String, AddVirtrualMaterialDTO> vMNosResult = materialService.batchAddMaterial(Collections.singletonList(ent), userInfo);
|
|
||||||
return vMNosResult.get(c.getRowId().toString()).getMaterialNo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -1234,10 +1234,29 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
newParent.setChangeDesc(paramDTO.getChangeDesc());
|
newParent.setChangeDesc(paramDTO.getChangeDesc());
|
||||||
newParent.setNoticeNums(paramDTO.getNoticeNums());
|
newParent.setNoticeNums(paramDTO.getNoticeNums());
|
||||||
newParent.setStatus(EBomStatusEnum.WAIT_CHECK.getValue());
|
newParent.setStatus(EBomStatusEnum.WAIT_CHECK.getValue());
|
||||||
|
newParent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||||
newParent.setDeptRowId(SessionUtil.getDepartRowId());
|
newParent.setDeptRowId(SessionUtil.getDepartRowId());
|
||||||
newParent.setDeptName(SessionUtil.getDepartName());
|
newParent.setDeptName(SessionUtil.getDepartName());
|
||||||
|
newParent.setDeviseName(SessionUtil.getRealName());
|
||||||
|
newParent.setDeviseUserCode(SessionUtil.getUserCode());
|
||||||
|
newParent.setRemark("");
|
||||||
|
newParent.setSource(EBomSourceEnum.FROM_CHANGE.getValue());
|
||||||
|
newParent.setConvertToEbomTime(null);
|
||||||
|
newParent.setReleaseUserName(null);
|
||||||
|
newParent.setReleaseTime(null);
|
||||||
|
newParent.setRevertDesc(null);
|
||||||
|
newParent.setRevertTime(null);
|
||||||
|
newParent.setRevertUserName(null);
|
||||||
|
newParent.setAuditUserName(null);
|
||||||
|
newParent.setAuditTime(null);
|
||||||
newParent.setRootIs(1);
|
newParent.setRootIs(1);
|
||||||
newParent.setUserRootIs(1);
|
newParent.setUserRootIs(1);
|
||||||
|
newParent.setSapState(1);
|
||||||
|
newParent.setSapTime(null);
|
||||||
|
newParent.setModifyTime(null);
|
||||||
|
newParent.setCreatedTime(LocalDateTime.now());
|
||||||
|
newParent.setCreatedBy(SessionUtil.getUserCode());
|
||||||
|
newParent.setCreatedJob(userRoleService.technician() ? UserJobEnum.ENGINEER.getValue() : UserJobEnum.DESIGNER.getValue());
|
||||||
parent.setLastVersionIs(0);
|
parent.setLastVersionIs(0);
|
||||||
parentResult.add(newParent);
|
parentResult.add(newParent);
|
||||||
parentResult.add(parent);
|
parentResult.add(parent);
|
||||||
|
|
@ -1246,6 +1265,13 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
BeanUtil.copyProperties(childEnt, newChild);
|
BeanUtil.copyProperties(childEnt, newChild);
|
||||||
newChild.setRowId(IdWorker.getId());
|
newChild.setRowId(IdWorker.getId());
|
||||||
newChild.setParentRowId(newParent.getRowId());
|
newChild.setParentRowId(newParent.getRowId());
|
||||||
|
newChild.setIdentityNo(newParent.getRowId() + "_" + newChild.getRowId());
|
||||||
|
newChild.setCreatedBy(SessionUtil.getUserCode());
|
||||||
|
newChild.setCreatedTime(LocalDateTime.now());
|
||||||
|
newChild.setModifyTime(null);
|
||||||
|
newChild.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||||
|
newChild.setSource(EBomSourceEnum.FROM_CHANGE.getValue());
|
||||||
|
newChild.setRemark("");
|
||||||
childResult.add(newChild);
|
childResult.add(newChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2175,6 +2201,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
if (CollUtil.isEmpty(delList)) {
|
if (CollUtil.isEmpty(delList)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
BomNewEbomParentEntity parentEntity = getById(parent.getRowId());
|
||||||
|
VUtils.isTure(Objects.isNull(parentEntity)).throwMessage("父级不存在");
|
||||||
|
VUtils.isTure(Objects.equals(parentEntity.getStatus(), EBomStatusEnum.PUBLISHED.getValue()))
|
||||||
|
.throwMessage("已定版数据不能删除");
|
||||||
|
|
||||||
List<Long> rowIds = delList.stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
|
List<Long> rowIds = delList.stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
|
||||||
QueryWrapper<BomNewEbomChildEntity> queryChildWrapper = new QueryWrapper<>();
|
QueryWrapper<BomNewEbomChildEntity> queryChildWrapper = new QueryWrapper<>();
|
||||||
queryChildWrapper.lambda().in(BomNewEbomChildEntity::getRowId, rowIds);
|
queryChildWrapper.lambda().in(BomNewEbomChildEntity::getRowId, rowIds);
|
||||||
|
|
@ -2191,8 +2222,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
// throw new NflgBusinessException(STATE.Error, StrUtil.format("从原始Bom导入的数据,数据没有异常的情况下,{} 不可以删除 ", StrUtil.join(",", check1List.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()))));
|
// throw new NflgBusinessException(STATE.Error, StrUtil.format("从原始Bom导入的数据,数据没有异常的情况下,{} 不可以删除 ", StrUtil.join(",", check1List.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()))));
|
||||||
// }
|
// }
|
||||||
VUtils.isTure(parent.getMaterialNo().startsWith("31")
|
VUtils.isTure(parent.getMaterialNo().startsWith("31")
|
||||||
|
&& delChildList.stream().anyMatch(c -> Objects.equals(c.getSource(), EBomSourceEnum.FROM_MDM.getValue()))
|
||||||
&& delChildList.stream().anyMatch(d -> !Objects.equals(d.getVirtualPartType(), VirtualPackageTypeEnum.UN_VIRTUAL_PACKAGE.getValue())))
|
&& delChildList.stream().anyMatch(d -> !Objects.equals(d.getVirtualPartType(), VirtualPackageTypeEnum.UN_VIRTUAL_PACKAGE.getValue())))
|
||||||
.throwMessage("不能删除31码下的虚拟包");
|
.throwMessage("请重新生成发货包");
|
||||||
|
|
||||||
//检查有bom数据关系是否可以删?
|
//检查有bom数据关系是否可以删?
|
||||||
// List<BomNewEbomParentVO> check2List = delList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource())
|
// List<BomNewEbomParentVO> check2List = delList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource())
|
||||||
|
|
@ -2232,9 +2264,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(delTagList)) {
|
if (CollectionUtil.isNotEmpty(delTagList)) {
|
||||||
List<Long> rowIdList = delTagList.stream().filter(u -> u.getRowId() != null || u.getRowId().longValue() > 0).map(BomNewEbomChildEntity::getRowId).collect(Collectors.toList());
|
List<Long> rowIdList = delTagList.stream().map(BomNewEbomChildEntity::getRowId).collect(Collectors.toList());
|
||||||
if (CollectionUtil.isNotEmpty(rowIdList)) {
|
if (CollectionUtil.isNotEmpty(rowIdList)) {
|
||||||
ebomChildService.removeByIds(rowIdList);
|
ebomChildService.removeByIds(rowIdList);
|
||||||
|
//将对应的parent设置为根节点
|
||||||
|
setRootIs1(delTagList.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()), SessionUtil.getUserCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2870,16 +2904,41 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
return baseMapper.getReverseBoms(parentRowId);
|
return baseMapper.getReverseBoms(parentRowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CheckBomQVO> checkQ(List<Long> bomRowIds) {
|
public List<CheckBomProjectTypeVO> checkProjectType(List<Long> bomRowIds) {
|
||||||
List<BomNewEbomChildEntity> children = ebomChildService.lambdaQuery()
|
List<BomNewEbomChildEntity> children = ebomChildService.lambdaQuery()
|
||||||
.in(BomNewEbomChildEntity::getParentRowId, bomRowIds)
|
.in(BomNewEbomChildEntity::getParentRowId, bomRowIds)
|
||||||
.list();
|
.list();
|
||||||
return bomRowIds.stream().map(bomRowId -> {
|
return bomRowIds.stream().map(bomRowId -> {
|
||||||
CheckBomQVO vo = new CheckBomQVO();
|
CheckBomProjectTypeVO vo = new CheckBomProjectTypeVO();
|
||||||
vo.setBomRowId(bomRowId);
|
vo.setBomRowId(bomRowId);
|
||||||
vo.setExists(children.stream().anyMatch(c -> c.getParentRowId().equals(bomRowId)
|
List<BomNewEbomChildEntity> cc = children.stream().filter(c -> c.getParentRowId().equals(bomRowId)).collect(Collectors.toList());
|
||||||
&& StrUtil.equals(c.getProjectType(), ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue())));
|
if (CollUtil.isEmpty(cc)) {
|
||||||
|
vo.setExistsQ(false);
|
||||||
|
vo.setAllIsF(false);
|
||||||
|
} else {
|
||||||
|
vo.setExistsQ(cc.stream().anyMatch(c -> StrUtil.equals(c.getProjectType(), ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue())));
|
||||||
|
vo.setAllIsF(cc.stream().allMatch(c -> StrUtil.equals(c.getProjectType(), ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue())));
|
||||||
|
}
|
||||||
return vo;
|
return vo;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置根节点
|
||||||
|
* @param materialNos 物料编号
|
||||||
|
* @param userCode 用户编号
|
||||||
|
*/
|
||||||
|
public void setRootIs1(Collection<String> materialNos, String userCode) {
|
||||||
|
if (CollUtil.isNotEmpty(materialNos)) {
|
||||||
|
log.debug("setRootIs1 将{}设置为根节点", String.join(",", materialNos));
|
||||||
|
this.lambdaUpdate()
|
||||||
|
.set(BomNewEbomParentEntity::getRootIs, 1)
|
||||||
|
.set(BomNewEbomParentEntity::getUserRootIs, 1)
|
||||||
|
.set(BomNewEbomParentEntity::getModifyTime, LocalDateTime.now())
|
||||||
|
.in(BomNewEbomParentEntity::getMaterialNo, materialNos)
|
||||||
|
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||||
|
.eq(BomNewEbomParentEntity::getCreatedBy, userCode)
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,12 @@ import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.nflg.product.bomnew.constant.EBomStatusEnum;
|
import com.nflg.product.bomnew.constant.EBomStatusEnum;
|
||||||
import com.nflg.product.bomnew.mapper.master.BomNewEbomUpgradeChangeMapper;
|
import com.nflg.product.bomnew.mapper.master.BomNewEbomUpgradeChangeMapper;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomVirtualPackageCompositionEntity;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||||
import com.nflg.product.bomnew.service.domain.EBom.ChangeImpactUpgrade;
|
import com.nflg.product.bomnew.service.domain.EBom.ChangeImpactUpgrade;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -17,6 +19,7 @@ import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -41,6 +44,9 @@ public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgrad
|
||||||
@Resource
|
@Resource
|
||||||
BomNewEbomParentService ebomParentService;
|
BomNewEbomParentService ebomParentService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BomNewEbomVirtualPackageCompositionService virtualPackageCompositionService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
|
|
@ -91,6 +97,15 @@ public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgrad
|
||||||
if (CollUtil.isNotEmpty(updateImpact.getPBomChildResult())) {
|
if (CollUtil.isNotEmpty(updateImpact.getPBomChildResult())) {
|
||||||
pbomChildService.saveOrUpdateBatch(updateImpact.getPBomChildResult());
|
pbomChildService.saveOrUpdateBatch(updateImpact.getPBomChildResult());
|
||||||
}
|
}
|
||||||
|
//修改直发包-物料组成(更新虚拟包组成)
|
||||||
|
if(CollUtil.isNotEmpty(updateImpact.getVirtualPackageCompositionResult())){
|
||||||
|
virtualPackageCompositionService.getBaseMapper().deleteByMap(ImmutableMap.of("virtual_package_material_no",ent.getMaterialNo()));
|
||||||
|
List<BomNewEbomVirtualPackageCompositionEntity> comVList = updateImpact.getVirtualPackageCompositionResult().stream().filter(u -> u.getVirtualPackageMaterialNo().equals(ent.getMaterialNo())).collect(Collectors.toList());
|
||||||
|
if(CollUtil.isNotEmpty(comVList)) {
|
||||||
|
virtualPackageCompositionService.saveBatch(comVList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//新加的移到历史表
|
//新加的移到历史表
|
||||||
if(CollUtil.isNotEmpty(updateImpact.getNewAddPBomParentResult())){
|
if(CollUtil.isNotEmpty(updateImpact.getNewAddPBomParentResult())){
|
||||||
pbomParentService.getBaseMapper().insertPBomParentToFormal(updateImpact.getNewAddPBomParentResult());
|
pbomParentService.getBaseMapper().insertPBomParentToFormal(updateImpact.getNewAddPBomParentResult());
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,14 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
import com.nflg.product.bomnew.constant.EBomStatusEnum;
|
import com.nflg.product.bomnew.constant.EBomStatusEnum;
|
||||||
import com.nflg.product.bomnew.constant.OriginalEditStatusEnum;
|
import com.nflg.product.bomnew.constant.OriginalEditStatusEnum;
|
||||||
import com.nflg.product.bomnew.constant.OriginalStatusEnum;
|
import com.nflg.product.bomnew.constant.OriginalStatusEnum;
|
||||||
import com.nflg.product.bomnew.mapper.master.BomNewOriginalParentMapper;
|
import com.nflg.product.bomnew.mapper.master.BomNewOriginalParentMapper;
|
||||||
import com.nflg.product.bomnew.pojo.dto.BaseImportExcelDTO;
|
import com.nflg.product.bomnew.pojo.dto.BaseImportExcelDTO;
|
||||||
import com.nflg.product.bomnew.pojo.dto.BomNewOriginalExcelDTO;
|
import com.nflg.product.bomnew.pojo.dto.BomNewOriginalExcelDTO;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
import com.nflg.product.bomnew.pojo.entity.*;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewOriginalParentEntity;
|
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomOriginalCadChildEntity;
|
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomOriginalCadParentEntity;
|
|
||||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
|
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomOriginalPlmBomVO;
|
import com.nflg.product.bomnew.pojo.vo.BomOriginalPlmBomVO;
|
||||||
|
|
@ -115,7 +113,7 @@ public class BomNewOriginalParentV2Service extends ServiceImpl<BomNewOriginalPar
|
||||||
|
|
||||||
VUtils.isTure(CollUtil.isEmpty(parents)).throwMessage("没有你的数据,你无需转换");
|
VUtils.isTure(CollUtil.isEmpty(parents)).throwMessage("没有你的数据,你无需转换");
|
||||||
//物料编号去除前后空格
|
//物料编号去除前后空格
|
||||||
parents.parallelStream().forEach(u -> {
|
parents.forEach(u -> {
|
||||||
u.setMaterialNo(StrUtil.trim(u.getMaterialNo()));
|
u.setMaterialNo(StrUtil.trim(u.getMaterialNo()));
|
||||||
if (StrUtil.equals(u.getMaterialNo(), "无")) {
|
if (StrUtil.equals(u.getMaterialNo(), "无")) {
|
||||||
u.setMaterialNo("");
|
u.setMaterialNo("");
|
||||||
|
|
@ -124,14 +122,14 @@ public class BomNewOriginalParentV2Service extends ServiceImpl<BomNewOriginalPar
|
||||||
//检查物料编码在主数据中是否存在
|
//检查物料编码在主数据中是否存在
|
||||||
List<BomOriginalCadChildEntity> childs = originalCadChildService.lambdaQuery().in(BomOriginalCadChildEntity::getParentRowId, parents.stream().map(u -> u.getRowId()).collect(Collectors.toList())).list();
|
List<BomOriginalCadChildEntity> childs = originalCadChildService.lambdaQuery().in(BomOriginalCadChildEntity::getParentRowId, parents.stream().map(u -> u.getRowId()).collect(Collectors.toList())).list();
|
||||||
//物料编号去除前后空格
|
//物料编号去除前后空格
|
||||||
childs.parallelStream().forEach(u -> {
|
childs.forEach(u -> {
|
||||||
u.setMaterialNo(StrUtil.trim(u.getMaterialNo()));
|
u.setMaterialNo(StrUtil.trim(u.getMaterialNo()));
|
||||||
if (StrUtil.equals(u.getMaterialNo(), "无")) {
|
if (StrUtil.equals(u.getMaterialNo(), "无")) {
|
||||||
u.setMaterialNo("");
|
u.setMaterialNo("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
checkMaterialHasExist(parents.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(BomOriginalCadParentEntity::getMaterialNo).collect(Collectors.toList()));
|
// checkMaterialHasExist(parents.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(BomOriginalCadParentEntity::getMaterialNo).collect(Collectors.toList()));
|
||||||
checkMaterialHasExist(childs.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(BomOriginalCadChildEntity::getMaterialNo).collect(Collectors.toList()));
|
// checkMaterialHasExist(childs.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(BomOriginalCadChildEntity::getMaterialNo).collect(Collectors.toList()));
|
||||||
|
|
||||||
//父级物料编码不能为空
|
//父级物料编码不能为空
|
||||||
materialMainService.initMaterialForDrawdingNo(parents, BomOriginalCadParentEntity::getChartNo, BomOriginalCadParentEntity::setMaterialNo, BomOriginalCadParentEntity::setMaterialName);
|
materialMainService.initMaterialForDrawdingNo(parents, BomOriginalCadParentEntity::getChartNo, BomOriginalCadParentEntity::setMaterialNo, BomOriginalCadParentEntity::setMaterialName);
|
||||||
|
|
@ -147,6 +145,16 @@ public class BomNewOriginalParentV2Service extends ServiceImpl<BomNewOriginalPar
|
||||||
VUtils.isTure(true).throwMessage(StrUtil.join(",", hasVirtualPackageMaterialNo)+"已生成虚拟包,请先删除再导入");
|
VUtils.isTure(true).throwMessage(StrUtil.join(",", hasVirtualPackageMaterialNo)+"已生成虚拟包,请先删除再导入");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//把没有child的parent删除
|
||||||
|
List<Integer> nonChildParents = parents.stream()
|
||||||
|
.map(BomOriginalCadParentEntity::getRowId)
|
||||||
|
.filter(rowId -> childs.stream().noneMatch(c -> Objects.equals(c.getParentRowId(), rowId)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(nonChildParents)) {
|
||||||
|
parents.removeIf(u -> nonChildParents.contains(u.getRowId()));
|
||||||
|
originalCadParentService.getBaseMapper().deleteBatchIds(nonChildParents);
|
||||||
|
}
|
||||||
|
|
||||||
PlmBomToOriginalConvertV2 convert = new PlmBomToOriginalConvertV2();
|
PlmBomToOriginalConvertV2 convert = new PlmBomToOriginalConvertV2();
|
||||||
//存原始BOM
|
//存原始BOM
|
||||||
toOriginalBom(parents,convert);
|
toOriginalBom(parents,convert);
|
||||||
|
|
@ -212,11 +220,13 @@ public class BomNewOriginalParentV2Service extends ServiceImpl<BomNewOriginalPar
|
||||||
List<ImportOriginalBomVO> importOriginalBomVOList = new ArrayList<>();
|
List<ImportOriginalBomVO> importOriginalBomVOList = new ArrayList<>();
|
||||||
|
|
||||||
//开始转换
|
//开始转换
|
||||||
|
List<BomNewEbomParentEntity> allParents = new ArrayList<>();
|
||||||
|
List<BomNewEbomChildEntity> allChildren = new ArrayList<>();
|
||||||
for (BomNewOriginalParentEntity parent : bomNewOriginalParentEntities) {
|
for (BomNewOriginalParentEntity parent : bomNewOriginalParentEntities) {
|
||||||
|
|
||||||
Long ebomRowId = IdWorker.getId();
|
Long ebomRowId = IdWorker.getId();
|
||||||
try {
|
try {
|
||||||
convertToEBomDoV2(parent, ebomRowId);
|
convertToEBomDoV2(parent, ebomRowId, allParents, allChildren);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
importOriginalBomVOList.add(new ImportOriginalBomVO(parent.getDrawingNo(), "操作失败:" + e.getMessage()));
|
importOriginalBomVOList.add(new ImportOriginalBomVO(parent.getDrawingNo(), "操作失败:" + e.getMessage()));
|
||||||
throw e;
|
throw e;
|
||||||
|
|
@ -225,6 +235,11 @@ public class BomNewOriginalParentV2Service extends ServiceImpl<BomNewOriginalPar
|
||||||
//更新并保存异常信息
|
//更新并保存异常信息
|
||||||
ebomParentService.checkAndSaveEBomException(ebomRowId);
|
ebomParentService.checkAndSaveEBomException(ebomRowId);
|
||||||
}
|
}
|
||||||
|
//设置根节点
|
||||||
|
Set<String> materialNos = allParents.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toSet());
|
||||||
|
materialNos.removeAll(allChildren.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||||
|
ebomParentService.setRootIs1(materialNos, SessionUtil.getUserCode());
|
||||||
|
|
||||||
return importOriginalBomVOList;
|
return importOriginalBomVOList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -234,7 +249,8 @@ public class BomNewOriginalParentV2Service extends ServiceImpl<BomNewOriginalPar
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void convertToEBomDoV2(BomNewOriginalParentEntity parent, Long eBomRowId) throws ExecutionException, InterruptedException {
|
private void convertToEBomDoV2(BomNewOriginalParentEntity parent, Long eBomRowId
|
||||||
|
, List<BomNewEbomParentEntity> allParents, List<BomNewEbomChildEntity> allChildren) {
|
||||||
|
|
||||||
List<BomOriginalListVO> bomAllChildList = this.getBaseMapper().getParentChild(parent.getRowId());
|
List<BomOriginalListVO> bomAllChildList = this.getBaseMapper().getParentChild(parent.getRowId());
|
||||||
BomOriginalListVO parentVO = Convert.convert(BomOriginalListVO.class, parent);
|
BomOriginalListVO parentVO = Convert.convert(BomOriginalListVO.class, parent);
|
||||||
|
|
@ -242,14 +258,34 @@ public class BomNewOriginalParentV2Service extends ServiceImpl<BomNewOriginalPar
|
||||||
OriginalBomToEBomV2Convert convert = new OriginalBomToEBomV2Convert(parentVO, bomAllChildList);
|
OriginalBomToEBomV2Convert convert = new OriginalBomToEBomV2Convert(parentVO, bomAllChildList);
|
||||||
convert.convert();
|
convert.convert();
|
||||||
|
|
||||||
|
convert.getEBomParentResult()
|
||||||
|
.stream()
|
||||||
|
.filter(p -> convert.getEBomChildResult().stream().noneMatch(c -> StrUtil.equals(p.getMaterialNo(), c.getMaterialNo())))
|
||||||
|
.forEach(p -> {
|
||||||
|
//设置是否有下级
|
||||||
|
p.setBomExist(convert.getEBomChildResult().stream().anyMatch(c -> Objects.equals(p.getRowId(), c.getParentRowId())) ? 1 : 0);
|
||||||
|
});
|
||||||
|
//取消本人以前导入的,草稿状态的bom的根节点状态
|
||||||
|
Set<String> materialNos = convert.getEBomChildResult().stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toSet());
|
||||||
|
materialNos.removeAll(convert.getEBomParentResult().stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||||
|
if (CollUtil.isNotEmpty(materialNos)) {
|
||||||
|
ebomParentService.lambdaUpdate()
|
||||||
|
.set(BomNewEbomParentEntity::getRootIs, 0)
|
||||||
|
.set(BomNewEbomParentEntity::getUserRootIs, 0)
|
||||||
|
.set(BomNewEbomParentEntity::getRootIsForWaitReview, 0)
|
||||||
|
.in(BomNewEbomParentEntity::getMaterialNo, materialNos)
|
||||||
|
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||||
|
.eq(BomNewEbomParentEntity::getCreatedBy, SessionUtil.getUserCode())
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(convert.getEBomParentResult())) {
|
if (CollUtil.isNotEmpty(convert.getEBomParentResult())) {
|
||||||
ebomParentService.saveOrUpdateBatch(convert.getEBomParentResult());
|
ebomParentService.saveOrUpdateBatch(convert.getEBomParentResult());
|
||||||
|
allParents.addAll(convert.getEBomParentResult());
|
||||||
|
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(convert.getEBomChildResult())) {
|
if (CollUtil.isNotEmpty(convert.getEBomChildResult())) {
|
||||||
ebomChildService.saveOrUpdateBatch(convert.getEBomChildResult());
|
ebomChildService.saveOrUpdateBatch(convert.getEBomChildResult());
|
||||||
|
allChildren.addAll(convert.getEBomChildResult());
|
||||||
}
|
}
|
||||||
//将原始BOM及子级转为已处理
|
//将原始BOM及子级转为已处理
|
||||||
if (CollUtil.isNotEmpty(convert.getHasHandlerParentIds())) {
|
if (CollUtil.isNotEmpty(convert.getHasHandlerParentIds())) {
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,8 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
|
||||||
LOGGER.debug("{} 物料提层到顶级发货包且合并 编号:{},父级编号:{},数量:{},合并后总数:{},描述:{}", TAG, it.getMaterialNo(), p.getMaterialNo(), it.getNum().toString(), cct.getMENGE(), it.getMaterialDesc());
|
LOGGER.debug("{} 物料提层到顶级发货包且合并 编号:{},父级编号:{},数量:{},合并后总数:{},描述:{}", TAG, it.getMaterialNo(), p.getMaterialNo(), it.getNum().toString(), cct.getMENGE(), it.getMaterialDesc());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!Objects.equals(it.getVirtualPartType(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue())) {
|
// } else if (!Objects.equals(it.getVirtualPartType(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue())) {
|
||||||
|
} else {
|
||||||
LOGGER.debug("{} 添加物料 编号:{},父级编号:{},数量:{},描述:{}", TAG, it.getMaterialNo(), p.getMaterialNo(), it.getNum().toString(), it.getMaterialDesc());
|
LOGGER.debug("{} 添加物料 编号:{},父级编号:{},数量:{},描述:{}", TAG, it.getMaterialNo(), p.getMaterialNo(), it.getNum().toString(), it.getMaterialDesc());
|
||||||
children.add(convert(cp, it, p.getMaterialNo(), ignore));
|
children.add(convert(cp, it, p.getMaterialNo(), ignore));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,13 @@ public class CheckEBomException {
|
||||||
// qList.forEach(u -> u.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue()));
|
// qList.forEach(u -> u.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue()));
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
if (ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue().equals(parent.getProjectType())) {
|
||||||
|
if (CollUtil.isNotEmpty(child) && child.stream()
|
||||||
|
.allMatch(c -> StrUtil.equals(c.getProjectType(), ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue()))) {
|
||||||
|
parent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_17.getValue());
|
||||||
|
child.forEach(c -> c.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_17.getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// checkCircularDependency(checkEBomExceptionDTOS);
|
// checkCircularDependency(checkEBomExceptionDTOS);
|
||||||
//bom异常-黄色警号
|
//bom异常-黄色警号
|
||||||
|
|
|
||||||
|
|
@ -268,9 +268,9 @@ public class EBomEdit {
|
||||||
if (StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(), child.getProjectType())) {
|
if (StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(), child.getProjectType())) {
|
||||||
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_9.getValue());
|
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_9.getValue());
|
||||||
}
|
}
|
||||||
if (StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue(), child.getProjectType())) {
|
// if (StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue(), child.getProjectType())) {
|
||||||
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue());
|
// child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue());
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ public abstract class EBomToPbomBase {
|
||||||
|
|
||||||
List<BomNewEbomParentVO> result = child.stream().filter(u -> StrUtil.isBlank(u.getMaterialNo())).collect(Collectors.toList());
|
List<BomNewEbomParentVO> result = child.stream().filter(u -> StrUtil.isBlank(u.getMaterialNo())).collect(Collectors.toList());
|
||||||
|
|
||||||
Map<String, List<BomNewEbomParentVO>> listMp = child.stream().collect(Collectors.groupingBy(BomNewEbomParentVO::getMaterialNo));
|
Map<String, List<BomNewEbomParentVO>> listMp = child.stream().filter(u->StrUtil.isNotBlank(u.getMaterialNo())).collect(Collectors.groupingBy(BomNewEbomParentVO::getMaterialNo));
|
||||||
|
|
||||||
for (String key : listMp.keySet()) {
|
for (String key : listMp.keySet()) {
|
||||||
List<BomNewEbomParentVO> voList = listMp.get(key);
|
List<BomNewEbomParentVO> voList = listMp.get(key);
|
||||||
|
|
|
||||||
|
|
@ -246,11 +246,20 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
||||||
List<BomNewEbomChildEntity> oldParenChild = SpringUtil.getBean(BomNewEbomChildMapper.class).getChildByMaterialNo(parentEntity.getMaterialNo());
|
List<BomNewEbomChildEntity> oldParenChild = SpringUtil.getBean(BomNewEbomChildMapper.class).getChildByMaterialNo(parentEntity.getMaterialNo());
|
||||||
//不存在EBom 时
|
//不存在EBom 时
|
||||||
if (Objects.isNull(oldEBom)) {
|
if (Objects.isNull(oldEBom)) {
|
||||||
buildCommonMaterialChildBom(childVo, materialBaseInfo, VersionUtil.getNextVersion(""));
|
|
||||||
|
|
||||||
|
buildCommonMaterialChildBom(childVo, materialBaseInfo, VersionUtil.getNextVersion(""));
|
||||||
} else {
|
} else {
|
||||||
if (!EBomStatusEnum.PUBLISHED.equalsValue(oldEBom.getStatus())) {
|
if (!EBomStatusEnum.PUBLISHED.equalsValue(oldEBom.getStatus())) {
|
||||||
BomNewEbomChildEntity newChild = buildCommonEbomChildEntity(materialBaseInfo, parentEntity);
|
List<BomNewEbomChildEntity> oldChild = ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, oldEBom.getRowId()).list();
|
||||||
|
if(CollUtil.isNotEmpty(oldChild)){
|
||||||
|
List<BomNewEbomChildEntity> oldChildEntityList = oldChild.stream().filter(u->u.getMaterialNo().equals(materialBaseInfo.getMaterialNo())).collect(Collectors.toList());
|
||||||
|
BomNewEbomChildEntity oldChildEntity=CollUtil.isNotEmpty(oldChildEntityList)?oldChildEntityList.get(0):null;
|
||||||
|
if( Objects.nonNull(oldChildEntity) && Objects.nonNull(oldChildEntity.getNum()) && oldChildEntity.getNum().compareTo(childVo.getUnitWeight())>0){
|
||||||
|
buildEBomChild(childVo, parentEntity);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BomNewEbomChildEntity newChild = buildCommonEbomChildEntity(materialBaseInfo, childVo);
|
||||||
//结构是否相同 且为同一个人
|
//结构是否相同 且为同一个人
|
||||||
if ( oldEBom.getCreatedBy().equals(parentEntity.getCreatedBy())) {
|
if ( oldEBom.getCreatedBy().equals(parentEntity.getCreatedBy())) {
|
||||||
ebomParentService.getBaseMapper().deleteById(oldEBom.getRowId());
|
ebomParentService.getBaseMapper().deleteById(oldEBom.getRowId());
|
||||||
|
|
@ -335,25 +344,25 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected BomNewEbomChildEntity buildCommonEbomChildEntity(BaseMaterialVO material, BomOriginalListVO parent) {
|
protected BomNewEbomChildEntity buildCommonEbomChildEntity(BaseMaterialVO material, BomOriginalListVO parentV) {
|
||||||
BomNewEbomChildEntity childEntity = new BomNewEbomChildEntity();
|
BomNewEbomChildEntity childEntity = new BomNewEbomChildEntity();
|
||||||
childEntity.setParentRowId(parent.getEBomRowId() > 0 ? parent.getEBomRowId() : parent.getRowId());
|
childEntity.setParentRowId(parentV.getEBomRowId() > 0 ? parentV.getEBomRowId() : parentV.getRowId());
|
||||||
childEntity.setOrderNumber("001");
|
childEntity.setOrderNumber("001");
|
||||||
childEntity.setIdentityNo(StrUtil.join("-", parent.getMaterialNo(), material.getMaterialNo()));
|
childEntity.setIdentityNo(StrUtil.join("-", parentV.getMaterialNo(), material.getMaterialNo()));
|
||||||
//图号=物料编码
|
//图号=物料编码
|
||||||
childEntity.setDrawingNo(material.getMaterialNo());
|
childEntity.setDrawingNo(material.getMaterialNo());
|
||||||
childEntity.setMaterialNo(material.getMaterialNo());
|
childEntity.setMaterialNo(material.getMaterialNo());
|
||||||
childEntity.setMaterialName(material.getMaterialName());
|
childEntity.setMaterialName(material.getMaterialName());
|
||||||
childEntity.setMaterialDesc(material.getMaterialDesc());
|
childEntity.setMaterialDesc(material.getMaterialDesc());
|
||||||
childEntity.setMaterialTexture(material.getMaterial());
|
childEntity.setMaterialTexture(material.getMaterial());
|
||||||
childEntity.setUnitWeight(parent.getUnitWeight());
|
childEntity.setUnitWeight(parentV.getUnitWeight());
|
||||||
childEntity.setNum(parent.getUnitWeight());
|
childEntity.setNum(parentV.getUnitWeight());
|
||||||
childEntity.setCreatedBy(SessionUtil.getUserCode());
|
childEntity.setCreatedBy(SessionUtil.getUserCode());
|
||||||
childEntity.setMaterialUnit("KG");
|
childEntity.setMaterialUnit("KG");
|
||||||
childEntity.setProjectType("L");
|
childEntity.setProjectType("L");
|
||||||
childEntity.setMaterialOriginalUnit(material.getMaterialUnit());
|
childEntity.setMaterialOriginalUnit(material.getMaterialUnit());
|
||||||
childEntity.setSourceRowId(parent.getRowId().toString());
|
childEntity.setSourceRowId(parentV.getRowId().toString());
|
||||||
parent.setBomExist(1);
|
parentV.setBomExist(1);
|
||||||
|
|
||||||
// this.eBomChildResult.add(childEntity);
|
// this.eBomChildResult.add(childEntity);
|
||||||
return childEntity;
|
return childEntity;
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,26 @@ package com.nflg.product.bomnew.service.domain.OriginalBom;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.github.xiaoymin.knife4j.core.util.StrUtil;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.nflg.product.bomnew.constant.*;
|
import com.nflg.product.bomnew.constant.OriginalConstant;
|
||||||
|
import com.nflg.product.bomnew.constant.OriginalEditStatusEnum;
|
||||||
|
import com.nflg.product.bomnew.constant.OriginalSourceEnum;
|
||||||
|
import com.nflg.product.bomnew.constant.OriginalStatusEnum;
|
||||||
import com.nflg.product.bomnew.mapper.master.MaterialMainMapper;
|
import com.nflg.product.bomnew.mapper.master.MaterialMainMapper;
|
||||||
import com.nflg.product.bomnew.pojo.entity.*;
|
import com.nflg.product.bomnew.pojo.entity.BomNewOriginalParentEntity;
|
||||||
import com.nflg.product.bomnew.pojo.vo.*;
|
import com.nflg.product.bomnew.pojo.entity.BomOriginalCadChildEntity;
|
||||||
import com.nflg.product.bomnew.service.*;
|
import com.nflg.product.bomnew.pojo.entity.BomOriginalCadParentEntity;
|
||||||
|
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||||
|
import com.nflg.product.bomnew.pojo.vo.BomOriginalPlmBomVO;
|
||||||
|
import com.nflg.product.bomnew.pojo.vo.ImportOriginalBomVO;
|
||||||
|
import com.nflg.product.bomnew.pojo.vo.MaterialMateVO;
|
||||||
|
import com.nflg.product.bomnew.service.BomNewOriginalChildService;
|
||||||
|
import com.nflg.product.bomnew.service.BomNewOriginalParentService;
|
||||||
|
import com.nflg.product.bomnew.service.BomOriginalCadChildService;
|
||||||
|
import com.nflg.product.bomnew.service.MaterialMainService;
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
|
@ -49,11 +60,15 @@ public class PlmBomToOriginalConvertV2 extends BaseConvert {
|
||||||
if (parent.getMaterialNo().trim().equalsIgnoreCase("无")) {
|
if (parent.getMaterialNo().trim().equalsIgnoreCase("无")) {
|
||||||
parent.setMaterialNo("");
|
parent.setMaterialNo("");
|
||||||
}
|
}
|
||||||
|
parent.setMaterialNo(StrUtil.trim(parent.getMaterialNo()));
|
||||||
if (StrUtil.isBlank(parent.getMaterialNo())) {
|
if (StrUtil.isBlank(parent.getMaterialNo())) {
|
||||||
SpringUtil.getBean(MaterialMainService.class).initMaterialForDrawdingNo(ImmutableList.of(parent), BomOriginalPlmBomVO::getDrawingNo, BomOriginalPlmBomVO::setMaterialNo, BomOriginalPlmBomVO::setMaterialName);
|
SpringUtil.getBean(MaterialMainService.class).initMaterialForDrawdingNo(ImmutableList.of(parent), BomOriginalPlmBomVO::getDrawingNo, BomOriginalPlmBomVO::setMaterialNo, BomOriginalPlmBomVO::setMaterialName);
|
||||||
}
|
}
|
||||||
childs.stream().filter(f -> f.getMaterialNo().trim().equalsIgnoreCase("无")).forEach(it -> {
|
childs.parallelStream().forEach(f -> {
|
||||||
it.setMaterialNo("");
|
f.setMaterialNo(StrUtil.trim(f.getMaterialNo()));
|
||||||
|
if (StrUtil.equals("无", f.getMaterialNo())) {
|
||||||
|
f.setMaterialNo("");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
List<BomOriginalPlmBomVO> noMaterialNoList = childs.stream().filter(u -> StrUtil.isBlank(u.getMaterialNo())).collect(Collectors.toList());
|
List<BomOriginalPlmBomVO> noMaterialNoList = childs.stream().filter(u -> StrUtil.isBlank(u.getMaterialNo())).collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(noMaterialNoList)) {
|
if (CollUtil.isNotEmpty(noMaterialNoList)) {
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,15 @@ import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
|
import com.nflg.product.bomnew.constant.PBomEditStatusEnum;
|
||||||
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
||||||
import com.nflg.product.bomnew.constant.PbomSourceEnum;
|
import com.nflg.product.bomnew.constant.PbomSourceEnum;
|
||||||
|
import com.nflg.product.bomnew.constant.UserJobEnum;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
|
||||||
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.BomNewPbomParentService;
|
import com.nflg.product.bomnew.service.BomNewPbomParentService;
|
||||||
|
import com.nflg.product.bomnew.service.UserRoleService;
|
||||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
import com.nflg.product.bomnew.util.VersionUtil;
|
import com.nflg.product.bomnew.util.VersionUtil;
|
||||||
|
|
@ -87,12 +90,23 @@ public class PBomUpgrade {
|
||||||
pbomParent.setRowId(IdWorker.getId());
|
pbomParent.setRowId(IdWorker.getId());
|
||||||
pbomParent.setCreatedTime(LocalDateTime.now());
|
pbomParent.setCreatedTime(LocalDateTime.now());
|
||||||
pbomParent.setCreatedBy(SessionUtil.getUserCode());
|
pbomParent.setCreatedBy(SessionUtil.getUserCode());
|
||||||
pbomParent.setModifyTime(LocalDateTime.now());
|
|
||||||
pbomParent.setStatus(PBomStatusEnum.WAIT_PUBLISH.getValue());
|
pbomParent.setStatus(PBomStatusEnum.WAIT_PUBLISH.getValue());
|
||||||
|
pbomParent.setEditStatus(PBomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||||
pbomParent.setCurrentVersion(VersionUtil.getNextVersion(parentVO.getCurrentVersion()));
|
pbomParent.setCurrentVersion(VersionUtil.getNextVersion(parentVO.getCurrentVersion()));
|
||||||
pbomParent.setModifyTime(LocalDateTime.now());
|
|
||||||
pbomParent.setDeptRowId(SessionUtil.getDepartRowId());
|
pbomParent.setDeptRowId(SessionUtil.getDepartRowId());
|
||||||
|
pbomParent.setDeptName(SessionUtil.getDepartName());
|
||||||
|
pbomParent.setDeviseName(SessionUtil.getRealName());
|
||||||
|
pbomParent.setDeviseUserCode(SessionUtil.getUserCode());
|
||||||
|
pbomParent.setTechnologyUserName(SessionUtil.getUserName());
|
||||||
|
pbomParent.setTechnologyUserCode(SessionUtil.getUserCode());
|
||||||
|
pbomParent.setRemark("");
|
||||||
pbomParent.setSource(PbomSourceEnum.FROM_CHANGE.getValue());
|
pbomParent.setSource(PbomSourceEnum.FROM_CHANGE.getValue());
|
||||||
|
pbomParent.setReleaseTime(null);
|
||||||
|
pbomParent.setReleaseUserName(null);
|
||||||
|
pbomParent.setSapState(1);
|
||||||
|
pbomParent.setSapTime(null);
|
||||||
|
pbomParent.setModifyTime(null);
|
||||||
|
pbomParent.setCreatedJob(SpringUtil.getBean(UserRoleService.class).technician() ? UserJobEnum.ENGINEER.getValue() : UserJobEnum.DESIGNER.getValue());
|
||||||
if (rootIs) {
|
if (rootIs) {
|
||||||
pbomParent.setRootIs(1);
|
pbomParent.setRootIs(1);
|
||||||
pbomParent.setUserRootIs(1);
|
pbomParent.setUserRootIs(1);
|
||||||
|
|
@ -118,10 +132,12 @@ public class PBomUpgrade {
|
||||||
BeanUtil.copyProperties(childVO, child);
|
BeanUtil.copyProperties(childVO, child);
|
||||||
child.setRowId(IdWorker.getId());
|
child.setRowId(IdWorker.getId());
|
||||||
child.setParentRowId(newParent.getRowId());
|
child.setParentRowId(newParent.getRowId());
|
||||||
|
child.setIdentityNo(newParent.getRowId() + "_" + child.getRowId());
|
||||||
child.setCreatedTime(LocalDateTime.now());
|
child.setCreatedTime(LocalDateTime.now());
|
||||||
child.setCreatedBy(SessionUtil.getRealName());
|
child.setCreatedBy(SessionUtil.getUserCode());
|
||||||
child.setModifyTime(LocalDateTime.now());
|
child.setModifyTime(null);
|
||||||
|
child.setSource(PbomSourceEnum.FROM_CHANGE.getValue());
|
||||||
|
child.setRemark("");
|
||||||
this.childResult.add(child);
|
this.childResult.add(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,11 @@
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- 忽略Nacos服务器的INFO日志 -->
|
|
||||||
<logger name="com.alibaba.nacos" level="WARN" />
|
<logger name="com.alibaba.nacos" level="WARN" />
|
||||||
|
<logger name="org.mybatis.spring" level="WARN"/>
|
||||||
|
<logger name="org.springframework.web" level="WARN"/>
|
||||||
|
<logger name="org.springframework.jdbc" level="WARN"/>
|
||||||
|
<logger name="io.lettuce.core" level="WARN"/>
|
||||||
|
|
||||||
<!-- 日志输出级别 -->
|
<!-- 日志输出级别 -->
|
||||||
<root level="DEBUG">
|
<root level="DEBUG">
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
package com.nflg.product.base.core.config.fillter;
|
package com.nflg.product.base.core.config.fillter;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import nflg.product.common.constant.STATE;
|
||||||
|
import nflg.product.common.util.JwtUtil;
|
||||||
|
import nflg.product.common.vo.ResultVO;
|
||||||
import org.slf4j.MDC;
|
import org.slf4j.MDC;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
@ -9,6 +14,7 @@ import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求拦截器
|
* 请求拦截器
|
||||||
|
|
@ -20,39 +26,50 @@ import java.nio.charset.StandardCharsets;
|
||||||
public class HttpInterceptor implements HandlerInterceptor {
|
public class HttpInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
private static final String CHARSET = StandardCharsets.UTF_8.name();
|
private static final String CHARSET = StandardCharsets.UTF_8.name();
|
||||||
private static final ThreadLocal<String> currentAuthorization = new ThreadLocal<>();
|
private static final String TRACEID = "traceId";
|
||||||
|
private static final ThreadLocal<String> AUTHORIZATION = new ThreadLocal<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||||
response.setCharacterEncoding(CHARSET);
|
response.setCharacterEncoding(CHARSET);
|
||||||
String traceId = IdWorker.getIdStr();
|
String traceId = IdWorker.getIdStr();
|
||||||
MDC.put("traceId", traceId);
|
MDC.put(TRACEID, traceId);
|
||||||
// String body="内容无法显示(" + request.getContentType() + ")";
|
log.info("HttpRecord Request,url: " + request.getRequestURL() + " ,method: " + request.getMethod());
|
||||||
// if (request.getMethod().equalsIgnoreCase("post") && request.getContentType().contains("json") && request.getContentLength()>0){
|
|
||||||
// InputStream inputStream = request.getInputStream();
|
StringBuilder sb = new StringBuilder("请求头: ");
|
||||||
// BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
|
Enumeration<String> headerNames = request.getHeaderNames();
|
||||||
// char[] chars = new char[request.getContentLength()];
|
while (headerNames.hasMoreElements()) {
|
||||||
// reader.read(chars, 0, chars.length);
|
String headerName = headerNames.nextElement();
|
||||||
// body = String.valueOf(chars);
|
sb.append(StrUtil.format("{}={},", headerName, request.getHeader(headerName)));
|
||||||
// }
|
}
|
||||||
log.info("HttpRecord Request,url:" + request.getRequestURL() + ",method:" + request.getMethod());
|
log.info(sb.substring(0, sb.length() - 1));
|
||||||
currentAuthorization.set(request.getHeader("Authorization"));
|
|
||||||
|
String token = request.getHeader("Authorization");
|
||||||
|
if (StrUtil.isNotBlank(token)) {
|
||||||
|
ResultVO result = JwtUtil.parse(token);
|
||||||
|
if (result.getState().equals(STATE.Success.getState())) {
|
||||||
|
log.info("请求用户: {}", JSON.toJSONString(result.getData()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AUTHORIZATION.set(request.getHeader("Authorization"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||||
HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
|
HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
|
||||||
log.info("HttpRecord Response,url:" + request.getRequestURL() + ",status:" + response.getStatus());
|
log.info("HttpRecord Response,url: " + request.getRequestURL() + " ,status: " + response.getStatus());
|
||||||
|
MDC.remove(TRACEID);
|
||||||
removeAuthorization();
|
removeAuthorization();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeAuthorization() {
|
private void removeAuthorization() {
|
||||||
log.trace("已清除当前线程的Authorization");
|
log.trace("已清除当前线程的Authorization");
|
||||||
currentAuthorization.remove();
|
AUTHORIZATION.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getAuthorization() {
|
public static String getAuthorization() {
|
||||||
return currentAuthorization.get();
|
return AUTHORIZATION.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue