whycxzp
2022-08-27 1070bbc0a4a569203f6bd5537f9f69ceb8378105
更新
1个文件已修改
24 ■■■■ 已修改文件
src/main/java/com/whyc/service/WorksheetLinkService.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/WorksheetLinkService.java
@@ -153,17 +153,19 @@
                Integer nextVersion = currentVersion + 1;
                //产品物料关系迁移
                //查询生效版本的关联关系
                List<MaterialProductHistory> mpList = mphService.getListByParentCodeAndCustomCodeAndVersion(parentCode, customCode, enabledProduct.getVersion());
                if(latestProduct.getVersion().intValue() == enabledProduct.getVersion()){
                    //最新版本生效,关联关系版本连着的
                    mphService.updateVersionBatch(mpList);
                }else{
                    //旧版本生效,关联关系版本不连着
                    mpList.forEach(mp->{
                        mp.setSVersion(nextVersion);
                        mp.setEVersion(nextVersion);
                    });
                    mphService.insertBatch(mpList);
                if(latestProduct!=null &&enabledProduct!=null) {
                    List<MaterialProductHistory> mpList = mphService.getListByParentCodeAndCustomCodeAndVersion(parentCode, customCode, enabledProduct.getVersion());
                    if (latestProduct.getVersion().intValue() == enabledProduct.getVersion()) {
                        //最新版本生效,关联关系版本连着的
                        mphService.updateVersionBatch(mpList);
                    } else {
                        //旧版本生效,关联关系版本不连着
                        mpList.forEach(mp -> {
                            mp.setSVersion(nextVersion);
                            mp.setEVersion(nextVersion);
                        });
                        mphService.insertBatch(mpList);
                    }
                }
                //将产品文件复制至正式路径