编辑调整
This commit is contained in:
parent
51ddd67849
commit
501ff022c3
|
|
@ -272,7 +272,7 @@ public class EbomApi extends BaseApi {
|
|||
@ApiOperation("更新物料行")
|
||||
public ResultVO<List<BomNewEbomParentVO>> 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));
|
||||
|
|
|
|||
|
|
@ -277,6 +277,13 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
@ApiModelProperty("来源行-父项物料编码")
|
||||
private String sourceParentMaterialNo;
|
||||
|
||||
@ApiModelProperty("是否虚拟包 0-否 1-是")
|
||||
private Integer virtualPackageIs;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private List<BomNewEbomParentVO> childNodes = Collections.emptyList();
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -252,10 +252,12 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
child.setBomRowId(parentEntity.getRowId());
|
||||
child.setLevelNum(parentEntity.getLevelNum());
|
||||
child.setDeptName(parentEntity.getDeptName());
|
||||
child.setSource(parentEntity.getSource());
|
||||
// child.setSource(parentEntity.getSource());
|
||||
child.setSourceRowId(parentEntity.getSourceRowId());
|
||||
child.setBomExist(parentEntity.getBomExist());
|
||||
child.setShouldBomExist(parentEntity.getShouldBomExist());
|
||||
child.setVirtualPackageIs(parentEntity.getVirtualPackageIs()) ;
|
||||
|
||||
|
||||
|
||||
if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) {
|
||||
|
|
@ -264,12 +266,13 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
} else { //无BOM-版本时 确定版本号
|
||||
|
||||
child.setSource(Objects.nonNull(parent) ? parent.getSource() : EBomSourceEnum.FROM_BOM.getValue());
|
||||
//child.setSource(Objects.nonNull(parent) ? parent.getSource() : EBomSourceEnum.FROM_BOM.getValue());
|
||||
child.setDeviseUserCode(parent.getDeviseUserCode());
|
||||
child.setDeviseName(parent.getDeviseName());
|
||||
child.setDeptName(parent.getDeptName());
|
||||
child.setStatus(parent.getStatus());
|
||||
child.setEditStatus(parent.getEditStatus());
|
||||
child.setVirtualPackageIs(parent.getVirtualPackageIs()) ;
|
||||
if (MaterialshouldBomExistUtil.checkShouldBomExist(child)) {
|
||||
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||
child.setStatus(parent.getStatus());
|
||||
|
|
@ -794,8 +797,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
if(CollectionUtil.isNotEmpty(revertList)) {
|
||||
UpdateWrapper<BomNewEbomParentEntity> 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<BomNewEbomParentMapper,
|
|||
*/
|
||||
public List<BomNewEbomParentVO> changeMaterial(BomNewEBomChangeDTO dto) {
|
||||
|
||||
|
||||
CheckEBomException.checkMaterialNoInMain(dto.getDatas());
|
||||
|
||||
List<BomNewEbomParentVO> parentChild = dto.getDatas();
|
||||
|
||||
materialMainService.intiMaterialInfo(parentChild);
|
||||
// materialMainService.intiMaterialInfo(parentChild);
|
||||
|
||||
List<BomNewEbomParentVO> 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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<BomNewEbomParentVO> allBomDetail ;
|
||||
|
||||
|
||||
|
||||
|
||||
public static void checkMaterialNoInMain1(List<String> materialNos){
|
||||
// List<String> materialNos = dto.getDatas().stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
//检查物料编码是否在主数据中存在
|
||||
List<BaseMaterialVO> materialBaseInfo = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos);
|
||||
List<String> effectiveMaterialNos = materialBaseInfo.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
Set<String> difference = Sets.difference(new HashSet<>(materialNos), new HashSet<>(effectiveMaterialNos));
|
||||
VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料档案中不存在");
|
||||
}
|
||||
|
||||
public static void checkMaterialNoInMain(List<BomNewEbomParentVO> list){
|
||||
List<String> 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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue