变更原因

This commit is contained in:
大米 2024-01-16 19:00:45 +08:00
parent df856477cb
commit f7fc1a9d41
3 changed files with 33 additions and 7 deletions

View File

@ -155,9 +155,9 @@ public class EbomApi extends BaseApi {
@PostMapping("upgradeChanges") @PostMapping("upgradeChanges")
@ApiOperation("发起变更") @ApiOperation("发起变更")
public ResultVO<Boolean> upgradeChanges(@RequestBody List<Long> bomRowIds) { public ResultVO<Boolean> upgradeChanges(@RequestBody EBomUpgradeChangesParamDTO param) {
VUtils.isTure(CollUtil.isEmpty(bomRowIds)).throwMessage("请选择要发起变更的物料"); VUtils.isTure(CollUtil.isEmpty(param.getBomRowIds())).throwMessage("请选择要发起变更的物料");
bomNewEbomParentService.upgradeChanges(bomRowIds); bomNewEbomParentService.upgradeChanges(param);
return ResultVO.success(true); return ResultVO.success(true);

View File

@ -0,0 +1,21 @@
package com.nflg.product.bomnew.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class EBomUpgradeChangesParamDTO {
@ApiModelProperty("bom行ID")
private List<Long> bomRowIds;
@ApiModelProperty("升版说明")
private String changeDesc;
@ApiModelProperty("通知单号")
private String noticeNums;
}

View File

@ -304,6 +304,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
child.setBomExist(parentEntity.getBomExist()); child.setBomExist(parentEntity.getBomExist());
child.setShouldBomExist(parentEntity.getShouldBomExist()); child.setShouldBomExist(parentEntity.getShouldBomExist());
child.setVirtualPackageIs(parentEntity.getVirtualPackageIs()); child.setVirtualPackageIs(parentEntity.getVirtualPackageIs());
child.setChangeDesc(parentEntity.getChangeDesc());
child.setNoticeNums(parentEntity.getNoticeNums());
if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue()) && EBomStatusEnum.PUBLISHED.getValue()>parentEntity.getStatus()) { if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue()) && EBomStatusEnum.PUBLISHED.getValue()>parentEntity.getStatus()) {
@ -672,16 +674,16 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
/** /**
* 发起变更 * 发起变更
* *
* @param bomRowIds * @param paramDTO
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void upgradeChanges(List<Long> bomRowIds) { public void upgradeChanges(EBomUpgradeChangesParamDTO paramDTO) {
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getRowId, bomRowIds).list(); List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getRowId, paramDTO.getBomRowIds()).list();
List<String> notConvertToPbom = list.stream().filter(u -> u.getStatus() < EBomStatusEnum.PUBLISHED.getValue()).map(u -> u.getMaterialNo()).collect(Collectors.toList()); List<String> notConvertToPbom = list.stream().filter(u -> u.getStatus() < EBomStatusEnum.PUBLISHED.getValue()).map(u -> u.getMaterialNo()).collect(Collectors.toList());
VUtils.isTure(CollUtil.isNotEmpty(notConvertToPbom)).throwMessage(StrUtil.join(",", notConvertToPbom) + "未转PBom,不能发起变更"); VUtils.isTure(CollUtil.isNotEmpty(notConvertToPbom)).throwMessage(StrUtil.join(",", notConvertToPbom) + "未转PBom,不能发起变更");
List<BomNewEbomParentEntity> parentResult = new ArrayList<>(); List<BomNewEbomParentEntity> parentResult = new ArrayList<>();
List<BomNewEbomChildEntity> childResult = new ArrayList<>(); List<BomNewEbomChildEntity> childResult = new ArrayList<>();
for (Long bomRowId : bomRowIds) { for (Long bomRowId : paramDTO.getBomRowIds()) {
BomNewEbomParentEntity parent = this.getById(bomRowId); BomNewEbomParentEntity parent = this.getById(bomRowId);
List<BomNewEbomChildEntity> child = ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, bomRowId).list(); List<BomNewEbomChildEntity> child = ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, bomRowId).list();
@ -691,10 +693,13 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
newParent.setLastVersionIs(1); newParent.setLastVersionIs(1);
newParent.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(parent.getCurrentVersion())); newParent.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(parent.getCurrentVersion()));
newParent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_11.getValue()); newParent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_11.getValue());
newParent.setChangeDesc(paramDTO.getChangeDesc());
newParent.setNoticeNums(paramDTO.getNoticeNums());
parent.setLastVersionIs(0); parent.setLastVersionIs(0);
parentResult.add(newParent); parentResult.add(newParent);
parentResult.add(parent); parentResult.add(parent);
for (BomNewEbomChildEntity childEnt : child) { for (BomNewEbomChildEntity childEnt : child) {
BomNewEbomChildEntity newChild = new BomNewEbomChildEntity(); BomNewEbomChildEntity newChild = new BomNewEbomChildEntity();
BeanUtil.copyProperties(childEnt, newChild); BeanUtil.copyProperties(childEnt, newChild);