变更影响
This commit is contained in:
parent
46a870b3a1
commit
268d94b392
|
|
@ -85,13 +85,13 @@ public class EbomApi extends BaseApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("changeImpact")
|
@PostMapping("changeImpact")
|
||||||
@ApiOperation("Ebom-变更影响")
|
@ApiOperation("变更影响-列表")
|
||||||
public ResultVO<Page<BomNewEbomUpgradeChangeVO>> changeImpact(@RequestBody BomNewEbomParentQuery query) {
|
public ResultVO<Page<BomNewEbomUpgradeChangeVO>> changeImpact(@RequestBody BomNewEbomParentQuery query) {
|
||||||
return ResultVO.success(bomNewEbomParentService.getUpgradeChangeList(query));
|
return ResultVO.success(bomNewEbomParentService.getUpgradeChangeList(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("delChangeImpact")
|
@PostMapping("delChangeImpact")
|
||||||
@ApiOperation("Ebom-删除变更影响")
|
@ApiOperation("变更影响-删除")
|
||||||
public ResultVO<Boolean> delChangeImpact(@RequestBody List<Long> rowIds){
|
public ResultVO<Boolean> delChangeImpact(@RequestBody List<Long> rowIds){
|
||||||
VUtils.isTure(CollUtil.isEmpty(rowIds)).throwMessage("请选择要删除的数据");
|
VUtils.isTure(CollUtil.isEmpty(rowIds)).throwMessage("请选择要删除的数据");
|
||||||
upgradeChangeService.delChangeImpact(rowIds);
|
upgradeChangeService.delChangeImpact(rowIds);
|
||||||
|
|
@ -99,7 +99,7 @@ public class EbomApi extends BaseApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("updateChangeImpactVersion")
|
@PostMapping("updateChangeImpactVersion")
|
||||||
@ApiOperation("Ebom-更新版本")
|
@ApiOperation("变更影响-更新版本")
|
||||||
public ResultVO<Boolean> updateChangeImpactVersion(@RequestBody List<Long> rowIds){
|
public ResultVO<Boolean> updateChangeImpactVersion(@RequestBody List<Long> rowIds){
|
||||||
VUtils.isTure(CollUtil.isEmpty(rowIds)).throwMessage("请选择要更新版本的数据");
|
VUtils.isTure(CollUtil.isEmpty(rowIds)).throwMessage("请选择要更新版本的数据");
|
||||||
upgradeChangeService.updateChangeImpactVersion(rowIds);
|
upgradeChangeService.updateChangeImpactVersion(rowIds);
|
||||||
|
|
@ -359,13 +359,13 @@ public class EbomApi extends BaseApi {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("getrel")
|
// @GetMapping("getrel")
|
||||||
@ApiOperation("模糊匹配物料")
|
// @ApiOperation("模糊匹配物料")
|
||||||
public ResultVO<MaterialMateVO> getRelMaterial(@RequestParam(value = "materialName", required = false) String materialName ,@RequestParam(value = "materialTexture" ,required = false) String materialTexture ){
|
// public ResultVO<MaterialMateVO> getRelMaterial(@RequestParam(value = "materialName", required = false) String materialName ,@RequestParam(value = "materialTexture" ,required = false) String materialTexture ){
|
||||||
MaterialMateCache mateCache = new MaterialMateCache();
|
// MaterialMateCache mateCache = new MaterialMateCache();
|
||||||
MaterialMateVO materialMate = mateCache.findMaterialByNameOrmaterialTexture(materialName,materialTexture);
|
// MaterialMateVO materialMate = mateCache.findMaterialByNameOrmaterialTexture(materialName,materialTexture);
|
||||||
return ResultVO.success(materialMate) ;
|
// return ResultVO.success(materialMate) ;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.nflg.product.bomnew.mapper.master;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpdateDetailEntity;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* t_bom_new_ebom_update_detail 表数据库访问层
|
||||||
|
* 变更影响-变更具体明细(用于变更确认)
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-01-12 14:27:20
|
||||||
|
*/
|
||||||
|
public interface BomNewEbomUpdateDetailMapper extends BaseMapper<BomNewEbomUpdateDetailEntity> {
|
||||||
|
|
||||||
|
void delByVnoAndParentNo(@Param("virtualPackageMaterialNo")String virtualPackageMaterialNo, @Param("parentMaterialNo")String parentMaterialNo);
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,9 @@ package com.nflg.product.bomnew.mapper.master;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* t_bom_new_ebom_upgrade_change 表数据库访问层
|
* t_bom_new_ebom_upgrade_change 表数据库访问层
|
||||||
|
|
@ -11,4 +14,6 @@ import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
|
||||||
* @since 2023-12-22 13:44:47
|
* @since 2023-12-22 13:44:47
|
||||||
*/
|
*/
|
||||||
public interface BomNewEbomUpgradeChangeMapper extends BaseMapper<BomNewEbomUpgradeChangeEntity> {
|
public interface BomNewEbomUpgradeChangeMapper extends BaseMapper<BomNewEbomUpgradeChangeEntity> {
|
||||||
|
|
||||||
|
void delByVNo(@Param("vNoList")List<String> vNoList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.nflg.product.bomnew.mapper.master;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomVirtualPackageCompositionEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomVirtualPackageCompositionEntity;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* t_bom_new_ebom_virtual_package_composition 表数据库访问层
|
* t_bom_new_ebom_virtual_package_composition 表数据库访问层
|
||||||
|
|
@ -11,4 +12,6 @@ import com.nflg.product.bomnew.pojo.entity.BomNewEbomVirtualPackageCompositionEn
|
||||||
* @since 2023-12-22 13:44:10
|
* @since 2023-12-22 13:44:10
|
||||||
*/
|
*/
|
||||||
public interface BomNewEbomVirtualPackageCompositionMapper extends BaseMapper<BomNewEbomVirtualPackageCompositionEntity> {
|
public interface BomNewEbomVirtualPackageCompositionMapper extends BaseMapper<BomNewEbomVirtualPackageCompositionEntity> {
|
||||||
|
|
||||||
|
void delByVnoAndParentNo(@Param("virtualPackageMaterialNo")String virtualPackageMaterialNo, @Param("parentMaterialNo")String parentMaterialNo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
package com.nflg.product.bomnew.pojo.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* t_bom_new_ebom_update_detail
|
||||||
|
* 变更影响-变更具体明细(用于变更确认)
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-01-12 15:05:47
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel(value="com-nflg-product-bomnew-pojo-new-entity-BomNewEbomUpdateDetailEntity")
|
||||||
|
@TableName(value = "t_bom_new_ebom_update_detail")
|
||||||
|
public class BomNewEbomUpdateDetailEntity implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "row_id", type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "行ID")
|
||||||
|
private Long rowId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 影响到的物料编码(虚拟件编码)
|
||||||
|
*/
|
||||||
|
@TableField(value = "virtual_package_material_no")
|
||||||
|
@ApiModelProperty(value = "影响到的物料编码(虚拟件编码)")
|
||||||
|
private String virtualPackageMaterialNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 影响行父级物料编码
|
||||||
|
*/
|
||||||
|
@TableField(value = "parent_material_no")
|
||||||
|
@ApiModelProperty(value = "影响行父级物料编码")
|
||||||
|
private String parentMaterialNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 影响行父级版本号
|
||||||
|
*/
|
||||||
|
@TableField(value = "current_version")
|
||||||
|
@ApiModelProperty(value = "影响行父级版本号")
|
||||||
|
private String currentVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 影响行物料编码
|
||||||
|
*/
|
||||||
|
@TableField(value = "child_material_no")
|
||||||
|
@ApiModelProperty(value = "影响行物料编码")
|
||||||
|
private String childMaterialNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 影响行数量
|
||||||
|
*/
|
||||||
|
@TableField(value = "num")
|
||||||
|
@ApiModelProperty(value = "影响行数量")
|
||||||
|
private BigDecimal num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目类别
|
||||||
|
*/
|
||||||
|
@TableField(value = "project_type")
|
||||||
|
@ApiModelProperty(value = "项目类别")
|
||||||
|
private String projectType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "updated_time")
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 591631695584079922L;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,22 +1,24 @@
|
||||||
package com.nflg.product.bomnew.pojo.entity;
|
package com.nflg.product.bomnew.pojo.entity;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import java.time.LocalDateTime;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import java.io.Serializable;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* t_bom_new_ebom_virtual_package_composition
|
* t_bom_new_ebom_virtual_package_composition
|
||||||
*
|
* 虚拟包-提层项组成
|
||||||
*
|
*
|
||||||
* @author makejava
|
* @author makejava
|
||||||
* @since 2023-12-22 13:44:10
|
* @since 2024-01-12 15:05:49
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
|
|
@ -45,13 +47,6 @@ public class BomNewEbomVirtualPackageCompositionEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "父级物料编码")
|
@ApiModelProperty(value = "父级物料编码")
|
||||||
private String parentMaterialNo;
|
private String parentMaterialNo;
|
||||||
|
|
||||||
/**
|
|
||||||
* 标识全路径
|
|
||||||
*/
|
|
||||||
@TableField(value = "parent_full_path_material_no")
|
|
||||||
@ApiModelProperty(value = "标识全路径")
|
|
||||||
private String parentFullPathMaterialNo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子级物料编码
|
* 子级物料编码
|
||||||
*/
|
*/
|
||||||
|
|
@ -60,11 +55,11 @@ public class BomNewEbomVirtualPackageCompositionEntity implements Serializable {
|
||||||
private String childMaterialNo;
|
private String childMaterialNo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子级物料数量
|
* 全路径数量,从上到下。逗号隔开(不含本物料)
|
||||||
*/
|
*/
|
||||||
@TableField(value = "child_num")
|
@TableField(value = "parent_full_path_num")
|
||||||
@ApiModelProperty(value = "子级物料数量")
|
@ApiModelProperty(value = "全路径数量,从上到下。逗号隔开(不含本物料)")
|
||||||
private BigDecimal childNum;
|
private String parentFullPathNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单重
|
* 单重
|
||||||
|
|
@ -87,6 +82,13 @@ public class BomNewEbomVirtualPackageCompositionEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "数量")
|
@ApiModelProperty(value = "数量")
|
||||||
private BigDecimal num;
|
private BigDecimal num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子级物料项目类别
|
||||||
|
*/
|
||||||
|
@TableField(value = "project_type")
|
||||||
|
@ApiModelProperty(value = "子级物料项目类别")
|
||||||
|
private String projectType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
|
|
@ -94,6 +96,6 @@ public class BomNewEbomVirtualPackageCompositionEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "更新时间")
|
@ApiModelProperty(value = "更新时间")
|
||||||
private LocalDateTime updatedTime;
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
private static final long serialVersionUID = -45385735428516334L;
|
private static final long serialVersionUID = -50661114691989818L;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
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.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||||
|
|
@ -97,6 +98,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
@Resource
|
@Resource
|
||||||
private BomNewEbomUpgradeChangeService upgradeChangeService;
|
private BomNewEbomUpgradeChangeService upgradeChangeService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BomNewEbomUpdateDetailService updateDetailService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取列表
|
* 获取列表
|
||||||
*
|
*
|
||||||
|
|
@ -623,11 +627,35 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
|
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(eBomToPBom.getVirtualPackageCompositionResult())) {
|
if (CollUtil.isNotEmpty(eBomToPBom.getVirtualPackageCompositionResult())) {
|
||||||
|
//先删除
|
||||||
|
Set<String> delSet = eBomToPBom.getVirtualPackageCompositionResult().stream().map(u -> StrUtil.join("-", u.getVirtualPackageMaterialNo(), u.getParentMaterialNo())).collect(Collectors.toSet());
|
||||||
|
for (String s : delSet) {
|
||||||
|
String[] split = StrUtil.split(s, "-");
|
||||||
|
virtualPackageCompositionService.getBaseMapper().delByVnoAndParentNo(split[0],split[1]);
|
||||||
|
}
|
||||||
virtualPackageCompositionService.saveOrUpdateBatch(eBomToPBom.getVirtualPackageCompositionResult());
|
virtualPackageCompositionService.saveOrUpdateBatch(eBomToPBom.getVirtualPackageCompositionResult());
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
//记录变更影响
|
||||||
if (CollUtil.isNotEmpty(eBomToPBom.getUpgradeChangeResult())) {
|
if (CollUtil.isNotEmpty(eBomToPBom.getUpgradeChangeResult())) {
|
||||||
|
|
||||||
|
List<String> vNos = eBomToPBom.getUpgradeChangeResult().stream().map(u -> StrUtil.join( u.getMaterialNo(),u.getRelMaterialNo())).collect(Collectors.toList());
|
||||||
|
if(CollUtil.isNotEmpty(vNos)){
|
||||||
|
upgradeChangeService.getBaseMapper().delByVNo(vNos);
|
||||||
|
}
|
||||||
upgradeChangeService.saveOrUpdateBatch(eBomToPBom.getUpgradeChangeResult());
|
upgradeChangeService.saveOrUpdateBatch(eBomToPBom.getUpgradeChangeResult());
|
||||||
}
|
}
|
||||||
|
if (CollUtil.isNotEmpty(eBomToPBom.getUpgradeChangeDetailResult())) {
|
||||||
|
|
||||||
|
//先删除
|
||||||
|
Set<String> delSet = eBomToPBom.getUpgradeChangeDetailResult().stream().map(u -> StrUtil.join("-", u.getVirtualPackageMaterialNo(), u.getParentMaterialNo())).collect(Collectors.toSet());
|
||||||
|
for (String s : delSet) {
|
||||||
|
String[] split = StrUtil.split(s, "-");
|
||||||
|
updateDetailService.getBaseMapper().delByVnoAndParentNo(split[0],split[1]);
|
||||||
|
}
|
||||||
|
updateDetailService.saveOrUpdateBatch(eBomToPBom.getUpgradeChangeDetailResult());
|
||||||
|
}
|
||||||
|
}
|
||||||
List<Long> bomRowIds = bomTree.stream().filter(u -> u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
|
List<Long> bomRowIds = bomTree.stream().filter(u -> u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(bomRowIds)) {
|
if (CollUtil.isNotEmpty(bomRowIds)) {
|
||||||
this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), bomRowIds);
|
this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), bomRowIds);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.nflg.product.bomnew.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.nflg.product.bomnew.mapper.master.BomNewEbomUpdateDetailMapper;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpdateDetailEntity;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* t_bom_new_ebom_update_detail 表服务实现类
|
||||||
|
* 变更影响-变更具体明细(用于变更确认)
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-01-12 14:27:20
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BomNewEbomUpdateDetailService extends ServiceImpl<BomNewEbomUpdateDetailMapper, BomNewEbomUpdateDetailEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,23 @@
|
||||||
package com.nflg.product.bomnew.service;
|
package com.nflg.product.bomnew.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.nflg.product.bomnew.mapper.master.BomNewEbomUpdateDetailMapper;
|
||||||
import com.nflg.product.bomnew.mapper.master.BomNewEbomUpgradeChangeMapper;
|
import com.nflg.product.bomnew.mapper.master.BomNewEbomUpgradeChangeMapper;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpdateDetailEntity;
|
||||||
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.entity.BomNewPbomParentEntity;
|
||||||
|
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||||
|
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||||
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -19,6 +31,17 @@ import java.util.List;
|
||||||
public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgradeChangeMapper, BomNewEbomUpgradeChangeEntity> {
|
public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgradeChangeMapper, BomNewEbomUpgradeChangeEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BomNewEbomUpdateDetailService updateDetailService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BomNewEbomVirtualPackageCompositionService virtualPackageCompositionService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BomNewPbomParentService pbomParentService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
|
|
@ -29,14 +52,48 @@ public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgrad
|
||||||
/**
|
/**
|
||||||
* 更新版本
|
* 更新版本
|
||||||
*/
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateChangeImpactVersion(List<Long> rowIds){
|
public void updateChangeImpactVersion(List<Long> rowIds){
|
||||||
List<BomNewEbomUpgradeChangeEntity> upList = this.getBaseMapper().selectBatchIds(rowIds);
|
List<BomNewEbomUpgradeChangeEntity> upList = this.getBaseMapper().selectBatchIds(rowIds);
|
||||||
//
|
//
|
||||||
|
for ( BomNewEbomUpgradeChangeEntity ent:upList) {
|
||||||
|
handlerImpact(ent);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handlerImpact(BomNewEbomUpgradeChangeEntity ent){
|
||||||
|
//新的提层明细
|
||||||
|
List<BomNewEbomUpdateDetailEntity> newVirtualDetail = updateDetailService.lambdaQuery()
|
||||||
|
.eq(BomNewEbomUpdateDetailEntity::getVirtualPackageMaterialNo, ent.getMaterialNo())
|
||||||
|
.eq(BomNewEbomUpdateDetailEntity::getParentMaterialNo,ent.getRelMaterialNo())
|
||||||
|
.list();
|
||||||
|
//旧的体层明细
|
||||||
|
List<BomNewEbomVirtualPackageCompositionEntity> oldVirtualDetail = virtualPackageCompositionService.lambdaQuery()
|
||||||
|
.eq(BomNewEbomVirtualPackageCompositionEntity::getVirtualPackageMaterialNo, ent.getMaterialNo())
|
||||||
|
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentMaterialNo,ent.getRelMaterialNo())
|
||||||
|
.list();
|
||||||
|
|
||||||
|
// newVirtualDetail.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// BomNewPbomParentEntity vPbom = pbomParentService.lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, ent.getMaterialNo()).eq(BomNewPbomParentEntity::getLastVersionIs, 1).one();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// VUtils.isTure(Objects.isNull(vPbom)).throwMessage("未找到该虚拟包的Pbom 的版本");
|
||||||
|
// //现有Pbom明细
|
||||||
|
// List<BomNewPbomParentVO> pBomChild = pbomParentService.getChild(vPbom.getRowId());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addChild(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
package com.nflg.product.bomnew.service;
|
package com.nflg.product.bomnew.service;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.nflg.product.bomnew.mapper.master.BomNewEbomVirtualPackageCompositionMapper;
|
import com.nflg.product.bomnew.mapper.master.BomNewEbomVirtualPackageCompositionMapper;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomVirtualPackageCompositionEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomVirtualPackageCompositionEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* t_bom_new_ebom_virtual_package_composition 表服务实现类
|
* t_bom_new_ebom_virtual_package_composition 表服务实现类
|
||||||
*
|
* 虚拟包-提层项组成
|
||||||
*
|
*
|
||||||
* @author makejava
|
* @author makejava
|
||||||
* @since 2023-12-22 13:44:10
|
* @since 2024-01-12 10:28:36
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class BomNewEbomVirtualPackageCompositionService extends ServiceImpl<BomNewEbomVirtualPackageCompositionMapper, BomNewEbomVirtualPackageCompositionEntity> {
|
public class BomNewEbomVirtualPackageCompositionService extends ServiceImpl<BomNewEbomVirtualPackageCompositionMapper, BomNewEbomVirtualPackageCompositionEntity> {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||||
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
||||||
import com.nflg.product.bomnew.service.MaterialMainService;
|
import com.nflg.product.bomnew.service.MaterialMainService;
|
||||||
|
import com.nflg.product.bomnew.util.BomLevelUtil;
|
||||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||||
import com.nflg.product.bomnew.util.TreeUtils;
|
import com.nflg.product.bomnew.util.TreeUtils;
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
|
|
@ -198,7 +199,7 @@ public class CheckEBomException {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (BomNewEbomParentVO exItem : exceptionList) {
|
for (BomNewEbomParentVO exItem : exceptionList) {
|
||||||
List<String> parentByLevel = getParentByLevel(exItem.getLevelNo());
|
List<String> parentByLevel = BomLevelUtil.getParentByLevel(exItem.getLevelNo());
|
||||||
List<BomNewEbomParentVO> warnList = allBomDetail.stream().filter(u -> u.getBomRowId() > 0 && parentByLevel.contains(u.getLevelNo()) && EBomExceptionStatusEnum.OK.equalsValue(u.getExceptionStatus())).collect(Collectors.toList());
|
List<BomNewEbomParentVO> warnList = allBomDetail.stream().filter(u -> u.getBomRowId() > 0 && parentByLevel.contains(u.getLevelNo()) && EBomExceptionStatusEnum.OK.equalsValue(u.getExceptionStatus())).collect(Collectors.toList());
|
||||||
for (BomNewEbomParentVO k :warnList) {
|
for (BomNewEbomParentVO k :warnList) {
|
||||||
k.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue());
|
k.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue());
|
||||||
|
|
@ -211,16 +212,7 @@ public class CheckEBomException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getParentByLevel(String levelNo){
|
|
||||||
List<String> result=new ArrayList<>();
|
|
||||||
String[] parts = levelNo.split("-");
|
|
||||||
|
|
||||||
for (int i=parts.length;i>1;i--) {
|
|
||||||
result.add( String.join("-", Arrays.copyOfRange(parts, 0, i-1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查循环依赖
|
* 检查循环依赖
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,12 @@ import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
import com.nflg.product.bomnew.constant.EBomExceptionStatusEnum;
|
import com.nflg.product.bomnew.constant.EBomExceptionStatusEnum;
|
||||||
import com.nflg.product.bomnew.constant.EBomStatusEnum;
|
import com.nflg.product.bomnew.constant.EBomStatusEnum;
|
||||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
|
import com.nflg.product.bomnew.pojo.entity.*;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomVirtualPackageCompositionEntity;
|
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
|
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||||
import com.nflg.product.bomnew.service.BomNewEbomVirtualPackageCompositionService;
|
import com.nflg.product.bomnew.service.BomNewEbomVirtualPackageCompositionService;
|
||||||
import com.nflg.product.bomnew.service.BomNewPbomChildService;
|
import com.nflg.product.bomnew.service.BomNewPbomChildService;
|
||||||
import com.nflg.product.bomnew.service.BomNewPbomParentService;
|
import com.nflg.product.bomnew.service.BomNewPbomParentService;
|
||||||
|
import com.nflg.product.bomnew.util.BomLevelUtil;
|
||||||
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;
|
||||||
|
|
@ -61,13 +59,10 @@ public class EBomToPBom {
|
||||||
@Getter
|
@Getter
|
||||||
private List<BomNewEbomUpgradeChangeEntity> upgradeChangeResult = new ArrayList<>();
|
private List<BomNewEbomUpgradeChangeEntity> upgradeChangeResult = new ArrayList<>();
|
||||||
|
|
||||||
// @Getter
|
@Getter
|
||||||
// private List<Long> hasConvertEBomRowIds=new ArrayList<>();
|
private List<BomNewEbomUpdateDetailEntity> upgradeChangeDetailResult=new ArrayList<>();
|
||||||
|
|
||||||
|
private Set<String> hasBuildVNo = Sets.newHashSet();
|
||||||
private Map<String, String> generateDrawingNoMap = new HashMap<>();
|
|
||||||
|
|
||||||
private Set<String> upChangeMaterialSet = new HashSet<>();
|
|
||||||
|
|
||||||
|
|
||||||
public EBomToPBom(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail, List<String> inFacCodes, Long parentRowId) {
|
public EBomToPBom(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail, List<String> inFacCodes, Long parentRowId) {
|
||||||
|
|
@ -82,6 +77,7 @@ public class EBomToPBom {
|
||||||
* 31項体层
|
* 31項体层
|
||||||
*/
|
*/
|
||||||
public void convert() {
|
public void convert() {
|
||||||
|
|
||||||
//效验数据是否OK
|
//效验数据是否OK
|
||||||
check();
|
check();
|
||||||
//bom 提层
|
//bom 提层
|
||||||
|
|
@ -91,6 +87,10 @@ public class EBomToPBom {
|
||||||
for (String facCode : facCodes) {
|
for (String facCode : facCodes) {
|
||||||
//buildPBomParent(parent, facCode);
|
//buildPBomParent(parent, facCode);
|
||||||
for (BomNewEbomParentVO vo : parentList) {
|
for (BomNewEbomParentVO vo : parentList) {
|
||||||
|
//构建变更明细
|
||||||
|
buildUpgradeChangeDetail(vo,VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||||
|
buildUpgradeChangeDetail(vo,VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||||
|
|
||||||
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode);
|
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode);
|
||||||
//子级
|
//子级
|
||||||
List<BomNewEbomParentVO> child = result.stream().filter(u -> u.getParentRowId().equals(vo.getBomRowId())).collect(Collectors.toList());
|
List<BomNewEbomParentVO> child = result.stream().filter(u -> u.getParentRowId().equals(vo.getBomRowId())).collect(Collectors.toList());
|
||||||
|
|
@ -190,9 +190,11 @@ public class EBomToPBom {
|
||||||
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
|
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
|
||||||
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
||||||
result.add(vo);
|
result.add(vo);
|
||||||
} else { //当没找到直发包时,记录到变更影响
|
|
||||||
// buildUpgradeChange(vo);
|
|
||||||
}
|
}
|
||||||
|
//当没找到直发包时,丢弃
|
||||||
|
// else {
|
||||||
|
// // buildUpgradeChange(vo);
|
||||||
|
// }
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(vo.getProjectType()) && vo.getProjectType().equals(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getProductTypeKey())) {
|
if (StrUtil.isNotBlank(vo.getProjectType()) && vo.getProjectType().equals(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getProductTypeKey())) {
|
||||||
|
|
@ -203,44 +205,72 @@ public class EBomToPBom {
|
||||||
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
|
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
|
||||||
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
||||||
result.add(vo);
|
result.add(vo);
|
||||||
} else { //当没找到直发包时,记录到变更影响
|
|
||||||
// buildUpgradeChange(vo);
|
|
||||||
}
|
}
|
||||||
|
// else { //当没找到直发包时,丢弃
|
||||||
|
// // buildUpgradeChange(vo);
|
||||||
|
// }
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result.add(vo);
|
result.add(vo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//变更记录
|
//变更记录(明细)
|
||||||
private void buildUpgradeChange(BomNewEbomParentVO vo) {
|
private void buildUpgradeChangeDetail(BomNewEbomParentVO parent,VirtualPackageTypeEnum packageTypeEnum) {
|
||||||
List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId())).collect(Collectors.toList());
|
|
||||||
VUtils.isTure(CollUtil.isNotEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级");
|
|
||||||
List<BomNewEbomVirtualPackageCompositionEntity> list = SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).lambdaQuery()
|
|
||||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentMaterialNo, voParent.get(0).getMaterialNo()).list();
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
if (upChangeMaterialSet.contains(voParent.get(0).getMaterialNo())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Map<String, List<BomNewEbomVirtualPackageCompositionEntity>> vMaterialMap = ListCommonUtil.listGroupMap(list, BomNewEbomVirtualPackageCompositionEntity::getParentFullPathMaterialNo);
|
|
||||||
Set<String> oldMaterialNoAndNumSet = new HashSet<>();
|
|
||||||
for (String key : vMaterialMap.keySet()) {
|
|
||||||
oldMaterialNoAndNumSet = vMaterialMap.get(key).stream().map(u -> StrUtil.join("-", u.getChildMaterialNo(), u.getNum())).collect(Collectors.toSet());
|
|
||||||
|
|
||||||
}
|
List<BomNewEbomVirtualPackageCompositionEntity> list = SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).lambdaQuery()
|
||||||
Set<String> newSet = allBomDetail.stream().filter(u -> u.getParentRowId().equals(vo.getParentRowId()) && Objects.nonNull(u.getProjectType()) && vo.getProjectType().equals(u.getProjectType())).map(u -> StrUtil.join("-", u.getMaterialNo(), u.getNum())).collect(Collectors.toSet());
|
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentMaterialNo, parent.getMaterialNo())
|
||||||
|
.eq(BomNewEbomVirtualPackageCompositionEntity::getProjectType, packageTypeEnum.getProductTypeKey()).list();
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
//老的虚拟包组成
|
||||||
|
Set<String> oldMaterialNoAndNumSet = list.stream().filter(u-> u.getParentMaterialNo().equals(parent.getMaterialNo())).map(u->StrUtil.join("-", u.getChildMaterialNo(),u.getNum())).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
List<BomNewEbomParentVO> parentChildren = allBomDetail.stream().filter(u -> u.getParentRowId().equals(parent.getBomRowId())).collect(Collectors.toList());
|
||||||
|
//物料编码 +数量
|
||||||
|
Set<String> newSet = parentChildren.stream().filter(u -> Objects.nonNull(u.getProjectType()) && VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getProductTypeKey().equals(u.getProjectType())).map(u -> StrUtil.join("-", u.getMaterialNo(), u.getNum())).collect(Collectors.toSet());
|
||||||
//bom 发生了改变-影响了虚拟包
|
//bom 发生了改变-影响了虚拟包
|
||||||
if (CollUtil.isNotEmpty(Sets.difference(oldMaterialNoAndNumSet, newSet)) || CollUtil.isNotEmpty(Sets.difference(newSet, oldMaterialNoAndNumSet))) {
|
if (CollUtil.isNotEmpty(Sets.difference(oldMaterialNoAndNumSet, newSet)) || CollUtil.isNotEmpty(Sets.difference(newSet, oldMaterialNoAndNumSet))) {
|
||||||
upChangeMaterialSet.add(parent.getMaterialNo());
|
|
||||||
buildUpgradeChange(list, voParent.get(0));
|
List<String> vmaterialNoList = list.stream().map(u -> u.getVirtualPackageMaterialNo()).distinct().collect(Collectors.toList());
|
||||||
|
//记录变更明细行
|
||||||
|
buildChangeDetailD0(vmaterialNoList,parent, parentChildren);
|
||||||
|
//变更
|
||||||
|
buildUpgradeChange(list, parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buildChangeDetailD0( List<String> vmaterialNoList, BomNewEbomParentVO parent, List<BomNewEbomParentVO> parentChildren){
|
||||||
|
for (BomNewEbomParentVO vo : parentChildren) {
|
||||||
|
for (String vNo:vmaterialNoList) {
|
||||||
|
BomNewEbomUpdateDetailEntity changeDetailEnt=new BomNewEbomUpdateDetailEntity();
|
||||||
|
changeDetailEnt.setRowId(IdWorker.getId());
|
||||||
|
changeDetailEnt.setVirtualPackageMaterialNo(vNo);
|
||||||
|
changeDetailEnt.setParentMaterialNo(parent.getMaterialNo());
|
||||||
|
changeDetailEnt.setCurrentVersion(parent.getCurrentVersion());
|
||||||
|
changeDetailEnt.setChildMaterialNo(vo.getMaterialNo());
|
||||||
|
changeDetailEnt.setNum(vo.getNum());
|
||||||
|
changeDetailEnt.setProjectType(vo.getProjectType());
|
||||||
|
changeDetailEnt.setUpdatedTime(LocalDateTime.now());
|
||||||
|
|
||||||
|
this.upgradeChangeDetailResult.add(changeDetailEnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void buildUpgradeChange(List<BomNewEbomVirtualPackageCompositionEntity> changeList, BomNewEbomParentVO parent) {
|
private void buildUpgradeChange(List<BomNewEbomVirtualPackageCompositionEntity> changeList, BomNewEbomParentVO parent) {
|
||||||
List<String> vmaterialNoList = changeList.stream().map(u -> u.getVirtualPackageMaterialNo()).distinct().collect(Collectors.toList());
|
List<String> vmaterialNoList = changeList.stream().map(u -> u.getVirtualPackageMaterialNo()).distinct().collect(Collectors.toList());
|
||||||
for (String vmaterialNo : vmaterialNoList) {
|
for (String vmaterialNo : vmaterialNoList) {
|
||||||
|
String key = StrUtil.join("-", vmaterialNo, parent.getMaterialNo());
|
||||||
|
if(hasBuildVNo.contains(key))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
BomNewEbomUpgradeChangeEntity changeEntity = new BomNewEbomUpgradeChangeEntity();
|
BomNewEbomUpgradeChangeEntity changeEntity = new BomNewEbomUpgradeChangeEntity();
|
||||||
changeEntity.setRowId(IdWorker.getId());
|
changeEntity.setRowId(IdWorker.getId());
|
||||||
changeEntity.setMaterialNo(vmaterialNo);
|
changeEntity.setMaterialNo(vmaterialNo);
|
||||||
|
|
@ -252,6 +282,8 @@ public class EBomToPBom {
|
||||||
changeEntity.setRelMaterialDesc(parent.getMaterialDesc());
|
changeEntity.setRelMaterialDesc(parent.getMaterialDesc());
|
||||||
changeEntity.setStatus(0);
|
changeEntity.setStatus(0);
|
||||||
upgradeChangeResult.add(changeEntity);
|
upgradeChangeResult.add(changeEntity);
|
||||||
|
|
||||||
|
hasBuildVNo.add( key);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -265,54 +297,37 @@ public class EBomToPBom {
|
||||||
*/
|
*/
|
||||||
private void liftingLayerSummary(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo) {
|
private void liftingLayerSummary(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo) {
|
||||||
BigDecimal sum = vo.getNum();
|
BigDecimal sum = vo.getNum();
|
||||||
String parentLevelNo = vo.getLevelNo().substring(0, vo.getLevelNo().length() - 2);
|
String parentLevelNo = BomLevelUtil.getParentLevelNo(vo.getLevelNo());
|
||||||
List<String> parentFullPathMaterialNoList = new ArrayList<>();
|
List<BigDecimal> parentFullPathNum = new ArrayList<>();
|
||||||
while (parentLevelNo.length() >= lastVirtualPackage.getLevelNo().length()) {
|
while (parentLevelNo.length() >= lastVirtualPackage.getLevelNo().length()) {
|
||||||
String pNo = parentLevelNo;
|
String pNo = parentLevelNo;
|
||||||
List<BomNewEbomParentVO> parentList = allBomDetail.stream().filter(u -> u.getLevelNo().equals(pNo) && !u.getMaterialName().contains(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getConMaterialName()) &&
|
List<BomNewEbomParentVO> parentList = allBomDetail.stream().filter(u -> u.getLevelNo().equals(pNo)).collect(Collectors.toList());
|
||||||
!u.getMaterialName().contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getConMaterialName()) && !u.getMaterialName().contains(VirtualPackageTypeEnum.MAKING_PACKAGE.getConMaterialName()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (CollUtil.isNotEmpty(parentList)) {
|
if (CollUtil.isNotEmpty(parentList)) {
|
||||||
sum = NumberUtil.mul(sum, parentList.get(0).getNum());
|
sum = NumberUtil.mul(sum, parentList.get(0).getNum());
|
||||||
parentFullPathMaterialNoList.add(parentList.get(0).getMaterialNo());
|
parentFullPathNum.add(parentList.get(0).getNum());
|
||||||
} else {
|
} else {
|
||||||
parentFullPathMaterialNoList.add(vo.getMaterialNo());
|
parentFullPathNum.add(parentList.get(0).getNum());
|
||||||
}
|
}
|
||||||
parentLevelNo = parentLevelNo.substring(0, parentLevelNo.length() - 2);
|
parentLevelNo = BomLevelUtil.getParentLevelNo(parentLevelNo);
|
||||||
|
|
||||||
}
|
}
|
||||||
vo.setNum(sum);
|
vo.setNum(sum);
|
||||||
//构建虚拟包组成
|
//构建虚拟包组成
|
||||||
buildVirtualPackageComposition(lastVirtualPackage, vo, parentFullPathMaterialNoList);
|
buildVirtualPackageComposition(lastVirtualPackage, vo, parentFullPathNum);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildVirtualPackageComposition(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo, List<String> parentFullPathMaterialNoList) {
|
private void buildVirtualPackageComposition(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo, List<BigDecimal> parentFullPathNum) {
|
||||||
Collections.reverse(parentFullPathMaterialNoList);
|
|
||||||
String fullPath = StrUtil.join("-", parentFullPathMaterialNoList);
|
|
||||||
List<BomNewEbomVirtualPackageCompositionEntity> list = SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).lambdaQuery()
|
|
||||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentFullPathMaterialNo, fullPath)
|
|
||||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getVirtualPackageMaterialNo, lastVirtualPackage.getMaterialNo()).list();
|
|
||||||
//删除旧的
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
List<Long> delRowIds = list.stream().map(u -> u.getRowId()).collect(Collectors.toList());
|
|
||||||
SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).getBaseMapper().deleteBatchIds(delRowIds);
|
|
||||||
}
|
|
||||||
BomNewEbomVirtualPackageCompositionEntity packageCompositionEntity = new BomNewEbomVirtualPackageCompositionEntity();
|
BomNewEbomVirtualPackageCompositionEntity packageCompositionEntity = new BomNewEbomVirtualPackageCompositionEntity();
|
||||||
packageCompositionEntity.setRowId(IdWorker.getId());
|
packageCompositionEntity.setRowId(IdWorker.getId());
|
||||||
packageCompositionEntity.setVirtualPackageMaterialNo(lastVirtualPackage.getMaterialNo());
|
packageCompositionEntity.setVirtualPackageMaterialNo(lastVirtualPackage.getMaterialNo());
|
||||||
List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId())).collect(Collectors.toList());
|
List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId())).collect(Collectors.toList());
|
||||||
VUtils.isTure(CollUtil.isEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级");
|
VUtils.isTure(CollUtil.isEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级");
|
||||||
if (voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getConMaterialName()) &&
|
|
||||||
!voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getConMaterialName()) && !voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.MAKING_PACKAGE.getConMaterialName())) {
|
|
||||||
packageCompositionEntity.setParentMaterialNo(voParent.get(0).getMaterialNo());
|
packageCompositionEntity.setParentMaterialNo(voParent.get(0).getMaterialNo());
|
||||||
} else {
|
|
||||||
packageCompositionEntity.setParentMaterialNo(vo.getMaterialNo());
|
|
||||||
}
|
|
||||||
|
|
||||||
packageCompositionEntity.setParentFullPathMaterialNo(fullPath);
|
|
||||||
packageCompositionEntity.setChildMaterialNo(vo.getMaterialNo());
|
packageCompositionEntity.setChildMaterialNo(vo.getMaterialNo());
|
||||||
packageCompositionEntity.setChildNum(vo.getNum());
|
packageCompositionEntity.setParentFullPathNum(StrUtil.join(",",parentFullPathNum));
|
||||||
|
packageCompositionEntity.setProjectType(vo.getProjectType());
|
||||||
packageCompositionEntity.setUnitWeight(vo.getUnitWeight());
|
packageCompositionEntity.setUnitWeight(vo.getUnitWeight());
|
||||||
packageCompositionEntity.setTotalWeight(vo.getTotalWeight());
|
packageCompositionEntity.setTotalWeight(vo.getTotalWeight());
|
||||||
packageCompositionEntity.setUpdatedTime(LocalDateTime.now());
|
packageCompositionEntity.setUpdatedTime(LocalDateTime.now());
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.nflg.product.bomnew.util;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BomLevelUtil {
|
||||||
|
|
||||||
|
public static List<String> getParentByLevel(String levelNo){
|
||||||
|
List<String> result=new ArrayList<>();
|
||||||
|
String[] parts = levelNo.split("-");
|
||||||
|
|
||||||
|
for (int i=parts.length;i>1;i--) {
|
||||||
|
result.add( String.join("-", Arrays.copyOfRange(parts, 0, i-1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getParentLevelNo(String levelNo){
|
||||||
|
List<String> result=new ArrayList<>();
|
||||||
|
String[] parts = levelNo.split("-");
|
||||||
|
return String.join("-", Arrays.copyOfRange(parts, 0, levelNo.length()-1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.nflg.product.bomnew.mapper.master.BomNewEbomUpdateDetailMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.nflg.product.bomnew.pojo.entity.BomNewEbomUpdateDetailEntity">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table t_bom_new_ebom_update_detail -->
|
||||||
|
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
|
||||||
|
<result column="virtual_package_material_no" property="virtualPackageMaterialNo" jdbcType="VARCHAR"/>
|
||||||
|
<result column="parent_material_no" property="parentMaterialNo" jdbcType="VARCHAR"/>
|
||||||
|
<result column="current_version" property="currentVersion" jdbcType="VARCHAR"/>
|
||||||
|
<result column="child_material_no" property="childMaterialNo" jdbcType="VARCHAR"/>
|
||||||
|
<result column="num" property="num" jdbcType="DECIMAL"/>
|
||||||
|
<result column="project_type" property="projectType" jdbcType="VARCHAR"/>
|
||||||
|
<result column="updated_time" property="updatedTime" jdbcType="TIMESTAMP"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
row_id, virtual_package_material_no, parent_material_no, current_version, child_material_no, num, updated_time </sql>
|
||||||
|
|
||||||
|
|
||||||
|
<delete id="delByVnoAndParentNo">
|
||||||
|
delete from t_bom_new_ebom_update_detail
|
||||||
|
where virtual_package_material_no=#{virtualPackageMaterialNo}
|
||||||
|
and parent_material_no=#{parentMaterialNo}}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
|
|
@ -23,4 +23,11 @@
|
||||||
row_id, material_no, version_old, version_new, material_name, drawing_no, devise_name, dept_name,
|
row_id, material_no, version_old, version_new, material_name, drawing_no, devise_name, dept_name,
|
||||||
rel_material_no, rel_material_desc, status, updated_time
|
rel_material_no, rel_material_desc, status, updated_time
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<delete id="delByVNo">
|
||||||
|
delete from t_bom_new_ebom_upgrade_change where status=0 and concat(material_no, rel_material_no) in
|
||||||
|
<foreach collection="vNoList" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -7,18 +7,24 @@
|
||||||
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
|
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
|
||||||
<result column="virtual_package_material_no" property="virtualPackageMaterialNo" jdbcType="VARCHAR"/>
|
<result column="virtual_package_material_no" property="virtualPackageMaterialNo" jdbcType="VARCHAR"/>
|
||||||
<result column="parent_material_no" property="parentMaterialNo" jdbcType="VARCHAR"/>
|
<result column="parent_material_no" property="parentMaterialNo" jdbcType="VARCHAR"/>
|
||||||
<result column="parent_full_path_material_no" property="parentFullPathMaterialNo" jdbcType="VARCHAR"/>
|
|
||||||
<result column="child_material_no" property="childMaterialNo" jdbcType="VARCHAR"/>
|
<result column="child_material_no" property="childMaterialNo" jdbcType="VARCHAR"/>
|
||||||
<result column="child_num" property="childNum" jdbcType="DECIMAL"/>
|
<result column="parent_full_path_num" property="parentFullPathNum" jdbcType="VARCHAR"/>
|
||||||
<result column="unit_weight" property="unitWeight" jdbcType="DECIMAL"/>
|
<result column="unit_weight" property="unitWeight" jdbcType="DECIMAL"/>
|
||||||
<result column="total_weight" property="totalWeight" jdbcType="DECIMAL"/>
|
<result column="total_weight" property="totalWeight" jdbcType="DECIMAL"/>
|
||||||
<result column="num" property="num" jdbcType="DECIMAL"/>
|
<result column="num" property="num" jdbcType="DECIMAL"/>
|
||||||
|
<result column="project_type" property="projectType" jdbcType="VARCHAR"/>
|
||||||
<result column="updated_time" property="updatedTime" jdbcType="TIMESTAMP"/>
|
<result column="updated_time" property="updatedTime" jdbcType="TIMESTAMP"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
row_id, virtual_package_material_no, parent_material_no, parent_full_path_material_no, child_material_no,
|
row_id, virtual_package_material_no, parent_material_no, child_material_no, parent_full_path_num,
|
||||||
child_num, unit_weight, total_weight, num, updated_time
|
unit_weight, total_weight, num, updated_time
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<delete id="delByVnoAndParentNo">
|
||||||
|
delete from t_bom_new_ebom_virtual_package_composition
|
||||||
|
where virtual_package_material_no=#{virtualPackageMaterialNo}
|
||||||
|
and parent_material_no=#{parentMaterialNo}}
|
||||||
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue