1、变更影响-升级
This commit is contained in:
parent
1d85e0468a
commit
6176f3b903
|
|
@ -116,7 +116,7 @@ public class BomNewEbomUpgradeChangeEntity implements Serializable {
|
|||
@ApiModelProperty(value = "虚拟包父级物料编码")
|
||||
private String virtualMaterialParentMaterialNo;
|
||||
|
||||
@TableField(value = "virtual_material_parent_material_no")
|
||||
@TableField(value = "fac_code")
|
||||
@ApiModelProperty("工厂编码")
|
||||
private String facCode;
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgrad
|
|||
BomNewEbomParentService ebomParentService;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
|
|
@ -79,7 +81,7 @@ public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgrad
|
|||
|
||||
BomNewEbomParentEntity ebom = ebomParentService.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, ent.getVirtualMaterialParentMaterialNo())
|
||||
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).last(" order by current_version desc limit 1").one();
|
||||
if(Objects.isNull(ebom)){
|
||||
if(Objects.nonNull(ebom)){
|
||||
|
||||
List<BomNewEbomParentVO> bomTree =ebomParentService.getFormalBomTree(ebom.getRowId());
|
||||
BomNewEbomParentVO parentBom = Convert.convert(BomNewEbomParentVO.class, ebom);
|
||||
|
|
@ -96,16 +98,18 @@ public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgrad
|
|||
if(CollUtil.isNotEmpty(updateImpact.getPBomChildResult())){
|
||||
pbomChildService.saveOrUpdateBatch(updateImpact.getPBomChildResult());
|
||||
}
|
||||
//旧版PBOM移动到历史表中
|
||||
if(CollUtil.isNotEmpty(updateImpact.getOldPBomList())){
|
||||
List<Long> oldPBomRowIds = updateImpact.getOldPBomList().stream().map(u -> u.getRowId()).collect(Collectors.toList());
|
||||
pbomParentService.getBaseMapper().insertPBomParentToFormal(oldPBomRowIds);
|
||||
pbomParentService.getBaseMapper().insertPBomChildToFormal(oldPBomRowIds);
|
||||
pbomParentService.getBaseMapper().delPBom(oldPBomRowIds);
|
||||
}
|
||||
ent.setStatus(1);
|
||||
ent.setUpdatedTime(LocalDateTime.now());
|
||||
this.save(ent);
|
||||
this.updateById(ent);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,11 @@ public class ChangeImpactUpgrade extends EBomToPbomBase {
|
|||
//需升级虚拟包编码
|
||||
private String vMaterialNo;
|
||||
|
||||
//旧版Pbom-需移到历史表中
|
||||
|
||||
@Getter
|
||||
private List<BomNewPbomParentEntity> oldPBomList=new ArrayList<>();
|
||||
|
||||
|
||||
public ChangeImpactUpgrade(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail, List<String> inFacCodes, String vMaterialNo) {
|
||||
this.parent = inParent;
|
||||
|
|
@ -116,7 +121,7 @@ public class ChangeImpactUpgrade extends EBomToPbomBase {
|
|||
.eq(BomNewPbomParentEntity::getMaterialNo, parentVo.getMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getFacCode, facCode).last(" order by current_version desc limit 1").one();
|
||||
|
||||
if (Objects.isNull(oldParent) || !samePBomIs(oldParent.getRowId(), newChild)) {
|
||||
if (Objects.isNull(oldParent) || samePBomIs(oldParent.getRowId(), newChild)) {
|
||||
return null;
|
||||
}
|
||||
//pbom 处于工作表
|
||||
|
|
@ -149,7 +154,7 @@ public class ChangeImpactUpgrade extends EBomToPbomBase {
|
|||
BeanUtil.copyProperties(parentVo, pBomParent, "sourceRowId");
|
||||
pBomParent.setSourceRowId(parentVo.getBomRowId());
|
||||
pBomParent.setRowId(IdWorker.getId());
|
||||
pBomParent.setStatus(PBomStatusEnum.WAIT_PUBLISH.getValue());
|
||||
pBomParent.setStatus(PBomStatusEnum.PUBLISH.getValue());
|
||||
pBomParent.setLastVersionIs(1);
|
||||
pBomParent.setFacCode(facCode);
|
||||
pBomParent.setTechnologyUserCode(SessionUtil.getUserCode());
|
||||
|
|
@ -163,6 +168,8 @@ public class ChangeImpactUpgrade extends EBomToPbomBase {
|
|||
oldParent.setExpireEndTime(LocalDateTime.now());
|
||||
oldParent.setLastVersionIs(0);
|
||||
this.pBomParentResult.add(oldParent);
|
||||
this.oldPBomList.add(oldParent);
|
||||
|
||||
}
|
||||
this.pBomParentResult.add(pBomParent);
|
||||
return pBomParent;
|
||||
|
|
|
|||
|
|
@ -460,10 +460,15 @@ public abstract class EBomToPbomBase {
|
|||
|
||||
private void buildChangeImpactEntity(BomNewEbomVirtualPackageCompositionEntity v, BomNewEbomParentVO vo) {
|
||||
|
||||
List<BomNewEbomUpgradeChangeEntity> checkExists = upgradeChangeResult.stream().filter(u -> u.getMaterialNo().equals(v.getVirtualPackageMaterialNo()) && u.getRelMaterialNo().equals(vo.getMaterialNo())).collect(Collectors.toList());
|
||||
List<BomNewEbomUpgradeChangeEntity> checkExists = upgradeChangeResult.stream().filter(u -> u.getMaterialNo().equals(v.getVirtualPackageMaterialNo())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(checkExists)) {
|
||||
return;
|
||||
}
|
||||
List<BomNewEbomUpgradeChangeEntity> noHanlderV = SpringUtil.getBean(BomNewEbomUpgradeChangeService.class).lambdaQuery().eq(BomNewEbomUpgradeChangeEntity::getMaterialNo, v.getVirtualPackageMaterialNo())
|
||||
.eq(BomNewEbomUpgradeChangeEntity::getStatus, 0).list();
|
||||
if (CollUtil.isNotEmpty(noHanlderV)) {
|
||||
return;
|
||||
}
|
||||
BomNewEbomUpgradeChangeEntity changeEntity = new BomNewEbomUpgradeChangeEntity();
|
||||
changeEntity.setRowId(IdWorker.getId());
|
||||
changeEntity.setMaterialNo(v.getVirtualPackageMaterialNo());
|
||||
|
|
|
|||
Loading…
Reference in New Issue