Merge branch 'feature/DM/nflg-bom' of http://112.74.186.154:3000/nflj/nflg_project into feature/DM/nflg-bom
# Conflicts: # nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomEdit.java
This commit is contained in:
commit
852ebe63b3
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -249,7 +249,7 @@ 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());
|
||||||
// }
|
// }
|
||||||
|
|
|
||||||
|
|
@ -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