diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java index de30d3f8..2f47719b 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java @@ -272,7 +272,7 @@ public class EbomApi extends BaseApi { @ApiOperation("更新物料行") public ResultVO> changeMaterial(@RequestBody BomNewEBomChangeDTO dto) { if ( dto.getParent() ==null || CollectionUtil.isEmpty(dto.getDatas()) ) { - return ResultVO.error(STATE.Error, ""); + return ResultVO.error(STATE.Error, "选择更新的数据"); } return ResultVO.success(bomNewEbomParentService.changeMaterial(dto)); diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomParentVO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomParentVO.java index 4984a39e..dd41aee0 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomParentVO.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomParentVO.java @@ -277,6 +277,13 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable { @ApiModelProperty("来源行-父项物料编码") private String sourceParentMaterialNo; + @ApiModelProperty("是否虚拟包 0-否 1-是") + private Integer virtualPackageIs; + + + + + private List childNodes = Collections.emptyList(); private static final long serialVersionUID = 1L; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java index c7a64fcb..707528c9 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java @@ -252,10 +252,12 @@ public class BomNewEbomParentService extends ServiceImpl updateWrapper = new UpdateWrapper<>(); updateWrapper.lambda() - .set(BomNewEbomParentEntity::getAuditTime, LocalDateTime.now()) - .set(BomNewEbomParentEntity::getAuditUserName, SessionUtil.getUserName()) + .set(BomNewEbomParentEntity::getRevertTime, LocalDateTime.now()) + .set(BomNewEbomParentEntity::getRevertUserName, SessionUtil.getUserName()) .set(BomNewEbomParentEntity::getStatus, EBomStatusEnum.RETURNED.getValue()) .set(BomNewEbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_CREATED.getValue()) .in(BomNewEbomParentEntity::getRowId, revertList); @@ -1213,15 +1216,30 @@ public class BomNewEbomParentService extends ServiceImpl changeMaterial(BomNewEBomChangeDTO dto) { + + CheckEBomException.checkMaterialNoInMain(dto.getDatas()); + List parentChild = dto.getDatas(); - materialMainService.intiMaterialInfo(parentChild); + // materialMainService.intiMaterialInfo(parentChild); List checkBom = new ArrayList<>(); - checkBom.add(dto.getParent()); + // checkBom.add(dto.getParent()); checkBom.addAll(dto.getDatas()); CheckEBomException checkEBomException = new CheckEBomException(checkBom); - checkEBomException.checkException(); + checkEBomException.initException(); + if(CollectionUtil.isNotEmpty(dto.getDatas())){ + for (BomNewEbomParentVO vo: + dto.getDatas()) { + if(Objects.isNull(vo.getRowId())){ + vo.setDeviseUserCode(SessionUtil.getUserCode()); + vo.setDeviseName(SessionUtil.getRealName()); + vo.setCreatedBy(SessionUtil.getUserCode()); + + } + } + } + return dto.getDatas(); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java index 10f1d742..803fa325 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java @@ -7,11 +7,13 @@ import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; import com.google.common.collect.ImmutableList; +import com.google.common.collect.Sets; import com.nflg.product.base.core.exception.NflgBusinessException; import com.nflg.product.bomnew.constant.EBomExceptionStatusEnum; import com.nflg.product.bomnew.constant.MaterialGetEnum; import com.nflg.product.bomnew.constant.ProjectTypeInputTypeEnum; import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity; +import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO; import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO; import com.nflg.product.bomnew.service.BomNewEbomParentService; import com.nflg.product.bomnew.service.MaterialMainService; @@ -22,10 +24,7 @@ import lombok.Getter; import nflg.product.common.constant.STATE; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; @@ -37,6 +36,24 @@ public class CheckEBomException { @Getter List allBomDetail ; + + + + public static void checkMaterialNoInMain1(List materialNos){ + // List materialNos = dto.getDatas().stream().map(u -> u.getMaterialNo()).collect(Collectors.toList()); + //检查物料编码是否在主数据中存在 + List materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos); + List effectiveMaterialNos = materialBaseInfo.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList()); + Set difference = Sets.difference(new HashSet<>(materialNos), new HashSet<>(effectiveMaterialNos)); + VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料档案中不存在"); + } + + public static void checkMaterialNoInMain(List list){ + List materialNos = list.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList()); + checkMaterialNoInMain1(materialNos); + } + + public CheckEBomException(Long bomRowId) throws ExecutionException, InterruptedException { allBomDetail = SpringUtil.getBean(BomNewEbomParentService.class).getBomTree(bomRowId);