项目类型

This commit is contained in:
jing's 2023-12-26 23:32:20 +08:00
parent 45df2e2b14
commit 5f8dcf5907
3 changed files with 61 additions and 58 deletions

View File

@ -1,11 +1,9 @@
package com.nflg.product.bomnew.pojo.dto; package com.nflg.product.bomnew.pojo.dto;
import com.nflg.product.bomnew.constant.EBomSourceEnum;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.util.List; import java.util.List;
@Data @Data
@ -13,10 +11,16 @@ import java.util.List;
public class BomNewEbomProjectTypeDTO { public class BomNewEbomProjectTypeDTO {
@ApiModelProperty("行rowId") @ApiModelProperty("行rowId")
private List<Long> rowIdList; private List<BomNewEbomChangeProjectType> rowIdList;
@ApiModelProperty("项目类型") @ApiModelProperty("项目类型")
private String projectType; private String projectType;
@Data
public static class BomNewEbomChangeProjectType{
@ApiModelProperty("行rowId")
private Long rowId;
@ApiModelProperty("bomRowId")
private Long bomRowId;
}
} }

View File

@ -14,6 +14,8 @@ import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil; import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; 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;
@ -251,7 +253,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
child.setLevelNum(parentEntity.getLevelNum()); child.setLevelNum(parentEntity.getLevelNum());
child.setDeptName(parentEntity.getDeptName()); child.setDeptName(parentEntity.getDeptName());
child.setSource(parentEntity.getSource()); child.setSource(parentEntity.getSource());
child.setSourceRowId(parentEntity.getSourceRowId());
child.setBomExist(parentEntity.getBomExist()); child.setBomExist(parentEntity.getBomExist());
child.setShouldBomExist(parentEntity.getShouldBomExist()); child.setShouldBomExist(parentEntity.getShouldBomExist());
@ -282,11 +284,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
public List<BomNewEbomParentVO> getChildBatch(List<Long> rowIds) { public List<BomNewEbomParentVO> getChildBatch(List<Long> rowIds) {
List<BomNewEbomParentVO> result = new ArrayList<>(); List<BomNewEbomParentVO> result = new ArrayList<>();
for (Long bomRowId : rowIds) { for (Long bomRowId : rowIds) {
@ -296,12 +293,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
/** /**
* 获取整个BOM树 * 获取整个BOM树
* *
@ -637,7 +628,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料档案中不存在"); VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料档案中不存在");
materialMainService.intiMaterialInfo(datas, BomNewEbomParentVO::getMaterialNo); materialMainService.intiMaterialInfo(datas, BomNewEbomParentVO::getMaterialNo);
EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_EXCE.getValue()); EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_EXCE.getValue());
BomNewEBomParentEditDTO bomNewEBomParentEditDTO = new BomNewEBomParentEditDTO(); BomNewEBomParentEditDTO bomNewEBomParentEditDTO = new BomNewEBomParentEditDTO();
@ -890,18 +880,32 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
public Boolean updateProjectType(BomNewEbomProjectTypeDTO dto) { public Boolean updateProjectType(BomNewEbomProjectTypeDTO dto) {
List<BomNewEbomChildEntity> childEntity = new ArrayList<>(); List<Long> rowIdList = dto.getRowIdList().stream().map(BomNewEbomProjectTypeDTO.BomNewEbomChangeProjectType::getRowId).collect(Collectors.toList());
dto.getRowIdList().forEach(rowid -> { List<Long> bomRowIdList = dto.getRowIdList().stream().filter(u -> u.getBomRowId() > 0).map(BomNewEbomProjectTypeDTO.BomNewEbomChangeProjectType::getBomRowId).collect(Collectors.toList());
BomNewEbomChildEntity entity = new BomNewEbomChildEntity();
entity.setRowId(rowid); if (CollectionUtil.isNotEmpty(bomRowIdList)) {
entity.setProjectTypeInputType(ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue()); UpdateWrapper<BomNewEbomParentEntity> parentUpdate = new UpdateWrapper<>();
entity.setProjectType(dto.getProjectType()); parentUpdate.lambda()
entity.setModifyTime(LocalDateTime.now()); .set(BomNewEbomParentEntity::getProjectType, dto.getProjectType())
}); .set(BomNewEbomParentEntity::getModifyTime, LocalDateTime.now())
.set(BomNewEbomParentEntity::getProjectTypeInputType, ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue())
.in(BomNewEbomParentEntity::getRowId, bomRowIdList);
this.update(parentUpdate);
}
if (CollectionUtil.isNotEmpty(rowIdList)) {
UpdateWrapper<BomNewEbomChildEntity> childUpdate = new UpdateWrapper<>();
childUpdate.lambda()
.set(BomNewEbomChildEntity::getProjectType, dto.getProjectType())
.set(BomNewEbomChildEntity::getModifyTime, LocalDateTime.now())
.set(BomNewEbomChildEntity::getProjectTypeInputType, ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue())
.in(BomNewEbomChildEntity::getRowId, rowIdList);
SpringUtil.getBean(BomNewEbomChildService.class).update(childUpdate);
}
SpringUtil.getBean(BomNewEbomChildService.class).updateBatchById(childEntity);
return true; return true;
} }
public BomNewEbomEditDetailVO editDetail(Long bomRowId) { public BomNewEbomEditDetailVO editDetail(Long bomRowId) {
@ -910,7 +914,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parent); BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parent);
parentVO.setBomRowId(parentVO.getRowId()); parentVO.setBomRowId(parentVO.getRowId());
parentVO.setParentRowId(0l); parentVO.setParentRowId(0l);
materialMainService.intiMaterialInfo(ImmutableList.of(parentVO)); // materialMainService.intiMaterialInfo(ImmutableList.of(parentVO));
// List<BomNewEbomParentVO> parentList = new ArrayList<>(); // List<BomNewEbomParentVO> parentList = new ArrayList<>();
@ -999,8 +1003,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (CollectionUtil.isNotEmpty(eBomDel.getRevertOBom())) { if (CollectionUtil.isNotEmpty(eBomDel.getRevertOBom())) {
List<Long> rowIds = eBomDel.getRevertOBom().stream().map(BomNewEbomParentVO::getSourceRowId).collect(Collectors.toList()); List<Long> rowIds = eBomDel.getRevertOBom().stream().map(BomNewEbomParentVO::getSourceRowId).collect(Collectors.toList());
SpringUtil.getBean(BomNewOriginalParentService.class).revertBom(rowIds); SpringUtil.getBean(BomNewOriginalParentService.class).revertBom(rowIds);
} }
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) { if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
@ -1131,7 +1133,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (CollectionUtil.isNotEmpty(rowIdList)) { if (CollectionUtil.isNotEmpty(rowIdList)) {
ebomChildService.removeByIds(rowIdList); ebomChildService.removeByIds(rowIdList);
} }
} }
@ -1158,7 +1159,4 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
} }

View File

@ -60,6 +60,7 @@ public class EBomDetailTask extends RecursiveTask<List<BomNewEbomParentVO>> {
BomNewEbomParentEntity ebomParentEntity = stringBomNewOriginalParentEntityMap.get(detailVO.getMaterialNo()); BomNewEbomParentEntity ebomParentEntity = stringBomNewOriginalParentEntityMap.get(detailVO.getMaterialNo());
detailVO.setChildBomRowId(ebomParentEntity.getRowId()); detailVO.setChildBomRowId(ebomParentEntity.getRowId());
detailVO.setBomRowId(ebomParentEntity.getRowId()); detailVO.setBomRowId(ebomParentEntity.getRowId());
detailVO.setSourceRowId(ebomParentEntity.getSourceRowId());
detailVO.setCurrentVersion(ebomParentEntity.getCurrentVersion()); detailVO.setCurrentVersion(ebomParentEntity.getCurrentVersion());
} }
} }