1.ebom_parent 去掉项目类别
This commit is contained in:
parent
6b56deff50
commit
c4fd3f89cb
|
|
@ -320,6 +320,19 @@ public class EbomApi extends BaseApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("intiException")
|
||||||
|
@ApiOperation("初始化错误类型")
|
||||||
|
public ResultVO<Boolean> intiException(@RequestParam("bomRowId") Long bomRowId) throws ExecutionException, InterruptedException {
|
||||||
|
|
||||||
|
bomNewEbomParentService.checkAndSaveEBomException(bomRowId );
|
||||||
|
return ResultVO.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,7 @@ public class BomNewEbomChildVO extends BaseMaterialVO implements Serializable {
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "项目类别输入方式: 0-自动匹配 1-手工录入 3-来自物料主数据 4-来自历史统计")
|
@ApiModelProperty(value = "项目类别输入方式: 0-自动匹配 1-手工录入 3-来自物料主数据 4-来自历史统计")
|
||||||
private Integer projectTypeInputType;
|
private Integer projectTypeInputType;
|
||||||
@ApiModelProperty(value = "项目类别")
|
|
||||||
private String projectType;
|
|
||||||
/**
|
/**
|
||||||
* 创建人工号
|
* 创建人工号
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -345,8 +345,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
materialMainService.intiMaterialInfo(data);
|
materialMainService.intiMaterialInfo(data);
|
||||||
productTypeInitDo(parent, data);
|
productTypeInitDo(parent, data);
|
||||||
|
|
||||||
//更新异常信息
|
|
||||||
checkAndSaveEBomException(bomRowId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.nflg.product.bomnew.service.domain.EBom;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 循环依赖检查
|
||||||
|
*/
|
||||||
|
public class DependencyChecker {
|
||||||
|
|
||||||
|
|
||||||
|
private Map<Integer, Boolean> visited; // 使用Integer类型的哈希码
|
||||||
|
private Set<String> nodes;
|
||||||
|
|
||||||
|
public DependencyChecker() {
|
||||||
|
visited = new HashMap<>();
|
||||||
|
nodes = new HashSet<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addDependency(String child, String parent) {
|
||||||
|
nodes.add(child);
|
||||||
|
nodes.add(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasCycle() {
|
||||||
|
for (String node : nodes) {
|
||||||
|
if (!visited.put(node.hashCode(), false) == false) {
|
||||||
|
// 当前节点已经被访问过,存在循环依赖
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -72,9 +72,9 @@ public class EBomEdit {
|
||||||
parent.setLastVersionIs(1);
|
parent.setLastVersionIs(1);
|
||||||
parent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
parent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||||
parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
|
parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
|
||||||
if(StrUtil.isEmpty(parent.getProjectType())){
|
// if(StrUtil.isEmpty(parent.getProjectType())){
|
||||||
parent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
|
// parent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
|
||||||
}
|
// }
|
||||||
|
|
||||||
parent.setStatus(SpringUtil.getBean(UserRoleService.class).technician()? EBomStatusEnum.CHECKED.getValue():EBomStatusEnum.WAIT_CHECK.getValue());
|
parent.setStatus(SpringUtil.getBean(UserRoleService.class).technician()? EBomStatusEnum.CHECKED.getValue():EBomStatusEnum.WAIT_CHECK.getValue());
|
||||||
parent.setCreatedJob(SpringUtil.getBean(UserRoleService.class).technician()?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue());
|
parent.setCreatedJob(SpringUtil.getBean(UserRoleService.class).technician()?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue());
|
||||||
|
|
@ -245,14 +245,14 @@ public class EBomEdit {
|
||||||
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
|
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(StrUtil.isNotEmpty(parent.getProjectType()) && StrUtil.containsAny(parent.getProjectType(),ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(),ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue())){
|
// if(StrUtil.isNotEmpty(parent.getProjectType()) && StrUtil.containsAny(parent.getProjectType(),ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(),ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue())){
|
||||||
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());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// VUtils.isTure(parent.getProjectType().equals(child.getProjectType())).throwMessage("父、子级项目类型不能相同");
|
// VUtils.isTure(parent.getProjectType().equals(child.getProjectType())).throwMessage("父、子级项目类型不能相同");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,8 @@ public abstract class VirtualPackageBase {
|
||||||
parent.setMaterialDesc(vMaterialDesc);
|
parent.setMaterialDesc(vMaterialDesc);
|
||||||
parent.setCurrentVersion(VersionUtil.getNextVersion(Objects.nonNull(oldParent)?oldParent.getCurrentVersion():""));
|
parent.setCurrentVersion(VersionUtil.getNextVersion(Objects.nonNull(oldParent)?oldParent.getCurrentVersion():""));
|
||||||
parent.setVirtualPackageIs(1);
|
parent.setVirtualPackageIs(1);
|
||||||
parent.setProjectType("L");
|
// parent.setProjectType("L");
|
||||||
parent.setProjectTypeInputType(ProjectTypeInputTypeEnum.AUTO_MATCH.getValue());
|
// parent.setProjectTypeInputType(ProjectTypeInputTypeEnum.AUTO_MATCH.getValue());
|
||||||
parent.setShouldBomExist(1);
|
parent.setShouldBomExist(1);
|
||||||
parent.setBomExist(1);
|
parent.setBomExist(1);
|
||||||
parent.setSourceRowId(0L);
|
parent.setSourceRowId(0L);
|
||||||
|
|
|
||||||
|
|
@ -296,7 +296,7 @@ public class OriginalBomToEBomConvert extends BaseConvert {
|
||||||
BeanUtil.copyProperties(parentEnt, eBomParent, "materialGetType");
|
BeanUtil.copyProperties(parentEnt, eBomParent, "materialGetType");
|
||||||
eBomParent.setRowId(parentEnt.getEBomRowId() > 0 ? parentEnt.getEBomRowId() : IdWorker.getId());
|
eBomParent.setRowId(parentEnt.getEBomRowId() > 0 ? parentEnt.getEBomRowId() : IdWorker.getId());
|
||||||
eBomParent.setSource(EBomSourceEnum.FROM_BOM.getValue());
|
eBomParent.setSource(EBomSourceEnum.FROM_BOM.getValue());
|
||||||
eBomParent.setCurrentVersion(Objects.isNull(ebom) ? "" : VersionUtil.getNextVersion(ebom.getCurrentVersion()));
|
eBomParent.setCurrentVersion(VersionUtil.getNextVersion(Objects.isNull(ebom) ? "" : VersionUtil.getNextVersion(ebom.getCurrentVersion()) ));
|
||||||
eBomParent.setConvertToEbomTime(LocalDateTime.now());
|
eBomParent.setConvertToEbomTime(LocalDateTime.now());
|
||||||
eBomParent.setSourceRowId(parentEnt.getBomRowId());
|
eBomParent.setSourceRowId(parentEnt.getBomRowId());
|
||||||
eBomParent.setLastVersionIs(1);
|
eBomParent.setLastVersionIs(1);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.nflg.product.bomnew.util;
|
package com.nflg.product.bomnew.util;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.nflg.product.bomnew.service.domain.EBom.DependencyChecker;
|
||||||
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
@ -127,22 +128,25 @@ public class TreeUtils {
|
||||||
* @return List<Long> 存在循环依赖的具体行-rowId
|
* @return List<Long> 存在循环依赖的具体行-rowId
|
||||||
*/
|
*/
|
||||||
public static <T> List<Long> checkParentChildRelationship(List<T> list ,Function<T,String> getParentFun, Function<T,String> getChildFun,Function<T,Long> getRowIdFun) {
|
public static <T> List<Long> checkParentChildRelationship(List<T> list ,Function<T,String> getParentFun, Function<T,String> getChildFun,Function<T,Long> getRowIdFun) {
|
||||||
Set<String> parents = new HashSet<>();
|
|
||||||
|
|
||||||
List<Long> result=new ArrayList<>();
|
DependencyChecker checker = new DependencyChecker();
|
||||||
|
|
||||||
for (T data : list) {
|
for (T data : list) {
|
||||||
String parent = getParentFun.apply(data);
|
String parent = getParentFun.apply(data);
|
||||||
String child = getChildFun.apply(data);
|
String child = getChildFun.apply(data);
|
||||||
|
checker.addDependency(child, parent);
|
||||||
|
|
||||||
if (parents.contains(child)) {
|
|
||||||
result.add(getRowIdFun.apply(data));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parents.add(parent);
|
if (checker.hasCycle()) {
|
||||||
|
System.out.println("存在循环依赖");
|
||||||
|
} else {
|
||||||
|
System.out.println("不存在循环依赖");
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue