lyh
2025-01-16 1d84a3c62eeee429f7d7d6339bcf9b504a9d7277
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java
@@ -66,6 +66,8 @@
    @Lazy
    private IProcessStreamService processStreamService;
    @Autowired
    private IWorkStepService workStepService;
    @Autowired
    private IDocInfoService docInfoService;
    @Autowired
    private INcLogInfoService iNcLogInfoService;
@@ -163,16 +165,28 @@
    @Override
    public List<CommonGenericTree> loadProductTree(String userId) {
        //todo 翻译创建人修改人
        //产品
        List<ProductInfo> productInfoList = getByUserPerms(userId);
        if(productInfoList == null || productInfoList.isEmpty())
            return Collections.emptyList();
        //部件
        List<ComponentExt> componentInfoList = componentInfoService.getByUserPermsAs(userId);
        if(componentInfoList == null)
            componentInfoList = Collections.emptyList();
        //零件
        List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId);
        if(partsInfos == null)
            partsInfos = Collections.emptyList();
        return ProductTreeWrapper.loadTree(productInfoList, componentInfoList, partsInfos);
        //工序
        List<ProcessStream> processStreams=processStreamService.getByuserPerms(userId);
        if(processStreams==null)
            processStreams = Collections.emptyList();
        //工步
        List<WorkStep> workStepList=workStepService.getByUserPerms(userId);
        if(workStepList==null)
            workStepList = Collections.emptyList();
        return ProductTreeWrapper.loadTree(productInfoList, componentInfoList, partsInfos,processStreams,workStepList);
    }
    @Override
@@ -1427,7 +1441,8 @@
        List<ProductInfo> productInfos = this.getByUserPerms(userId, queryParam);
        List<ComponentInfo> componentInfos = componentInfoService.getByUserPerms(userId, queryParam);
        List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId, null, queryParam);
        List<ProcessStream> processStreams=processStreamService.getByuserPerms(userId, queryParam);
        List<WorkStep> workSteps=workStepService.getByUserPerms(userId, queryParam);
        List<ComponentInfo> componentInfoList = new ArrayList<>();
        List<ProductInfo> productInfoList = new ArrayList<>();
@@ -1462,6 +1477,44 @@
            if(!componentInfoMap.containsKey(p.getComponentId())) {
                component = componentInfoService.getById(p.getComponentId());
                if(component != null) {
                    componentInfoMap.put(component.getComponentId(), component);
                    componentInfoList.add(component);
                }
            }
        }
        for (ProcessStream processStream : processStreams) {
            if (!productInfoMap.containsKey(processStream.getProductId())) {
                product  = super.getById(processStream.getProductId());
                if(product != null) {
                    productInfoMap.put(product.getProductId(), product);
                    productInfoList.add(product);
                }
            }
            if(!componentInfoMap.containsKey(processStream.getComponentId())) {
                component = componentInfoService.getById(processStream.getComponentId());
                if(component != null) {
                    componentInfoMap.put(component.getComponentId(), component);
                    componentInfoList.add(component);
                }
            }
        }
        for (WorkStep workStep :workSteps){
            if (!productInfoMap.containsKey(workStep.getProductId())) {
                product  = super.getById(workStep.getProductId());
                if(product != null) {
                    productInfoMap.put(product.getProductId(), product);
                    productInfoList.add(product);
                }
            }
            if(!componentInfoMap.containsKey(workStep.getComponentId())) {
                component = componentInfoService.getById(workStep.getComponentId());
                if(component != null) {
                    componentInfoMap.put(component.getComponentId(), component);
                    componentInfoList.add(component);
@@ -1515,6 +1568,6 @@
        //转换数据
        List<ComponentExt> componentExtList = ComponentExt.convertToExtList(componentInfoList);
        return ProductTreeWrapper.loadTree(productInfoList, componentExtList, partsInfos);
        return ProductTreeWrapper.loadTree(productInfoList, componentExtList, partsInfos,processStreams,workSteps);
    }
}